MGDoFHandler<dim> mgdof(tr);
DoFHandler<dim>& dof=mgdof;
mgdof.distribute_dofs(fe);
- DoFRenumbering::component_wise(static_cast<DoFHandler<dim>&>(mgdof));
+ DoFRenumbering::component_wise(mgdof);
vector<unsigned int> ndofs(fe.n_blocks());
DoFTools::count_dofs_per_block(mgdof, ndofs);
// the embedding, we obtain the
// constant one and the l2-norm is
// the number of degrees of freedom.
- Vector<double> u2(mg_ndofs[2][selected]);
- Vector<double> u1(mg_ndofs[1][selected]);
- Vector<double> u0(mg_ndofs[0][selected]);
+ MGLevelObject< Vector<double> > 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<double> u;
- u.reinit (ndofs);
- for (unsigned int i=0;i<u.size();++i)
- u(i) = i+1;
-
+ BlockVector<double> v;
+ v.reinit (ndofs);
+ for (unsigned int i=0;i<v.size();++i)
+ v(i) = i+1;
+
// See what part gets copied to mg
- MGLevelObject<Vector<double> > 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<v[2].size();++i)
- deallog << ' ' << (int) v[2](i);
+ transfer.copy_to_mg(mgdof, u, v);
+ for (unsigned int i=0; i<u[2].size();++i)
+ deallog << ' ' << (int) u[2](i);
deallog << std::endl;
// Now do the opposite: fill a
// multigrid vector counting the
// dofs and see where the numbers go
- u = 0.;
- for (unsigned int i=0;i<v[2].size();++i)
- v[2](i) = i+1;
- transfer.copy_from_mg_add(mgdof, u, v);
- for (unsigned int i=0; i<u.size();++i)
- deallog << ' ' << (int) u(i);
+ for (unsigned int i=0;i<u[2].size();++i)
+ u[2](i) = i+1;
+ v = 0.;
+ transfer.copy_from_mg(mgdof, v, u);
+ for (unsigned int i=0; i<v.size();++i)
+ deallog << ' ' << (int) v(i);
deallog << std::endl;
-
+ v.equ(-1., v);
+ transfer.copy_from_mg_add(mgdof, v, u);
+ deallog << "diff " << v.l2_norm() << std::endl;
}
DEAL::u0 2214
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 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 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144
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 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 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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>(1)-FE_DGQ<2>(1)] select 1
DEAL::Global dofs: 144 64
DEAL::Level 0 dofs: 12 4
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
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
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
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
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