From 48939b44a216b9c9be252fd5db5fbd6dc9581bc7 Mon Sep 17 00:00:00 2001 From: Denis Davydov Date: Wed, 2 Sep 2015 13:33:29 +0200 Subject: [PATCH] fix find_least_face_dominating_fe() for self-domination --- include/deal.II/hp/fe_collection.h | 11 ++++++----- source/hp/fe_collection.cc | 5 +++-- tests/hp/fe_collection_05.cc | 11 +++++++++++ tests/hp/fe_collection_05.output | 2 ++ 4 files changed, 22 insertions(+), 7 deletions(-) diff --git a/include/deal.II/hp/fe_collection.h b/include/deal.II/hp/fe_collection.h index 8433cb308e..0684aead53 100644 --- a/include/deal.II/hp/fe_collection.h +++ b/include/deal.II/hp/fe_collection.h @@ -195,6 +195,11 @@ namespace hp * answer is Q3 and therefore this function will return its index in * FECollection, namely 2. * + * For the purpose of this function by domination we consider either + * this_element_dominate or either_element_can_dominate ; therefore the + * element can dominate itself. Thus if FECollection contains {Q1,Q2,Q4,Q3} + * and @p fes = {3}, the function returns 3. + * * If we were not able to find a finite element, the function returns * numbers::invalid_unsigned_int . * @@ -203,11 +208,7 @@ namespace hp * will not find the most dominating element as the default behavior of * FE_Nothing is to return FiniteElementDomination::no_requirements when * comparing for face domination. This, therefore, can't be considered as a - * dominating element in the sense defined in FiniteElementDomination . - * - * Finally, for the purpose of this function we consider that an element - * dominates itself. Thus if FECollection contains {Q1,Q2,Q4,Q3} and @p fes - * = {3}, the function returns 3. + * dominating element in the sense described above . */ unsigned int find_least_face_dominating_fe (const std::set &fes) const; diff --git a/source/hp/fe_collection.cc b/source/hp/fe_collection.cc index b4161d04eb..0e52842212 100644 --- a/source/hp/fe_collection.cc +++ b/source/hp/fe_collection.cc @@ -40,7 +40,7 @@ namespace hp const hp::FECollection &fe_collection = *this; std::set candidate_fes; - // first loop over all FEs and check which can dominate those given in FEs: + // first loop over all FEs and check which can dominate those given in @p fes: for (unsigned int cur_fe = 0; cur_fe < fe_collection.size(); cur_fe++) { FiniteElementDomination::Domination domination = FiniteElementDomination::no_requirements; @@ -56,7 +56,8 @@ namespace hp } // if we found dominating element, keep them in a set. - if (domination == FiniteElementDomination::this_element_dominates) + if (domination == FiniteElementDomination::this_element_dominates || + domination == FiniteElementDomination::either_element_can_dominate /*covers cases like {Q2,Q3,Q1,Q1} with fes={2,3}*/) candidate_fes.insert(cur_fe); } diff --git a/tests/hp/fe_collection_05.cc b/tests/hp/fe_collection_05.cc index 885a5df921..eff18fc58b 100644 --- a/tests/hp/fe_collection_05.cc +++ b/tests/hp/fe_collection_05.cc @@ -24,6 +24,7 @@ // {Q1xQ1,Q1xQ1,Q2xQ1,Q1,Q2} with {2,3} => Q1 0 // {Q4xQ4, Q5xQ5, Q3xQ4, Q4xQ3} with {2,3} => none invalid_unsigned_int // {Q1,Q2,Q4,Q3} with {3} => Q3 3 +// {Q3,Q4,Q1,Q1} with {2,3} => Q1 2 // self-domination #include "../tests.h" @@ -160,6 +161,16 @@ void test () deallog << fe_collection.find_least_face_dominating_fe(fes) << std::endl; } + { + hp::FECollection fe_collection; + fe_collection.push_back (FE_Q(3)); + fe_collection.push_back (FE_Q(4)); + fe_collection.push_back (FE_Q(1)); + fe_collection.push_back (FE_Q(1)); + deallog << fe_collection.find_least_face_dominating_fe(fes) << std::endl; + } + + } diff --git a/tests/hp/fe_collection_05.output b/tests/hp/fe_collection_05.output index 66c6056a96..e333ddf30c 100644 --- a/tests/hp/fe_collection_05.output +++ b/tests/hp/fe_collection_05.output @@ -8,6 +8,7 @@ DEAL::0 DEAL::numbers::invalid_unsigned_int DEAL::3 DEAL::2 +DEAL::2 DEAL::1 DEAL::0 DEAL::numbers::invalid_unsigned_int @@ -15,4 +16,5 @@ DEAL::0 DEAL::0 DEAL::numbers::invalid_unsigned_int DEAL::3 +DEAL::2 DEAL::OK -- 2.39.5