]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Avoid cycles in constraint.
authorMartin Kronbichler <kronbichler@lnm.mw.tum.de>
Thu, 5 Dec 2013 10:45:13 +0000 (10:45 +0000)
committerMartin Kronbichler <kronbichler@lnm.mw.tum.de>
Thu, 5 Dec 2013 10:45:13 +0000 (10:45 +0000)
git-svn-id: https://svn.dealii.org/trunk@31897 0785d39b-7218-0410-832d-ea1e28bc413d

tests/deal.II/assemble_matrix_parallel_04.cc

index 9c4d594fbd5466da968bad82cad481805a522ee1..4713c3c936f7dab7613eb216b53cdbecd5fee435 100644 (file)
@@ -264,14 +264,21 @@ void LaplaceProblem<dim>::setup_system ()
 
   constraints.clear ();
 
-  // add a constraint that expands over most of the domain, which should
-  // create many conflicts
-  constraints.add_line(3);
-  for (unsigned int i=5; i<dof_handler.n_dofs(); i+=11)
-    constraints.add_entry(3, i, -0.5);
-
   DoFTools::make_hanging_node_constraints (dof_handler, constraints);
 
+  // add a constraint that expands over most of the domain, which should
+  // create many conflicts. Avoid cycles and do not constrain to entries
+  // already constrained
+  for (unsigned int c=0; c<dof_handler.n_dofs(); ++c)
+    if (constraints.is_constrained(c) == false)
+      {
+        constraints.add_line(c);
+        for (unsigned int i=5; i<dof_handler.n_dofs(); i+=11)
+          if (constraints.is_constrained(i) == false)
+            constraints.add_entry(c, i, -0.5);
+        break;
+      }
+
   // add boundary conditions as inhomogeneous constraints here, do it after
   // having added the hanging node constraints in order to be consistent and
   // skip dofs that are already constrained (i.e., are hanging nodes on the

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.