Reference documentation for deal.II version 8.5.1
fe_collection.h
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2003 - 2016 by the deal.II authors
4 //
5 // This file is part of the deal.II library.
6 //
7 // The deal.II library is free software; you can use it, redistribute
8 // it, and/or modify it under the terms of the GNU Lesser General
9 // Public License as published by the Free Software Foundation; either
10 // version 2.1 of the License, or (at your option) any later version.
11 // The full text of the license can be found in the file LICENSE at
12 // the top level of the deal.II distribution.
13 //
14 // ---------------------------------------------------------------------
15 
16 #ifndef dealii__fe_collection_h
17 #define dealii__fe_collection_h
18 
19 #include <deal.II/base/config.h>
20 #include <deal.II/base/std_cxx11/shared_ptr.h>
21 #include <deal.II/fe/fe.h>
22 #include <deal.II/fe/fe_values_extractors.h>
23 #include <deal.II/fe/component_mask.h>
24 
25 DEAL_II_NAMESPACE_OPEN
26 
27 namespace hp
28 {
29 
52  template <int dim, int spacedim=dim>
53  class FECollection : public Subscriptor
54  {
55  public:
60  FECollection ();
61 
68  explicit FECollection (const FiniteElement<dim,spacedim> &fe);
69 
75  const FiniteElement<dim,spacedim> &fe2);
76 
82  const FiniteElement<dim,spacedim> &fe2,
83  const FiniteElement<dim,spacedim> &fe3);
84 
90  const FiniteElement<dim,spacedim> &fe2,
91  const FiniteElement<dim,spacedim> &fe3,
92  const FiniteElement<dim,spacedim> &fe4);
93 
99  const FiniteElement<dim,spacedim> &fe2,
100  const FiniteElement<dim,spacedim> &fe3,
101  const FiniteElement<dim,spacedim> &fe4,
102  const FiniteElement<dim,spacedim> &fe5);
103 
111  FECollection (const std::vector<const FiniteElement<dim,spacedim>*> &fes);
112 
116  FECollection (const FECollection<dim,spacedim> &fe_collection);
117 
127  void push_back (const FiniteElement<dim,spacedim> &new_fe);
128 
136  operator[] (const unsigned int index) const;
137 
141  unsigned int size () const;
142 
152  unsigned int n_components () const;
153 
170  unsigned int n_blocks () const;
171 
176  unsigned int max_dofs_per_vertex () const;
177 
182  unsigned int max_dofs_per_line () const;
183 
188  unsigned int max_dofs_per_quad () const;
189 
194  unsigned int max_dofs_per_hex () const;
195 
200  unsigned int max_dofs_per_face () const;
201 
206  unsigned int max_dofs_per_cell () const;
207 
211  std::size_t memory_consumption () const;
212 
213 
231  bool hp_constraints_are_implemented () const;
232 
256  unsigned int
257  find_least_face_dominating_fe (const std::set<unsigned int> &fes) const;
258 
276  component_mask (const FEValuesExtractors::Scalar &scalar) const;
277 
295  component_mask (const FEValuesExtractors::Vector &vector) const;
296 
315  component_mask (const FEValuesExtractors::SymmetricTensor<2> &sym_tensor) const;
316 
338  component_mask (const BlockMask &block_mask) const;
339 
366  BlockMask
367  block_mask (const FEValuesExtractors::Scalar &scalar) const;
368 
391  BlockMask
392  block_mask (const FEValuesExtractors::Vector &vector) const;
393 
417  BlockMask
418  block_mask (const FEValuesExtractors::SymmetricTensor<2> &sym_tensor) const;
419 
448  BlockMask
449  block_mask (const ComponentMask &component_mask) const;
450 
451 
456 
457  private:
461  std::vector<std_cxx11::shared_ptr<const FiniteElement<dim,spacedim> > > finite_elements;
462  };
463 
464 
465 
466  /* --------------- inline functions ------------------- */
467 
468  template <int dim, int spacedim>
469  inline
470  unsigned int
472  {
473  return finite_elements.size();
474  }
475 
476 
477  template <int dim, int spacedim>
478  inline
479  unsigned int
481  {
482  Assert (finite_elements.size () > 0, ExcNoFiniteElements());
483 
484  // note that there is no need
485  // here to enforce that indeed
486  // all elements have the same
487  // number of components since we
488  // have already done this when
489  // adding a new element to the
490  // collection.
491 
492  return finite_elements[0]->n_components ();
493  }
494 
495 
496  template <int dim, int spacedim>
497  inline
499  FECollection<dim,spacedim>::operator[] (const unsigned int index) const
500  {
501  Assert (index < finite_elements.size(),
502  ExcIndexRange (index, 0, finite_elements.size()));
503  return *finite_elements[index];
504  }
505 
506 
507 
508  template <int dim, int spacedim>
509  unsigned int
511  {
512  Assert (finite_elements.size() > 0, ExcNoFiniteElements());
513 
514  unsigned int max = 0;
515  for (unsigned int i=0; i<finite_elements.size(); ++i)
516  if (finite_elements[i]->dofs_per_vertex > max)
517  max = finite_elements[i]->dofs_per_vertex;
518 
519  return max;
520  }
521 
522 
523 
524  template <int dim, int spacedim>
525  unsigned int
527  {
528  Assert (finite_elements.size() > 0, ExcNoFiniteElements());
529 
530  unsigned int max = 0;
531  for (unsigned int i=0; i<finite_elements.size(); ++i)
532  if (finite_elements[i]->dofs_per_line > max)
533  max = finite_elements[i]->dofs_per_line;
534 
535  return max;
536  }
537 
538 
539 
540  template <int dim, int spacedim>
541  unsigned int
543  {
544  Assert (finite_elements.size() > 0, ExcNoFiniteElements());
545 
546  unsigned int max = 0;
547  for (unsigned int i=0; i<finite_elements.size(); ++i)
548  if (finite_elements[i]->dofs_per_quad > max)
549  max = finite_elements[i]->dofs_per_quad;
550 
551  return max;
552  }
553 
554 
555 
556  template <int dim, int spacedim>
557  unsigned int
559  {
560  Assert (finite_elements.size() > 0, ExcNoFiniteElements());
561 
562  unsigned int max = 0;
563  for (unsigned int i=0; i<finite_elements.size(); ++i)
564  if (finite_elements[i]->dofs_per_hex > max)
565  max = finite_elements[i]->dofs_per_hex;
566 
567  return max;
568  }
569 
570 
571 
572  template <int dim, int spacedim>
573  unsigned int
575  {
576  Assert (finite_elements.size() > 0, ExcNoFiniteElements());
577 
578  unsigned int max = 0;
579  for (unsigned int i=0; i<finite_elements.size(); ++i)
580  if (finite_elements[i]->dofs_per_face > max)
581  max = finite_elements[i]->dofs_per_face;
582 
583  return max;
584  }
585 
586 
587 
588  template <int dim, int spacedim>
589  unsigned int
591  {
592  Assert (finite_elements.size() > 0, ExcNoFiniteElements());
593 
594  unsigned int max = 0;
595  for (unsigned int i=0; i<finite_elements.size(); ++i)
596  if (finite_elements[i]->dofs_per_cell > max)
597  max = finite_elements[i]->dofs_per_cell;
598 
599  return max;
600  }
601 
602 
603  template <int dim, int spacedim>
604  bool
606  {
607  Assert (finite_elements.size() > 0, ExcNoFiniteElements());
608 
609  bool hp_constraints = true;
610  for (unsigned int i=0; i<finite_elements.size(); ++i)
611  hp_constraints = hp_constraints &&
612  finite_elements[i]->hp_constraints_are_implemented();
613 
614  return hp_constraints;
615  }
616 
617 
618 } // namespace hp
619 
620 DEAL_II_NAMESPACE_CLOSE
621 
622 #endif
ComponentMask component_mask(const FEValuesExtractors::Scalar &scalar) const
std::size_t memory_consumption() const
unsigned int find_least_face_dominating_fe(const std::set< unsigned int > &fes) const
unsigned int size() const
static ::ExceptionBase & ExcIndexRange(int arg1, int arg2, int arg3)
unsigned int n_blocks() const
BlockMask block_mask(const FEValuesExtractors::Scalar &scalar) const
unsigned int max_dofs_per_cell() const
void push_back(const FiniteElement< dim, spacedim > &new_fe)
bool hp_constraints_are_implemented() const
static ::ExceptionBase & ExcNoFiniteElements()
std::vector< std_cxx11::shared_ptr< const FiniteElement< dim, spacedim > > > finite_elements
unsigned int max_dofs_per_hex() const
#define Assert(cond, exc)
Definition: exceptions.h:313
#define DeclException0(Exception0)
Definition: exceptions.h:541
unsigned int max_dofs_per_line() const
Definition: hp.h:102
unsigned int max_dofs_per_face() const
unsigned int max_dofs_per_vertex() const
unsigned int n_components() const
const FiniteElement< dim, spacedim > & operator[](const unsigned int index) const
unsigned int max_dofs_per_quad() const