/usr/include/dune/localfunctions/meta/power.hh is in libdune-localfunctions-dev 2.5.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
#ifndef DUNE_LOCALFUNCTIONS_META_POWER_HH
#define DUNE_LOCALFUNCTIONS_META_POWER_HH
#include <cstddef>
#include <memory>
#include <dune/geometry/type.hh>
#include <dune/localfunctions/meta/power/basis.hh>
#include <dune/localfunctions/meta/power/coefficients.hh>
#include <dune/localfunctions/meta/power/interpolation.hh>
namespace Dune {
//! \brief Meta-finite element turning a scalar finite element into
//! vector-valued one
/**
* @ingroup FiniteElementImplementation
*
* \tparam Backend Type of finite element to take the power of.
* \tparam dimR Power to raise the finite element to.
*/
template<class Backend, std::size_t dimR>
class PowerFiniteElement {
public:
//! types of component objects
struct Traits {
//! type of the Basis
typedef PowerBasis<typename Backend::Traits::Basis, dimR> Basis;
//! type of the Coefficients
typedef PowerCoefficients Coefficients;
//! type of the Interpolation
typedef PowerInterpolation<typename Backend::Traits::Interpolation,
typename Basis::Traits> Interpolation;
};
private:
std::shared_ptr<const Backend> backend;
typename Traits::Basis basis_;
typename Traits::Coefficients coefficients_;
typename Traits::Interpolation interpolation_;
public:
//! Construct a finite element
/**
* \note With this constructor a copy of the backend finite element is
* stored in this object.
*/
PowerFiniteElement(const Backend &backend_) :
backend(new Backend(backend_)),
basis_(backend->basis()),
coefficients_(backend->coefficients(), dimR),
interpolation_(backend->interpolation())
{ }
//! Construct a finite element
/**
* \note With this constructor ownership of the backend finite element is
* determined by the shared_ptr.
*/
PowerFiniteElement(const std::shared_ptr<const Backend> &backendSPtr) :
backend(backendSPtr),
basis_(backend->basis()),
coefficients_(backend->coefficients(), dimR),
interpolation_(backend->interpolation())
{ }
//! Extract basis of this finite element
/**
* The returned lvalue must have a lifetime at least as long as the finite
* element object it was acquired from.
*/
const typename Traits::Basis& basis() const { return basis_; }
//! Extract coefficients of this finite element
/**
* The returned lvalue must have a lifetime at least as long as the finite
* element object it was acquired from.
*/
const typename Traits::Coefficients& coefficients() const
{ return coefficients_; }
//! Extract interpolation of this finite element
/**
* The returned lvalue must have a lifetime at least as long as the finite
* element object it was acquired from.
*/
const typename Traits::Interpolation& interpolation() const
{ return interpolation_; }
//! Extract geometry type of this finite element
GeometryType type() const { return backend->type(); }
};
//! \brief Factory for meta-finite elements turning scalar finite elements
//! into vector-valued ones
/**
* \implements FiniteElementFactory
* \ingroup FiniteElementFactoryImplementation
*
* \tparam BackendFiniteElement Type of finite element to take the power of.
* \tparam dimR Power to raise the finite element to.
*/
template<class BackendFiniteElement, std::size_t dimR>
class PowerFiniteElementFactory
{
public:
//! Type of the finite element
typedef PowerFiniteElement<BackendFiniteElement, dimR> FiniteElement;
//! create a finite element
/**
* \note With this overload of make() the backend finite element is copied
* into the created object.
*/
const FiniteElement make(const BackendFiniteElement &backend) const
{ return FiniteElement(backend); }
//! create a finite element
/**
* \note With this overload of make() ownership of the backend finite
* element is determined by the shared_ptr.
*/
const FiniteElement
make(const std::shared_ptr<const BackendFiniteElement> &backendSPtr) const
{ return FiniteElement(backendSPtr); }
};
} // namespace Dune
#endif // DUNE_LOCALFUNCTIONS_META_POWER_HH
|