From d316374dd852ed0246e9ddf931ba3acd16152b96 Mon Sep 17 00:00:00 2001 From: Matthias Maier Date: Fri, 25 May 2018 16:11:51 -0500 Subject: [PATCH] RCM: Update fe: fe, fe_tools --- include/deal.II/fe/fe.h | 6 +- include/deal.II/fe/fe_tools.h | 66 +++++---- include/deal.II/fe/fe_tools.templates.h | 1 - .../fe/fe_tools_extrapolate.templates.h | 15 +- .../fe/fe_tools_interpolate.templates.h | 129 ++++++++++-------- source/fe/fe_tools_extrapolate.inst.in | 2 +- source/fe/fe_tools_interpolate.inst.in | 24 ++-- 7 files changed, 130 insertions(+), 113 deletions(-) diff --git a/include/deal.II/fe/fe.h b/include/deal.II/fe/fe.h index 24fc67c069..0b242bb903 100644 --- a/include/deal.II/fe/fe.h +++ b/include/deal.II/fe/fe.h @@ -412,7 +412,7 @@ class FESystem; * with some weights, then the weights have to be exactly the same as those * for constrained nodes on the three other edges with respect to the * corresponding nodes on these edges. If this isn't the case, you will get - * into trouble with the ConstraintMatrix class that is the primary consumer + * into trouble with the AffineConstraints class that is the primary consumer * of the constraint information: while that class is able to handle * constraints that are entered more than once (as is necessary for the case * above), it insists that the weights are exactly the same. @@ -421,9 +421,9 @@ class FESystem; * parent face degrees of freedom that contain those on the edges of the * parent face; it is possible that some of them are in turn constrained * themselves, leading to longer chains of constraints that the - * ConstraintMatrix class will eventually have to sort out. (The constraints + * AffineConstraints class will eventually have to sort out. (The constraints * described above are used by the DoFTools::make_hanging_node_constraints() - * function that constructs a ConstraintMatrix object.) However, this is of no + * function that constructs an AffineConstraints object.) However, this is of no * concern for the FiniteElement and derived classes since they only act * locally on one cell and its immediate neighbor, and do not see the bigger * picture. The diff --git a/include/deal.II/fe/fe_tools.h b/include/deal.II/fe/fe_tools.h index a99b256ef8..ae6c8e4d54 100644 --- a/include/deal.II/fe/fe_tools.h +++ b/include/deal.II/fe/fe_tools.h @@ -49,7 +49,8 @@ template class DoFHandler; template class FiniteElementData; -class ConstraintMatrix; +template +class AffineConstraints; @@ -643,9 +644,10 @@ namespace FETools * course Q1 on each cell. * * For this case (continuous elements on grids with hanging nodes), please - * use the @p interpolate() function with an additional ConstraintMatrix - * argument, see below, or make the field conforming yourself by calling the - * @p distribute function of your hanging node constraints object. + * use the @p interpolate() function with an additional AffineConstraints + * object as argument, see below, or make the field conforming yourself + * by calling the @p distribute function of your hanging node constraints + * object. */ template void - interpolate(const DoFHandlerType1 &dof1, - const InVector & u1, - const DoFHandlerType2 &dof2, - const ConstraintMatrix & constraints, - OutVector & u2); + interpolate( + const DoFHandlerType1 & dof1, + const InVector & u1, + const DoFHandlerType2 & dof2, + const AffineConstraints &constraints, + OutVector & u2); /** * Compute the interpolation of the @p fe1-function @p u1 to a @p @@ -695,7 +698,7 @@ namespace FETools * * Note, that this function does not work on continuous elements at hanging * nodes. For that case use the @p back_interpolate function, below, that - * takes an additional @p ConstraintMatrix object. + * takes an additional @p AffineConstraints object. * * @p dof1 might be a DoFHandler or a hp::DoFHandler onject. * @@ -728,12 +731,13 @@ namespace FETools */ template void - back_interpolate(const DoFHandler &dof1, - const ConstraintMatrix & constraints1, - const InVector & u1, - const DoFHandler &dof2, - const ConstraintMatrix & constraints2, - OutVector & u1_interpolated); + back_interpolate( + const DoFHandler & dof1, + const AffineConstraints &constraints1, + const InVector & u1, + const DoFHandler & dof2, + const AffineConstraints &constraints2, + OutVector & u1_interpolated); /** * Compute $(Id-I_h)z_1$ for a given @p dof1-function $z_1$, where $I_h$ is @@ -742,7 +746,7 @@ namespace FETools * * Note, that this function does not work for continuous elements at hanging * nodes. For that case use the @p interpolation_difference function, below, - * that takes an additional @p ConstraintMatrix object. + * that takes an additional @p AffineConstraints object. */ template void @@ -765,12 +769,13 @@ namespace FETools */ template void - interpolation_difference(const DoFHandler &dof1, - const ConstraintMatrix & constraints1, - const InVector & z1, - const DoFHandler &dof2, - const ConstraintMatrix & constraints2, - OutVector & z1_difference); + interpolation_difference( + const DoFHandler & dof1, + const AffineConstraints &constraints1, + const InVector & z1, + const DoFHandler & dof2, + const AffineConstraints &constraints2, + OutVector & z1_difference); @@ -842,7 +847,7 @@ namespace FETools * @note The resulting field does not satisfy continuity requirements of the * given finite elements if the algorithm outlined above is used. When you * use continuous elements on grids with hanging nodes, please use the @p - * extrapolate function with an additional ConstraintMatrix argument, see + * extrapolate function with an additional AffineConstraints argument, see * below. * * @note Since this function operates on patches of cells, it requires that @@ -870,11 +875,12 @@ namespace FETools */ template void - extrapolate(const DoFHandler &dof1, - const InVector & z1, - const DoFHandler &dof2, - const ConstraintMatrix & constraints, - OutVector & z2); + extrapolate( + const DoFHandler & dof1, + const InVector & z1, + const DoFHandler & dof2, + const AffineConstraints &constraints, + OutVector & z2); //@} /** @@ -1405,7 +1411,7 @@ namespace FETools << "You are using continuous elements on a grid with " << "hanging nodes but without providing hanging node " << "constraints. Use the respective function with " - << "additional ConstraintMatrix argument(s), instead." + << "additional AffineConstraints argument(s), instead." << (arg1 ? "" : "")); /** * You need at least two grid levels. diff --git a/include/deal.II/fe/fe_tools.templates.h b/include/deal.II/fe/fe_tools.templates.h index 7370518a3a..132c4aa5ff 100644 --- a/include/deal.II/fe/fe_tools.templates.h +++ b/include/deal.II/fe/fe_tools.templates.h @@ -60,7 +60,6 @@ #include -#include #include #include diff --git a/include/deal.II/fe/fe_tools_extrapolate.templates.h b/include/deal.II/fe/fe_tools_extrapolate.templates.h index 1dd3c2a448..c9a711203b 100644 --- a/include/deal.II/fe/fe_tools_extrapolate.templates.h +++ b/include/deal.II/fe/fe_tools_extrapolate.templates.h @@ -28,8 +28,8 @@ #include +#include #include -#include #include #include #include @@ -1738,7 +1738,7 @@ namespace FETools const DoFHandler &dof2, OutVector & u2) { - ConstraintMatrix dummy; + AffineConstraints dummy; dummy.close(); extrapolate(dof1, u1, dof2, dummy, u2); } @@ -1747,11 +1747,12 @@ namespace FETools template void - extrapolate(const DoFHandler &dof1, - const InVector & u1, - const DoFHandler &dof2, - const ConstraintMatrix & constraints, - OutVector & u2) + extrapolate( + const DoFHandler & dof1, + const InVector & u1, + const DoFHandler & dof2, + const AffineConstraints &constraints, + OutVector & u2) { Assert(dof1.get_fe(0).n_components() == dof2.get_fe(0).n_components(), ExcDimensionMismatch(dof1.get_fe(0).n_components(), diff --git a/include/deal.II/fe/fe_tools_interpolate.templates.h b/include/deal.II/fe/fe_tools_interpolate.templates.h index a576829a61..0b31e77723 100644 --- a/include/deal.II/fe/fe_tools_interpolate.templates.h +++ b/include/deal.II/fe/fe_tools_interpolate.templates.h @@ -38,8 +38,8 @@ #include +#include #include -#include #include #include #include @@ -69,7 +69,7 @@ namespace FETools const DoFHandlerType2 &dof2, OutVector & u2) { - ConstraintMatrix dummy; + AffineConstraints dummy; dummy.close(); interpolate(dof1, u1, dof2, dummy, u2); } @@ -83,11 +83,12 @@ namespace FETools class InVector, class OutVector> void - interpolate(const DoFHandlerType1 &dof1, - const InVector & u1, - const DoFHandlerType2 &dof2, - const ConstraintMatrix & constraints, - OutVector & u2) + interpolate( + const DoFHandlerType1 & dof1, + const InVector & u1, + const DoFHandlerType2 & dof2, + const AffineConstraints &constraints, + OutVector & u2) { Assert(&dof1.get_triangulation() == &dof2.get_triangulation(), ExcTriangulationMismatch()); @@ -321,13 +322,9 @@ namespace FETools if ((cell->subdomain_id() == subdomain_id) || (subdomain_id == numbers::invalid_subdomain_id)) { - // For continuous elements on - // grids with hanging nodes we - // need hanging node - // constraints. Consequently, - // when the elements are - // continuous no hanging node - // constraints are allowed. + // For continuous elements on grids with hanging nodes we need + // hanging node constraints. Consequently, when the elements are + // continuous no hanging node constraints are allowed. const bool hanging_nodes_not_allowed = (cell->get_fe().dofs_per_vertex != 0) || (fe2.dofs_per_vertex != 0); @@ -341,8 +338,7 @@ namespace FETools const unsigned int dofs_per_cell1 = cell->get_fe().dofs_per_cell; - // make sure back_interpolation - // matrix is available + // make sure back_interpolation matrix is available if (interpolation_matrices[&cell->get_fe()] == nullptr) { interpolation_matrices[&cell->get_fe()] = @@ -373,12 +369,13 @@ namespace FETools { template void - back_interpolate(const DoFHandler &dof1, - const ConstraintMatrix & constraints1, - const InVector & u1, - const DoFHandler &dof2, - const ConstraintMatrix & constraints2, - InVector & u1_interpolated) + back_interpolate( + const DoFHandler & dof1, + const AffineConstraints &constraints1, + const InVector & u1, + const DoFHandler & dof2, + const AffineConstraints &constraints2, + InVector & u1_interpolated) { Vector u2(dof2.n_dofs()); interpolate(dof1, u1, dof2, constraints2, u2); @@ -389,12 +386,15 @@ namespace FETools #ifdef DEAL_II_WITH_PETSC template void - back_interpolate(const DoFHandler & dof1, - const ConstraintMatrix & constraints1, - const PETScWrappers::MPI::Vector &u1, - const DoFHandler & dof2, - const ConstraintMatrix & constraints2, - PETScWrappers::MPI::Vector & u1_interpolated) + back_interpolate( + const DoFHandler &dof1, + const AffineConstraints + & constraints1, + const PETScWrappers::MPI::Vector &u1, + const DoFHandler & dof2, + const AffineConstraints + & constraints2, + PETScWrappers::MPI::Vector &u1_interpolated) { // if u1 is a parallel distributed PETSc vector, we create a // vector u2 with based on the sets of locally owned and relevant @@ -419,12 +419,15 @@ namespace FETools #ifdef DEAL_II_WITH_TRILINOS template void - back_interpolate(const DoFHandler & dof1, - const ConstraintMatrix & constraints1, - const TrilinosWrappers::MPI::Vector &u1, - const DoFHandler & dof2, - const ConstraintMatrix & constraints2, - TrilinosWrappers::MPI::Vector & u1_interpolated) + back_interpolate( + const DoFHandler &dof1, + const AffineConstraints< + typename TrilinosWrappers::MPI::Vector::value_type> &constraints1, + const TrilinosWrappers::MPI::Vector & u1, + const DoFHandler & dof2, + const AffineConstraints< + typename TrilinosWrappers::MPI::Vector::value_type> &constraints2, + TrilinosWrappers::MPI::Vector & u1_interpolated) { // if u1 is a parallel distributed Trilinos vector, we create a // vector u2 with based on the sets of locally owned and relevant @@ -450,10 +453,10 @@ namespace FETools void back_interpolate( const DoFHandler & dof1, - const ConstraintMatrix & constraints1, + const AffineConstraints & constraints1, const LinearAlgebra::distributed::Vector &u1, const DoFHandler & dof2, - const ConstraintMatrix & constraints2, + const AffineConstraints & constraints2, LinearAlgebra::distributed::Vector & u1_interpolated) { const IndexSet &dof2_locally_owned_dofs = dof2.locally_owned_dofs(); @@ -477,12 +480,13 @@ namespace FETools template void - back_interpolate(const DoFHandler &dof1, - const ConstraintMatrix & constraints1, - const InVector & u1, - const DoFHandler &dof2, - const ConstraintMatrix & constraints2, - OutVector & u1_interpolated) + back_interpolate( + const DoFHandler & dof1, + const AffineConstraints &constraints1, + const InVector & u1, + const DoFHandler & dof2, + const AffineConstraints &constraints2, + OutVector & u1_interpolated) { // For discontinuous elements without constraints take the simpler version // of the back_interpolate function. @@ -594,12 +598,13 @@ namespace FETools { template void - interpolation_difference(const DoFHandler &dof1, - const ConstraintMatrix & constraints1, - const InVector & u1, - const DoFHandler &dof2, - const ConstraintMatrix & constraints2, - OutVector & u1_difference) + interpolation_difference( + const DoFHandler & dof1, + const AffineConstraints &constraints1, + const InVector & u1, + const DoFHandler & dof2, + const AffineConstraints &constraints2, + OutVector & u1_difference) { back_interpolate( dof1, constraints1, u1, dof2, constraints2, u1_difference); @@ -610,12 +615,15 @@ namespace FETools #ifdef DEAL_II_WITH_TRILINOS template void - interpolation_difference(const DoFHandler &dof1, - const ConstraintMatrix & constraints1, - const TrilinosWrappers::MPI::Vector &u1, - const DoFHandler & dof2, - const ConstraintMatrix & constraints2, - TrilinosWrappers::MPI::Vector &u1_difference) + interpolation_difference( + const DoFHandler &dof1, + const AffineConstraints + & constraints1, + const TrilinosWrappers::MPI::Vector &u1, + const DoFHandler & dof2, + const AffineConstraints + & constraints2, + TrilinosWrappers::MPI::Vector &u1_difference) { back_interpolate( dof1, constraints1, u1, dof2, constraints2, u1_difference); @@ -638,12 +646,13 @@ namespace FETools template void - interpolation_difference(const DoFHandler &dof1, - const ConstraintMatrix & constraints1, - const InVector & u1, - const DoFHandler &dof2, - const ConstraintMatrix & constraints2, - OutVector & u1_difference) + interpolation_difference( + const DoFHandler & dof1, + const AffineConstraints &constraints1, + const InVector & u1, + const DoFHandler & dof2, + const AffineConstraints &constraints2, + OutVector & u1_difference) { // For discontinuous elements // without constraints take the diff --git a/source/fe/fe_tools_extrapolate.inst.in b/source/fe/fe_tools_extrapolate.inst.in index 05c06edc43..3f09588d6f 100644 --- a/source/fe/fe_tools_extrapolate.inst.in +++ b/source/fe/fe_tools_extrapolate.inst.in @@ -31,7 +31,7 @@ for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS; extrapolate(const DoFHandler &, const VEC &, const DoFHandler &, - const ConstraintMatrix &, + const AffineConstraints &, VEC &); #endif \} diff --git a/source/fe/fe_tools_interpolate.inst.in b/source/fe/fe_tools_interpolate.inst.in index 9e62e5b3e9..a301dac43e 100644 --- a/source/fe/fe_tools_interpolate.inst.in +++ b/source/fe/fe_tools_interpolate.inst.in @@ -20,6 +20,7 @@ for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS; { namespace FETools \{ + #if deal_II_dimension <= deal_II_space_dimension template void interpolate( @@ -33,7 +34,7 @@ for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS; const DoFHandler &, const Vector &, const DoFHandler &, - const ConstraintMatrix &, + const AffineConstraints &, Vector &); #endif \} @@ -54,7 +55,7 @@ for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS) interpolate(const hp::DoFHandler &, const Vector &, const hp::DoFHandler &, - const ConstraintMatrix &, + const AffineConstraints &, Vector &); template void @@ -67,7 +68,7 @@ for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS) interpolate(const hp::DoFHandler &, const Vector &, const hp::DoFHandler &, - const ConstraintMatrix &, + const AffineConstraints &, Vector &); #endif \} @@ -94,12 +95,13 @@ for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS; VEC &); template void - back_interpolate(const DoFHandler &, - const ConstraintMatrix &, - const VEC &, - const DoFHandler &, - const ConstraintMatrix &, - VEC &); + back_interpolate( + const DoFHandler &, + const AffineConstraints &, + const VEC &, + const DoFHandler &, + const AffineConstraints &, + VEC &); template void interpolation_difference( @@ -111,10 +113,10 @@ for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS; template void interpolation_difference( const DoFHandler &, - const ConstraintMatrix &, + const AffineConstraints &, const VEC &, const DoFHandler &, - const ConstraintMatrix &, + const AffineConstraints &, VEC &); template void -- 2.39.5