4#ifndef DUNE_LOCALFUNCTIONS_COMMON_LOCALTOGLOBALADAPTORS_HH
5#define DUNE_LOCALFUNCTIONS_COMMON_LOCALTOGLOBALADAPTORS_HH
27 template<
class LocalBasisTraits, std::
size_t dimDomainGlobal_>
31 static const std::size_t dimDomainGlobal = dimDomainGlobal_;
62 template<
class LocalBasis,
class Geometry>
64 static_assert(LocalBasis::Traits::dimRange == 1,
65 "ScalarLocalToGlobalBasisAdaptor can only wrap a "
66 "scalar local basis.");
67 static_assert((std::is_same<
typename LocalBasis::Traits::DomainFieldType,
69 "ScalarLocalToGlobalBasisAdaptor: LocalBasis must use "
70 "the same ctype as Geometry");
72 (
static_cast<std::size_t
>(LocalBasis::Traits::dimDomain) ==
74 "ScalarLocalToGlobalBasisAdaptor: LocalBasis domain dimension must "
75 "match local dimension of Geometry");
77 const LocalBasis& localBasis;
96 localBasis(localBasis_), geometry(geometry_)
99 std::size_t size()
const {
return localBasis.size(); }
111 return localBasis.order();
114 return localBasis.order() + Traits::dimDomainGlobal - 1;
117 void evaluateFunction(
const typename Traits::DomainLocal& in,
118 std::vector<typename Traits::Range>& out)
const
120 localBasis.evaluateFunction(in, out);
123 void evaluateJacobian(
const typename Traits::DomainLocal& in,
124 std::vector<typename Traits::Jacobian>& out)
const
126 std::vector<typename LocalBasis::Traits::JacobianType>
127 localJacobian(size());
128 localBasis.evaluateJacobian(in, localJacobian);
134 for(std::size_t i = 0; i < size(); ++i)
135 geoJacobian.mv(localJacobian[i][0], out[i][0]);
146 template<
class LocalInterpolation,
class Traits_>
148 const LocalInterpolation& localInterpolation;
163 (
const LocalInterpolation& localInterpolation_) :
164 localInterpolation(localInterpolation_)
167 template<
class Function,
class Coeff>
168 void interpolate(
const Function& function, std::vector<Coeff>& out)
const
169 { localInterpolation.interpolate(function, out); }
184 template<
class LocalFiniteElement,
class Geometry>
191 Traits::LocalBasisType,
Geometry> Basis;
193 Traits::LocalInterpolationType,
typename Basis::Traits>
195 typedef typename LocalFiniteElement::Traits::LocalCoefficientsType
200 const LocalFiniteElement &localFE;
216 (
const LocalFiniteElement& localFE_,
const Geometry &geometry) :
218 basis_(localFE.localBasis(), geometry),
219 interpolation_(localFE.localInterpolation())
222 const typename Traits::Basis& basis()
const {
return basis_; }
223 const typename Traits::Interpolation& interpolation()
const
224 {
return interpolation_; }
225 const typename Traits::Coefficients& coefficients()
const
226 {
return localFE.localCoefficients(); }
241 template<
class LocalFiniteElement,
class Geometry>
243 const LocalFiniteElement& localFE;
259 (
const LocalFiniteElement &localFE_) : localFE(localFE_) {}
A dense n x m matrix.
Definition: fmatrix.hh:69
vector space out of a tensor product of fields.
Definition: fvector.hh:95
Base class template for function classes.
Definition: function.hh:39
Wrapper class for geometries.
Definition: geometry.hh:67
@ coorddimension
Definition: geometry.hh:92
Implementation::JacobianInverseTransposed JacobianInverseTransposed
type of jacobian inverse transposed
Definition: geometry.hh:115
GridImp::ctype ctype
define type used for coordinates in grid module
Definition: geometry.hh:95
bool affine() const
Return true if the geometry mapping is affine and false otherwise.
Definition: geometry.hh:134
@ mydimension
Definition: geometry.hh:90
JacobianInverseTransposed jacobianInverseTransposed(const LocalCoordinate &local) const
Return inverse of transposed of Jacobian.
Definition: geometry.hh:265
Convert a local interpolation into a global interpolation.
Definition: localtoglobaladaptors.hh:147
LocalToGlobalInterpolationAdaptor(const LocalInterpolation &localInterpolation_)
construct a LocalToGlobalInterpolationAdaptor
Definition: localtoglobaladaptors.hh:163
Convert a simple scalar local basis into a global basis.
Definition: localtoglobaladaptors.hh:63
std::size_t order() const
return maximum polynomial order of the base function
Definition: localtoglobaladaptors.hh:108
ScalarLocalToGlobalBasisAdaptor(const LocalBasis &localBasis_, const Geometry &geometry_)
construct a ScalarLocalToGlobalBasisAdaptor
Definition: localtoglobaladaptors.hh:94
Factory for ScalarLocalToGlobalFiniteElementAdaptor objects.
Definition: localtoglobaladaptors.hh:242
const FiniteElement make(const Geometry &geometry)
construct ScalarLocalToGlobalFiniteElementAdaptor
Definition: localtoglobaladaptors.hh:272
ScalarLocalToGlobalFiniteElementAdaptorFactory(const LocalFiniteElement &localFE_)
construct a ScalarLocalToGlobalFiniteElementAdaptorFactory
Definition: localtoglobaladaptors.hh:259
Traits for type conversions and type information.
GeometryType
Type representing VTK's entity geometry types.
Definition: common.hh:130
Implements a matrix constructed from a given type representing a field and compile-time given number ...
Implements a vector constructed from a given type representing a field and a compile-time given size.
Dune namespace.
Definition: alignedallocator.hh:11
types of domain and range
Definition: interface.hh:186
Dummy struct used for documentation purposes.
Definition: documentation.hh:40
D DomainType
domain type
Definition: localbasis.hh:43
RF RangeFieldType
Export type for range field.
Definition: localbasis.hh:46
DF DomainFieldType
Export type for domain field.
Definition: localbasis.hh:34
@ dimRange
dimension of the range
Definition: localbasis.hh:51
@ dimDomain
dimension of the domain
Definition: localbasis.hh:39
R RangeType
range type
Definition: localbasis.hh:55
Traits class for local-to-global basis adaptors.
Definition: localtoglobaladaptors.hh:28
Convert a simple scalar local finite element into a global finite element.
Definition: localtoglobaladaptors.hh:185
ScalarLocalToGlobalFiniteElementAdaptor(const LocalFiniteElement &localFE_, const Geometry &geometry)
construct a ScalarLocalToGlobalFiniteElementAdaptor
Definition: localtoglobaladaptors.hh:216
A unique label for each type of element that can occur in a grid.