template<class FES, class Derived>
GridFunctionBase class
Base class for grid function objects.
Abstract base class for GridFunction objects.
This class contains the common routines for the behaviour of a GridFunction object. It provides a common interface for the manipulation of its data and weights, as well as projection utilities and convenience functions.
Data layout
The data of the GridFunctionBase object can be accessed via a call to getData(). The i-th column of the returned Math::
const auto& data = gf.getData(); assert(data.rows() == gf.getFiniteElementSpace().getVectorDimension()); assert(data.cols() == gf.getFiniteElementSpace().getSize());
Base classes
-
template<class StrictType>class LazyEvaluator<GridFunctionBase<FES, Derived>>
- Represents the lazy evaluation of a mesh function.
Public types
-
using RangeType = typename FormLanguage::
Traits<FESType>::RangeType - Range type of value.
-
using MeshType = Geometry::
Mesh<Context:: Sequential> - Type of mesh on which the finite element space is built.
-
using ContextType = Context::
Sequential - Represents the Context of the P1 space.
-
using ElementType = typename FormLanguage::
Traits<FESType>::ElementType - Type of finite element.
- using Parent = LazyEvaluator<GridFunctionBase<FESType, Derived>>
- Parent class.
Public functions
- auto max() const -> ScalarType constexpr
- Searches for the maximum value in the grid function data.
- auto min() const -> ScalarType constexpr
- Searches the minimum value in the grid function data.
- auto operator=(const RangeType& v) -> Derived&
- Bulk assigns the value to the whole data array.
-
template<class NestedDerived>auto operator=(const FunctionBase<NestedDerived>& fn) -> Derived&
- Projection of a function.
- auto operator+=(const ScalarType& rhs) -> Derived&
- Addition of a scalar value.
- auto operator-=(const ScalarType& rhs) -> Derived&
- Substraction of a scalar value.
- auto operator*=(const ScalarType& rhs) -> Derived&
- Multiplication by a scalar value.
- auto operator/=(const ScalarType& rhs) -> Derived&
- Division by a scalar value.
-
auto project(std::function<RangeType(const Geometry::
Point&)> fn, Geometry:: Attribute attr) -> auto& - Projects a scalar valued function on the region of the mesh with the given attribute.
-
template<class NestedDerived>auto project(const FunctionBase<NestedDerived>& fn, Geometry::
Attribute attr) -> Derived& - Projects a FunctionBase instance.
-
template<class NestedDerived>auto project(const FunctionBase<NestedDerived>& fn, const FlatSet<Geometry::
Attribute>& attrs) -> Derived& - Projects a FunctionBase instance on the grid function.
-
template<class Matrix>auto setData(Matrix&& data) const -> Derived& constexpr
- Returns a constant reference to the GridFunction data.
- auto getData() -> auto& constexpr
- Returns a constant reference to the GridFunction data.
- auto getData() const -> const DataType& constexpr
- Returns a constant reference to the GridFunction data.
- auto setWeights() -> Derived&
- Computes the weights from the data.
-
template<class Vector>auto setWeights(Vector&& weights) -> Derived&
- Sets the weights in the GridFunction object and computes the values at all the degrees of freedom.
-
template<class Vector, class Matrix>auto setWeightsAndData(Vector&& weights, Matrix&& data) -> Derived&
- Sets the weights and data in the GridFunction object. No computation is performed.
- auto getValue(const std::pair<size_t, Index>& p, size_t local) const -> auto
- Gets the value at the given polytope on the local degree of freedom.
- auto getValue(Index global) const -> auto
- Gets the value of the GridFunction at the global degree of freedom index.
-
void getValue(RangeType& res,
const Geometry::
Point& p) const - Gets the interpolated value at the point.
-
void interpolate(RangeType& res,
const Geometry::
Point& p) const constexpr - Interpolates the GridFunction at the given point.
Function documentation
template<class FES, class Derived>
ScalarType Rodin:: Variational:: GridFunctionBase<FES, Derived>:: max() const constexpr
Searches for the maximum value in the grid function data.
Returns | Maximum value in grid function. |
---|
This function will compute the maximum value in the grid function data array.
Complexity
The operation is linear in the size of the number of entries in the underlying matrix.
template<class FES, class Derived>
ScalarType Rodin:: Variational:: GridFunctionBase<FES, Derived>:: min() const constexpr
Searches the minimum value in the grid function data.
Returns | Minimum value in grid function. |
---|
This function will compute the minimum value in the grid function data array.
Complexity
The operation is linear in the size of the number of entries in the underlying matrix.
template<class FES, class Derived>
auto& Rodin:: Variational:: GridFunctionBase<FES, Derived>:: project(std::function<RangeType(const Geometry:: Point&)> fn,
Geometry:: Attribute attr)
Projects a scalar valued function on the region of the mesh with the given attribute.
Parameters | |
---|---|
fn in | Scalar valued function |
attr in | Attribute |
template<class FES, class Derived>
template<class NestedDerived>
Derived& Rodin:: Variational:: GridFunctionBase<FES, Derived>:: project(const FunctionBase<NestedDerived>& fn,
Geometry:: Attribute attr)
Projects a FunctionBase instance.
This function will project a FunctionBase instance on the domain elements with the given attribute.
It is a convenience function to call project(const FunctionBase&, const FlatSet<Geometry::Atribute>&) with one attribute.
template<class FES, class Derived>
template<class NestedDerived>
Derived& Rodin:: Variational:: GridFunctionBase<FES, Derived>:: project(const FunctionBase<NestedDerived>& fn,
const FlatSet<Geometry:: Attribute>& attrs)
Projects a FunctionBase instance on the grid function.
This function will project a FunctionBase instance on the domain elements with the given attributes. If the attribute set is empty, this function will project over all elements in the mesh.
template<class FES, class Derived>
Derived& Rodin:: Variational:: GridFunctionBase<FES, Derived>:: setWeights()
Computes the weights from the data.
template<class FES, class Derived>
template<class Vector>
Derived& Rodin:: Variational:: GridFunctionBase<FES, Derived>:: setWeights(Vector&& weights)
Sets the weights in the GridFunction object and computes the values at all the degrees of freedom.
template<class FES, class Derived>
void Rodin:: Variational:: GridFunctionBase<FES, Derived>:: interpolate(RangeType& res,
const Geometry:: Point& p) const constexpr
Interpolates the GridFunction at the given point.