Although it is stated in the code comments that already existing entries
are skipped they are added nevertheless and thus lead to duplicates in
the constraint matrix. This bug was fixed by introducing a bool variable
indicating the currently treated column-value-pair to be added or not.
{
Assert(line_n != col_val_pair.first,
ExcMessage("Can't constrain a degree of freedom to itself"));
-
+ bool entry_exists = false;
for (const std::pair<size_type, number> &entry : line.entries)
if (entry.first == col_val_pair.first)
{
col_val_pair.first,
entry.second,
col_val_pair.second));
+ entry_exists = true;
break;
}
- line.entries.push_back(col_val_pair);
+ if (entry_exists == false)
+ line_ptr->entries.push_back(*col_val_pair);
}
}
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