Dune Core Modules (2.6.0)

power.hh
1 // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 // vi: set et ts=4 sw=2 sts=2:
3 
4 #ifndef DUNE_LOCALFUNCTIONS_META_POWER_HH
5 #define DUNE_LOCALFUNCTIONS_META_POWER_HH
6 
7 #include <cstddef>
8 #include <memory>
9 
10 #include <dune/geometry/type.hh>
11 
12 #include <dune/localfunctions/meta/power/basis.hh>
13 #include <dune/localfunctions/meta/power/coefficients.hh>
14 #include <dune/localfunctions/meta/power/interpolation.hh>
15 
16 namespace Dune {
17 
20 
26  template<class Backend, std::size_t dimR>
28  public:
30  struct Traits {
36  typedef PowerInterpolation<typename Backend::Traits::Interpolation,
37  typename Basis::Traits> Interpolation;
38  };
39  private:
40  std::shared_ptr<const Backend> backend;
41  typename Traits::Basis basis_;
42  typename Traits::Coefficients coefficients_;
43  typename Traits::Interpolation interpolation_;
44 
45  public:
47 
51  PowerFiniteElement(const Backend &backend_) :
52  backend(new Backend(backend_)),
53  basis_(backend->basis()),
54  coefficients_(backend->coefficients(), dimR),
55  interpolation_(backend->interpolation())
56  { }
57 
59 
63  PowerFiniteElement(const std::shared_ptr<const Backend> &backendSPtr) :
64  backend(backendSPtr),
65  basis_(backend->basis()),
66  coefficients_(backend->coefficients(), dimR),
67  interpolation_(backend->interpolation())
68  { }
69 
71 
75  const typename Traits::Basis& basis() const { return basis_; }
77 
81  const typename Traits::Coefficients& coefficients() const
82  { return coefficients_; }
84 
88  const typename Traits::Interpolation& interpolation() const
89  { return interpolation_; }
91  GeometryType type() const { return backend->type(); }
92  };
93 
96 
103  template<class BackendFiniteElement, std::size_t dimR>
105  {
106  public:
109 
111 
115  const FiniteElement make(const BackendFiniteElement &backend) const
116  { return FiniteElement(backend); }
118 
122  const FiniteElement
123  make(const std::shared_ptr<const BackendFiniteElement> &backendSPtr) const
124  { return FiniteElement(backendSPtr); }
125 
126  };
127 
128 } // namespace Dune
129 
130 #endif // DUNE_LOCALFUNCTIONS_META_POWER_HH
Unique label for each type of entities that can occur in DUNE grids.
Definition: type.hh:277
Meta-coefficients turning a scalar coefficients into vector-valued coefficients.
Definition: coefficients.hh:20
Factory for meta-finite elements turning scalar finite elements into vector-valued ones.
Definition: power.hh:105
const FiniteElement make(const std::shared_ptr< const BackendFiniteElement > &backendSPtr) const
create a finite element
Definition: power.hh:123
const FiniteElement make(const BackendFiniteElement &backend) const
create a finite element
Definition: power.hh:115
PowerFiniteElement< BackendFiniteElement, dimR > FiniteElement
Type of the finite element.
Definition: power.hh:108
Meta-finite element turning a scalar finite element into vector-valued one.
Definition: power.hh:27
const Traits::Coefficients & coefficients() const
Extract coefficients of this finite element.
Definition: power.hh:81
const Traits::Basis & basis() const
Extract basis of this finite element.
Definition: power.hh:75
GeometryType type() const
Extract geometry type of this finite element.
Definition: power.hh:91
PowerFiniteElement(const Backend &backend_)
Construct a finite element.
Definition: power.hh:51
const Traits::Interpolation & interpolation() const
Extract interpolation of this finite element.
Definition: power.hh:88
PowerFiniteElement(const std::shared_ptr< const Backend > &backendSPtr)
Construct a finite element.
Definition: power.hh:63
Meta-interpolation turning a scalar interpolation into vector-valued interpolation.
Definition: interpolation.hh:23
Dune namespace.
Definition: alignedallocator.hh:10
types of component objects
Definition: power.hh:30
PowerBasis< typename Backend::Traits::Basis, dimR > Basis
type of the Basis
Definition: power.hh:32
PowerCoefficients Coefficients
type of the Coefficients
Definition: power.hh:34
PowerInterpolation< typename Backend::Traits::Interpolation, typename Basis::Traits > Interpolation
type of the Interpolation
Definition: power.hh:37
A unique label for each type of element that can occur in a grid.
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.80.0 (May 4, 22:30, 2024)