]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Fix tests.
authorWolfgang Bangerth <bangerth@colostate.edu>
Tue, 19 Sep 2023 15:24:40 +0000 (09:24 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Wed, 20 Sep 2023 02:06:55 +0000 (20:06 -0600)
23 files changed:
tests/gla/block_vec_02.cc
tests/gla/vec_03.cc
tests/hp/field_transfer_05.cc
tests/lac/linear_operator_12.cc
tests/lac/linear_operator_12a.cc
tests/mpi/fe_tools_extrapolate_common.h
tests/mpi/hp_integrate_difference.cc
tests/mpi/interpolate_04.cc
tests/mpi/multigrid_adaptive.cc
tests/mpi/multigrid_uniform.cc
tests/mpi/step-37.cc
tests/multigrid-global-coarsening/mg_data_out_05.cc
tests/multigrid-global-coarsening/mg_transfer_p_01.cc
tests/multigrid-global-coarsening/mg_transfer_p_02.cc
tests/multigrid-global-coarsening/mg_transfer_p_03.cc
tests/multigrid-global-coarsening/mg_transfer_p_04.cc
tests/multigrid-global-coarsening/mg_transfer_p_05.cc
tests/multigrid-global-coarsening/mg_transfer_p_06.cc
tests/multigrid-global-coarsening/mg_transfer_util.h
tests/multigrid/mg_data_out_05.cc
tests/remote_point_evaluation/vector_tools_evaluate_at_points_02.cc
tests/simplex/step-67.cc
tests/trilinos/direct_solver_3.cc

index ad7bf809a934d2cf88fd69e73dd3ef414be6c3a1..4946b78f86cf01208d84e55835752a8a37e32d13 100644 (file)
@@ -77,7 +77,8 @@ test()
 
 
   using scalar_type = typename LA::MPI::BlockVector::value_type;
-  AffineConstraints<scalar_type> cm;
+  AffineConstraints<scalar_type> cm(complete_index_set(v.size()),
+                                    complete_index_set(v.size()));
   cm.add_line(0);
   cm.add_entry(0, 1, 3.0);
   cm.close();
index e53a527341b1229974063ed5f6ed0047e2396346..a78b4ff6557104d596472d799294f31b76d5e077 100644 (file)
@@ -80,7 +80,8 @@ test()
          ExcInternalError());
 
   using scalar_type = typename LA::MPI::BlockVector::value_type;
-  AffineConstraints<scalar_type> cm;
+  AffineConstraints<scalar_type> cm(local_active,
+                                    complete_index_set(local_active.size()));
   cm.add_line(1);
   cm.add_entry(1, 2, 3.0);
   cm.close();
index 443bdc91e10da96b3f77c8e08f6fad0bcfdebaf6..aef839c65a1e0da79a0fe9920be930615dd2a323 100644 (file)
@@ -148,7 +148,9 @@ main(int argc, char *argv[])
   LinearAlgebra::distributed::Vector<double> new_solution(
     dof_handler.locally_owned_dofs(), locally_relevant_dofs, MPI_COMM_WORLD);
 
-  AffineConstraints<double> affine_constraints;
+  AffineConstraints<double> affine_constraints(
+    dof_handler.locally_owned_dofs(),
+    DoFTools::extract_locally_relevant_dofs(dof_handler));
   DoFTools::make_hanging_node_constraints(dof_handler, affine_constraints);
   affine_constraints.close();
 
index fa98e6afc8aa4eceb4da3e55c471d080faa87a47..cb2e34c7a05fc00d4360c9773f8a49fb60f57d34 100644 (file)
@@ -186,6 +186,8 @@ Step4<dim>::setup_system()
   dof_handler.distribute_dofs(fe);
 
   constraints.clear();
+  constraints.reinit(dof_handler.locally_owned_dofs(),
+                     DoFTools::extract_locally_relevant_dofs(dof_handler));
   std::map<unsigned int, double> boundary_values;
   VectorTools::interpolate_boundary_values(dof_handler,
                                            0,
index 46eee505f0c121ca007e5cbb45a594e5aa0513cd..c48a9f75877d1d7742d65144c3f7693f6a6279b5 100644 (file)
@@ -187,6 +187,8 @@ Step4<dim>::setup_system()
   dof_handler.distribute_dofs(fe);
 
   constraints.clear();
+  constraints.reinit(dof_handler.locally_owned_dofs(),
+                     DoFTools::extract_locally_relevant_dofs(dof_handler));
   std::map<unsigned int, double> boundary_values;
   VectorTools::interpolate_boundary_values(dof_handler,
                                            0,
index 5ebf2d1d59ecf0c9d6730e94047783fe993d2611..31ca05ac622247866584e104870f81002b5742b1 100644 (file)
@@ -193,12 +193,6 @@ check_this(const FiniteElement<dim> &fe1, const FiniteElement<dim> &fe2)
 
   std::unique_ptr<DoFHandler<dim>> dof1(make_dof_handler(*tria, fe1));
   std::unique_ptr<DoFHandler<dim>> dof2(make_dof_handler(*tria, fe2));
-  AffineConstraints<double>        cm1;
-  DoFTools::make_hanging_node_constraints(*dof1, cm1);
-  cm1.close();
-  AffineConstraints<double> cm2;
-  DoFTools::make_hanging_node_constraints(*dof2, cm2);
-  cm2.close();
 
   const IndexSet &locally_owned_dofs1 = dof1->locally_owned_dofs();
   const IndexSet  locally_relevant_dofs1 =
@@ -207,6 +201,16 @@ check_this(const FiniteElement<dim> &fe1, const FiniteElement<dim> &fe2)
   const IndexSet  locally_relevant_dofs2 =
     DoFTools::extract_locally_relevant_dofs(*dof2);
 
+  AffineConstraints<PetscScalar> cm1(locally_owned_dofs1,
+                                     locally_relevant_dofs1);
+  DoFTools::make_hanging_node_constraints(*dof1, cm1);
+  cm1.close();
+  AffineConstraints<PetscScalar> cm2(locally_owned_dofs2,
+                                     locally_relevant_dofs2);
+  DoFTools::make_hanging_node_constraints(*dof2, cm2);
+  cm2.close();
+
+
   VectorType in_ghosted =
     build_ghosted<VectorType>(locally_owned_dofs1, locally_relevant_dofs1);
   VectorType in_distributed =
@@ -324,12 +328,6 @@ check_this_dealii(const FiniteElement<dim> &fe1, const FiniteElement<dim> &fe2)
 
   std::unique_ptr<DoFHandler<dim>> dof1(make_dof_handler(*tria, fe1));
   std::unique_ptr<DoFHandler<dim>> dof2(make_dof_handler(*tria, fe2));
-  AffineConstraints<double>        cm1;
-  DoFTools::make_hanging_node_constraints(*dof1, cm1);
-  cm1.close();
-  AffineConstraints<double> cm2;
-  DoFTools::make_hanging_node_constraints(*dof2, cm2);
-  cm2.close();
 
   const IndexSet &locally_owned_dofs1 = dof1->locally_owned_dofs();
   const IndexSet  locally_relevant_dofs1 =
@@ -338,6 +336,13 @@ check_this_dealii(const FiniteElement<dim> &fe1, const FiniteElement<dim> &fe2)
   const IndexSet  locally_relevant_dofs2 =
     DoFTools::extract_locally_relevant_dofs(*dof2);
 
+  AffineConstraints<double> cm1(locally_owned_dofs1, locally_relevant_dofs1);
+  DoFTools::make_hanging_node_constraints(*dof1, cm1);
+  cm1.close();
+  AffineConstraints<double> cm2(locally_owned_dofs2, locally_relevant_dofs2);
+  DoFTools::make_hanging_node_constraints(*dof2, cm2);
+  cm2.close();
+
   VectorType in_ghosted =
     build_ghosted<VectorType>(locally_owned_dofs1, locally_relevant_dofs1);
   VectorType out_ghosted =
index 0ae78048f2de1832099985bbdaf3ff3b2c1227c0..73de23c74ae4cf635a43e2204fdf27165bbcb378 100644 (file)
@@ -156,15 +156,16 @@ test()
   VectorTools::interpolate(dof_handler, CheckFunction<dim>(), interpolated);
 
   // then also apply constraints
-  AffineConstraints<double> hanging_node_constraints;
+  const IndexSet relevant_set =
+    DoFTools::extract_locally_relevant_dofs(dof_handler);
+  AffineConstraints<double> hanging_node_constraints(
+    dof_handler.locally_owned_dofs(), relevant_set);
   DoFTools::make_hanging_node_constraints(dof_handler,
                                           hanging_node_constraints);
   hanging_node_constraints.close();
   hanging_node_constraints.distribute(interpolated);
 
   // extract a vector that has ghost elements
-  const IndexSet relevant_set =
-    DoFTools::extract_locally_relevant_dofs(dof_handler);
   TrilinosWrappers::MPI::Vector x_rel(relevant_set, MPI_COMM_WORLD);
   x_rel = interpolated;
 
index abb249c5176b9af8ba4087d3cb042ccf2da9949a..049fe7230d950af31e657e58ae4890360876d5c6 100644 (file)
@@ -60,11 +60,6 @@ test()
   dofh1.distribute_dofs(fe);
   dofh2.distribute_dofs(fe);
 
-  AffineConstraints<PetscScalar> cm1;
-  cm1.close();
-  AffineConstraints<PetscScalar> cm2;
-  cm2.close();
-
   const IndexSet &dof1_locally_owned_dofs = dofh1.locally_owned_dofs();
   const IndexSet &dof2_locally_owned_dofs = dofh2.locally_owned_dofs();
   const IndexSet  dof1_locally_relevant_dofs =
@@ -72,6 +67,13 @@ test()
   const IndexSet dof2_locally_relevant_dofs =
     DoFTools::extract_locally_relevant_dofs(dofh2);
 
+  AffineConstraints<PetscScalar> cm1(dof1_locally_owned_dofs,
+                                     dof1_locally_relevant_dofs);
+  cm1.close();
+  AffineConstraints<PetscScalar> cm2(dof2_locally_owned_dofs,
+                                     dof2_locally_relevant_dofs);
+  cm2.close();
+
 
   PETScWrappers::MPI::Vector u1(dof1_locally_owned_dofs,
                                 dof1_locally_relevant_dofs,
index 091ff4526151f8abc271f0cdf447bfa532ee8696..03cb4c2eb175afcb55dcfd0cf7002d1c49e09d23 100644 (file)
@@ -189,6 +189,8 @@ namespace Step50
     system_rhs.reinit(mg_dof_handler.locally_owned_dofs(), MPI_COMM_WORLD);
 
     constraints.clear();
+    constraints.reinit(mg_dof_handler.locally_owned_dofs(),
+                       DoFTools::extract_locally_relevant_dofs(mg_dof_handler));
     DoFTools::make_hanging_node_constraints(mg_dof_handler, constraints);
 
     std::map<types::boundary_id, const Function<dim> *> dirichlet_boundary;
index 9d802ac204d8068fc9f5db444f71c50d402a4edc..bdbc5273156a6ffbd525196de86f375223a746bd 100644 (file)
@@ -189,6 +189,8 @@ namespace Step50
     system_rhs.reinit(mg_dof_handler.locally_owned_dofs(), MPI_COMM_WORLD);
 
     constraints.clear();
+    constraints.reinit(mg_dof_handler.locally_owned_dofs(),
+                       DoFTools::extract_locally_relevant_dofs(mg_dof_handler));
     DoFTools::make_hanging_node_constraints(mg_dof_handler, constraints);
 
     std::map<types::boundary_id, const Function<dim> *> dirichlet_boundary;
index 030bd04d755f49120cc8a6f1a99efffec59095b2..fb03d8bfb6959bb2c958730206ddbe83c534e210 100644 (file)
@@ -195,6 +195,9 @@ namespace Step37
 
     // Apply hanging node constraints on that vector
     constraints_euler.clear();
+    constraints_euler.reinit(dof_euler.locally_owned_dofs(),
+                             DoFTools::extract_locally_relevant_dofs(
+                               dof_euler));
     DoFTools::make_hanging_node_constraints(dof_euler, constraints_euler);
     constraints_euler.close();
     constraints_euler.distribute(euler_positions);
index d9c069f22ee5c1195833b82919ceee37f9995a61..1d096d08b2bd1d70ebf4625db546894a1c479073 100644 (file)
@@ -73,7 +73,8 @@ do_test()
   FunctionParser<dim> function(dim == 2 ? "y;-x;x*x+y*y" :
                                           "y;-x;0;x*x+y*y+z*z");
 
-  AffineConstraints<double> constraints;
+  AffineConstraints<double> constraints(dof_handler.locally_owned_dofs(),
+                                        locally_relevant_dofs);
   DoFTools::make_hanging_node_constraints(dof_handler, constraints);
   constraints.close();
   VectorTools::project(
index 39000e83f24ecb97f8bbcbb06716eb31b92249f6..11b68190a6227fdc8ef36b679e75f7df72eb8340 100644 (file)
@@ -81,12 +81,18 @@ do_test(const FiniteElement<dim> &fe_fine, const FiniteElement<dim> &fe_coarse)
   DoFHandler<dim> dof_handler_coarse(tria);
   dof_handler_coarse.distribute_dofs(fe_coarse);
 
-  AffineConstraints<Number> constraint_coarse;
+  AffineConstraints<Number> constraint_coarse(
+    dof_handler_coarse.locally_owned_dofs(),
+    DoFTools::extract_locally_relevant_dofs(dof_handler_coarse));
+
+  AffineConstraints<Number> constraint_fine(
+    dof_handler_fine.locally_owned_dofs(),
+    DoFTools::extract_locally_relevant_dofs(dof_handler_fine));
+
   DoFTools::make_hanging_node_constraints(dof_handler_coarse,
                                           constraint_coarse);
   constraint_coarse.close();
 
-  AffineConstraints<Number> constraint_fine;
   DoFTools::make_hanging_node_constraints(dof_handler_fine, constraint_fine);
   constraint_fine.close();
 
index c97c8115104e96720c36386c355f0992d50a3bb8..297c4ae96437665da4d7a3584583461365c9d753 100644 (file)
@@ -126,12 +126,18 @@ do_test()
       dof_handler_fine.distribute_dofs(fe_collection);
       dof_handler_coarse.distribute_dofs(fe_collection);
 
-      AffineConstraints<Number> constraint_coarse;
+      AffineConstraints<Number> constraint_coarse(
+        dof_handler_coarse.locally_owned_dofs(),
+        DoFTools::extract_locally_relevant_dofs(dof_handler_coarse));
+
+      AffineConstraints<Number> constraint_fine(
+        dof_handler_fine.locally_owned_dofs(),
+        DoFTools::extract_locally_relevant_dofs(dof_handler_fine));
+
       DoFTools::make_hanging_node_constraints(dof_handler_coarse,
                                               constraint_coarse);
       constraint_coarse.close();
 
-      AffineConstraints<Number> constraint_fine;
       DoFTools::make_hanging_node_constraints(dof_handler_fine,
                                               constraint_fine);
       constraint_fine.close();
index 68deebebb7fb1356998e6dc53cbb88d6252c2eea..73ae1ceaa28733981298ae37cd7d07163f6bc9cc 100644 (file)
@@ -68,12 +68,18 @@ do_test(const FiniteElement<dim> &fe_fine, const FiniteElement<dim> &fe_coarse)
   DoFHandler<dim> dof_handler_coarse(tria);
   dof_handler_coarse.distribute_dofs(FESystem<dim>(fe_coarse, dim));
 
-  AffineConstraints<Number> constraint_coarse;
+  AffineConstraints<Number> constraint_coarse(
+    dof_handler_coarse.locally_owned_dofs(),
+    DoFTools::extract_locally_relevant_dofs(dof_handler_coarse));
+
+  AffineConstraints<Number> constraint_fine(
+    dof_handler_fine.locally_owned_dofs(),
+    DoFTools::extract_locally_relevant_dofs(dof_handler_fine));
+
   DoFTools::make_hanging_node_constraints(dof_handler_coarse,
                                           constraint_coarse);
   constraint_coarse.close();
 
-  AffineConstraints<Number> constraint_fine;
   DoFTools::make_hanging_node_constraints(dof_handler_fine, constraint_fine);
   constraint_fine.close();
 
index 6d83e2b9056bc81e6f6cbe53fbf8edf32063df61..ad3ef0182d35102d4d8e1d47955d223d8cbb3ef8 100644 (file)
@@ -111,12 +111,18 @@ do_test(const FiniteElement<dim> &fe_fine, const FiniteElement<dim> &fe_coarse)
   DoFHandler<dim> dof_handler_coarse(tria_coarse);
   dof_handler_coarse.distribute_dofs(fe_coarse);
 
-  AffineConstraints<Number> constraint_coarse;
+  AffineConstraints<Number> constraint_coarse(
+    dof_handler_coarse.locally_owned_dofs(),
+    DoFTools::extract_locally_relevant_dofs(dof_handler_coarse));
+
+  AffineConstraints<Number> constraint_fine(
+    dof_handler_fine.locally_owned_dofs(),
+    DoFTools::extract_locally_relevant_dofs(dof_handler_fine));
+
   DoFTools::make_hanging_node_constraints(dof_handler_coarse,
                                           constraint_coarse);
   constraint_coarse.close();
 
-  AffineConstraints<Number> constraint_fine;
   DoFTools::make_hanging_node_constraints(dof_handler_fine, constraint_fine);
   constraint_fine.close();
 
index 838e595c9a9ed2f110f355b614977ee65dee58dc..b85f8237b92919d5c02f441853530d04c0dd12f0 100644 (file)
@@ -81,10 +81,14 @@ do_test(const FiniteElement<dim> &fe_fine, const FiniteElement<dim> &fe_coarse)
   dof_handler_coarse.distribute_dofs(fe_coarse);
   dof_handler_coarse.distribute_mg_dofs();
 
-  AffineConstraints<Number> constraint_coarse;
+  AffineConstraints<Number> constraint_coarse(
+    dof_handler_coarse.locally_owned_dofs(),
+    DoFTools::extract_locally_relevant_dofs(dof_handler_coarse));
   constraint_coarse.close();
 
-  AffineConstraints<Number> constraint_fine;
+  AffineConstraints<Number> constraint_fine(
+    dof_handler_fine.locally_owned_dofs(),
+    DoFTools::extract_locally_relevant_dofs(dof_handler_fine));
   constraint_fine.close();
 
   // setup transfer operator
index 97e1affdcb6ccfa7b31cd9ce346cc13339dbeda1..a636a89627f775008eafdcbd8c6272b8e77d66ab 100644 (file)
@@ -85,10 +85,14 @@ do_test(const FiniteElement<dim> &fe_fine, const FiniteElement<dim> &fe_coarse)
   DoFHandler<dim> dof_handler_coarse(tria);
   dof_handler_coarse.distribute_dofs(fe_coarse);
 
-  AffineConstraints<Number> constraint_coarse;
+  AffineConstraints<Number> constraint_coarse(
+    dof_handler_coarse.locally_owned_dofs(),
+    DoFTools::extract_locally_relevant_dofs(dof_handler_coarse));
   constraint_coarse.close();
 
-  AffineConstraints<Number> constraint_fine;
+  AffineConstraints<Number> constraint_fine(
+    dof_handler_fine.locally_owned_dofs(),
+    DoFTools::extract_locally_relevant_dofs(dof_handler_fine));
   constraint_fine.close();
 
   // setup transfer operator
index fdf916d9eeb618605b51fa38d1f18953d08dcfa0..197e065c19d685e80eac2e2d2566447f08819735 100644 (file)
@@ -76,7 +76,9 @@ test_transfer_operator(
   const unsigned int mg_level_fine   = numbers::invalid_unsigned_int,
   const unsigned int mg_level_coarse = numbers::invalid_unsigned_int)
 {
-  AffineConstraints<Number> constraint_fine;
+  AffineConstraints<Number> constraint_fine(
+    dof_handler_fine.locally_owned_dofs(),
+    DoFTools::extract_locally_relevant_dofs(dof_handler_fine));
   DoFTools::make_hanging_node_constraints(dof_handler_fine, constraint_fine);
   constraint_fine.close();
 
@@ -186,7 +188,9 @@ test_non_nested_transfer(
   const unsigned int mg_level_fine   = numbers::invalid_unsigned_int,
   const unsigned int mg_level_coarse = numbers::invalid_unsigned_int)
 {
-  AffineConstraints<Number> constraint_fine;
+  AffineConstraints<Number> constraint_fine(
+    dof_handler_fine.locally_owned_dofs(),
+    DoFTools::extract_locally_relevant_dofs(dof_handler_fine));
   DoFTools::make_hanging_node_constraints(dof_handler_fine, constraint_fine);
   constraint_fine.close();
 
index 785c553df6cb9d47ffe51b9fb35e0d643a9e3af6..88ce39e26d5fc3cd48ba40d740bd46b650076644 100644 (file)
@@ -73,7 +73,8 @@ do_test()
   FunctionParser<dim> function(dim == 2 ? "y;-x;x*x+y*y" :
                                           "y;-x;0;x*x+y*y+z*z");
 
-  AffineConstraints<double> constraints;
+  AffineConstraints<double> constraints(dof_handler.locally_owned_dofs(),
+                                        locally_relevant_dofs);
   DoFTools::make_hanging_node_constraints(dof_handler, constraints);
   constraints.close();
   VectorTools::project(
index f2f9bb76e3d5e6f100da1903bcb97e7aac0159b3..2328401dd43ce14afda45c54ab56b1e0bd2b1e01 100644 (file)
@@ -137,7 +137,9 @@ public:
         const LinearAlgebra::distributed::Vector<double> &solution_other,
         const Mapping<dim>                               &mapping_other)
   {
-    AffineConstraints<double> constraints;
+    AffineConstraints<double> constraints(
+      dof_handler.locally_owned_dofs(),
+      DoFTools::extract_locally_relevant_dofs(dof_handler));
     {
       std::map<types::global_dof_index, Point<dim>> support_points;
 
index f152a3d5e06ecc4a31f1ee10e436ed3e7e559b1d..75be730e4c7d952a6362bb37ea96ab48faba72c9 100644 (file)
@@ -864,7 +864,9 @@ namespace Euler_DG
     const DoFHandler<dim> &dof_handler)
   {
     const std::vector<const DoFHandler<dim> *> dof_handlers = {&dof_handler};
-    const AffineConstraints<double>            dummy;
+    const AffineConstraints<double>            dummy(
+      dof_handler.locally_owned_dofs(),
+      DoFTools::extract_locally_relevant_dofs(dof_handler));
     const std::vector<const AffineConstraints<double> *> constraints = {&dummy};
 #ifdef HEX
     const std::vector<Quadrature<1>> quadratures = {QGauss<1>(n_q_points_1d),
@@ -2320,7 +2322,9 @@ namespace Euler_DG
           euler_operator.project(ExactSolution<dim>(time), reference);
 #else
 
-          AffineConstraints<double> dummy;
+          AffineConstraints<double> dummy(
+            dof_handler.locally_owned_dofs(),
+            DoFTools::extract_locally_relevant_dofs(dof_handler));
           dummy.close();
           VectorTools::project(mapping,
                                dof_handler,
@@ -2414,7 +2418,9 @@ namespace Euler_DG
 #ifdef HEX
     euler_operator.project(ExactSolution<dim>(time), solution);
 #else
-    AffineConstraints<double> dummy;
+    AffineConstraints<double> dummy(dof_handler.locally_owned_dofs(),
+                                    DoFTools::extract_locally_relevant_dofs(
+                                      dof_handler));
     dummy.close();
     VectorTools::project(mapping,
                          dof_handler,
index 1b1b3158edc33b19f926bd494b7cfc705fa52e12..827058290f496ad1eb73f91a1e0c456750d4bb86 100644 (file)
@@ -147,6 +147,8 @@ Step4<dim>::setup_system()
   dof_handler.distribute_dofs(fe);
 
   constraints.clear();
+  constraints.reinit(dof_handler.locally_owned_dofs(),
+                     DoFTools::extract_locally_relevant_dofs(dof_handler));
   std::map<unsigned int, double> boundary_values;
   VectorTools::interpolate_boundary_values(dof_handler,
                                            0,

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.