* operation and will return @p true only if all processors are consistent.
*
* Please supply the owned DoFs per processor as return by
- * DoFHandler::locally_owned_dofs_per_processor() as @p locally_owned_dofs.
+ * DoFHandler::locally_owned_dofs_per_processor() as @p locally_owned_dofs
+ * and the result of DoFTools::extract_locally_active_dofs() as
+ * @p locally_active_dofs. The
+ * former is used to determine ownership of the specific DoF, while the latter
+ * is used as the set of rows that need to be checked.
*
* If @p verbose is set to @p true, additional debug information is written
* to std::cout.
*
- * @note This method exchanges all constraint information of locally relevant
+ * @note This method exchanges all constraint information of locally active
* lines and is as such slow for large computations and should probably
* only be used in debug mode.
*
- * @return Whether all ConstraintMatrix objects are consistent.
+ * @return Whether all ConstraintMatrix objects are consistent. Returns the
+ * same value on all processors.
*/
bool is_consistent_in_parallel(const std::vector<IndexSet> &locally_owned_dofs,
+ const IndexSet &locally_active_dofs,
const MPI_Comm mpi_communicator,
const bool verbose=false) const;
}
bool ConstraintMatrix::is_consistent_in_parallel(const std::vector<IndexSet> &locally_owned_dofs,
+ const IndexSet &locally_active_dofs,
const MPI_Comm mpi_communicator,
const bool verbose) const
{
std::map< unsigned int, std::vector<line> > to_send;
const unsigned int myid = dealii::Utilities::MPI::this_mpi_process(mpi_communicator);
- IndexSet non_owned = this->get_local_lines();
+
+ // We will send all locally active dofs that are not locally owned for checking. Note
+ // that we allow constraints to differ on locally_relevant (and not active) DoFs.
+ IndexSet non_owned = locally_active_dofs;
non_owned.subtract_set(locally_owned_dofs[myid]);
for (auto it = non_owned.begin(); it != non_owned.end(); ++it)
{
dof_handler.distribute_dofs (fe);
IndexSet locally_owned_dofs = dof_handler.locally_owned_dofs ();
+ IndexSet locally_active_dofs;
+
+ DoFTools::extract_locally_active_dofs (dof_handler, locally_active_dofs);
+
IndexSet locally_relevant_dofs;
DoFTools::extract_locally_relevant_dofs (dof_handler,
locally_relevant_dofs);
"consistent? "
<<
constraints.is_consistent_in_parallel(dof_handler.locally_owned_dofs_per_processor(),
+ locally_active_dofs,
MPI_COMM_WORLD,
true)
<< std::endl;