/usr/include/dune/localfunctions/common/interface.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 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 | // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
#ifndef DUNE_LOCALFUNCTIONS_INTERFACE_HH
#define DUNE_LOCALFUNCTIONS_INTERFACE_HH
#ifndef HEADERCHECK
#error This header exists for documentation purposes only and should never be included directly.
#endif
#include <array>
#include <cstddef>
#include <vector>
#include <dune/geometry/type.hh>
#include <dune/localfunctions/common/localkey.hh>
namespace Dune {
//! Interface for global-valued finite elements
class FiniteElementInterface
{
struct ImplementationDefined;
public:
//! types of component objects
/**
* \note This may be a typedef instead of a member class.
*/
struct Traits
{
//! type of the Basis
/**
* Should be an implementation of BasisInterface
*
* \note May be an inline class instead of a typedef.
*/
typedef ImplementationDefined Basis;
//! type of the Coefficients
/**
* Should be an implementation of CoefficientsInterface
*
* \note May be an inline class instead of a typedef.
*/
typedef ImplementationDefined Coefficients;
//! type of the Interpolation
/**
* Should be an implementation of InterpolationInterface
*
* \note May be an inline class instead of a typedef.
*/
typedef ImplementationDefined Interpolation;
};
//! Construct a finite element
/**
* \note The arguments of the constructor are implementation specific. In
* fact, finite element implementations are not required to be
* constructible by the user at all (except for copy-construction).
* The official way to construct a finite element is to use its
* factory.
*/
FiniteElementInterface(...);
//! Finite elements are CopyConstructible
FiniteElementInterface(const FiniteElementInterface&);
//! 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 Traits::Basis& basis() const;
//! 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 Traits::Coefficients& coefficients() const;
//! 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 Traits::Interpolation& interpolation() const;
//! Extract geometry type of this finite element
GeometryType type() const;
};
//! Factory interface for global-valued finite elements
/**
* The main purpose of the factory class is to provide a concept for
* caching. Take for instance a global-valued finite element that wraps a
* local finite element. The local finite element will typically have very
* few variants, and the global-valued finite element will just apply a
* geometric transformation to the derivatives. The wrapped local finite
* elements can be stored inside the factory and any global-valued finite
* elements created by the factory just contain references or pointers.
* This way the local finite elements don't need to be created anew for each
* global-valued finite element.
*
* The other purpose is to semi-standardize the interface used to actually
* create finite elements. "Semi" because the information needed to create
* an actual global-valued finite element will vary between finite element
* types. There are however certain types of information that are needed by
* a larger subset of all available finite elements, so it makes sense to
* define a common encoding for these types of information. On the other
* hand this information is often expensive to obtain, so it makes sense to
* only provide it when it is actually needed.
*/
template<class Geometry, class VertexOrder>
class FiniteElementFactoryInterface
{
struct ImplementationDefined;
public:
//! Type of the finite element
/**
* Should be an implementation of FiniteElementInterface
*
* \note May be an inline class instead of a typedef.
*/
typedef ImplementationDefined FiniteElement;
//! Construct a finite element factory
/**
* \note The arguments of the constructor are implementation specific.
*/
FiniteElementFactoryInterface(...);
/** \name Finite element creation methods
*
* Each finite element factory implementation must provide at least one of
* these methods. The signatures may be extended by additional
* parameters, but the parameters that are specified here should be given
* first and in the order specified here.
*
* The return value of these functions is suitable for binding to a const
* reference -- it will either be an rvalue (in which case binding to a
* const reference will create a copy whose lifetime is the same as the
* reference itself), or it will be an lvalue (in which case the factory
* must guarantee that it will be valid until the factory is destroyed or
* something else happens that explicitly invalidates all created finite
* elements).
*
* In any case, since global-valued finite element objects are
* copy-constructible, it is also possible to use the returned value to
* initialize a finite element object instead of a const reference.
*/
//! \{
//! create a finite element from a geometry and a vertex ordering
const FiniteElement make(const Geometry&, const VertexOrder&, ...);
//! create a finite element from a geometry
const FiniteElement make(const Geometry&, ...);
//! create a finite element from a vertex ordering
const FiniteElement make(const VertexOrder&, ...);
//! create a finite element from a geometry type
/**
* \note This signature should only be used when only the geometry type
* but not the full geometry or vertex ordering are needed.
*/
const FiniteElement make(const GeometryType&, ...);
//! create a finite element
const FiniteElement make(...);
//! \}
};
//! Interface for global-valued shape functions
class BasisInterface
{
struct ImplementationDefined;
enum { implementationDefined };
public:
//! types of domain and range
/**
* \nosubgrouping
*
* \note This may be a typedef instead of a member class.
*/
struct Traits
{
//! \name Domain properties (local and global)
//! \{
//! Field type of the domain
typedef ImplementationDefined DomainField;
//! Dimension of the local coordinate system
static const std::size_t dimDomainLocal = implementationDefined;
//! Dimension of the world coordinate system
static const std::size_t dimDomainGlobal = implementationDefined;
//! Type used for coordinate vectors in the local domain
typedef ImplementationDefined DomainLocal;
//! Type used for coordinate vectors in the world domain
typedef ImplementationDefined DomainGlobal;
//! \}
//! \name Range properties (global range only)
//! \{
//! Field type of the range
typedef ImplementationDefined RangeField;
//! Dimension of the range values
static const std::size_t dimRange = implementationDefined;
//! Type used for range values
typedef ImplementationDefined Range;
//! \}
//! Jacobian properties
/**
* \note The Jacobian should be some matrix type with \c dimRange x
* \c dimDomainGlobal components of type \c RangeField.
*/
typedef ImplementationDefined Jacobian;
//! maximum number of partial derivatives supported
static const std::size_t diffOrder = implementationDefined;
};
//! Number of shape functions
std::size_t size () const;
//! Polynomial order of the shape functions for quadrature
std::size_t order () const;
//! Evaluate all shape functions at given position
void evaluateFunction(const Traits::DomainLocal& in,
std::vector<Traits::Range>& out) const;
//! Evaluate Jacobian of all shape functions at given position
/**
* Note: Only required for Traits::diffOrder >= 1
*/
void evaluateJacobian(const Traits::DomainLocal& in,
std::vector<Traits::Jacobian>& out) const;
//! Evaluate derivatives of all shape functions at given position
/**
* \note Only required for Traits::diffOrder >= 2
*/
void evaluate
( const std::array<std::size_t, Traits::dimDomainGlobal>& directions,
const Traits::DomainLocal& in,
std::vector<Traits::Range>& out) const;
};
//! Interface for global-valued interpolation
struct InterpolationInterface
{
//! Export basis traits
/**
* This should be the traits class of the corresponding basis.
*/
typedef BasisInterface::Traits Traits;
//! Determine coefficients interpolating a given function
/**
* \param f An object supporting the expression \c f.evaluate(x,y),
* where \c x is of type \c Traits::DomainLocal and \c y of the
* type \c Traits::Range. When \c f.evaluate(x,y) is
* evaluated, \c x will be a local coordinate , and the
* expression should set \c y to the function value at that
* position. The initial value of \c y should not be used.
* \param out Vector where to store the interpolated coefficients.
*/
template<typename F, typename C>
void interpolate (const F& f, std::vector<C>& out) const;
};
//! Interface for global-valued coefficients
/**
* \note This interface is listed separately only to keep it together with
* the other global-valued interfaces. It is identical to the
* interface for local coefficients.
*/
struct CoefficientsInterface
{
//! number of coefficients
std::size_t size() const;
//! get i'th index
const LocalKey& localKey(std::size_t i) const;
};
}
#endif // DUNE_LOCALFUNCTIONS_INTERFACE_HH
|