]> https://gitweb.dealii.org/ - dealii.git/commitdiff
fix bug in make_hanging_node_constraints in parallel with elements like RaviartThomas
authorTimo Heister <timo.heister@gmail.com>
Sat, 23 Nov 2013 22:06:02 +0000 (22:06 +0000)
committerTimo Heister <timo.heister@gmail.com>
Sat, 23 Nov 2013 22:06:02 +0000 (22:06 +0000)
git-svn-id: https://svn.dealii.org/trunk@31779 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/doc/news/changes.h
deal.II/source/dofs/dof_tools_constraints.cc

index 83b3ab3d4bb547d3b863b1482e954d3f650351d0..af4c024ec6668de5308d18c32e14def362c35282 100644 (file)
@@ -212,6 +212,13 @@ inconvenience this causes.
 <h3>Specific improvements</h3>
 
 <ol>
+  <li> Fixed: make_hanging_node_constraints failed with an exception in a
+  parallel::distributed computation if the element is
+  RaviartThomas (and probably others).
+  <br>
+  (Timo Heister, 2013/11/23)
+  </li>
+
   <li> Improved: CMake: Added a configuration check for incompatible ninja
   + icc setup, fixed several setup and performance issues with the
   testsuite
index 25c01c21cf3f03b3853c1c0b65921002957490ac..2f32ccfacf637adb3481395b19b4a6ecb5b81d73 100644 (file)
@@ -809,7 +809,10 @@ namespace DoFTools
                 n_dofs_on_children = fe.dofs_per_vertex + 2*fe.dofs_per_line;
 
                 dofs_on_mother.resize (n_dofs_on_mother);
-                dofs_on_children.resize (n_dofs_on_children);
+                // we might not use all of those in case of artificial cells,
+                // so do not resize(), but reserve() and use push_back later.
+                dofs_on_children.clear();
+                dofs_on_children.reserve (n_dofs_on_children);
 
                 Assert(n_dofs_on_mother == fe.constraints().n(),
                        ExcDimensionMismatch(n_dofs_on_mother,
@@ -831,15 +834,20 @@ namespace DoFTools
                   dofs_on_mother[next_index++] = this_face->dof_index(dof, fe_index);
                 AssertDimension (next_index, dofs_on_mother.size());
 
-                next_index = 0;
                 for (unsigned int dof=0; dof!=fe.dofs_per_vertex; ++dof)
-                  dofs_on_children[next_index++]
-                    = this_face->child(0)->vertex_dof_index(1,dof,fe_index);
+                  dofs_on_children.push_back(
+                    this_face->child(0)->vertex_dof_index(1,dof,fe_index));
                 for (unsigned int child=0; child<2; ++child)
-                  for (unsigned int dof=0; dof!=fe.dofs_per_line; ++dof)
-                    dofs_on_children[next_index++]
-                      = this_face->child(child)->dof_index(dof, fe_index);
-                AssertDimension (next_index, dofs_on_children.size());
+                  {
+                    // skip artificial cells
+                    if (cell->neighbor_child_on_subface (face, child)->is_artificial())
+                      continue;
+                    for (unsigned int dof=0; dof!=fe.dofs_per_line; ++dof)
+                      dofs_on_children.push_back(
+                          this_face->child(child)->dof_index(dof, fe_index));
+                  }
+                // note: can get fewer DoFs when we have artificial cells
+                Assert(dofs_on_children.size() <= n_dofs_on_children, ExcInternalError());
 
                 // for each row in the constraint matrix for this line:
                 for (unsigned int row=0; row!=dofs_on_children.size(); ++row)

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.