17 #include <deal.II/base/memory_consumption.h> 19 #include <deal.II/hp/fe_collection.h> 21 DEAL_II_NAMESPACE_OPEN
25 template <
int dim,
int spacedim>
28 const std::set<unsigned int> &fes)
const 30 return find_dominated_fe(find_common_fes(fes, 1),
36 template <
int dim,
int spacedim>
37 std::set<unsigned int>
39 const std::set<unsigned int> &fes,
40 const unsigned int codim)
const 44 for (
const auto &fe : fes)
53 std::set<unsigned int> dominating_fes;
54 for (
unsigned int current_fe = 0; current_fe < finite_elements.size();
60 for (
const auto &other_fe : fes)
62 domination & finite_elements[current_fe]->compare_for_domination(
63 *finite_elements[other_fe], codim);
69 dominating_fes.insert(current_fe);
71 return dominating_fes;
76 template <
int dim,
int spacedim>
77 std::set<unsigned int>
79 const std::set<unsigned int> &fes,
80 const unsigned int codim)
const 84 for (
const auto &fe : fes)
93 std::set<unsigned int> dominated_fes;
94 for (
unsigned int current_fe = 0; current_fe < finite_elements.size();
100 for (
const auto &other_fe : fes)
102 domination & finite_elements[current_fe]->compare_for_domination(
103 *finite_elements[other_fe], codim);
109 dominated_fes.insert(current_fe);
111 return dominated_fes;
116 template <
int dim,
int spacedim>
119 const std::set<unsigned int> &fes,
120 const unsigned int codim)
const 124 for (
const auto &fe : fes)
138 for (
const auto ¤t_fe : fes)
143 for (
const auto &other_fe : fes)
144 if (current_fe != other_fe)
146 domination & finite_elements[current_fe]->compare_for_domination(
147 *finite_elements[other_fe], codim);
162 template <
int dim,
int spacedim>
165 const std::set<unsigned int> &fes,
166 const unsigned int codim)
const 170 for (
const auto &fe : fes)
184 for (
const auto ¤t_fe : fes)
189 for (
const auto &other_fe : fes)
190 if (current_fe != other_fe)
192 domination & finite_elements[current_fe]->compare_for_domination(
193 *finite_elements[other_fe], codim);
208 template <
int dim,
int spacedim>
211 const std::set<unsigned int> &fes,
212 const unsigned int codim)
const 214 unsigned int fe_index = find_dominating_fe(fes, codim);
218 const std::set<unsigned int> dominating_fes =
219 find_common_fes(fes, codim);
220 fe_index = find_dominated_fe(dominating_fes, codim);
228 template <
int dim,
int spacedim>
231 const std::set<unsigned int> &fes,
232 const unsigned int codim)
const 234 unsigned int fe_index = find_dominated_fe(fes, codim);
238 const std::set<unsigned int> dominated_fes =
239 find_enclosing_fes(fes, codim);
240 fe_index = find_dominating_fe(dominated_fes, codim);
248 template <
int dim,
int spacedim>
251 set_default_hierarchy();
256 template <
int dim,
int spacedim>
266 template <
int dim,
int spacedim>
272 ExcMessage(
"Need to pass at least one finite element."));
274 for (
unsigned int i = 0; i < fes.size(); ++i)
280 template <
int dim,
int spacedim>
290 if (finite_elements.size() != 0)
292 ExcMessage(
"All elements inside a collection need to have the " 293 "same number of vector components!"));
295 finite_elements.push_back(new_fe.
clone());
300 template <
int dim,
int spacedim>
305 const unsigned int)> &next,
308 const unsigned int)> &prev)
311 hierarchy_next = next;
312 hierarchy_prev = prev;
317 template <
int dim,
int spacedim>
322 set_hierarchy(&DefaultHierarchy::next_index,
323 &DefaultHierarchy::previous_index);
328 template <
int dim,
int spacedim>
331 const unsigned int fe_index)
const 335 const unsigned int new_fe_index = hierarchy_next(*
this, fe_index);
343 template <
int dim,
int spacedim>
346 const unsigned int fe_index)
const 350 const unsigned int new_fe_index = hierarchy_prev(*
this, fe_index);
358 template <
int dim,
int spacedim>
364 ExcMessage(
"This collection contains no finite element."));
371 for (
unsigned int c = 1; c < size(); ++c)
378 template <
int dim,
int spacedim>
384 ExcMessage(
"This collection contains no finite element."));
391 for (
unsigned int c = 1; c < size(); ++c)
398 template <
int dim,
int spacedim>
404 ExcMessage(
"This collection contains no finite element."));
411 for (
unsigned int c = 1; c < size(); ++c)
418 template <
int dim,
int spacedim>
423 ExcMessage(
"This collection contains no finite element."));
430 for (
unsigned int c = 1; c < size(); ++c)
432 ExcMessage(
"Not all elements of this collection agree on what " 433 "the appropriate mask should be."));
439 template <
int dim,
int spacedim>
445 ExcMessage(
"This collection contains no finite element."));
452 for (
unsigned int c = 1; c < size(); ++c)
454 ExcMessage(
"Not all elements of this collection agree on what " 455 "the appropriate mask should be."));
461 template <
int dim,
int spacedim>
467 ExcMessage(
"This collection contains no finite element."));
474 for (
unsigned int c = 1; c < size(); ++c)
476 ExcMessage(
"Not all elements of this collection agree on what " 477 "the appropriate mask should be."));
483 template <
int dim,
int spacedim>
489 ExcMessage(
"This collection contains no finite element."));
496 for (
unsigned int c = 1; c < size(); ++c)
498 ExcMessage(
"Not all elements of this collection agree on what " 499 "the appropriate mask should be."));
506 template <
int dim,
int spacedim>
512 ExcMessage(
"This collection contains no finite element."));
519 for (
unsigned int c = 1; c < size(); ++c)
521 ExcMessage(
"Not all elements of this collection agree on what " 522 "the appropriate mask should be."));
529 template <
int dim,
int spacedim>
533 Assert(finite_elements.size() > 0, ExcNoFiniteElements());
535 const unsigned int nb = finite_elements[0]->n_blocks();
536 for (
unsigned int i = 1; i < finite_elements.size(); ++i)
537 Assert(finite_elements[i]->n_blocks() == nb,
538 ExcMessage(
"Not all finite elements in this collection have " 539 "the same number of components."));
546 template <
int dim,
int spacedim>
552 for (
unsigned int i = 0; i < finite_elements.size(); ++i)
553 mem += finite_elements[i]->memory_consumption();
562 #include "fe_collection.inst" 565 DEAL_II_NAMESPACE_CLOSE
unsigned int find_dominated_fe_extended(const std::set< unsigned int > &fes, const unsigned int codim=0) const
static const unsigned int invalid_unsigned_int
unsigned int find_least_face_dominating_fe(const std::set< unsigned int > &fes) const
unsigned int find_dominating_fe(const std::set< unsigned int > &fes, const unsigned int codim=0) const
std::vector< bool > component_mask
#define AssertIndexRange(index, range)
virtual std::unique_ptr< FiniteElement< dim, spacedim > > clone() const =0
static ::ExceptionBase & ExcIndexRange(int arg1, int arg2, int arg3)
unsigned int find_dominating_fe_extended(const std::set< unsigned int > &fes, const unsigned int codim=0) const
static ::ExceptionBase & ExcMessage(std::string arg1)
static ::ExceptionBase & ExcImpossibleInDim(int arg1)
#define Assert(cond, exc)
std::vector< bool > block_mask
unsigned int n_components() const
std::set< unsigned int > find_common_fes(const std::set< unsigned int > &fes, const unsigned int codim=0) const
std::set< unsigned int > find_enclosing_fes(const std::set< unsigned int > &fes, const unsigned int codim=0) const
unsigned int find_dominated_fe(const std::set< unsigned int > &fes, const unsigned int codim=0) const
std::enable_if< std::is_fundamental< T >::value, std::size_t >::type memory_consumption(const T &t)
static ::ExceptionBase & ExcInternalError()