From 62ec0cd137cdb4c79ab14172d7a3a88b73158156 Mon Sep 17 00:00:00 2001 From: Timo Heister Date: Mon, 25 Jan 2021 11:44:44 -0500 Subject: [PATCH] address comments --- include/deal.II/fe/mapping.h | 3 +-- include/deal.II/fe/mapping_fe.h | 10 ---------- source/fe/mapping_cartesian.cc | 15 ++++++++------- source/fe/mapping_fe.cc | 19 +++++++++++++++++++ source/fe/mapping_fe_field.cc | 12 ++++++++++-- 5 files changed, 38 insertions(+), 21 deletions(-) diff --git a/include/deal.II/fe/mapping.h b/include/deal.II/fe/mapping.h index ede2ebe400..7f8db1c26b 100644 --- a/include/deal.II/fe/mapping.h +++ b/include/deal.II/fe/mapping.h @@ -402,9 +402,8 @@ public: preserves_vertex_locations() const = 0; /** - * Returns is this instance of Mapping is compatible with the type of cell + * Returns if this instance of Mapping is compatible with the type of cell * in @p cell_type. - * */ virtual bool is_compatible_with(const ReferenceCell::Type &cell_type) const = 0; diff --git a/include/deal.II/fe/mapping_fe.h b/include/deal.II/fe/mapping_fe.h index 0e0bb66592..15d90cfa64 100644 --- a/include/deal.II/fe/mapping_fe.h +++ b/include/deal.II/fe/mapping_fe.h @@ -608,16 +608,6 @@ MappingFE::preserves_vertex_locations() const } -template -bool -MappingFE::is_compatible_with( - const ReferenceCell::Type &cell_type) const -{ - if (cell_type.get_dimension() != dim) - return false; // TODO: or is this an error? - - return true; -} #endif // DOXYGEN diff --git a/source/fe/mapping_cartesian.cc b/source/fe/mapping_cartesian.cc index 1a138613d1..e445960cc4 100644 --- a/source/fe/mapping_cartesian.cc +++ b/source/fe/mapping_cartesian.cc @@ -75,13 +75,14 @@ bool MappingCartesian::is_compatible_with( const ReferenceCell::Type &cell_type) const { - if (cell_type.get_dimension() != dim) - return false; // TODO: or is this an error? - - if (cell_type.is_hyper_cube()) - return true; - - return false; + Assert(dim == cell_type.get_dimension(), + ExcMessage("The dimension of your mapping (" + + Utilities::to_string(dim) + + ") and the reference cell cell_type (" + + Utilities::to_string(cell_type.get_dimension()) + + " ) do not agree.")); + + return cell_type.is_hyper_cube(); } diff --git a/source/fe/mapping_fe.cc b/source/fe/mapping_fe.cc index 3b8415b4d8..b84cad10f3 100644 --- a/source/fe/mapping_fe.cc +++ b/source/fe/mapping_fe.cc @@ -2309,6 +2309,25 @@ MappingFE::get_bounding_box( +template +bool +MappingFE::is_compatible_with( + const ReferenceCell::Type &cell_type) const +{ + Assert(dim == cell_type.get_dimension(), + ExcMessage("The dimension of your mapping (" + + Utilities::to_string(dim) + + ") and the reference cell cell_type (" + + Utilities::to_string(cell_type.get_dimension()) + + " ) do not agree.")); + + // TODO: query fe->reference_cell() to compare once is exists. + + return true; +} + + + //--------------------------- Explicit instantiations ----------------------- #include "mapping_fe.inst" diff --git a/source/fe/mapping_fe_field.cc b/source/fe/mapping_fe_field.cc index c9815c61b3..9d1d800389 100644 --- a/source/fe/mapping_fe_field.cc +++ b/source/fe/mapping_fe_field.cc @@ -347,8 +347,16 @@ bool MappingFEField::is_compatible_with( const ReferenceCell::Type &cell_type) const { - if (cell_type.get_dimension() != dim) - return false; // TODO: or is this an error? + Assert(dim == cell_type.get_dimension(), + ExcMessage("The dimension of your mapping (" + + Utilities::to_string(dim) + + ") and the reference cell cell_type (" + + Utilities::to_string(cell_type.get_dimension()) + + " ) do not agree.")); + + + // TODO: check euler_dof_handler->get_fe() + return true; } -- 2.39.5