]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Bug fix in FE_Enriched element. Avoid evaluating quadrature points if no dofs are... 5733/head
authornivesh <nidhinivesh.d@gmail.com>
Mon, 15 Jan 2018 15:28:40 +0000 (16:28 +0100)
committernivesh <nidhinivesh.d@gmail.com>
Mon, 15 Jan 2018 15:28:40 +0000 (16:28 +0100)
doc/news/changes/minor/20180115NiveshD [new file with mode: 0644]
source/fe/fe_enriched.cc
tests/fe/fe_enriched_compare_to_fe_system_2.cc

diff --git a/doc/news/changes/minor/20180115NiveshD b/doc/news/changes/minor/20180115NiveshD
new file mode 100644 (file)
index 0000000..8f6e336
--- /dev/null
@@ -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.
+<br>
+(Nivesh Dommaraju, 2018/01/15)
index e177284eecea37752f81722e5b3d82554a044b64..e88731d9d7e54206a65a095a37e059c82c8c68f6 100644 (file)
@@ -663,6 +663,11 @@ FE_Enriched<dim,spacedim>::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"));
 
index 3c7abd37d1db2a8da62acbbb1b430600ee2aaf21..46207c1bb6b5665092ba999cafe6631c4b7c4a52 100644 (file)
@@ -215,10 +215,12 @@ void test(const FiniteElement<dim> &fe_base,
   p2[0] = 10.0;
   p3[0] = 5.0;
   EnrichmentFunction<dim> fun1(p1), fun2(p2),fun3(p3);
-  std::vector<const FiniteElement<dim> *> fe_enrichements(2);
+  std::vector<const FiniteElement<dim> *> fe_enrichements(3);
   fe_enrichements[0] = &fe_en1;
   fe_enrichements[1] = &fe_en2;
-  std::vector<std::vector<std::function<const Function<dim> *(const typename Triangulation<dim, dim>::cell_iterator &) > > > functions(2);
+  FE_Nothing<dim> fe_nothing(1,true);
+  fe_enrichements[2] = &fe_nothing; //should be ignored
+  std::vector<std::vector<std::function<const Function<dim> *(const typename Triangulation<dim, dim>::cell_iterator &) > > > functions(3);
   functions[0].resize(1);
   functions[0][0] = [&](const typename Triangulation<dim, dim>::cell_iterator &)
   {
@@ -233,6 +235,12 @@ void test(const FiniteElement<dim> &fe_base,
   {
     return &fun3;
   };
+  functions[2].resize(1);
+  functions[2][0] = [&](const typename Triangulation<dim, dim>::cell_iterator &)
+  {
+    AssertThrow(false, ExcMessage("Called enrichment function for FE_Nothing"));
+    return nullptr;
+  };
 
   FE_Enriched<dim> fe_enriched(&fe_base,
                                fe_enrichements,

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.