From: kanschat Date: Tue, 1 May 2007 22:32:59 +0000 (+0000) Subject: more tests for MGTransferBlockSelect X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0306c652176c356faf72a2708d31188e5b4c4366;p=dealii-svn.git more tests for MGTransferBlockSelect git-svn-id: https://svn.dealii.org/trunk@14655 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/tests/multigrid/transfer_block.cc b/tests/multigrid/transfer_block.cc index 74ac637ee4..37a0b80e31 100644 --- a/tests/multigrid/transfer_block.cc +++ b/tests/multigrid/transfer_block.cc @@ -117,12 +117,16 @@ void check_block(const FiniteElement& fe, for (unsigned int b=0;b v; v.reinit (ndofs); for (unsigned int i=0;i& fe, unsigned int selected) MGDoFHandler mgdof(tr); DoFHandler& dof=mgdof; mgdof.distribute_dofs(fe); - DoFRenumbering::component_wise(static_cast&>(mgdof)); + DoFRenumbering::component_wise(mgdof); vector ndofs(fe.n_blocks()); DoFTools::count_dofs_per_block(mgdof, ndofs); @@ -80,52 +80,54 @@ void check_select(const FiniteElement& fe, unsigned int selected) // the embedding, we obtain the // constant one and the l2-norm is // the number of degrees of freedom. - Vector u2(mg_ndofs[2][selected]); - Vector u1(mg_ndofs[1][selected]); - Vector u0(mg_ndofs[0][selected]); + MGLevelObject< Vector > u(0, tr.n_levels()-1); + + MGTools::reinit_vector_by_blocks(mgdof, u, selected, mg_ndofs); - u0 = 1; - transfer.prolongate(1,u1,u0); - transfer.prolongate(2,u2,u1); - deallog << "u0\t" << (int) (u0*u0+.5) << std::endl - << "u1\t" << (int) (u1*u1+.5) << std::endl - << "u2\t" << (int) (u2*u2+.5) << std::endl; + u[0] = 1; + transfer.prolongate(1,u[1],u[0]); + transfer.prolongate(2,u[2],u[1]); + deallog << "u0\t" << (int) (u[0]*u[0]+.4) << std::endl + << "u1\t" << (int) (u[1]*u[1]+.4) << std::endl + << "u2\t" << (int) (u[2]*u[2]+.4) << std::endl; // Now restrict the same vectors. - u1 = 0.; - u0 = 0.; - transfer.restrict_and_add(2,u1,u2); - transfer.restrict_and_add(1,u0,u1); - deallog << "u1\t" << (int) (u1*u1+.5) << std::endl - << "u0\t" << (int) (u0*u0+.5) << std::endl; - + u[1] = 0.; + u[0] = 0.; + transfer.restrict_and_add(2,u[1],u[2]); + transfer.restrict_and_add(1,u[0],u[1]); + deallog << "u1\t" << (int) (u[1]*u[1]+.5) << std::endl + << "u0\t" << (int) (u[0]*u[0]+.5) << std::endl; + + // Check copy to mg and back // Fill a global vector by counting // from one up - BlockVector u; - u.reinit (ndofs); - for (unsigned int i=0;i v; + v.reinit (ndofs); + for (unsigned int i=0;i > v; - v.resize(0,tr.n_levels()-1); - MGTools::reinit_vector_by_blocks(mgdof, v, selected, mg_ndofs); + u.resize(0, tr.n_levels()-1); + MGTools::reinit_vector_by_blocks(mgdof, u, selected, mg_ndofs); - transfer.copy_to_mg(mgdof, v, u); - for (unsigned int i=0; i[FE_RaviartThomasNodal<2>(1)-FE_DGQ<2>(1)] select 1 DEAL::Global dofs: 144 64 DEAL::Level 0 dofs: 12 4 @@ -23,6 +24,7 @@ DEAL::u1 256 DEAL::u0 1024 DEAL:: 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 DEAL:: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 +DEAL::diff 0 DEAL::FESystem<2>[FE_RaviartThomasNodal<2>(0)^2-FE_DGQ<2>(0)^2] select 0 DEAL::Global dofs: 40 40 16 16 DEAL::Level 0 dofs: 4 4 1 1 @@ -35,6 +37,7 @@ DEAL::u1 136 DEAL::u0 400 DEAL:: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 DEAL:: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +DEAL::diff 0 DEAL::FESystem<2>[FE_RaviartThomasNodal<2>(0)^2-FE_DGQ<2>(0)^2] select 1 DEAL::Global dofs: 40 40 16 16 DEAL::Level 0 dofs: 4 4 1 1 @@ -47,6 +50,7 @@ DEAL::u1 136 DEAL::u0 400 DEAL:: 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 DEAL:: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +DEAL::diff 0 DEAL::FESystem<2>[FE_RaviartThomasNodal<2>(0)^2-FE_DGQ<2>(0)^2] select 2 DEAL::Global dofs: 40 40 16 16 DEAL::Level 0 dofs: 4 4 1 1 @@ -59,6 +63,7 @@ DEAL::u1 64 DEAL::u0 256 DEAL:: 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 DEAL:: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +DEAL::diff 0 DEAL::FESystem<2>[FE_RaviartThomasNodal<2>(0)^2-FE_DGQ<2>(0)^2] select 3 DEAL::Global dofs: 40 40 16 16 DEAL::Level 0 dofs: 4 4 1 1 @@ -71,3 +76,4 @@ DEAL::u1 64 DEAL::u0 256 DEAL:: 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 DEAL:: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 +DEAL::diff 0