From b626b5258044bf8e60c26d7d8c303485b7d7cf9e Mon Sep 17 00:00:00 2001 From: Peter Munch Date: Mon, 24 Apr 2023 20:58:36 +0200 Subject: [PATCH] Remove assert --- source/fe/fe_hermite.cc | 101 +++++++++++++++++++--------------------- 1 file changed, 47 insertions(+), 54 deletions(-) diff --git a/source/fe/fe_hermite.cc b/source/fe/fe_hermite.cc index 858783dd0a..0d414c01ce 100644 --- a/source/fe/fe_hermite.cc +++ b/source/fe/fe_hermite.cc @@ -20,17 +20,17 @@ #include -#include #include +#include +#include #include #include #include #include #include -#include -#include #include #include +#include #include #include @@ -568,24 +568,24 @@ FE_Hermite::clone() const /** - * A large part of the following function is copied from FE_Q_Base, the main + * A large part of the following function is copied from FE_Q_Base, the main * difference is that some additional constraints are needed between two - * Hermite finite elements + * Hermite finite elements */ template std::vector> FE_Hermite::hp_vertex_dof_identities( const FiniteElement &fe_other) const { - /*if (const FE_Hermite *fe_herm_other = + /*if (const FE_Hermite *fe_herm_other = dynamic_cast *>(&fe_other)) { // In this case there will be several DoFs that need to be matched between // the elements to ensure continuity. The number of DoFs to be matched is // dependent on the polynomial degree of the lower order element, and dim // - // Note: is this using hierarchical or lexicographic numbering at the vertices? - if (this->degree < fe_herm_other->degree) + // Note: is this using hierarchical or lexicographic numbering at the + vertices? if (this->degree < fe_herm_other->degree) { std::vector> dof_matches; dof_matches.reserve(this->n_dofs_per_vertex()); @@ -597,7 +597,8 @@ FE_Hermite::hp_vertex_dof_identities( } } - else */if (dynamic_cast *>(&fe_other) != nullptr) + else */ + if (dynamic_cast *>(&fe_other) != nullptr) { // there should be exactly one single DoF of FE_Q_Base at a vertex, and it // should have an identical value to the first Hermite DoF @@ -700,23 +701,23 @@ FE_Hermite::hp_quad_dof_identities( /* -* The layout of this function is largely copied directly from FE_Q, -* however FE_Hermite can behave significantly differently in terms -* of domination due to how the function space is defined */ + * The layout of this function is largely copied directly from FE_Q, + * however FE_Hermite can behave significantly differently in terms + * of domination due to how the function space is defined */ template FiniteElementDomination::Domination FE_Hermite::compare_for_domination( - const FiniteElement& fe_other, + const FiniteElement &fe_other, const unsigned int codim) const - { - Assert(codim <= dim, ExcImpossibleInDim(dim)); +{ + Assert(codim <= dim, ExcImpossibleInDim(dim)); + + if (codim > 0) + if (dynamic_cast *>(&fe_other) != nullptr) + // there are no requirements between continuous and discontinuous elements + return FiniteElementDomination::no_requirements; - if (codim > 0) - if (dynamic_cast *>(&fe_other) != nullptr) - // there are no requirements between continuous and discontinuous elements - return FiniteElementDomination::no_requirements; - // vertex/line/face domination // (if fe_other is not derived from FE_DGQ) // & cell domination @@ -735,12 +736,12 @@ FE_Hermite::compare_for_domination( dynamic_cast *>(&fe_other)) { if (fe_q_other->degree == 1) - { - if (this->degree == 1) - return FiniteElementDomination::either_element_can_dominate; - else - return FiniteElementDomination::other_element_dominates; - } + { + if (this->degree == 1) + return FiniteElementDomination::either_element_can_dominate; + else + return FiniteElementDomination::other_element_dominates; + } else if (this->degree <= fe_q_other->degree) return FiniteElementDomination::this_element_dominates; else @@ -750,12 +751,12 @@ FE_Hermite::compare_for_domination( dynamic_cast *>(&fe_other)) { if (fe_p_other->degree == 1) - { - if (this->degree == 1) - return FiniteElementDomination::either_element_can_dominate; - else - return FiniteElementDomination::other_element_dominates; - } + { + if (this->degree == 1) + return FiniteElementDomination::either_element_can_dominate; + else + return FiniteElementDomination::other_element_dominates; + } else if (this->degree <= fe_p_other->degree) return FiniteElementDomination::this_element_dominates; else @@ -765,12 +766,12 @@ FE_Hermite::compare_for_domination( dynamic_cast *>(&fe_other)) { if (fe_wp_other->degree == 1) - { - if (this->degree == 1) - return FiniteElementDomination::either_element_can_dominate; - else - return FiniteElementDomination::other_element_dominates; - } + { + if (this->degree == 1) + return FiniteElementDomination::either_element_can_dominate; + else + return FiniteElementDomination::other_element_dominates; + } else if (this->degree <= fe_wp_other->degree) return FiniteElementDomination::this_element_dominates; else @@ -780,12 +781,12 @@ FE_Hermite::compare_for_domination( dynamic_cast *>(&fe_other)) { if (fe_pp_other->degree == 1) - { - if (this->degree == 1) - return FiniteElementDomination::either_element_can_dominate; - else - return FiniteElementDomination::other_element_dominates; - } + { + if (this->degree == 1) + return FiniteElementDomination::either_element_can_dominate; + else + return FiniteElementDomination::other_element_dominates; + } else if (this->degree <= fe_pp_other->degree) return FiniteElementDomination::this_element_dominates; else @@ -802,10 +803,10 @@ FE_Hermite::compare_for_domination( // interface return FiniteElementDomination::no_requirements; } - + Assert(false, ExcNotImplemented()); return FiniteElementDomination::neither_element_dominates; - } +} @@ -845,14 +846,6 @@ FE_Hermite::fill_fe_values( static_cast::InternalData &>( fe_internal); - Assert( - ((dynamic_cast::InternalData *>( - &mapping_internal) != nullptr) || - (dynamic_cast::InternalData *>( - &mapping_internal) != nullptr)), - ExcInternalError()); - - const UpdateFlags flags(fe_data.update_each); // Transform values gradients and higher derivatives. Values also need to -- 2.39.5