--- /dev/null
+Changed: The function previously called
+FECollection::find_least_face_dominating_fe()
+is now named
+FECollection::find_least_face_dominating_fe_in_collection().
+<br>
+(Marc Fehling, 2018/10/08)
* a refined cell inherit the `active_fe_index` from their parent. If
* cells get coarsened into one, the latter will get the least dominating
* `active_fe_index` amongst its children, as determined by the function
- * hp::FECollection::find_least_face_dominating_fe().
+ * hp::FECollection::find_least_face_dominating_fe_in_collection().
*
* @note If you use more than one object to attach data to a
* parallel::distributed::Triangulation at the same time (e.g. a
* unpacked later with the same index on its children. If cells get
* coarsened into one, data will be packed on the latter with the least
* dominating `active_fe_index` amongst its children, as determined by the
- * function hp::FECollection::find_least_face_dominating_fe(), and unpacked
- * later on the same cell with the same index.
+ * function hp::FECollection::find_least_face_dominating_fe_in_collection(),
+ * and unpacked on the same cell with the same index.
*
* Code snippets to demonstrate the usage of the
* parallel::distributed::SolutionTransfer class with hp::DoFHandler
*
* If the function is not able to find a finite element that satisfies
* the description above, the function
- * returns numbers::invalid_unsigned_int . An example would go like this:
+ * returns numbers::invalid_unsigned_int. An example would go like this:
* If the FECollection consists of `{FE_Nothing
* x FE_Nothing, FE_Q(1)xFE_Q(2), FE_Q(2)xFE_Q(1)}` with @p fes as `{1}`,
* the function will not find a most dominating element as the default
* numbers::invalid_unsigned_int.
*/
unsigned int
+ find_least_face_dominating_fe_in_collection(
+ const std::set<unsigned int> &fes) const;
+
+ /**
+ * @copydoc FECollection::find_least_face_dominating_fe_in_collection()
+ *
+ * @deprecated This function has been renamed. Use
+ * hp::FECollection::find_least_face_dominating_fe_in_collection() instead.
+ */
+ DEAL_II_DEPRECATED unsigned int
find_least_face_dominating_fe(const std::set<unsigned int> &fes) const;
/**
fe_indices_children.insert(child->active_fe_index());
}
- fe_index = dof_handler->get_fe().find_least_face_dominating_fe(
- fe_indices_children);
+ fe_index = dof_handler->get_fe()
+ .find_least_face_dominating_fe_in_collection(
+ fe_indices_children);
Assert(fe_index != numbers::invalid_unsigned_int,
ExcMessage(
fe_indices_children.insert(
cell->child(child_index)->active_fe_index());
- fe_index = dof_handler->get_fe().find_least_face_dominating_fe(
- fe_indices_children);
+ fe_index = dof_handler->get_fe()
+ .find_least_face_dominating_fe_in_collection(
+ fe_indices_children);
Assert(fe_index != numbers::invalid_unsigned_int,
ExcMessage(
fe_indices_children.insert(
cell->child(child_index)->active_fe_index());
- fe_index =
- dof_handler->get_fe_collection()
- .find_least_face_dominating_fe(fe_indices_children);
+ fe_index = dof_handler->get_fe_collection()
+ .find_least_face_dominating_fe_in_collection(
+ fe_indices_children);
Assert(
fe_index != numbers::invalid_unsigned_int,
// 2) there is no dominating FE among sub faces (e.g.
// Q1xQ2 vs Q2xQ1), but subfaces still dominate mother
// face (e.g. Q2xQ2). To cover this case we would have
- // to use find_least_face_dominating_fe() of
- // FECollection with fe_indices of sub faces. 3)
+ // to use find_least_face_dominating_fe_in_collection()
+ // of FECollection with fe_indices of sub faces. 3)
// Finally, it could happen that we got here because
// neither_element_dominates (e.g. Q1xQ1xQ2 and Q1xQ2xQ1
// for subfaces and Q2xQ1xQ1 for mother face). This
- // requires usage of find_least_face_dominating_fe()
- // with fe_indices of sub-faces and the mother face.
+ // requires usage of
+ // find_least_face_dominating_fe_in_collection() with
+ // fe_indices of sub-faces and the mother face.
// Note that the last solution covers the first two
// scenarios, thus we stick with it assuming that we
// won't lose much time/efficiency.
const unsigned int dominating_fe_index =
- fe_collection.find_least_face_dominating_fe(
- fe_ind_face_subface);
+ fe_collection
+ .find_least_face_dominating_fe_in_collection(
+ fe_ind_face_subface);
AssertThrow(
dominating_fe_index != numbers::invalid_unsigned_int,
ExcMessage(
const dealii::hp::FECollection<dim, spacedim>
&fe_collection = dof_handler.get_fe_collection();
const unsigned int dominating_fe_index =
- fe_collection.find_least_face_dominating_fe(fes);
+ fe_collection
+ .find_least_face_dominating_fe_in_collection(
+ fes);
AssertThrow(
dominating_fe_index !=
* Each time we build constraints at the
* interface between two different FE_Enriched, we look for the least
* dominating FE via
- * hp::FECollection< dim, spacedim >::find_least_face_dominating_fe().
- * If we don't take further actions, we may find a dominating FE that
- * is too restrictive, i.e. enriched FE consisting of only FE_Nothing.
- * New elements needs to be added to FECollection object to help
- * find the correct enriched FE underlying the spaces in the
- * adjacent cells. This is done by creating an appropriate
- * set in fe_sets and a call to the function
+ * hp::FECollection< dim, spacedim
+ * >::find_least_face_dominating_fe_in_collection(). If we don't take
+ * further actions, we may find a dominating FE that is too restrictive,
+ * i.e. enriched FE consisting of only FE_Nothing. New elements needs to
+ * be added to FECollection object to help find the correct enriched FE
+ * underlying the spaces in the adjacent cells. This is done by creating
+ * an appropriate set in fe_sets and a call to the function
* make_fe_collection_from_colored_enrichments at a later stage.
*
* Consider a domain with three predicates and hence with three different
* on adjacent cells, an enriched FE [0 0 1] should exist and is
* found as the least dominating finite element for the two cells by
* DoFTools::make_hanging_node_constraints using a call to the function
- * hp::FECollection::find_least_face_dominating_fe.
+ * hp::FECollection::find_least_face_dominating_fe_in_collection.
* Denoting the fe set in adjacent cells as {1,3} and {2,3}, this
* implies that an fe set {3} needs to be added! Based on the
* predicate configuration, this may not be automatically done without
{
template <int dim, int spacedim>
unsigned int
- FECollection<dim, spacedim>::find_least_face_dominating_fe(
+ FECollection<dim, spacedim>::find_least_face_dominating_fe_in_collection(
const std::set<unsigned int> &fes) const
{
+ for (auto it = fes.cbegin(); it != fes.cend(); ++it)
+ AssertIndexRange(*it, finite_elements.size());
+
// If the set of elements to be dominated contains only a single element X,
// then by definition the dominating set contains this single element X
// (because each element can dominate itself). There may also be others,
if (fes.size() == 1)
return *fes.begin();
- const hp::FECollection<dim, spacedim> &fe_collection = *this;
- std::set<unsigned int> candidate_fes;
+ std::set<unsigned int> candidate_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++)
+ for (unsigned int cur_fe = 0; cur_fe < finite_elements.size(); ++cur_fe)
{
FiniteElementDomination::Domination domination =
FiniteElementDomination::no_requirements;
// check if cur_fe can dominate all FEs in @p fes:
- for (std::set<unsigned int>::const_iterator it = fes.begin();
- it != fes.end();
- ++it)
- {
- Assert(*it < fe_collection.size(),
- ExcIndexRangeType<unsigned int>(*it,
- 0,
- fe_collection.size()));
- domination =
- domination & fe_collection[cur_fe].compare_for_face_domination(
- fe_collection[*it]);
- }
+ for (const auto &other_fe : fes)
+ domination =
+ domination & finite_elements[cur_fe]->compare_for_face_domination(
+ *finite_elements[other_fe]);
// if we found dominating element, keep them in a set.
if (
return *candidate_fes.begin();
}
else
- for (std::set<unsigned int>::const_iterator it = candidate_fes.begin();
- it != candidate_fes.end();
- ++it)
+ for (const auto ¤t_fe : candidate_fes)
{
FiniteElementDomination::Domination domination =
FiniteElementDomination::no_requirements;
- for (std::set<unsigned int>::const_iterator ito =
- candidate_fes.begin();
- ito != candidate_fes.end();
- ++ito)
- if (it != ito)
- {
- domination =
- domination & fe_collection[*it].compare_for_face_domination(
- fe_collection[*ito]);
- }
-
- if (
- domination == FiniteElementDomination::other_element_dominates ||
- domination == FiniteElementDomination::either_element_can_dominate /*covers cases like candidate_fes={Q1,Q1}*/)
- return *it;
+
+ for (const auto &other_fe : candidate_fes)
+ if (current_fe != other_fe)
+ domination =
+ domination &
+ finite_elements[current_fe]->compare_for_face_domination(
+ *finite_elements[other_fe]);
+
+ if ((domination ==
+ FiniteElementDomination::other_element_dominates) ||
+ (domination ==
+ FiniteElementDomination::either_element_can_dominate
+ /*covers cases like candidate_fes={Q1,Q1}*/))
+ return current_fe;
}
// We couldn't find the FE, return invalid_unsigned_int :
return numbers::invalid_unsigned_int;
+ template <int dim, int spacedim>
+ unsigned int
+ FECollection<dim, spacedim>::find_least_face_dominating_fe(
+ const std::set<unsigned int> &fes) const
+ {
+ return find_least_face_dominating_fe_in_collection(fes);
+ }
+
+
+
template <int dim, int spacedim>
FECollection<dim, spacedim>::FECollection(
const FiniteElement<dim, spacedim> &fe)
}
deallog << "Dominating set for 1 and 2: "
- << fe_collection.find_least_face_dominating_fe({1, 2}) << std::endl;
+ << fe_collection.find_least_face_dominating_fe_in_collection({1, 2})
+ << std::endl;
dof_handler.distribute_dofs(fe_collection);
/* clang-format off */
-// test the results of FECollection::find_least_face_dominating_fe(), namely for:
+// test the results of FECollection::find_least_face_dominating_fe_in_collection(), namely for:
// {Q1, Q2, Q3, Q4} with {2,3} => Q3 2
// {Q1xQ1, Q2xQ2, Q3xQ4, Q4xQ3} with {2,3} => Q2xQ2 1
// {Q1xQ1, Q3xQ4, Q4xQ3} with {1,2} => Q1xQ1 0
fe_collection.push_back(FE_Q<dim>(2));
fe_collection.push_back(FE_Q<dim>(3));
fe_collection.push_back(FE_Q<dim>(4));
- deallog << fe_collection.find_least_face_dominating_fe(fes) << std::endl;
+ deallog << fe_collection.find_least_face_dominating_fe_in_collection(fes)
+ << std::endl;
}
// {Q1xQ1, Q2xQ2, Q3xQ4, Q4xQ3}
fe_collection.push_back(FESystem<dim>(FE_Q<dim>(2), 1, FE_Q<dim>(2), 1));
fe_collection.push_back(FESystem<dim>(FE_Q<dim>(3), 1, FE_Q<dim>(4), 1));
fe_collection.push_back(FESystem<dim>(FE_Q<dim>(4), 1, FE_Q<dim>(3), 1));
- deallog << fe_collection.find_least_face_dominating_fe(fes) << std::endl;
+ deallog << fe_collection.find_least_face_dominating_fe_in_collection(fes)
+ << std::endl;
}
// {Q1xQ1, Q3xQ4, Q4xQ3}
std::set<unsigned int> fes;
fes.insert(1);
fes.insert(2);
- deallog << fe_collection.find_least_face_dominating_fe(fes) << std::endl;
+ deallog << fe_collection.find_least_face_dominating_fe_in_collection(fes)
+ << std::endl;
}
// {0x0, 0x0, Q1x0, 0xQ1}
FESystem<dim>(FE_Q<dim>(1), 1, FE_Nothing<dim>(), 1));
fe_collection.push_back(
FESystem<dim>(FE_Nothing<dim>(), 1, FE_Q<dim>(1), 1));
- const unsigned int ind = fe_collection.find_least_face_dominating_fe(fes);
+ const unsigned int ind =
+ fe_collection.find_least_face_dominating_fe_in_collection(fes);
if (ind == numbers::invalid_unsigned_int)
deallog << "numbers::invalid_unsigned_int" << std::endl;
else
FESystem<dim>(FE_Q<dim>(1), 1, FE_Nothing<dim>(1, true), 1));
fe_collection.push_back(
FESystem<dim>(FE_Nothing<dim>(1, true), 1, FE_Q<dim>(1), 1));
- deallog << fe_collection.find_least_face_dominating_fe(fes) << std::endl;
+ deallog << fe_collection.find_least_face_dominating_fe_in_collection(fes)
+ << std::endl;
}
fe_collection.push_back(FESystem<dim>(FE_Q<dim>(1), 1, FE_Q<dim>(1), 1));
fe_collection.push_back(FESystem<dim>(FE_Q<dim>(2), 1, FE_Q<dim>(1), 1));
fe_collection.push_back(FESystem<dim>(FE_Q<dim>(1), 1, FE_Q<dim>(2), 1));
- deallog << fe_collection.find_least_face_dominating_fe(fes) << std::endl;
+ deallog << fe_collection.find_least_face_dominating_fe_in_collection(fes)
+ << std::endl;
}
// {Q4xQ4, Q5xQ5, Q3xQ4, Q4xQ3}
fe_collection.push_back(FESystem<dim>(FE_Q<dim>(5), 1, FE_Q<dim>(5), 1));
fe_collection.push_back(FESystem<dim>(FE_Q<dim>(3), 1, FE_Q<dim>(4), 1));
fe_collection.push_back(FESystem<dim>(FE_Q<dim>(4), 1, FE_Q<dim>(3), 1));
- const unsigned int ind = fe_collection.find_least_face_dominating_fe(fes);
+ const unsigned int ind =
+ fe_collection.find_least_face_dominating_fe_in_collection(fes);
if (ind == numbers::invalid_unsigned_int)
deallog << "numbers::invalid_unsigned_int" << std::endl;
else
fe_collection.push_back(FE_Q<dim>(3));
std::set<unsigned int> fes;
fes.insert(3);
- deallog << fe_collection.find_least_face_dominating_fe(fes) << std::endl;
+ deallog << fe_collection.find_least_face_dominating_fe_in_collection(fes)
+ << std::endl;
}
// {Q3, Q4, Q1, Q1}
fe_collection.push_back(FE_Q<dim>(4));
fe_collection.push_back(FE_Q<dim>(1));
fe_collection.push_back(FE_Q<dim>(1));
- deallog << fe_collection.find_least_face_dominating_fe(fes) << std::endl;
+ deallog << fe_collection.find_least_face_dominating_fe_in_collection(fes)
+ << std::endl;
}
}