A function over a discrete function space. More...
#include <ptems/discretefunction.hpp>
Public Types | |
typedef X | value_type |
The value of the components of the return type of the function. More... | |
typedef std::vector< X >::size_type | size_type |
The type to use for the number of degrees of freedom in the function. More... | |
typedef std::vector< X >::iterator< X > | iterator |
Type for an iterator over the degrees of freedom of the function. More... | |
typedef std::vector< X >::const_iterator< X > | const_iterator |
Type for a const iterator over the degrees of freedom of the function. More... | |
typedef std::reverse_iterator< iterator >< X > | reverse_iterator |
Type for an iterator over the degrees of freedom of the function in reverse. More... | |
typedef std::reverse_iterator< const_iterator >< X > | const_reverse_iterator |
Type for a const iterator over the degrees of freedom of the function in reverse. More... | |
Public Member Functions | |
template<std::size_t S, typename = std::enable_if_t<(S == N) && (S == LEN)>> | |
DiscreteFunction (const PDiscreteFunctionSpace< DIM, X, S > &space) | |
Creates a function in the specified function space. More... | |
template<std::size_t S, typename = std::enable_if_t<(S == N) && (S == LEN)>> | |
DiscreteFunction (const PDiscreteFunctionSpace< DIM, X, S > &space, X value) | |
Creates a function in the specified function space, with initial constant function value. More... | |
template<std::size_t S, typename... T, typename = std::enable_if_t<(sizeof...(T) == N) && (S == N) && (S == LEN)>> | |
DiscreteFunction (const PDiscreteFunctionSpace< DIM, X, S > &space, T... values) | |
Creates a function in the specified function space, with initial constant function value. More... | |
template<std::size_t S, typename = std::enable_if_t<(S == N) && (S == LEN)>> | |
DiscreteFunction & | operator= (const PDiscreteFunctionSpace< DIM, X, S > &space) |
Reset this function to be a function over the specified space. More... | |
size_type | size () const |
Gets the number of degrees of freedom in the function. More... | |
X & | operator[] (std::size_t idx) |
Gets a mutable reference to the degree of freedom at the specified index. More... | |
const X & | operator[] (std::size_t idx) const |
Gets a const reference to the degree of freedom at the specified index. More... | |
X & | at (std::size_t idx) |
Gets a mutable reference to the degree of freedom at the specified index. More... | |
const X & | at (std::size_t idx) const |
Gets a const reference to the degree of freedom at the specified index. More... | |
const X * | data () const |
Gets a pointer to the raw C-style array of the degrees of freedom. More... | |
template<std::size_t NUM = 1, typename = std::enable_if_t<(NUM <= LEN) && (NUM > 0)>> | |
DiscreteFunction< DIM, X, N, NUM > | Components (std::size_t idx) const |
Extracts a sub-range of components from the function. More... | |
BasicVector< X, LEN > | Value (std::size_t elementIdx, const Vector< DIM > &localPt) const |
Gets the function or value projection evaluated at the specified local point of the specified element. More... | |
BasicVector< X, LEN > | operator() (std::size_t elementIdx, const Vector< DIM > &localPt) const |
Gets the function or value projection evaluated at the specified local point of the specified element. More... | |
BasicMatrix< X, LEN, DIM > | Gradient (std::size_t elementIdx, const Vector< DIM > &localPt) const |
Gets the gradient or gradient projection of the function evaluated at the specified local point of the specified element. More... | |
BasicMatrix< X, LEN, DIM > | GradientValue (std::size_t elementIdx, const Vector< DIM > &localPt) const |
Gets the gradient of the value. More... | |
std::array< FuncAndGradData< DIM, X >, LEN > | ValueAndGradient (std::size_t elementIdx, const Vector< DIM > &localPt) const |
Gets the function and gradient, or value and gradient projection, of the function evaluated at the specified local point of the specified element. More... | |
std::array< BasicMatrix< X, DIM >, LEN > | Hessian (std::size_t elementIdx, const Vector< DIM > &localPt) const |
Gets the Hessian or Hessian projection of the function evaluated at the specified local point of the specified element. More... | |
std::array< FuncGradAndHessianData< DIM, X >, LEN > | ValueGradientAndHessian (std::size_t elementIdx, const Vector< DIM > &localPt) const |
Gets the function, gradient, and Hessian (or projections of these) of the function evaluated at the specified local point of the specified element. More... | |
iterator | begin () |
Gets an iterator to the first degree of freedom. More... | |
iterator | end () |
Gets an iterator to the 'one-past-the-end' degree of freedom. More... | |
const_iterator | begin () const |
Gets a const iterator to the first degree of freedom. More... | |
const_iterator | end () const |
Gets a const iterator to the 'one-past-the-end' degree of freedom. More... | |
const_iterator | cbegin () const |
Gets a const iterator to the first degree of freedom. More... | |
const_iterator | cend () const |
Gets a const iterator to the 'one-past-the-end' degree of freedom. More... | |
reverse_iterator | rbegin () const |
Gets a reverse iterator to the last degree of freedom. More... | |
reverse_iterator | rend () const |
Gets a reverse iterator to the 'one-before-the-start' degree of freedom. More... | |
const_reverse_iterator | rbegin () |
Gets a reverse const iterator to the last degree of freedom. More... | |
const_reverse_iterator | rend () |
Gets a reverse const iterator to the 'one-before-the-start' degree of freedom. More... | |
const_reverse_iterator | crbegin () const |
Gets a reverse const iterator to the last degree of freedom. More... | |
const_reverse_iterator | crend () const |
Gets a reverse const iterator to the 'one-before-the-start' degree of freedom. More... | |
DiscreteFunction & | operator= (const std::vector< X > &dofs) |
Sets all the degrees of freedom in the function to the specified degrees of freedom. More... | |
DiscreteFunction & | operator= (std::vector< X > &&dofs) |
Sets all the degrees of freedom in the function to the specified degrees of freedom (Moves the passed vector) More... | |
DiscreteFunction | Copy () const |
Creates a copy of the current function. More... | |
DiscreteFunction< DIM, X, N, LEN > & | operator*= (X constant) |
Multiplies this function by the specified constant. More... | |
DiscreteFunction< DIM, X, N, LEN > & | operator/= (X constant) |
Divides this function by the specified constant. More... | |
DiscreteFunction< DIM, X, N, LEN > & | operator+= (X constant) |
Adds the specified constant to this function. More... | |
DiscreteFunction< DIM, X, N, LEN > & | operator-= (X constant) |
Subtracts the specified constant from this function. More... | |
DiscreteFunction< DIM, X, N, LEN > & | operator+= (const DiscreteFunction< DIM, X, N, LEN > &rhs) |
Adds the specified function to this function. More... | |
DiscreteFunction< DIM, X, N, LEN > & | operator-= (const DiscreteFunction< DIM, X, N, LEN > &rhs) |
Subtracts the specified function from this function. More... | |
void | WriteVariable (DataFileWriter< DIM > &writer, const std::string &name) const override |
Writes the function to the specified data file. More... | |
Static Public Attributes | |
static constexpr std::size_t | DomainDimension = DIM |
The dimension of the spacial domain the function is over. More... | |
static constexpr std::size_t | Dimension = LEN |
The size of the resulting return type for the function. More... | |
Friends | |
template<std::size_t D, typename T , std::size_t M> | |
class | DiscreteFunctionSpace |
A function over a discrete function space.
DIM | The dimension of the domain (and mesh) |
X | The type of the result of the functions (double, std::complex, etc) |
N | The size of the underlying vector space (N=1 for scalars) |
LEN | The size of the actual vector space for this component (N=1 for scalars) |
typedef std::vector<X>::const_iterator< X > ptems::DiscreteFunction< DIM, X, N, LEN >::const_iterator |
Type for a const iterator over the degrees of freedom of the function.
typedef std::reverse_iterator<const_iterator>< X > ptems::DiscreteFunction< DIM, X, N, LEN >::const_reverse_iterator |
Type for a const iterator over the degrees of freedom of the function in reverse.
typedef std::vector<X>::iterator< X > ptems::DiscreteFunction< DIM, X, N, LEN >::iterator |
Type for an iterator over the degrees of freedom of the function.
typedef std::reverse_iterator<iterator>< X > ptems::DiscreteFunction< DIM, X, N, LEN >::reverse_iterator |
Type for an iterator over the degrees of freedom of the function in reverse.
typedef std::vector<X>::size_type ptems::DiscreteFunction< DIM, X, N, LEN >::size_type |
The type to use for the number of degrees of freedom in the function.
typedef X ptems::DiscreteFunction< DIM, X, N, LEN >::value_type |
The value of the components of the return type of the function.
|
inlineexplicit |
Creates a function in the specified function space.
space | The function space to create this function in |
|
inline |
Creates a function in the specified function space, with initial constant function value.
space | The function space to create this function in |
value | Constant value of all components of the function |
|
inline |
Creates a function in the specified function space, with initial constant function value.
T | The type of the constant values, must be convertible to X. Must have N arguments |
space | The function space to create this function in |
values | Constant values of the components of the function. Must have N arguments |
|
inline |
Gets a mutable reference to the degree of freedom at the specified index.
std::out_of_range | If idx is not in the range [0, size()). |
idx | Index of the degree of freedom to get |
|
inline |
Gets a const reference to the degree of freedom at the specified index.
std::out_of_range | If idx is not in the range [0, size()). |
idx | Index of the degree of freedom to get |
|
inline |
Gets an iterator to the first degree of freedom.
|
inline |
Gets a const iterator to the first degree of freedom.
|
inline |
Gets a const iterator to the first degree of freedom.
|
inline |
Gets a const iterator to the 'one-past-the-end' degree of freedom.
|
inline |
Extracts a sub-range of components from the function.
NUM | The number of components to extract |
idx | The index of the first component to extract |
|
inline |
Creates a copy of the current function.
|
inline |
Gets a reverse const iterator to the last degree of freedom.
|
inline |
Gets a reverse const iterator to the 'one-before-the-start' degree of freedom.
|
inline |
Gets a pointer to the raw C-style array of the degrees of freedom.
|
inline |
Gets an iterator to the 'one-past-the-end' degree of freedom.
|
inline |
Gets a const iterator to the 'one-past-the-end' degree of freedom.
|
inline |
Gets the gradient or gradient projection of the function evaluated at the specified local point of the specified element.
The result is the Jacobian matrix; i.e, each row is the gradient of each component
elementIdx | The index of the element |
localPt | The point in the element's local coordinate system |
|
inline |
Gets the gradient of the value.
The result is the Jacobian matrix; i.e, each row is the gradient of each component
elementIdx | The index of the element |
localPt | The point in the element's local coordinate system |
|
inline |
Gets the Hessian or Hessian projection of the function evaluated at the specified local point of the specified element.
The result is the Hessian matrix for each component of the vector
elementIdx | The index of the element |
localPt | The point in the element's local coordinate system |
|
inline |
Gets the function or value projection evaluated at the specified local point of the specified element.
elementIdx | The index of the element |
localPt | The point in the element's local coordinate system |
|
inline |
Multiplies this function by the specified constant.
constant | The value to multiply the function by |
|
inline |
Adds the specified function to this function.
std::invalid_argument | If the specified function is from a different space than this function |
std::invalid_argument | If the specified function has a different size (number of DoFs) than this function |
rhs | The function to add |
|
inline |
Adds the specified constant to this function.
T | The type of the value to multiply the function by |
constant | The value to multiply the function by |
|
inline |
Subtracts the specified function from this function.
std::invalid_argument | If the specified function is from a different space than this function |
std::invalid_argument | If the specified function has a different size (number of DoFs) than this function |
rhs | The function to subtract |
|
inline |
Subtracts the specified constant from this function.
T | The type of the value to multiply the function by |
constant | The value to multiply the function by |
|
inline |
Divides this function by the specified constant.
constant | The value to multiply the function by |
|
inline |
Reset this function to be a function over the specified space.
space | The function space to define this function in |
|
inline |
Sets all the degrees of freedom in the function to the specified degrees of freedom.
dofs | The vector of the degrees of freedom for the function |
|
inline |
Sets all the degrees of freedom in the function to the specified degrees of freedom (Moves the passed vector)
dofs | The vector of the degrees of freedom for the function |
|
inline |
Gets a mutable reference to the degree of freedom at the specified index.
idx | Index of the degree of freedom to get |
|
inline |
Gets a const reference to the degree of freedom at the specified index.
idx | Index of the degree of freedom to get |
|
inline |
Gets a reverse const iterator to the last degree of freedom.
|
inline |
Gets a reverse iterator to the last degree of freedom.
|
inline |
Gets a reverse const iterator to the 'one-before-the-start' degree of freedom.
|
inline |
Gets a reverse iterator to the 'one-before-the-start' degree of freedom.
|
inline |
Gets the number of degrees of freedom in the function.
|
inline |
Gets the function or value projection evaluated at the specified local point of the specified element.
elementIdx | The index of the element |
localPt | The point in the element's local coordinate system |
|
inline |
Gets the function and gradient, or value and gradient projection, of the function evaluated at the specified local point of the specified element.
elementIdx | The index of the element |
localPt | The point in the element's local coordinate system |
|
inline |
Gets the function, gradient, and Hessian (or projections of these) of the function evaluated at the specified local point of the specified element.
elementIdx | The index of the element |
localPt | The point in the element's local coordinate system |
|
inlineoverridevirtual |
Writes the function to the specified data file.
writer | Writer for data file to write to |
name | The name to use for the output variable |
Implements ptems::WritableVariable< DIM >.
|
staticconstexpr |
The size of the resulting return type for the function.
|
staticconstexpr |
The dimension of the spacial domain the function is over.