From d6cc4e963f9ee44e115d3ed517cbcb97cd2d5fd0 Mon Sep 17 00:00:00 2001 From: wolf Date: Tue, 27 Jan 2004 23:51:20 +0000 Subject: [PATCH] Fix MappingQ<3>(4), which was previously not implemented. Now everything up to and including degree=4 is implemented, and only what is above needs to be computed on the fly (2d) or is left unimplemented (3d). git-svn-id: https://svn.dealii.org/trunk@8347 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/deal.II/source/fe/mapping_q.cc | 128 ++++++++++++++++++++++++- 1 file changed, 124 insertions(+), 4 deletions(-) diff --git a/deal.II/deal.II/source/fe/mapping_q.cc b/deal.II/deal.II/source/fe/mapping_q.cc index b1edb0a9ac..75e2687de0 100644 --- a/deal.II/deal.II/source/fe/mapping_q.cc +++ b/deal.II/deal.II/source/fe/mapping_q.cc @@ -426,23 +426,38 @@ MappingQ::set_laplace_on_quad_vector(Table<2,double> &loqvs) const const unsigned int n_inner_2d=(degree-1)*(degree-1); const unsigned int n_outer_2d=4+4*(degree-1); - // first check whether we have - // precomputed the values for some - // polynomial degree + // first check whether we have precomputed + // the values for some polynomial degree; + // the sizes of arrays is + // n_inner_2d*n_outer_2d double const *loqv_ptr=0; switch (degree) { + // for degree==1, we shouldn't have to + // compute any support points, since + // all of them are on the vertices + case 2: { + // (checked these values against the + // output of compute_laplace_vector + // again, and found they're indeed + // right -- just in case someone + // wonders where they come from -- + // WB) static const double loqv2[1*8] ={1/16., 1/16., 1/16., 1/16., 3/16., 3/16., 3/16., 3/16.}; loqv_ptr=&loqv2[0]; + Assert (sizeof(loqv2)/sizeof(loqv2[0]) == + n_inner_2d * n_outer_2d, + ExcInternalError()); break; } case 3: { + // (same as above) static const double loqv3[4*12] ={80/1053., 1/81., 11/1053., 1/81., 25/117., 44/351., 7/117., 16/351., 7/117., 16/351., 25/117., 44/351., @@ -452,13 +467,114 @@ MappingQ::set_laplace_on_quad_vector(Table<2,double> &loqvs) const 16/351., 7/117., 25/117., 44/351., 44/351., 25/117., 11/1053., 1/81., 80/1053., 1/81., 16/351., 7/117., 44/351., 25/117., 44/351., 25/117., 16/351., 7/117.}; + Assert (sizeof(loqv3)/sizeof(loqv3[0]) == + n_inner_2d * n_outer_2d, + ExcInternalError()); + loqv_ptr=&loqv3[0]; break; } + + case 4: + { + static const double loqv4[9*16] + ={0.074059218503115712, -0.0010757446289059922, + 0.0019142922390714627, -0.0010757446289060069, + 0.22312738654318912, 0.13468513060151868, + 0.03812914216116723, 0.029131600026332517, + 0.02200737428129396, 0.016008355644312244, + 0.029131600026332527, 0.022007374281293915, + 0.016008355644312224, 0.22312738654318917, + 0.13468513060151874, 0.038129142161167237, + + 0.0066480315133420603, 0.0066480315133427186, + 0.0028734528616576258, 0.0028734528616574584, + 0.15277168188202372, 0.23481527607092728, + 0.15277168188202397, 0.079035726825841868, + 0.059692382812499903, 0.036198648174158153, + 0.024962693117977778, 0.040819489554071289, + 0.024962693117977889, 0.079035726825843783, + 0.059692382812500312, 0.036198648174158236, + + -0.0010757446289069229, 0.074059218503115892, + -0.0010757446289058842, 0.0019142922390713395, + 0.038129142161167293, 0.13468513060151846, + 0.22312738654318981, 0.22312738654318776, + 0.13468513060151835, 0.038129142161167202, + 0.016008355644312171, 0.022007374281293943, + 0.029131600026332617, 0.029131600026335094, + 0.02200737428129395, 0.016008355644312293, + + 0.0066480315133420733, 0.0028734528616574727, + 0.0028734528616576362, 0.0066480315133427255, + 0.079035726825843755, 0.059692382812500257, + 0.036198648174158243, 0.024962693117977792, + 0.04081948955407131, 0.024962693117977903, + 0.079035726825841868, 0.059692382812499799, + 0.036198648174158098, 0.15277168188202384, + 0.23481527607092734, 0.15277168188202397, + + 0.011067708333333018, 0.011067708333333358, + 0.011067708333333736, 0.01106770833333337, + 0.067708333333334217, 0.1035156250000009, + 0.067708333333334356, 0.067708333333333759, + 0.10351562499999903, 0.067708333333333995, + 0.067708333333333703, 0.10351562499999885, + 0.067708333333333898, 0.067708333333334245, + 0.10351562500000108, 0.067708333333334397, + + 0.0028734528616571847, 0.0066480315133423621, + 0.0066480315133430378, 0.0028734528616573343, + 0.036198648174158195, 0.059692382812500278, + 0.079035726825844074, 0.15277168188202336, + 0.23481527607092598, 0.15277168188202367, + 0.036198648174158042, 0.059692382812499861, + 0.079035726825842201, 0.024962693117977788, + 0.040819489554074009, 0.024962693117977879, + + -0.0010757446289069133, 0.0019142922390713401, + -0.0010757446289058651, 0.07405921850311592, + 0.029131600026335087, 0.022007374281293911, + 0.016008355644312279, 0.016008355644312175, + 0.022007374281293957, 0.029131600026332641, + 0.22312738654318776, 0.13468513060151827, + 0.038129142161167182, 0.038129142161167286, + 0.13468513060151852, 0.22312738654318992, + + 0.0028734528616571756, 0.0028734528616573209, + 0.0066480315133430369, 0.0066480315133423742, + 0.024962693117977757, 0.040819489554073919, + 0.024962693117977847, 0.036198648174158049, + 0.059692382812499924, 0.079035726825842215, + 0.15277168188202328, 0.23481527607092575, + 0.15277168188202356, 0.036198648174158167, + 0.059692382812500319, 0.079035726825844088, + + 0.0019142922390712369, -0.0010757446289068027, + 0.07405921850311617, -0.0010757446289067784, + 0.016008355644312283, 0.022007374281293967, + 0.02913160002633523, 0.038129142161167258, + 0.13468513060151821, 0.22312738654318864, + 0.038129142161167265, 0.13468513060151813, + 0.22312738654318859, 0.016008355644312276, + 0.022007374281294009, 0.029131600026335244 + }; + + Assert (sizeof(loqv4)/sizeof(loqv4[0]) == + n_inner_2d * n_outer_2d, + ExcInternalError()); + + loqv_ptr=&loqv4[0]; + + break; + } + // no other cases implemented, // so simply fall through + default: + break; } if (loqv_ptr!=0) @@ -495,7 +611,7 @@ MappingQ::set_laplace_on_quad_vector(Table<2,double> &loqvs) const // pin down their values and insert // them into the array above. Assert (false, ExcNotImplemented()); - } + } // the sum of weights of the points // at the outer rim should be @@ -585,6 +701,10 @@ MappingQ::compute_laplace_vector(Table<2,double> &lvs) const { Assert(lvs.n_rows()==0, ExcInternalError()); Assert(dim==2 || dim==3, ExcNotImplemented()); + + // for degree==1, we shouldn't have to + // compute any support points, since all of + // them are on the vertices Assert(degree>1, ExcInternalError()); // compute the shape -- 2.39.5