From: Matthias Maier Date: Fri, 21 Aug 2015 21:24:21 +0000 (-0500) Subject: Periodic bc: Relocate first_vector_components parameter X-Git-Tag: v8.4.0-rc2~557^2~6 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f83932a9fa3a5948b457cf0a11d4e48c99eca2ae;p=dealii.git Periodic bc: Relocate first_vector_components parameter This commit removes the first_vector_components parameter from GridTools::collect_periodic_faces(), as well as, the first_vector_components data field from the struct GridTools::PeriodicFacePair. The parameter is no added to all varianst of DoFTools::make_periodicity_constraints instead. This is an incompatible change made for consistency: A PeriodicFacePair should not store first_vector_components and with that information about the underlying finite element space. --- diff --git a/include/deal.II/dofs/dof_tools.h b/include/deal.II/dofs/dof_tools.h index b627eeed71..b1ae122967 100644 --- a/include/deal.II/dofs/dof_tools.h +++ b/include/deal.II/dofs/dof_tools.h @@ -896,22 +896,20 @@ namespace DoFTools * and any combination of that... * @endcode * - * Optionally a matrix @p matrix along with an std::vector @p - * first_vector_components can be specified that describes how DoFs on @p - * face_1 should be modified prior to constraining to the DoFs of @p face_2. - * Here, two declarations are possible: If the std::vector @p - * first_vector_components is non empty the matrix is interpreted as a @p - * dim $\times$ @p dim rotation matrix that is applied to all vector valued - * blocks listed in @p first_vector_components of the FESystem. If @p - * first_vector_components is empty the matrix is interpreted as an + * Optionally a matrix @p matrix along with an std::vector + * @p first_vector_components can be specified that describes how DoFs on + * @p face_1 should be modified prior to constraining to the DoFs of + * @p face_2. Here, two declarations are possible: If the std::vector + * @p first_vector_components is non empty the matrix is interpreted as a + * @p dim $\times$ @p dim rotation matrix that is applied to all vector + * valued blocks listed in @p first_vector_components of the FESystem. If + * @p first_vector_components is empty the matrix is interpreted as an * interpolation matrix with size no_face_dofs $\times$ no_face_dofs. * * Detailed information can be found in the see * @ref GlossPeriodicConstraints "Glossary entry on periodic boundary conditions". * - * @todo: Reference to soon be written example step and glossary article. - * - * @author Matthias Maier, 2012, 2014 + * @author Matthias Maier, 2012 - 2015 */ template void @@ -947,15 +945,16 @@ namespace DoFTools * @ref GlossPeriodicConstraints "Glossary entry on periodic boundary conditions" * for further information. * - * @author Daniel Arndt, Matthias Maier, 2013, 2014 + * @author Daniel Arndt, Matthias Maier, 2013 - 2015 */ template void make_periodicity_constraints (const std::vector > - &periodic_faces, - dealii::ConstraintMatrix &constraint_matrix, - const ComponentMask &component_mask = ComponentMask()); + &periodic_faces, + dealii::ConstraintMatrix &constraint_matrix, + const ComponentMask &component_mask = ComponentMask(), + const std::vector &first_vector_components = std::vector()); diff --git a/include/deal.II/grid/grid_tools.h b/include/deal.II/grid/grid_tools.h index ca335e2473..3239513e25 100644 --- a/include/deal.II/grid/grid_tools.h +++ b/include/deal.II/grid/grid_tools.h @@ -936,24 +936,18 @@ namespace GridTools std::bitset<3> orientation; /** - * A matrix that describes how vector valued DoFs of the first face should - * be modified prior to constraining to the DoFs of the second face. If - * the std::vector first_vector_components is non empty the matrix is - * interpreted as a @p dim $\times$ @p dim rotation matrix that is applied - * to all vector valued blocks listed in @p first_vector_components of the - * FESystem. If @p first_vector_components is empty the matrix is - * interpreted as an interpolation matrix with size no_face_dofs $\times$ - * no_face_dofs. For more details see make_periodicity_constraints() and - * the glossary - * @ref GlossPeriodicConstraints "glossary entry on periodic conditions". + * A matrix that describes how vector valued DoFs of the first face + * should be modified prior to constraining to the DoFs of the second + * face. If the std::vector first_vector_components (supplied as a + * parameter to DofTools::make_periodicity_constraints()) is non empty + * the matrix is interpreted as a @p dim $\times$ @p dim rotation + * matrix that is applied to all vector valued blocks listed in @p + * first_vector_components of the FESystem. Alternatively, if @p + * first_vector_components is empty the matrix is interpreted as an + * interpolation matrix with size no_face_dofs $\times$ no_face_dofs. + * For more details see DoFTools::make_periodicity_constraints(). */ FullMatrix matrix; - - /** - * A vector of unsigned ints pointing to the first components of all - * vector valued blocks that should be rotated by matrix. - */ - std::vector first_vector_components; }; @@ -1047,9 +1041,10 @@ namespace GridTools /** - * This function will collect periodic face pairs on the coarsest mesh level - * of the given @p container (a Triangulation or DoFHandler) and add them to - * the vector @p matched_pairs leaving the original contents intact. + * This function will collect periodic face pairs on the coarsest mesh + * level of the given @p container (a Triangulation or DoFHandler) and + * add them to the vector @p matched_pairs leaving the original contents + * intact. * * Define a 'first' boundary as all boundary faces having boundary_id @p * b_id1 and a 'second' boundary consisting of all faces belonging to @p @@ -1060,25 +1055,28 @@ namespace GridTools * orthogonal_equality(). * * The bitset that is returned inside of PeriodicFacePair encodes the - * _relative_ orientation of the first face with respect to the second face, - * see the documentation of orthogonal_equality() for further details. + * _relative_ orientation of the first face with respect to the second + * face, see the documentation of orthogonal_equality() for further + * details. * * The @p direction refers to the space direction in which periodicity is * enforced. * * The @p offset is a vector tangential to the faces that is added to the * location of vertices of the 'first' boundary when attempting to match - * them to the corresponding vertices of the 'second' boundary. This can be - * used to implement conditions such as $u(0,y)=u(1,y+1)$. - * - * Optionally a (dim x dim) rotation matrix @p matrix along with a vector @p - * first_vector_components can be specified that describes how vector valued - * DoFs of the first face should be modified prior to constraining to the - * DoFs of the second face. If @p first_vector_components is non empty the - * matrix is interpreted as a rotation matrix that is applied to all vector - * valued blocks listed in @p first_vector_components of the FESystem. For - * more details see make_periodicity_constraints() and the glossary - * @ref GlossPeriodicConstraints "glossary entry on periodic conditions". + * them to the corresponding vertices of the 'second' boundary. This can + * be used to implement conditions such as $u(0,y)=u(1,y+1)$. + * + * Optionally a @p matrix can be specified that describes how vector + * valued DoFs of the first face should be modified prior to constraining + * to the DoFs of the second face. If the matrix has size + * $n\_face\_dofs\times n\_face\_dofs$, the periodicity constraints are + * applied as $dofs\_2 = matrix\cdot dofs\_1$. If the matrix has size + * $dim\times dim$, the matrix is interpreted as a rotation matrix for + * vector valued components. + * For more details see DoFTools::make_periodicity_constraints(), the + * glossary @ref GlossPeriodicConstraints "glossary entry on periodic + * conditions" and @ref step_45 "step-45". * * @tparam Container A type that satisfies the requirements of a mesh * container (see @@ -1090,11 +1088,11 @@ namespace GridTools * periodicity algebraically. * * @note Because elements will be added to @p matched_pairs (and existing - * entries will be preserved), it is possible to call this function several - * times with different boundary ids to generate a vector with all periodic - * pairs. + * entries will be preserved), it is possible to call this function + * several times with different boundary ids to generate a vector with + * all periodic pairs. * - * @author Daniel Arndt, Matthias Maier, 2013, 2014 + * @author Daniel Arndt, Matthias Maier, 2013 - 2015 */ template void @@ -1105,8 +1103,7 @@ namespace GridTools const int direction, std::vector > &matched_pairs, const Tensor<1,CONTAINER::space_dimension> &offset = dealii::Tensor<1,CONTAINER::space_dimension>(), - const FullMatrix &matrix = FullMatrix(), - const std::vector &first_vector_components = std::vector()); + const FullMatrix &matrix = FullMatrix()); /** @@ -1150,8 +1147,7 @@ namespace GridTools const int direction, std::vector > &matched_pairs, const dealii::Tensor<1,CONTAINER::space_dimension> &offset = dealii::Tensor<1,CONTAINER::space_dimension>(), - const FullMatrix &matrix = FullMatrix(), - const std::vector &first_vector_components = std::vector()); + const FullMatrix &matrix = FullMatrix()); /*@}*/ /** diff --git a/source/dofs/dof_tools_constraints.cc b/source/dofs/dof_tools_constraints.cc index 3384d27aa9..195caade26 100644 --- a/source/dofs/dof_tools_constraints.cc +++ b/source/dofs/dof_tools_constraints.cc @@ -2267,9 +2267,10 @@ namespace DoFTools void make_periodicity_constraints (const std::vector > - &periodic_faces, - dealii::ConstraintMatrix &constraint_matrix, - const ComponentMask &component_mask) + &periodic_faces, + dealii::ConstraintMatrix &constraint_matrix, + const ComponentMask &component_mask, + const std::vector &first_vector_components) { typedef std::vector > FaceVector; @@ -2300,7 +2301,7 @@ namespace DoFTools it->orientation[1], it->orientation[2], it->matrix, - it->first_vector_components); + first_vector_components); } } @@ -2310,12 +2311,12 @@ namespace DoFTools template void - make_periodicity_constraints (const DH &dof_handler, - const types::boundary_id b_id1, - const types::boundary_id b_id2, - const int direction, - dealii::ConstraintMatrix &constraint_matrix, - const ComponentMask &component_mask) + make_periodicity_constraints (const DH &dof_handler, + const types::boundary_id b_id1, + const types::boundary_id b_id2, + const int direction, + dealii::ConstraintMatrix &constraint_matrix, + const ComponentMask &component_mask) { static const int space_dim = DH::space_dimension; (void)space_dim; @@ -2341,11 +2342,11 @@ namespace DoFTools template void - make_periodicity_constraints (const DH &dof_handler, - const types::boundary_id b_id, - const int direction, - dealii::ConstraintMatrix &constraint_matrix, - const ComponentMask &component_mask) + make_periodicity_constraints (const DH &dof_handler, + const types::boundary_id b_id, + const int direction, + dealii::ConstraintMatrix &constraint_matrix, + const ComponentMask &component_mask) { static const int dim = DH::dimension; static const int space_dim = DH::space_dimension; diff --git a/source/dofs/dof_tools_constraints.inst.in b/source/dofs/dof_tools_constraints.inst.in index 420155d5d2..b652ebd906 100644 --- a/source/dofs/dof_tools_constraints.inst.in +++ b/source/dofs/dof_tools_constraints.inst.in @@ -39,7 +39,8 @@ for (DH : DOFHANDLERS; deal_II_dimension : DIMENSIONS) DoFTools::make_periodicity_constraints (const std::vector > &, dealii::ConstraintMatrix &, - const ComponentMask &); + const ComponentMask &, + const std::vector &); template diff --git a/source/grid/grid_tools.cc b/source/grid/grid_tools.cc index 9d289634d0..7a04c594b9 100644 --- a/source/grid/grid_tools.cc +++ b/source/grid/grid_tools.cc @@ -2702,8 +2702,7 @@ next_cell: const int direction, std::vector > &matched_pairs, const dealii::Tensor<1,CellIterator::AccessorType::space_dimension> &offset, - const FullMatrix &matrix, - const std::vector &first_vector_components) + const FullMatrix &matrix) { static const int space_dim = CellIterator::AccessorType::space_dimension; (void)space_dim; @@ -2741,8 +2740,7 @@ next_cell: {cell1, cell2}, {face_idx1, face_idx2}, orientation, - matrix, - first_vector_components + matrix }; matched_pairs.push_back(matched_face); pairs2.erase(it2); @@ -2768,8 +2766,7 @@ next_cell: const int direction, std::vector > &matched_pairs, const Tensor<1,CONTAINER::space_dimension> &offset, - const FullMatrix &matrix, - const std::vector &first_vector_components) + const FullMatrix &matrix) { static const int dim = CONTAINER::dimension; static const int space_dim = CONTAINER::space_dimension; @@ -2810,8 +2807,8 @@ next_cell: ExcMessage ("Unmatched faces on periodic boundaries")); // and call match_periodic_face_pairs that does the actual matching: - match_periodic_face_pairs(pairs1, pairs2, direction, matched_pairs, - offset, matrix, first_vector_components); + match_periodic_face_pairs(pairs1, pairs2, direction, matched_pairs, offset, + matrix); } @@ -2824,8 +2821,7 @@ next_cell: const int direction, std::vector > &matched_pairs, const Tensor<1,CONTAINER::space_dimension> &offset, - const FullMatrix &matrix, - const std::vector &first_vector_components) + const FullMatrix &matrix) { static const int dim = CONTAINER::dimension; static const int space_dim = CONTAINER::space_dimension; @@ -2873,8 +2869,8 @@ next_cell: #endif // and call match_periodic_face_pairs that does the actual matching: - match_periodic_face_pairs(pairs1, pairs2, direction, matched_pairs, - offset, matrix, first_vector_components); + match_periodic_face_pairs(pairs1, pairs2, direction, matched_pairs, offset, + matrix); #ifdef DEBUG //check for standard orientation diff --git a/source/grid/grid_tools.inst.in b/source/grid/grid_tools.inst.in index 8acb27b95c..c1c5fe585c 100644 --- a/source/grid/grid_tools.inst.in +++ b/source/grid/grid_tools.inst.in @@ -24,7 +24,7 @@ for (X : TRIANGULATION_AND_DOFHANDLERS; deal_II_dimension : DIMENSIONS ; deal_II template unsigned int find_closest_vertex (const X &, - const Point &); + const Point &); template std::vector::type> @@ -37,19 +37,19 @@ for (X : TRIANGULATION_AND_DOFHANDLERS; deal_II_dimension : DIMENSIONS ; deal_II template std::pair::type, Point > find_active_cell_around_point (const Mapping &, - const X &, - const Point &); + const X &, + const Point &); template std::list > get_finest_common_cells (const X &mesh_1, - const X &mesh_2); + const X &mesh_2); template bool have_same_coarse_mesh (const X &mesh_1, - const X &mesh_2); + const X &mesh_2); \} @@ -67,33 +67,33 @@ for (deal_II_dimension : DIMENSIONS ; deal_II_space_dimension : SPACE_DIMENSIONS template unsigned int find_closest_vertex (const parallel::distributed::Triangulation &, - const Point &); + const Point &); template std::vector >::type> find_cells_adjacent_to_vertex(const parallel::distributed::Triangulation &, - const unsigned int); + const unsigned int); template dealii::internal::ActiveCellIterator >::type find_active_cell_around_point (const parallel::distributed::Triangulation &, - const Point &p); + const Point &p); template std::pair >::type, Point > find_active_cell_around_point (const Mapping &, - const parallel::distributed::Triangulation &, - const Point &); + const parallel::distributed::Triangulation &, + const Point &); template std::list::cell_iterator, parallel::distributed::Triangulation::cell_iterator> > get_finest_common_cells (const parallel::distributed::Triangulation &mesh_1, - const parallel::distributed::Triangulation &mesh_2); + const parallel::distributed::Triangulation &mesh_2); template bool have_same_coarse_mesh (const parallel::distributed::Triangulation &mesh_1, - const parallel::distributed::Triangulation &mesh_2); + const parallel::distributed::Triangulation &mesh_2); \} @@ -107,13 +107,13 @@ for (deal_II_space_dimension : SPACE_DIMENSIONS) dealii::internal::ActiveCellIterator >::type find_active_cell_around_point (const parallel::distributed::Triangulation &, - const Point &p); + const Point &p); std::pair >::type, Point > find_active_cell_around_point (const Mapping &, - const parallel::distributed::Triangulation &, - const Point &); + const parallel::distributed::Triangulation &, + const Point &); } @@ -135,28 +135,28 @@ for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS template void delete_unused_vertices (std::vector > &, - std::vector > &, - SubCellData &); + std::vector > &, + SubCellData &); template void delete_duplicated_vertices (std::vector > &, - std::vector > &, - SubCellData &, - std::vector &, - double); + std::vector > &, + SubCellData &, + std::vector &, + double); template void shift (const Tensor<1,deal_II_space_dimension> &, - Triangulation &); + Triangulation &); template void scale (const double, - Triangulation &); + Triangulation &); template void distort_random (const double, - Triangulation &, - const bool); + Triangulation &, + const bool); template void get_face_connectivity_of_cells @@ -175,16 +175,16 @@ for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS template void partition_triangulation (const unsigned int, - Triangulation &); + Triangulation &); template void partition_triangulation (const unsigned int, - const SparsityPattern &, - Triangulation &); + const SparsityPattern &, + Triangulation &); template std::pair::active_cell_iterator, - Point > + Point > find_active_cell_around_point (const hp::MappingCollection &, const hp::DoFHandler &, @@ -194,7 +194,7 @@ for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS template void get_subdomain_association (const Triangulation &, - std::vector &); + std::vector &); template unsigned int count_cells_with_subdomain_association( @@ -303,8 +303,7 @@ for (X : TRIANGULATION_AND_DOFHANDLERS; deal_II_dimension : DIMENSIONS ; deal_II const int, std::vector > &, const Tensor<1,X::space_dimension> &, - const FullMatrix &, - const std::vector &); + const FullMatrix &); template void collect_periodic_faces (const X &, @@ -312,8 +311,7 @@ for (X : TRIANGULATION_AND_DOFHANDLERS; deal_II_dimension : DIMENSIONS ; deal_II const int, std::vector > &, const Tensor<1,X::space_dimension> &, - const FullMatrix &, - const std::vector &); + const FullMatrix &); #endif @@ -336,8 +334,7 @@ for (deal_II_dimension : DIMENSIONS ; deal_II_space_dimension : SPACE_DIMENSIONS const int, std::vector::cell_iterator> > &, const Tensor<1,parallel::distributed::Triangulation::space_dimension> &, - const FullMatrix &, - const std::vector &); + const FullMatrix &); template void @@ -347,8 +344,7 @@ for (deal_II_dimension : DIMENSIONS ; deal_II_space_dimension : SPACE_DIMENSIONS const int, std::vector::cell_iterator> > &, const Tensor<1,parallel::distributed::Triangulation::space_dimension> &, - const FullMatrix &, - const std::vector &); + const FullMatrix &); \} #endif #endif