From 43df51cf855d23d4a74720081c3415734a2453f5 Mon Sep 17 00:00:00 2001 From: Matthias Maier Date: Sun, 27 May 2018 18:12:39 -0500 Subject: [PATCH] RCM: Update matrix_free, part 3: matrix_free and dof_info --- include/deal.II/matrix_free/dof_info.h | 5 +- .../deal.II/matrix_free/dof_info.templates.h | 3 +- include/deal.II/matrix_free/matrix_free.h | 152 +++++++++--------- .../matrix_free/matrix_free.templates.h | 10 +- 4 files changed, 88 insertions(+), 82 deletions(-) diff --git a/include/deal.II/matrix_free/dof_info.h b/include/deal.II/matrix_free/dof_info.h index f97710630d..0d815ad813 100644 --- a/include/deal.II/matrix_free/dof_info.h +++ b/include/deal.II/matrix_free/dof_info.h @@ -48,7 +48,7 @@ namespace internal * cells. Essentially, this is a smart number cache in the style of a * DoFHandler that also embeds the description of constraints directly on * the cell level without the need to refer to the external - * ConstraintMatrix. + * AffineConstraints object. * * This class only stores index relations. The weights for hanging node * constraints are stored in a different field. This is because a @@ -110,11 +110,12 @@ namespace internal * assigned the correct index after all the ghost indices have been * collected by the call to @p assign_ghosts. */ + template void read_dof_indices( const std::vector &local_indices, const std::vector & lexicographic_inv, - const ConstraintMatrix & constraints, + const AffineConstraints & constraints, const unsigned int cell_number, ConstraintValues & constraint_values, bool & cell_at_boundary); diff --git a/include/deal.II/matrix_free/dof_info.templates.h b/include/deal.II/matrix_free/dof_info.templates.h index 515ed57625..93d9de3a23 100644 --- a/include/deal.II/matrix_free/dof_info.templates.h +++ b/include/deal.II/matrix_free/dof_info.templates.h @@ -170,11 +170,12 @@ namespace internal + template void DoFInfo ::read_dof_indices( const std::vector &local_indices, const std::vector & lexicographic_inv, - const ConstraintMatrix & constraints, + const AffineConstraints & constraints, const unsigned int cell_number, ConstraintValues & constraint_values, bool & cell_at_subdomain_boundary) diff --git a/include/deal.II/matrix_free/matrix_free.h b/include/deal.II/matrix_free/matrix_free.h index ce79cd6dfd..4048a4fbb5 100644 --- a/include/deal.II/matrix_free/matrix_free.h +++ b/include/deal.II/matrix_free/matrix_free.h @@ -476,22 +476,23 @@ public: /** * Extracts the information needed to perform loops over cells. The - * DoFHandler and ConstraintMatrix describe the layout of degrees of - * freedom, the DoFHandler and the mapping describe the transformations from - * unit to real cell, and the finite element underlying the DoFHandler - * together with the quadrature formula describe the local operations. Note - * that the finite element underlying the DoFHandler must either be scalar - * or contain several copies of the same element. Mixing several different - * elements into one FESystem is not allowed. In that case, use the - * initialization function with several DoFHandler arguments. + * DoFHandler and AffineConstraints objects describe the layout of degrees + * of freedom, the DoFHandler and the mapping describe the + * transformations from unit to real cell, and the finite element + * underlying the DoFHandler together with the quadrature formula + * describe the local operations. Note that the finite element underlying + * the DoFHandler must either be scalar or contain several copies of the + * same element. Mixing several different elements into one FESystem is + * not allowed. In that case, use the initialization function with + * several DoFHandler arguments. */ template void - reinit(const Mapping & mapping, - const DoFHandlerType & dof_handler, - const ConstraintMatrix &constraint, - const QuadratureType & quad, - const AdditionalData additional_data = AdditionalData()); + reinit(const Mapping & mapping, + const DoFHandlerType & dof_handler, + const AffineConstraints &constraint, + const QuadratureType & quad, + const AdditionalData additional_data = AdditionalData()); /** * Initializes the data structures. Same as above, but using a $Q_1$ @@ -499,10 +500,10 @@ public: */ template void - reinit(const DoFHandlerType & dof_handler, - const ConstraintMatrix &constraint, - const QuadratureType & quad, - const AdditionalData additional_data = AdditionalData()); + reinit(const DoFHandlerType & dof_handler, + const AffineConstraints &constraint, + const QuadratureType & quad, + const AdditionalData additional_data = AdditionalData()); /** * Same as above. @@ -513,16 +514,16 @@ public: */ template DEAL_II_DEPRECATED void - reinit(const Mapping & mapping, - const DoFHandlerType & dof_handler, - const ConstraintMatrix &constraint, - const IndexSet & locally_owned_dofs, - const QuadratureType & quad, - const AdditionalData additional_data = AdditionalData()); + reinit(const Mapping & mapping, + const DoFHandlerType & dof_handler, + const AffineConstraints &constraint, + const IndexSet & locally_owned_dofs, + const QuadratureType & quad, + const AdditionalData additional_data = AdditionalData()); /** * Extracts the information needed to perform loops over cells. The - * DoFHandler and ConstraintMatrix describe the layout of degrees of + * DoFHandler and AffineConstraints objects describe the layout of degrees of * freedom, the DoFHandler and the mapping describe the transformations from * unit to real cell, and the finite element underlying the DoFHandler * together with the quadrature formula describe the local operations. As @@ -531,8 +532,8 @@ public: * finite elements. The DoFHandlers to each element must be passed as * pointers to the initialization function. Note that the finite element * underlying an DoFHandler must either be scalar or contain several copies - * of the same element. Mixing several different elements into one @p - * FE_System is not allowed. + * of the same element. Mixing several different elements into one + * @p FE_System is not allowed. * * This function also allows for using several quadrature formulas, e.g. * when the description contains independent integrations of elements of @@ -542,10 +543,10 @@ public: */ template void - reinit(const Mapping & mapping, - const std::vector & dof_handler, - const std::vector &constraint, - const std::vector & quad, + reinit(const Mapping & mapping, + const std::vector & dof_handler, + const std::vector *> &constraint, + const std::vector & quad, const AdditionalData additional_data = AdditionalData()); /** @@ -554,9 +555,9 @@ public: */ template void - reinit(const std::vector & dof_handler, - const std::vector &constraint, - const std::vector & quad, + reinit(const std::vector & dof_handler, + const std::vector *> &constraint, + const std::vector & quad, const AdditionalData additional_data = AdditionalData()); /** @@ -568,12 +569,12 @@ public: */ template DEAL_II_DEPRECATED void - reinit(const Mapping & mapping, - const std::vector & dof_handler, - const std::vector &constraint, - const std::vector & locally_owned_set, - const std::vector & quad, - const AdditionalData additional_data = AdditionalData()); + reinit(const Mapping & mapping, + const std::vector & dof_handler, + const std::vector *> &constraint, + const std::vector & locally_owned_set, + const std::vector &quad, + const AdditionalData additional_data = AdditionalData()); /** * Initializes the data structures. Same as before, but now the index set @@ -584,10 +585,10 @@ public: */ template void - reinit(const Mapping & mapping, - const std::vector & dof_handler, - const std::vector &constraint, - const QuadratureType & quad, + reinit(const Mapping & mapping, + const std::vector & dof_handler, + const std::vector *> &constraint, + const QuadratureType & quad, const AdditionalData additional_data = AdditionalData()); /** @@ -596,9 +597,9 @@ public: */ template void - reinit(const std::vector & dof_handler, - const std::vector &constraint, - const QuadratureType & quad, + reinit(const std::vector & dof_handler, + const std::vector *> &constraint, + const QuadratureType & quad, const AdditionalData additional_data = AdditionalData()); /** @@ -1154,7 +1155,7 @@ public: * this function does not re-arrange the information stored in this class, * but rather creates a renumbering for consumption of * DoFHandler::renumber_dofs. To have any effect a MatrixFree object must be - * set up again using the renumbered DoFHandler and ConstraintMatrix. Note + * set up again using the renumbered DoFHandler and AffineConstraints. Note * that if a DoFHandler calls DoFHandler::renumber_dofs, all information in * MatrixFree becomes invalid. */ @@ -1578,23 +1579,25 @@ private: * DoFHandler case. */ void - internal_reinit(const Mapping & mapping, - const std::vector *> & dof_handler, - const std::vector &constraint, - const std::vector & locally_owned_set, - const std::vector> &quad, - const AdditionalData & additional_data); + internal_reinit( + const Mapping & mapping, + const std::vector *> & dof_handler, + const std::vector *> &constraint, + const std::vector & locally_owned_set, + const std::vector> & quad, + const AdditionalData & additional_data); /** * Same as before but for hp::DoFHandler instead of generic DoFHandler type. */ void - internal_reinit(const Mapping & mapping, - const std::vector *> &dof_handler, - const std::vector & constraint, - const std::vector & locally_owned_set, - const std::vector> &quad, - const AdditionalData & additional_data); + internal_reinit( + const Mapping & mapping, + const std::vector *> & dof_handler, + const std::vector *> &constraint, + const std::vector & locally_owned_set, + const std::vector> & quad, + const AdditionalData & additional_data); /** * Initializes the fields in DoFInfo together with the constraint pool that @@ -1603,9 +1606,10 @@ private: * consequently only need to be stored once). */ void - initialize_indices(const std::vector &constraint, - const std::vector &locally_owned_set, - const AdditionalData & additional_data); + initialize_indices( + const std::vector *> &constraint, + const std::vector & locally_owned_set, + const AdditionalData & additional_data); /** * Initializes the DoFHandlers based on a DoFHandler argument. @@ -2425,13 +2429,13 @@ template void MatrixFree::reinit( const DoFHandlerType & dof_handler, - const ConstraintMatrix & constraints_in, + const AffineConstraints & constraints_in, const QuadratureType & quad, const typename MatrixFree::AdditionalData additional_data) { - std::vector dof_handlers; - std::vector constraints; - std::vector quads; + std::vector dof_handlers; + std::vector *> constraints; + std::vector quads; dof_handlers.push_back(&dof_handler); constraints.push_back(&constraints_in); @@ -2460,12 +2464,12 @@ void MatrixFree::reinit( const Mapping & mapping, const DoFHandlerType & dof_handler, - const ConstraintMatrix & constraints_in, + const AffineConstraints & constraints_in, const QuadratureType & quad, const typename MatrixFree::AdditionalData additional_data) { - std::vector dof_handlers; - std::vector constraints; + std::vector dof_handlers; + std::vector *> constraints; dof_handlers.push_back(&dof_handler); constraints.push_back(&constraints_in); @@ -2492,7 +2496,7 @@ template void MatrixFree::reinit( const std::vector & dof_handler, - const std::vector & constraint, + const std::vector *> & constraint, const std::vector & quad, const typename MatrixFree::AdditionalData additional_data) { @@ -2517,7 +2521,7 @@ template void MatrixFree::reinit( const std::vector & dof_handler, - const std::vector & constraint, + const std::vector *> & constraint, const QuadratureType & quad, const typename MatrixFree::AdditionalData additional_data) { @@ -2542,7 +2546,7 @@ void MatrixFree::reinit( const Mapping & mapping, const std::vector & dof_handler, - const std::vector & constraint, + const std::vector *> & constraint, const QuadratureType & quad, const typename MatrixFree::AdditionalData additional_data) { @@ -2567,7 +2571,7 @@ void MatrixFree::reinit( const Mapping & mapping, const std::vector & dof_handler, - const std::vector & constraint, + const std::vector *> & constraint, const std::vector & quad, const typename MatrixFree::AdditionalData additional_data) { @@ -2593,7 +2597,7 @@ void MatrixFree::reinit( const Mapping & mapping, const std::vector & dof_handler, - const std::vector & constraint, + const std::vector *> & constraint, const std::vector & locally_owned_set, const std::vector & quad, const typename MatrixFree::AdditionalData additional_data) diff --git a/include/deal.II/matrix_free/matrix_free.templates.h b/include/deal.II/matrix_free/matrix_free.templates.h index 823f5b8e8d..8c4074dfab 100644 --- a/include/deal.II/matrix_free/matrix_free.templates.h +++ b/include/deal.II/matrix_free/matrix_free.templates.h @@ -229,7 +229,7 @@ void MatrixFree::internal_reinit( const Mapping & mapping, const std::vector *> & dof_handler, - const std::vector & constraint, + const std::vector *> & constraint, const std::vector & locally_owned_set, const std::vector> & quad, const typename MatrixFree::AdditionalData &additional_data) @@ -388,7 +388,7 @@ void MatrixFree::internal_reinit( const Mapping & mapping, const std::vector *> & dof_handler, - const std::vector & constraint, + const std::vector *> & constraint, const std::vector & locally_owned_set, const std::vector> & quad, const typename MatrixFree::AdditionalData &additional_data) @@ -739,9 +739,9 @@ MatrixFree::initialize_dof_handlers( template void MatrixFree::initialize_indices( - const std::vector &constraint, - const std::vector & locally_owned_set, - const AdditionalData & additional_data) + const std::vector *> &constraint, + const std::vector & locally_owned_set, + const AdditionalData & additional_data) { // insert possible ghost cells and construct face topology const bool do_face_integrals = -- 2.39.5