From: nivesh Date: Mon, 15 Jan 2018 15:28:40 +0000 (+0100) Subject: Bug fix in FE_Enriched element. Avoid evaluating quadrature points if no dofs are... X-Git-Tag: v9.0.0-rc1~568^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F5733%2Fhead;p=dealii.git Bug fix in FE_Enriched element. Avoid evaluating quadrature points if no dofs are assigned --- diff --git a/doc/news/changes/minor/20180115NiveshD b/doc/news/changes/minor/20180115NiveshD new file mode 100644 index 0000000000..8f6e33694a --- /dev/null +++ b/doc/news/changes/minor/20180115NiveshD @@ -0,0 +1,5 @@ +Fixed: In FE_Enriched element, avoid evaluating quadrature points if no dofs are +assigned. This happens when FE_Nothing is used together with other FE +(i.e. FE_Q) as enrichments in FE_Enriched constructor. +
+(Nivesh Dommaraju, 2018/01/15) diff --git a/source/fe/fe_enriched.cc b/source/fe/fe_enriched.cc index e177284eec..e88731d9d7 100644 --- a/source/fe/fe_enriched.cc +++ b/source/fe/fe_enriched.cc @@ -663,6 +663,11 @@ FE_Enriched::multiply_by_enrichment fe_data.enrichment[base_no].size())); for (unsigned int m=0; m < base_no_mult_local_enriched_dofs[base_no].size(); m++) { + //Avoid evaluating quadrature points if no dofs are assigned. This + //happens when FE_Nothing is used together with other FE (i.e. FE_Q) as enrichments. + if (base_no_mult_local_enriched_dofs[base_no][m].size()==0) + continue; + Assert (enrichments[base_no-1][m](cell) != nullptr, ExcMessage("The pointer to the enrichment function is NULL")); diff --git a/tests/fe/fe_enriched_compare_to_fe_system_2.cc b/tests/fe/fe_enriched_compare_to_fe_system_2.cc index 3c7abd37d1..46207c1bb6 100644 --- a/tests/fe/fe_enriched_compare_to_fe_system_2.cc +++ b/tests/fe/fe_enriched_compare_to_fe_system_2.cc @@ -215,10 +215,12 @@ void test(const FiniteElement &fe_base, p2[0] = 10.0; p3[0] = 5.0; EnrichmentFunction fun1(p1), fun2(p2),fun3(p3); - std::vector *> fe_enrichements(2); + std::vector *> fe_enrichements(3); fe_enrichements[0] = &fe_en1; fe_enrichements[1] = &fe_en2; - std::vector *(const typename Triangulation::cell_iterator &) > > > functions(2); + FE_Nothing fe_nothing(1,true); + fe_enrichements[2] = &fe_nothing; //should be ignored + std::vector *(const typename Triangulation::cell_iterator &) > > > functions(3); functions[0].resize(1); functions[0][0] = [&](const typename Triangulation::cell_iterator &) { @@ -233,6 +235,12 @@ void test(const FiniteElement &fe_base, { return &fun3; }; + functions[2].resize(1); + functions[2][0] = [&](const typename Triangulation::cell_iterator &) + { + AssertThrow(false, ExcMessage("Called enrichment function for FE_Nothing")); + return nullptr; + }; FE_Enriched fe_enriched(&fe_base, fe_enrichements,