25 template <
int dim,
int spacedim>
26 std::set<unsigned int>
28 const std::set<unsigned int> &fes,
29 const unsigned int codim)
const
35 for (
const auto &fe : fes)
42 std::set<unsigned int> dominating_fes;
43 for (
unsigned int current_fe = 0; current_fe < this->size(); ++current_fe)
48 for (
const auto &other_fe : fes)
51 this->operator[](current_fe)
52 .compare_for_domination(this->
operator[](other_fe), codim);
58 dominating_fes.insert(current_fe);
60 return dominating_fes;
65 template <
int dim,
int spacedim>
66 std::set<unsigned int>
68 const std::set<unsigned int> &fes,
69 const unsigned int codim)
const
75 for (
const auto &fe : fes)
82 std::set<unsigned int> dominated_fes;
83 for (
unsigned int current_fe = 0; current_fe < this->size(); ++current_fe)
88 for (
const auto &other_fe : fes)
91 this->operator[](current_fe)
92 .compare_for_domination(this->
operator[](other_fe), codim);
98 dominated_fes.insert(current_fe);
100 return dominated_fes;
105 template <
int dim,
int spacedim>
108 const std::set<unsigned int> &fes,
109 const unsigned int codim)
const
120 for (
const auto &fe : fes)
127 for (
const auto ¤t_fe : fes)
132 for (
const auto &other_fe : fes)
133 if (current_fe != other_fe)
136 this->operator[](current_fe)
137 .compare_for_domination(this->
operator[](other_fe), codim);
152 template <
int dim,
int spacedim>
155 const std::set<unsigned int> &fes,
156 const unsigned int codim)
const
167 for (
const auto &fe : fes)
174 for (
const auto ¤t_fe : fes)
179 for (
const auto &other_fe : fes)
180 if (current_fe != other_fe)
183 this->operator[](current_fe)
184 .compare_for_domination(this->
operator[](other_fe), codim);
199 template <
int dim,
int spacedim>
202 const std::set<unsigned int> &fes,
203 const unsigned int codim)
const
205 unsigned int fe_index = find_dominating_fe(fes, codim);
209 const std::set<unsigned int> dominating_fes =
210 find_common_fes(fes, codim);
211 fe_index = find_dominated_fe(dominating_fes, codim);
219 template <
int dim,
int spacedim>
222 const std::set<unsigned int> &fes,
223 const unsigned int codim)
const
225 unsigned int fe_index = find_dominated_fe(fes, codim);
229 const std::set<unsigned int> dominated_fes =
230 find_enclosing_fes(fes, codim);
231 fe_index = find_dominating_fe(dominated_fes, codim);
239 template <
int dim,
int spacedim>
242 set_default_hierarchy();
247 template <
int dim,
int spacedim>
257 template <
int dim,
int spacedim>
263 ExcMessage(
"Need to pass at least one finite element."));
265 for (
unsigned int i = 0; i < fes.size(); ++i)
271 template <
int dim,
int spacedim>
279 Assert(this->size() == 0 ||
280 new_fe.
n_components() == this->operator[](0).n_components(),
281 ExcMessage(
"All elements inside a collection need to have the "
282 "same number of vector components!"));
289 template <
int dim,
int spacedim>
294 const unsigned int)> &next,
297 const unsigned int)> &prev)
300 hierarchy_next = next;
301 hierarchy_prev = prev;
306 template <
int dim,
int spacedim>
311 set_hierarchy(&DefaultHierarchy::next_index,
312 &DefaultHierarchy::previous_index);
317 template <
int dim,
int spacedim>
318 std::vector<unsigned int>
320 const unsigned int fe_index)
const
324 std::deque<unsigned int> sequence = {fe_index};
328 unsigned int front = sequence.front();
329 unsigned int previous;
330 while ((previous = previous_in_hierarchy(front)) != front)
332 sequence.push_front(previous);
335 Assert(sequence.size() <= this->size(),
337 "The registered hierarchy is not terminated: "
338 "previous_in_hierarchy() does not stop at a final index."));
344 unsigned int back = sequence.back();
346 while ((next = next_in_hierarchy(back)) != back)
348 sequence.push_back(next);
351 Assert(sequence.size() <= this->size(),
353 "The registered hierarchy is not terminated: "
354 "next_in_hierarchy() does not stop at a final index."));
358 return {sequence.begin(), sequence.end()};
363 template <
int dim,
int spacedim>
366 const unsigned int fe_index)
const
370 const unsigned int new_fe_index = hierarchy_next(*
this, fe_index);
378 template <
int dim,
int spacedim>
381 const unsigned int fe_index)
const
385 const unsigned int new_fe_index = hierarchy_prev(*
this, fe_index);
393 template <
int dim,
int spacedim>
399 ExcMessage(
"This collection contains no finite element."));
406 for (
unsigned int c = 1; c < this->size(); ++c)
413 template <
int dim,
int spacedim>
419 ExcMessage(
"This collection contains no finite element."));
426 for (
unsigned int c = 1; c < this->size(); ++c)
433 template <
int dim,
int spacedim>
439 ExcMessage(
"This collection contains no finite element."));
446 for (
unsigned int c = 1; c < this->size(); ++c)
453 template <
int dim,
int spacedim>
458 ExcMessage(
"This collection contains no finite element."));
465 for (
unsigned int c = 1; c < this->size(); ++c)
467 ExcMessage(
"Not all elements of this collection agree on what "
468 "the appropriate mask should be."));
474 template <
int dim,
int spacedim>
480 ExcMessage(
"This collection contains no finite element."));
483 const BlockMask mask = (*this)[0].block_mask(scalar);
487 for (
unsigned int c = 1; c < this->size(); ++c)
488 Assert(mask == (*
this)[c].block_mask(scalar),
489 ExcMessage(
"Not all elements of this collection agree on what "
490 "the appropriate mask should be."));
496 template <
int dim,
int spacedim>
502 ExcMessage(
"This collection contains no finite element."));
509 for (
unsigned int c = 1; c < this->size(); ++c)
510 Assert(mask == (*
this)[c].block_mask(vector),
511 ExcMessage(
"Not all elements of this collection agree on what "
512 "the appropriate mask should be."));
518 template <
int dim,
int spacedim>
524 ExcMessage(
"This collection contains no finite element."));
531 for (
unsigned int c = 1; c < this->size(); ++c)
533 ExcMessage(
"Not all elements of this collection agree on what "
534 "the appropriate mask should be."));
541 template <
int dim,
int spacedim>
547 ExcMessage(
"This collection contains no finite element."));
554 for (
unsigned int c = 1; c < this->size(); ++c)
555 Assert(mask == (*
this)[c].block_mask(component_mask),
556 ExcMessage(
"Not all elements of this collection agree on what "
557 "the appropriate mask should be."));
564 template <
int dim,
int spacedim>
568 Assert(this->size() > 0, ExcNoFiniteElements());
570 const unsigned int nb = this->operator[](0).n_blocks();
571 for (
unsigned int i = 1; i < this->size(); ++i)
572 Assert(this->
operator[](i).n_blocks() == nb,
573 ExcMessage(
"Not all finite elements in this collection have "
574 "the same number of components."));
583#include "fe_collection.inst"
std::vector< bool > block_mask
std::vector< bool > component_mask
unsigned int n_components() const
virtual std::unique_ptr< FiniteElement< dim, spacedim > > clone() const =0
std::set< unsigned int > find_common_fes(const std::set< unsigned int > &fes, const unsigned int codim=0) const
void push_back(const FiniteElement< dim, spacedim > &new_fe)
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
static ::ExceptionBase & ExcEmptyObject()
#define Assert(cond, exc)
static ::ExceptionBase & ExcImpossibleInDim(int arg1)
#define AssertIndexRange(index, range)
static ::ExceptionBase & ExcInternalError()
static ::ExceptionBase & ExcMessage(std::string arg1)
@ either_element_can_dominate
@ other_element_dominates
std::enable_if< IsBlockVector< VectorType >::value, unsignedint >::type n_blocks(const VectorType &vector)
static const unsigned int invalid_unsigned_int