<< "The entry for the indices " << arg1 << " and "
<< arg2 << " already exists, but the values "
<< arg3 << " (old) and " << arg4 << " (new) differ.");
+ /**
+ * Exception
+ */
+ DeclException2 (ExcDoFConstrainedToConstrainedDoF,
+ int, int,
+ << "You tried to constrain DoF " << arg1
+ << " to DoF " << arg2
+ << ", but that one is also constrained. This is not allowed!");
private:
* This class represents one line of a
* constraint matrix.
*/
- struct ConstraintLine {
+ struct ConstraintLine
+ {
/**
* Number of this line. Since only very
* few lines are stored, we can not
endl = lines.end();
for (; line!=endl; ++line)
{
- // first remove zero entries
+ // first remove zero
+ // entries. that would mean
+ // that in the linear
+ // constraint for a node,
+ // x_i = ax_1 + bx_2 + ...,
+ // another node times 0
+ // appears. obviously,
+ // 0*something can be omitted
line->entries.erase (remove_if (line->entries.begin(),
line->entries.end(),
compose1 (bind2nd (equal_to<double>(), 0),
// sort the lines
sort (lines.begin(), lines.end());
+
+#ifdef DEBUG
+ // if in debug mode: check that no
+ // dof is constraint to another dof
+ // that is also constrained
+ for (vector<ConstraintLine>::const_iterator line=lines.begin();
+ line!=lines.end(); ++line)
+ for (vector<pair<unsigned int,double> >::const_iterator entry=line->entries.begin();
+ entry!=line->entries.end(); ++entry)
+ {
+ // make sure that
+ // entry->first is not the
+ // index of a line itself
+ const ConstraintLine test_line = { entry->first,
+ vector<pair<unsigned int,double> >() };
+ const vector<ConstraintLine>::const_iterator
+ test_line_position = lower_bound (lines.begin(),
+ lines.end(),
+ test_line);
+ Assert ((test_line_position == lines.end())
+ ||
+ (test_line_position->line != entry->first),
+ ExcDoFConstrainedToConstrainedDoF(line->line, entry->first));
+ };
+#endif
sorted = true;
};