]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Allow merging with different lines only if explicitly requested 3789/head
authorDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Wed, 18 Jan 2017 10:28:28 +0000 (11:28 +0100)
committerDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Wed, 18 Jan 2017 10:28:28 +0000 (11:28 +0100)
include/deal.II/lac/constraint_matrix.h
source/lac/constraint_matrix.cc
tests/lac/constraints_merge_10.cc

index 3c3e758873b839c9bf3f0e8eb7126f1c9f697dff..02535c099c296bd67c1ce4d104ce67d0fad8f9f9 100644 (file)
@@ -360,15 +360,17 @@ public:
    * However, this behavior can be changed by providing a different value for
    * the second argument.
    *
-   * If both this object and the object given as argument are initialized with
-   * an IndexSet object, local_lines is set to the union of these IndexSet
-   * objects.
+   * By default, merging two ConstraintMatrix objects that are initialized
+   * with different IndexSet objects is not allowed.
+   * This behavior can be altered by setting @p allow_different_local_lines
+   * appropriately.
    *
    * Merging a ConstraintMatrix that is initialized with an IndexSet
    * and one that is not initialized with an IndexSet is not yet implemented.
    */
   void merge (const ConstraintMatrix &other_constraints,
-              const MergeConflictBehavior merge_conflict_behavior = no_conflicts_allowed);
+              const MergeConflictBehavior merge_conflict_behavior = no_conflicts_allowed,
+              const bool allow_different_local_lines = false);
 
   /**
    * Shift all entries of this matrix down @p offset rows and over @p offset
index 29f61125cb8a73c5eb35be0d538127b56dd45249..f0b0c1cbdfd466a111fb2fdfff9c953f032c2ad0 100644 (file)
@@ -475,8 +475,15 @@ void ConstraintMatrix::close ()
 
 void
 ConstraintMatrix::merge (const ConstraintMatrix &other_constraints,
-                         const MergeConflictBehavior merge_conflict_behavior)
+                         const MergeConflictBehavior merge_conflict_behavior,
+                         const bool allow_different_local_lines)
 {
+  (void) allow_different_local_lines;
+  Assert(allow_different_local_lines ||
+         local_lines == other_constraints.local_lines,
+         ExcMessage("local_lines for this and the other objects are not the same "
+                    "although allow_different_local_lines is false."));
+
   // store the previous state with respect to sorting
   const bool object_was_sorted = sorted;
   sorted = false;
index 7d0fc2dec1bc79f153af2ddcc963c537b454534a..48a6fa0d318602bc08f03ac651f6d73003bba23c 100644 (file)
@@ -103,7 +103,7 @@ void merge_check ()
 
       // now merge the two and print the
       // results
-      c1.merge (c2);
+      c1.merge (c2, ConstraintMatrix::no_conflicts_allowed, true);
       c1.print(deallog.get_file_stream());
     };
 }

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.