]> https://gitweb.dealii.org/ - dealii.git/commitdiff
only work on locally active
authorTimo Heister <timo.heister@gmail.com>
Wed, 18 Apr 2018 17:11:08 +0000 (13:11 -0400)
committerTimo Heister <timo.heister@gmail.com>
Fri, 4 May 2018 13:52:40 +0000 (09:52 -0400)
include/deal.II/lac/constraint_matrix.h
source/lac/constraint_matrix.cc
tests/mpi/constraints_consistent_01.cc
tests/mpi/constraints_consistent_01.mpirun=3.output

index a7dd4697717170cbea011d1fbd9c455c3c1dcd8a..652cfc17f732c6ad294f9d2a4c9e74a24d07c67f 100644 (file)
@@ -1212,18 +1212,24 @@ public:
    * 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;
 
index 9c1d98e3d92bda14f0c442cae3293c449eaaebe9..f4e24359a1f95d7c876d276ad43a4c7f0821dcc8 100644 (file)
@@ -131,6 +131,7 @@ namespace
 }
 
 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
 {
@@ -138,7 +139,10 @@ bool ConstraintMatrix::is_consistent_in_parallel(const std::vector<IndexSet> &lo
   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)
     {
index bef1b8d74798ad554a75fad23852f5f33802e838..478bd623770a50e2ffe39543195dc6e58ca0b025 100644 (file)
@@ -47,6 +47,10 @@ void check(parallel::distributed::Triangulation<dim> &tria)
   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);
@@ -77,6 +81,7 @@ void check(parallel::distributed::Triangulation<dim> &tria)
           "consistent? "
           <<
           constraints.is_consistent_in_parallel(dof_handler.locally_owned_dofs_per_processor(),
+                                                locally_active_dofs,
                                                 MPI_COMM_WORLD,
                                                 true)
           << std::endl;
index 8151cee2de8ab472ccbcdb73cb507402c1b1447e..239c8ec3ed6e90c5659683cc9a9d28a0d06c53e9 100644 (file)
@@ -414,7 +414,7 @@ constraints:
     91 = 42.0000
     94 = 42.0000
     95 = 42.0000
-DEAL:0::consistent? 0
+DEAL:0::consistent? 1
 
 DEAL:1::LocallyOwned = {[50,129]}
 constraints:
@@ -464,7 +464,7 @@ constraints:
     147 = 42.0000
     150 = 42.0000
     151 = 42.0000
-DEAL:1::consistent? 0
+DEAL:1::consistent? 1
 
 
 DEAL:2::LocallyOwned = {[130,161]}
@@ -495,6 +495,6 @@ constraints:
     157 = 42.0000
     158 = 42.0000
     159 = 42.0000
-DEAL:2::consistent? 0
+DEAL:2::consistent? 1
 
 DEAL::OK

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.