From: maier Date: Fri, 21 Feb 2014 11:51:27 +0000 (+0000) Subject: Expose the full interface for now X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5327a8f26931e329229799b876c961979b11dedd;p=dealii-svn.git Expose the full interface for now git-svn-id: https://svn.dealii.org/branches/branch_periodic_bc@32525 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/include/deal.II/dofs/dof_tools.h b/deal.II/include/deal.II/dofs/dof_tools.h index f695233853..889cae4260 100644 --- a/deal.II/include/deal.II/dofs/dof_tools.h +++ b/deal.II/include/deal.II/dofs/dof_tools.h @@ -843,9 +843,14 @@ namespace DoFTools * and any combination of that... * @endcode * - * The optional parameter @p rotation is a rotation matrix that is - * applied to all vector valued components of an FESystem on @p face_1 - * prior to periodically constraining them to the DoFs of @p face_2. + * Optionally a rotation matrix @p matrix along with a flag @p + * rotation_matrix can be specified that describes how DoFs on @p face_1 + * should be modified prior to constraining to the DoFs of @p face_2. If + * rotation_matrix is true the matrix is enterpreted as a rotation matrix + * applied to all vector valued blocks of an FESystem. For more details + * see make_periodicity_constraints and the glossary @ref + * GlossPeriodicConstraints "glossary entry on periodic boundary + * conditions". * * Detailed information can be found in the @see @ref * GlossPeriodicConstraints "Glossary entry on periodic boundary @@ -865,7 +870,8 @@ namespace DoFTools const bool face_orientation = true, const bool face_flip = false, const bool face_rotation = false, - const FullMatrix &rotation = IdentityMatrix(FaceIterator::space_dimension)); + const FullMatrix &matrix = IdentityMatrix(FaceIterator::space_dimension), + const bool rotation_matrix = true); diff --git a/deal.II/include/deal.II/grid/grid_tools.h b/deal.II/include/deal.II/grid/grid_tools.h index f7246afe1e..96308f0713 100644 --- a/deal.II/include/deal.II/grid/grid_tools.h +++ b/deal.II/include/deal.II/grid/grid_tools.h @@ -998,29 +998,39 @@ namespace GridTools struct PeriodicFacePair { /** - * the cells associated with the two 'periodic' faces + * The cells associated with the two 'periodic' faces. */ CellIterator cell[2]; /** - * the local face indices (with respect to the specified cells) of the - * two 'periodic' faces + * The local face indices (with respect to the specified cells) of the + * two 'periodic' faces. */ unsigned int face_idx[2]; /** - * the relative orientation of the first face with respect to the + * The relative orientation of the first face with respect to the * second face as described in orthogonal_equality and * make_periodicity_constraints (and stored as a bitset). */ std::bitset<3> orientation; /** - * a rotation matrix that describes how vector valued DoFs of the first face - * should be rotated prior to constraining to the DoFs of the second - * face, see make_periodicity_constraints. + * 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 rotation_matrix is true the matrix is enterpreted as a + * rotation matrix applied to all vector valued blocks of an FESystem. + * For more details see make_periodicity_constraints and the glossary + * @ref GlossPeriodicConstraints "glossary entry on periodic + * boundary conditions". */ - FullMatrix rotation; + FullMatrix matrix; + + /** + * A flag indicating whether matrix should be interpreted as rotation + * matrix or as an interpolation matrix. + */ + bool rotation_matrix; }; @@ -1133,10 +1143,14 @@ namespace GridTools * 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 rotation matrix @p rotation can be specified that - * describes how vector valued DoFs of the first boundary @p b_id1 should - * be rotated prior to constraining to the DoFs of the second boundary @p - * b_id2, see make_periodicity_constraints. + * Optionally a rotation matrix @p matrix along with a flag @p + * rotation_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 rotation_matrix is true the matrix is + * enterpreted as a rotation matrix applied to all vector valued blocks + * of an FESystem. For more details see make_periodicity_constraints and + * the glossary @ref GlossPeriodicConstraints "glossary entry on periodic + * boundary conditions". * * @note The created std::vector can be used in * DoFTools::make_periodicity_constraints and in @@ -1159,7 +1173,8 @@ namespace GridTools const int direction, std::vector > &matched_pairs, const Tensor<1,CONTAINER::space_dimension> &offset = dealii::Tensor<1,CONTAINER::space_dimension>(), - const FullMatrix &rotation = IdentityMatrix(CONTAINER::space_dimension)); + const FullMatrix &matrix = IdentityMatrix(CONTAINER::space_dimension), + const bool rotation_matrix = true); /** @@ -1190,7 +1205,8 @@ 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 &rotation = IdentityMatrix(CONTAINER::space_dimension)); + const FullMatrix &matrix = IdentityMatrix(CONTAINER::space_dimension), + const bool rotation_matrix = true); diff --git a/deal.II/source/dofs/dof_tools_constraints.cc b/deal.II/source/dofs/dof_tools_constraints.cc index 132396d24b..3d09923476 100644 --- a/deal.II/source/dofs/dof_tools_constraints.cc +++ b/deal.II/source/dofs/dof_tools_constraints.cc @@ -1836,8 +1836,8 @@ namespace DoFTools const unsigned int j = cell_to_rotated_face_index[fe.face_to_cell_index(identity_constraint_target, 0, /* It doesn't really matter, just assume - * we're on the first face... - */ + * we're on the first face... + */ face_orientation, face_flip, face_rotation)]; // if the two aren't already identity constrained (whichever way @@ -1887,7 +1887,8 @@ namespace DoFTools const bool face_orientation, const bool face_flip, const bool face_rotation, - const FullMatrix &rotation) + const FullMatrix &matrix, + const bool rotation_matrix) { static const int dim = FaceIterator::AccessorType::dimension; @@ -1974,25 +1975,39 @@ namespace DoFTools face_orientation, face_flip, face_rotation, - rotation); + matrix, + rotation_matrix); } } else // otherwise at least one of the two faces is active and // we need to enter the constraints { + // Build up the transformation matrix: + + if (rotation_matrix) + AssertThrow(false, ExcNotImplemented()); +// FullMatrix(IdentityMatrix(face_1->get_fe(face_1->nth_active_fe_index(0)).dofs_per_face)); + if (face_2->has_children() == false) - set_periodicity_constraints(face_2, face_1, - FullMatrix(IdentityMatrix(face_1->get_fe(face_1->nth_active_fe_index(0)).dofs_per_face)), // TODO - constraint_matrix, - component_mask, - face_orientation, face_flip, face_rotation); + { + // TODO: This is horrible... + FullMatrix inverse; + inverse.invert(matrix); + set_periodicity_constraints(face_2, face_1, + inverse, + constraint_matrix, + component_mask, + face_orientation, face_flip, face_rotation); + } else + { set_periodicity_constraints(face_1, face_2, - FullMatrix(IdentityMatrix(face_1->get_fe(face_1->nth_active_fe_index(0)).dofs_per_face)), // TODO + matrix, constraint_matrix, component_mask, face_orientation, face_flip, face_rotation); + } } } @@ -2002,7 +2017,7 @@ namespace DoFTools void make_periodicity_constraints (const std::vector > - &periodic_faces, + &periodic_faces, dealii::ConstraintMatrix &constraint_matrix, const ComponentMask &component_mask) { @@ -2034,7 +2049,8 @@ namespace DoFTools it->orientation[0], it->orientation[1], it->orientation[2], - it->rotation); + it->matrix, + it->rotation_matrix); } } diff --git a/deal.II/source/dofs/dof_tools_constraints.inst.in b/deal.II/source/dofs/dof_tools_constraints.inst.in index 450332f5d0..1b8a6d3e14 100644 --- a/deal.II/source/dofs/dof_tools_constraints.inst.in +++ b/deal.II/source/dofs/dof_tools_constraints.inst.in @@ -32,7 +32,8 @@ for (DH : DOFHANDLERS; deal_II_dimension : DIMENSIONS) dealii::ConstraintMatrix &, const ComponentMask &, bool, bool, bool, - const FullMatrix &); + const FullMatrix &, + const bool); template void diff --git a/deal.II/source/grid/grid_tools.cc b/deal.II/source/grid/grid_tools.cc index c5ada5eac1..dacf505b13 100644 --- a/deal.II/source/grid/grid_tools.cc +++ b/deal.II/source/grid/grid_tools.cc @@ -2379,10 +2379,11 @@ next_cell: match_periodic_face_pairs (std::set > &pairs1, std::set::type, unsigned int> > &pairs2, - const int direction, - std::vector > &matched_pairs, + const int direction, + std::vector > &matched_pairs, const dealii::Tensor<1,CellIterator::AccessorType::space_dimension> &offset, - const FullMatrix &rotation) + const FullMatrix &matrix, + const bool rotation_matrix) { static const int space_dim = CellIterator::AccessorType::space_dimension; Assert (0<=direction && direction matched_face - = {{cell1, cell2},{face_idx1, face_idx2}, orientation, rotation}; + = {{cell1, cell2},{face_idx1, face_idx2}, orientation, matrix, rotation_matrix}; matched_pairs.push_back(matched_face); pairs2.erase(it2); ++n_matches; @@ -2433,13 +2434,14 @@ next_cell: template void collect_periodic_faces - (const CONTAINER &container, - const types::boundary_id b_id1, - const types::boundary_id b_id2, - const int direction, + (const CONTAINER &container, + const types::boundary_id b_id1, + const types::boundary_id b_id2, + const int direction, std::vector > &matched_pairs, const Tensor<1,CONTAINER::space_dimension> &offset, - const FullMatrix &rotation) + const FullMatrix &matrix, + const bool rotation_matrix) { static const int dim = CONTAINER::dimension; static const int space_dim = CONTAINER::space_dimension; @@ -2478,7 +2480,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, rotation); + match_periodic_face_pairs(pairs1, pairs2, direction, matched_pairs, + offset, matrix, rotation_matrix); } @@ -2486,12 +2489,13 @@ next_cell: template void collect_periodic_faces - (const CONTAINER &container, - const types::boundary_id b_id, - const int direction, + (const CONTAINER &container, + const types::boundary_id b_id, + const int direction, std::vector > &matched_pairs, const Tensor<1,CONTAINER::space_dimension> &offset, - const FullMatrix &rotation) + const FullMatrix &matrix, + const bool rotation_matrix) { static const int dim = CONTAINER::dimension; static const int space_dim = CONTAINER::space_dimension; @@ -2537,7 +2541,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, rotation); + match_periodic_face_pairs(pairs1, pairs2, direction, matched_pairs, + offset, matrix, rotation_matrix); #ifdef DEBUG //check for standard orientation diff --git a/deal.II/source/grid/grid_tools.inst.in b/deal.II/source/grid/grid_tools.inst.in index 8586f204b9..4a5ac2eb23 100644 --- a/deal.II/source/grid/grid_tools.inst.in +++ b/deal.II/source/grid/grid_tools.inst.in @@ -321,7 +321,8 @@ for (X : TRIANGULATION_AND_DOFHANDLERS; deal_II_dimension : DIMENSIONS ; deal_II const int, std::vector > &, const Tensor<1,X::space_dimension> &, - const FullMatrix &); + const FullMatrix &, + const bool); template void collect_periodic_faces (const X &, @@ -329,7 +330,8 @@ for (X : TRIANGULATION_AND_DOFHANDLERS; deal_II_dimension : DIMENSIONS ; deal_II const int, std::vector > &, const Tensor<1,X::space_dimension> &, - const FullMatrix &); + const FullMatrix &, + const bool); #endif @@ -343,7 +345,6 @@ for (deal_II_dimension : DIMENSIONS ; deal_II_space_dimension : SPACE_DIMENSIONS #if deal_II_dimension >= 2 namespace GridTools \{ - template void collect_periodic_faces > @@ -353,7 +354,8 @@ 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 FullMatrix &, + const bool); template void @@ -363,8 +365,8 @@ 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 FullMatrix &, + const bool); \} #endif #endif