Reference documentation for deal.II version 8.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
fe_collection.h
1 // ---------------------------------------------------------------------
2 // @f$Id: fe_collection.h 30036 2013-07-18 16:55:32Z maier @f$
3 //
4 // Copyright (C) 2003 - 2013 by the deal.II authors
5 //
6 // This file is part of the deal.II library.
7 //
8 // The deal.II library is free software; you can use it, redistribute
9 // it, and/or modify it under the terms of the GNU Lesser General
10 // Public License as published by the Free Software Foundation; either
11 // version 2.1 of the License, or (at your option) any later version.
12 // The full text of the license can be found in the file LICENSE at
13 // the top level of the deal.II distribution.
14 //
15 // ---------------------------------------------------------------------
16 
17 #ifndef __deal2__fe_collection_h
18 #define __deal2__fe_collection_h
19 
20 #include <deal.II/base/config.h>
21 #include <deal.II/base/std_cxx1x/shared_ptr.h>
22 #include <deal.II/fe/fe.h>
23 #include <deal.II/fe/fe_values_extractors.h>
24 #include <deal.II/fe/component_mask.h>
25 
27 
28 namespace hp
29 {
30 
52  template <int dim, int spacedim=dim>
53  class FECollection : public Subscriptor
54  {
55  public:
62  FECollection ();
63 
75  explicit FECollection (const FiniteElement<dim,spacedim> &fe);
76 
80  FECollection (const FECollection<dim,spacedim> &fe_collection);
81 
99  void push_back (const FiniteElement<dim,spacedim> &new_fe);
100 
111  operator[] (const unsigned int index) const;
112 
118  unsigned int size () const;
119 
132  unsigned int n_components () const;
133 
153  unsigned int n_blocks () const;
154 
160  unsigned int max_dofs_per_vertex () const;
161 
167  unsigned int max_dofs_per_line () const;
168 
174  unsigned int max_dofs_per_quad () const;
175 
181  unsigned int max_dofs_per_hex () const;
182 
188  unsigned int max_dofs_per_face () const;
189 
195  unsigned int max_dofs_per_cell () const;
196 
201  std::size_t memory_consumption () const;
202 
203 
237  bool hp_constraints_are_implemented () const;
238 
257  component_mask (const FEValuesExtractors::Scalar &scalar) const;
258 
277  component_mask (const FEValuesExtractors::Vector &vector) const;
278 
298  component_mask (const FEValuesExtractors::SymmetricTensor<2> &sym_tensor) const;
299 
319  component_mask (const BlockMask &block_mask) const;
320 
347  BlockMask
348  block_mask (const FEValuesExtractors::Scalar &scalar) const;
349 
372  BlockMask
373  block_mask (const FEValuesExtractors::Vector &vector) const;
374 
398  BlockMask
399  block_mask (const FEValuesExtractors::SymmetricTensor<2> &sym_tensor) const;
400 
427  BlockMask
428  block_mask (const ComponentMask &component_mask) const;
429 
430 
434  DeclException0 (ExcNoFiniteElements);
435 
436  private:
441  std::vector<std_cxx1x::shared_ptr<const FiniteElement<dim,spacedim> > > finite_elements;
442  };
443 
444 
445 
446  /* --------------- inline functions ------------------- */
447 
448  template <int dim, int spacedim>
449  inline
450  unsigned int
452  {
453  return finite_elements.size();
454  }
455 
456 
457  template <int dim, int spacedim>
458  inline
459  unsigned int
461  {
462  Assert (finite_elements.size () > 0, ExcNoFiniteElements());
463 
464  // note that there is no need
465  // here to enforce that indeed
466  // all elements have the same
467  // number of components since we
468  // have already done this when
469  // adding a new element to the
470  // collection.
471 
472  return finite_elements[0]->n_components ();
473  }
474 
475 
476  template <int dim, int spacedim>
477  inline
479  FECollection<dim,spacedim>::operator[] (const unsigned int index) const
480  {
481  Assert (index < finite_elements.size(),
482  ExcIndexRange (index, 0, finite_elements.size()));
483  return *finite_elements[index];
484  }
485 
486 
487 
488  template <int dim, int spacedim>
489  unsigned int
491  {
492  Assert (finite_elements.size() > 0, ExcNoFiniteElements());
493 
494  unsigned int max = 0;
495  for (unsigned int i=0; i<finite_elements.size(); ++i)
496  if (finite_elements[i]->dofs_per_vertex > max)
497  max = finite_elements[i]->dofs_per_vertex;
498 
499  return max;
500  }
501 
502 
503 
504  template <int dim, int spacedim>
505  unsigned int
507  {
508  Assert (finite_elements.size() > 0, ExcNoFiniteElements());
509 
510  unsigned int max = 0;
511  for (unsigned int i=0; i<finite_elements.size(); ++i)
512  if (finite_elements[i]->dofs_per_line > max)
513  max = finite_elements[i]->dofs_per_line;
514 
515  return max;
516  }
517 
518 
519 
520  template <int dim, int spacedim>
521  unsigned int
523  {
524  Assert (finite_elements.size() > 0, ExcNoFiniteElements());
525 
526  unsigned int max = 0;
527  for (unsigned int i=0; i<finite_elements.size(); ++i)
528  if (finite_elements[i]->dofs_per_quad > max)
529  max = finite_elements[i]->dofs_per_quad;
530 
531  return max;
532  }
533 
534 
535 
536  template <int dim, int spacedim>
537  unsigned int
539  {
540  Assert (finite_elements.size() > 0, ExcNoFiniteElements());
541 
542  unsigned int max = 0;
543  for (unsigned int i=0; i<finite_elements.size(); ++i)
544  if (finite_elements[i]->dofs_per_hex > max)
545  max = finite_elements[i]->dofs_per_hex;
546 
547  return max;
548  }
549 
550 
551 
552  template <int dim, int spacedim>
553  unsigned int
555  {
556  Assert (finite_elements.size() > 0, ExcNoFiniteElements());
557 
558  unsigned int max = 0;
559  for (unsigned int i=0; i<finite_elements.size(); ++i)
560  if (finite_elements[i]->dofs_per_face > max)
561  max = finite_elements[i]->dofs_per_face;
562 
563  return max;
564  }
565 
566 
567 
568  template <int dim, int spacedim>
569  unsigned int
571  {
572  Assert (finite_elements.size() > 0, ExcNoFiniteElements());
573 
574  unsigned int max = 0;
575  for (unsigned int i=0; i<finite_elements.size(); ++i)
576  if (finite_elements[i]->dofs_per_cell > max)
577  max = finite_elements[i]->dofs_per_cell;
578 
579  return max;
580  }
581 
582 
583  template <int dim, int spacedim>
584  bool
586  {
587  Assert (finite_elements.size() > 0, ExcNoFiniteElements());
588 
589  bool hp_constraints = true;
590  for (unsigned int i=0; i<finite_elements.size(); ++i)
591  hp_constraints = hp_constraints &&
592  finite_elements[i]->hp_constraints_are_implemented();
593 
594  return hp_constraints;
595  }
596 
597 
598 } // namespace hp
599 
600 DEAL_II_NAMESPACE_CLOSE
601 
602 #endif
unsigned int max_dofs_per_hex() const
unsigned int max_dofs_per_line() const
bool hp_constraints_are_implemented() const
std::vector< std_cxx1x::shared_ptr< const FiniteElement< dim, spacedim > > > finite_elements
BlockMask block_mask(const FEValuesExtractors::Scalar &scalar) const
std::size_t memory_consumption() const
unsigned int max_dofs_per_cell() const
DeclException0(ExcNoFiniteElements)
#define Assert(cond, exc)
Definition: exceptions.h:299
unsigned int n_blocks() const
::ExceptionBase & ExcIndexRange(int arg1, int arg2, int arg3)
void push_back(const FiniteElement< dim, spacedim > &new_fe)
Definition: hp.h:103
unsigned int max_dofs_per_face() const
ComponentMask component_mask(const FEValuesExtractors::Scalar &scalar) const
const FiniteElement< dim, spacedim > & operator[](const unsigned int index) const
unsigned int n_components() const
unsigned int size() const
unsigned int max_dofs_per_quad() const
unsigned int max_dofs_per_vertex() const