From fce4f4778942b7a47edd26358c9d80e2e1d6208e Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Wed, 13 Jan 2021 17:02:50 -0700 Subject: [PATCH] Use linear Q1 mapping even in places where we know that that may be wrong. --- include/deal.II/fe/fe_interface_values.h | 48 ++++++++++++------- include/deal.II/fe/fe_tools.templates.h | 13 +++-- include/deal.II/grid/grid_tools.h | 30 +++++++----- include/deal.II/grid/grid_tools_cache.h | 3 +- .../numerics/vector_tools_constraints.h | 12 +++-- include/deal.II/particles/generators.h | 45 +++++++++-------- 6 files changed, 95 insertions(+), 56 deletions(-) diff --git a/include/deal.II/fe/fe_interface_values.h b/include/deal.II/fe/fe_interface_values.h index 0b581f237d..5887207b75 100644 --- a/include/deal.II/fe/fe_interface_values.h +++ b/include/deal.II/fe/fe_interface_values.h @@ -525,22 +525,38 @@ FEInterfaceValues::FEInterfaceValues( const Quadrature & quadrature, const UpdateFlags update_flags) : n_quadrature_points(quadrature.size()) - , internal_fe_face_values(StaticMappingQ1::mapping, - fe, - quadrature, - update_flags) - , internal_fe_subface_values(StaticMappingQ1::mapping, - fe, - quadrature, - update_flags) - , internal_fe_face_values_neighbor(StaticMappingQ1::mapping, - fe, - quadrature, - update_flags) - , internal_fe_subface_values_neighbor(StaticMappingQ1::mapping, - fe, - quadrature, - update_flags) + , internal_fe_face_values( + // TODO: We should query the default mapping for the kind of cell + // represented by 'fe' and 'q': + ReferenceCell::get_default_linear_mapping( + ReferenceCell::get_hypercube(dim)), + fe, + quadrature, + update_flags) + , internal_fe_subface_values( + // TODO: We should query the default mapping for the kind of cell + // represented by 'fe' and 'q': + ReferenceCell::get_default_linear_mapping( + ReferenceCell::get_hypercube(dim)), + fe, + quadrature, + update_flags) + , internal_fe_face_values_neighbor( + // TODO: We should query the default mapping for the kind of cell + // represented by 'fe' and 'q': + ReferenceCell::get_default_linear_mapping( + ReferenceCell::get_hypercube(dim)), + fe, + quadrature, + update_flags) + , internal_fe_subface_values_neighbor( + // TODO: We should query the default mapping for the kind of cell + // represented by 'fe' and 'q': + ReferenceCell::get_default_linear_mapping( + ReferenceCell::get_hypercube(dim)), + fe, + quadrature, + update_flags) , fe_face_values(nullptr) , fe_face_values_neighbor(nullptr) {} diff --git a/include/deal.II/fe/fe_tools.templates.h b/include/deal.II/fe/fe_tools.templates.h index fe4cdfc292..137ab656e3 100644 --- a/include/deal.II/fe/fe_tools.templates.h +++ b/include/deal.II/fe/fe_tools.templates.h @@ -2265,11 +2265,14 @@ namespace FETools tr.begin_active()->set_refine_flag(RefinementCase(ref_case)); tr.execute_coarsening_and_refinement(); - FEValues fine(StaticMappingQ1::mapping, - fe, - q_fine, - update_quadrature_points | - update_JxW_values | update_values); + FEValues fine( + // TODO: We should query the default mapping for the kind of cell + // represented by 'fe' and 'q': + ReferenceCell::get_default_linear_mapping( + ReferenceCell::get_hypercube(dim)), + fe, + q_fine, + update_quadrature_points | update_JxW_values | update_values); typename Triangulation::cell_iterator coarse_cell = tr.begin(0); diff --git a/include/deal.II/grid/grid_tools.h b/include/deal.II/grid/grid_tools.h index ae933ff775..c464e21576 100644 --- a/include/deal.II/grid/grid_tools.h +++ b/include/deal.II/grid/grid_tools.h @@ -176,7 +176,8 @@ namespace GridTools double volume(const Triangulation &tria, const Mapping & mapping = - (StaticMappingQ1::mapping)); + ReferenceCell::get_default_linear_mapping( + ReferenceCell::get_hypercube(dim))); /** * Return an approximation of the diameter of the smallest active cell of a @@ -190,9 +191,11 @@ namespace GridTools */ template double - minimal_cell_diameter(const Triangulation &triangulation, - const Mapping & mapping = - (StaticMappingQ1::mapping)); + minimal_cell_diameter( + const Triangulation &triangulation, + const Mapping & mapping = + ReferenceCell::get_default_linear_mapping( + ReferenceCell::get_hypercube(dim))); /** * Return an approximation of the diameter of the largest active cell of a @@ -206,9 +209,11 @@ namespace GridTools */ template double - maximal_cell_diameter(const Triangulation &triangulation, - const Mapping & mapping = - (StaticMappingQ1::mapping)); + maximal_cell_diameter( + const Triangulation &triangulation, + const Mapping & mapping = + ReferenceCell::get_default_linear_mapping( + ReferenceCell::get_hypercube(dim))); /** * Given a list of vertices (typically obtained using @@ -1036,9 +1041,11 @@ namespace GridTools */ template std::map> - extract_used_vertices(const Triangulation &container, - const Mapping & mapping = - StaticMappingQ1::mapping); + extract_used_vertices( + const Triangulation &container, + const Mapping & mapping = + ReferenceCell::get_default_linear_mapping( + ReferenceCell::get_hypercube(dim))); /** * Find and return the index of the closest vertex to a given point in the @@ -1865,7 +1872,8 @@ namespace GridTools const typename Triangulation::active_cell_iterator &cell, const Point & position, const Mapping & mapping = - StaticMappingQ1::mapping); + ReferenceCell::get_default_linear_mapping( + ReferenceCell::get_hypercube(dim))); /** * Compute a globally unique index for each vertex and hanging node diff --git a/include/deal.II/grid/grid_tools_cache.h b/include/deal.II/grid/grid_tools_cache.h index c575240bcd..e2fbe37a48 100644 --- a/include/deal.II/grid/grid_tools_cache.h +++ b/include/deal.II/grid/grid_tools_cache.h @@ -76,7 +76,8 @@ namespace GridTools */ Cache(const Triangulation &tria, const Mapping & mapping = - StaticMappingQ1::mapping); + ReferenceCell::get_default_linear_mapping( + ReferenceCell::get_hypercube(dim))); /** * Destructor. diff --git a/include/deal.II/numerics/vector_tools_constraints.h b/include/deal.II/numerics/vector_tools_constraints.h index e1daae474e..84c6d56c7e 100644 --- a/include/deal.II/numerics/vector_tools_constraints.h +++ b/include/deal.II/numerics/vector_tools_constraints.h @@ -280,7 +280,8 @@ namespace VectorTools & function_map, AffineConstraints & constraints, const Mapping &mapping = - StaticMappingQ1::mapping); + ReferenceCell::get_default_linear_mapping( + ReferenceCell::get_hypercube(dim))); /** * This function does the same as the @@ -302,7 +303,8 @@ namespace VectorTools const std::set &boundary_ids, AffineConstraints & constraints, const Mapping & mapping = - StaticMappingQ1::mapping); + ReferenceCell::get_default_linear_mapping( + ReferenceCell::get_hypercube(dim))); /** * Compute the constraints that correspond to boundary conditions of the @@ -330,7 +332,8 @@ namespace VectorTools & function_map, AffineConstraints & constraints, const Mapping &mapping = - StaticMappingQ1::mapping); + ReferenceCell::get_default_linear_mapping( + ReferenceCell::get_hypercube(dim))); /** * Same as above for homogeneous tangential-flux constraints. @@ -348,7 +351,8 @@ namespace VectorTools const std::set &boundary_ids, AffineConstraints & constraints, const Mapping & mapping = - StaticMappingQ1::mapping); + ReferenceCell::get_default_linear_mapping( + ReferenceCell::get_hypercube(dim))); //@} } // namespace VectorTools diff --git a/include/deal.II/particles/generators.h b/include/deal.II/particles/generators.h index 700050d5f4..994ef896ed 100644 --- a/include/deal.II/particles/generators.h +++ b/include/deal.II/particles/generators.h @@ -69,7 +69,8 @@ namespace Particles const std::vector> & particle_reference_locations, ParticleHandler & particle_handler, const Mapping & mapping = - StaticMappingQ1::mapping); + ReferenceCell::get_default_linear_mapping( + ReferenceCell::get_hypercube(dim))); /** * A function that generates one particle at a random location in cell @p cell and with @@ -107,7 +108,8 @@ namespace Particles const types::particle_index id, std::mt19937 & random_number_generator, const Mapping &mapping = - StaticMappingQ1::mapping); + ReferenceCell::get_default_linear_mapping( + ReferenceCell::get_hypercube(dim))); /** * A function that generates particles randomly in the domain with a @@ -162,7 +164,8 @@ namespace Particles const types::particle_index n_particles_to_create, ParticleHandler & particle_handler, const Mapping & mapping = - StaticMappingQ1::mapping, + ReferenceCell::get_default_linear_mapping( + ReferenceCell::get_hypercube(dim)), const unsigned int random_number_seed = 5432); @@ -202,14 +205,16 @@ namespace Particles */ template void - dof_support_points(const DoFHandler &dof_handler, - const std::vector>> - & global_bounding_boxes, - ParticleHandler &particle_handler, - const Mapping & mapping = - StaticMappingQ1::mapping, - const ComponentMask &components = ComponentMask(), - const std::vector> &properties = {}); + dof_support_points( + const DoFHandler &dof_handler, + const std::vector>> + & global_bounding_boxes, + ParticleHandler &particle_handler, + const Mapping & mapping = + ReferenceCell::get_default_linear_mapping( + ReferenceCell::get_hypercube(dim)), + const ComponentMask & components = ComponentMask(), + const std::vector> &properties = {}); /** * A function that generates particles at the locations of the quadrature @@ -244,14 +249,16 @@ namespace Particles */ template void - quadrature_points(const Triangulation &triangulation, - const Quadrature & quadrature, - const std::vector>> - & global_bounding_boxes, - ParticleHandler &particle_handler, - const Mapping & mapping = - StaticMappingQ1::mapping, - const std::vector> &properties = {}); + quadrature_points( + const Triangulation &triangulation, + const Quadrature & quadrature, + const std::vector>> + & global_bounding_boxes, + ParticleHandler &particle_handler, + const Mapping & mapping = + ReferenceCell::get_default_linear_mapping( + ReferenceCell::get_hypercube(dim)), + const std::vector> &properties = {}); } // namespace Generators } // namespace Particles -- 2.39.5