From 9e1c356a632b61d0e63a3c2aab036138c7a39ed4 Mon Sep 17 00:00:00 2001 From: bangerth Date: Tue, 2 Nov 2010 22:31:58 +0000 Subject: [PATCH] Make the VectorTools::interpolate_boundary_values function available for the codim=1 case. git-svn-id: https://svn.dealii.org/trunk@22588 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/doc/news/changes.h | 9 ++ .../deal.II/numerics/vectors.templates.h | 23 ++-- deal.II/source/numerics/vectors.cc | 130 +++++++++++++++--- 3 files changed, 134 insertions(+), 28 deletions(-) diff --git a/deal.II/doc/news/changes.h b/deal.II/doc/news/changes.h index ea5e92646e..c6e2146b58 100644 --- a/deal.II/doc/news/changes.h +++ b/deal.II/doc/news/changes.h @@ -332,6 +332,15 @@ through DoFHandler::get_tria() and DoFHandler::get_fe(), respectively.

deal.II

    +
  1. New: The class hp::FEFaceValues and hp::FESubfaceValues were not + previously available for meshes that were embedded in a higher + dimensional space (i.e. if the codimension was greater than 1). This is + now fixed. As a consequence, the VectorTools::interpolate_boundary_values + function is now also available for such meshes. +
    + (WB, 2010/11/02) +

  2. +
  3. Fixed: The FEValuesExtractors::Vector class did not work when the dimension of the domain was not equal to the dimension of the space in which it is embedded. This is now fixed. diff --git a/deal.II/include/deal.II/numerics/vectors.templates.h b/deal.II/include/deal.II/numerics/vectors.templates.h index e0494237be..b27f75adf4 100644 --- a/deal.II/include/deal.II/numerics/vectors.templates.h +++ b/deal.II/include/deal.II/numerics/vectors.templates.h @@ -1353,6 +1353,7 @@ interpolate_boundary_values (const Mapping const std::vector &component_mask_) { const unsigned int dim=DH::dimension; + const unsigned int spacedim=DH::space_dimension; Assert ((component_mask_.size() == 0) || (component_mask_.size() == dof.get_fe().n_components()), @@ -1373,7 +1374,7 @@ interpolate_boundary_values (const Mapping const unsigned int n_components = DoFTools::n_components(dof); const bool fe_is_system = (n_components != 1); - for (typename FunctionMap::type::const_iterator i=function_map.begin(); + for (typename FunctionMap::type::const_iterator i=function_map.begin(); i!=function_map.end(); ++i) Assert (n_components == i->second->n_components, ExcDimensionMismatch(n_components, i->second->n_components)); @@ -1391,7 +1392,7 @@ interpolate_boundary_values (const Mapping std::vector face_dofs; face_dofs.reserve (DoFTools::max_dofs_per_face(dof)); - std::vector > dof_locations; + std::vector > dof_locations; dof_locations.reserve (DoFTools::max_dofs_per_face(dof)); // array to store the values of @@ -1411,11 +1412,11 @@ interpolate_boundary_values (const Mapping // the interpolation points of all // finite elements that may ever be // in use - hp::FECollection finite_elements (dof.get_fe()); + hp::FECollection finite_elements (dof.get_fe()); hp::QCollection q_collection; for (unsigned int f=0; f &fe = finite_elements[f]; + const FiniteElement &fe = finite_elements[f]; // generate a quadrature rule // on the face from the unit @@ -1483,9 +1484,9 @@ interpolate_boundary_values (const Mapping // hp::FEFaceValues object that we // can use to evaluate the boundary // values at - hp::MappingCollection mapping_collection (mapping); - hp::FEFaceValues x_fe_values (mapping_collection, finite_elements, q_collection, - update_quadrature_points); + hp::MappingCollection mapping_collection (mapping); + hp::FEFaceValues x_fe_values (mapping_collection, finite_elements, q_collection, + update_quadrature_points); typename DH::active_cell_iterator cell = dof.begin_active(), endc = dof.end(); @@ -1494,7 +1495,7 @@ interpolate_boundary_values (const Mapping for (unsigned int face_no = 0; face_no < GeometryInfo::faces_per_cell; ++face_no) { - const FiniteElement &fe = cell->get_fe(); + const FiniteElement &fe = cell->get_fe(); // we can presently deal only with // primitive elements for boundary @@ -1526,14 +1527,14 @@ interpolate_boundary_values (const Mapping { // face is of the right component x_fe_values.reinit(cell, face_no); - const FEFaceValues &fe_values = x_fe_values.get_present_fe_values(); + const FEFaceValues &fe_values = x_fe_values.get_present_fe_values(); // get indices, physical location and // boundary values of dofs on this // face face_dofs.resize (fe.dofs_per_face); face->get_dof_indices (face_dofs, cell->active_fe_index()); - const std::vector > &dof_locations + const std::vector > &dof_locations = fe_values.get_quadrature_points (); if (fe_is_system) @@ -1997,7 +1998,7 @@ VectorTools::project_boundary_values (const Mapping &mappin && ! excluded_dofs[dof_to_boundary_mapping[i]]) { Assert(numbers::is_finite(boundary_projection(dof_to_boundary_mapping[i])), ExcNumberNotFinite()); - + // this dof is on one of the // interesting boundary parts // diff --git a/deal.II/source/numerics/vectors.cc b/deal.II/source/numerics/vectors.cc index c0bf0b59f7..c30a9f4c51 100644 --- a/deal.II/source/numerics/vectors.cc +++ b/deal.II/source/numerics/vectors.cc @@ -206,6 +206,101 @@ void VectorTools::interpolate_boundary_values ( ConstraintMatrix &, const std::vector &); +#if deal_II_dimension < 3 +template +void VectorTools::interpolate_boundary_values ( + const DoFHandler &, + const unsigned char, + const Function &, + std::map &, + const std::vector &); + +template +void VectorTools::interpolate_boundary_values ( + const hp::DoFHandler &, + const unsigned char, + const Function &, + std::map &, + const std::vector &); + +template +void VectorTools::interpolate_boundary_values ( + const MGDoFHandler &, + const unsigned char, + const Function &, + std::map &, + const std::vector &); + +template +void VectorTools::interpolate_boundary_values ( + const DoFHandler &, + const unsigned char, + const Function &, + ConstraintMatrix &, + const std::vector &); + +template +void VectorTools::interpolate_boundary_values ( + const hp::DoFHandler &, + const unsigned char, + const Function &, + ConstraintMatrix &, + const std::vector &); + +template +void VectorTools::interpolate_boundary_values ( + const MGDoFHandler &, + const unsigned char, + const Function &, + ConstraintMatrix &, + const std::vector &); + +template +void VectorTools::interpolate_boundary_values ( + const Mapping &, + const DoFHandler &, + const FunctionMap::type &, + ConstraintMatrix &, + const std::vector &); + +template +void VectorTools::interpolate_boundary_values ( + const Mapping &, + const hp::DoFHandler &, + const FunctionMap::type &, + ConstraintMatrix &, + const std::vector &); + +template +void VectorTools::interpolate_boundary_values ( + const Mapping &, + const MGDoFHandler &, + const FunctionMap::type &, + ConstraintMatrix &, + const std::vector &); + +template +void VectorTools::interpolate_boundary_values ( + const DoFHandler &, + const FunctionMap::type &, + ConstraintMatrix &, + const std::vector &); + +template +void VectorTools::interpolate_boundary_values ( + const hp::DoFHandler &, + const FunctionMap::type &, + ConstraintMatrix &, + const std::vector &); + +template +void VectorTools::interpolate_boundary_values ( + const MGDoFHandler &, + const FunctionMap::type &, + ConstraintMatrix &, + const std::vector &); +#endif + template void VectorTools::project_boundary_values (const Mapping &, @@ -266,22 +361,6 @@ VectorTools::compute_no_normal_flux_constraints (const DoFHandler -// (const Mapping<1> &, -// const DoFHandler<1> &, -// const unsigned char, -// const Function<1> &, -// std::map &, -// const std::vector &); -// #endif - -// the following two functions are not derived from a template in 1d -// and thus need no explicit instantiation -//#if deal_II_dimension > 1 template void VectorTools::interpolate_boundary_values (const Mapping &, @@ -299,7 +378,24 @@ void VectorTools::interpolate_boundary_values std::map &, const std::vector &); -//#endif +#if deal_II_dimension < 3 +template +void VectorTools::interpolate_boundary_values +(const Mapping &, + const DoFHandler &, + const FunctionMap::type &, + std::map &, + const std::vector &); + +template +void VectorTools::interpolate_boundary_values +(const Mapping &, + const DoFHandler &, + const unsigned char, + const Function &, + std::map &, + const std::vector &); +#endif template -- 2.39.5