Dune Core Modules (unstable)

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// SPDX-FileCopyrightInfo: Copyright © DUNE Project contributors, see file LICENSE.md in module root
4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
5
6#ifndef DUNE_LOCALFUNCTIONS_META_POWER_HH
7#define DUNE_LOCALFUNCTIONS_META_POWER_HH
8
9#include <cstddef>
10#include <memory>
11
12#include <dune/geometry/type.hh>
13
14#include <dune/localfunctions/meta/power/basis.hh>
15#include <dune/localfunctions/meta/power/coefficients.hh>
16#include <dune/localfunctions/meta/power/interpolation.hh>
17
18namespace Dune {
19
22
28 template<class Backend, std::size_t dimR>
30 public:
32 struct Traits {
38 typedef PowerInterpolation<typename Backend::Traits::Interpolation,
39 typename Basis::Traits> Interpolation;
40 };
41 private:
42 std::shared_ptr<const Backend> backend;
43 typename Traits::Basis basis_;
44 typename Traits::Coefficients coefficients_;
45 typename Traits::Interpolation interpolation_;
46
47 public:
49
53 PowerFiniteElement(const Backend &backend_) :
54 backend(new Backend(backend_)),
55 basis_(backend->basis()),
56 coefficients_(backend->coefficients(), dimR),
57 interpolation_(backend->interpolation())
58 { }
59
61
65 PowerFiniteElement(const std::shared_ptr<const Backend> &backendSPtr) :
66 backend(backendSPtr),
67 basis_(backend->basis()),
68 coefficients_(backend->coefficients(), dimR),
69 interpolation_(backend->interpolation())
70 { }
71
73
77 const typename Traits::Basis& basis() const { return basis_; }
79
83 const typename Traits::Coefficients& coefficients() const
84 { return coefficients_; }
86
90 const typename Traits::Interpolation& interpolation() const
91 { return interpolation_; }
93 GeometryType type() const { return backend->type(); }
94 };
95
98
105 template<class BackendFiniteElement, std::size_t dimR>
107 {
108 public:
111
113
117 const FiniteElement make(const BackendFiniteElement &backend) const
118 { return FiniteElement(backend); }
120
124 const FiniteElement
125 make(const std::shared_ptr<const BackendFiniteElement> &backendSPtr) const
126 { return FiniteElement(backendSPtr); }
127
128 };
129
130} // namespace Dune
131
132#endif // DUNE_LOCALFUNCTIONS_META_POWER_HH
Unique label for each type of entities that can occur in DUNE grids.
Definition: type.hh:114
Meta-coefficients turning a scalar coefficients into vector-valued coefficients.
Definition: coefficients.hh:23
Factory for meta-finite elements turning scalar finite elements into vector-valued ones.
Definition: power.hh:107
const FiniteElement make(const std::shared_ptr< const BackendFiniteElement > &backendSPtr) const
create a finite element
Definition: power.hh:125
const FiniteElement make(const BackendFiniteElement &backend) const
create a finite element
Definition: power.hh:117
PowerFiniteElement< BackendFiniteElement, dimR > FiniteElement
Type of the finite element.
Definition: power.hh:110
Meta-finite element turning a scalar finite element into vector-valued one.
Definition: power.hh:29
const Traits::Basis & basis() const
Extract basis of this finite element.
Definition: power.hh:77
GeometryType type() const
Extract geometry type of this finite element.
Definition: power.hh:93
const Traits::Interpolation & interpolation() const
Extract interpolation of this finite element.
Definition: power.hh:90
PowerFiniteElement(const Backend &backend_)
Construct a finite element.
Definition: power.hh:53
PowerFiniteElement(const std::shared_ptr< const Backend > &backendSPtr)
Construct a finite element.
Definition: power.hh:65
const Traits::Coefficients & coefficients() const
Extract coefficients of this finite element.
Definition: power.hh:83
Meta-interpolation turning a scalar interpolation into vector-valued interpolation.
Definition: interpolation.hh:26
Dune namespace.
Definition: alignedallocator.hh:13
types of component objects
Definition: power.hh:32
PowerBasis< typename Backend::Traits::Basis, dimR > Basis
type of the Basis
Definition: power.hh:34
PowerCoefficients Coefficients
type of the Coefficients
Definition: power.hh:36
PowerInterpolation< typename Backend::Traits::Interpolation, typename Basis::Traits > Interpolation
type of the Interpolation
Definition: power.hh:39
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.111.3 (Dec 21, 23:30, 2024)