CubbyFlow::CustomScalarField< N > Class Template Referencefinal

N-D scalar field with custom field function. More...

#include <Core/Field/CustomScalarField.hpp>

Inheritance diagram for CubbyFlow::CustomScalarField< N >:
CubbyFlow::ScalarField< N > CubbyFlow::Field< N >

Classes

class  Builder
 Front-end to create CustomScalarField objects step by step. More...
 

Public Member Functions

 CustomScalarField (std::function< double(const Vector< double, N > &)> customFunction, double derivativeResolution=1e-3)
 Constructs a field with given function. More...
 
 CustomScalarField (std::function< double(const Vector< double, N > &)> customFunction, std::function< Vector< double, N >(const Vector< double, N > &)> customGradientFunction, double derivativeResolution=1e-3)
 Constructs a field with given field and gradient function. More...
 
 CustomScalarField (std::function< double(const Vector< double, N > &)> customFunction, std::function< Vector< double, N >(const Vector< double, N > &)> customGradientFunction, std::function< double(const Vector< double, N > &)> customLaplacianFunction)
 Constructs a field with given field, gradient, and Laplacian function. More...
 
double Sample (const Vector< double, N > &x) const override
 Returns the sampled value at given position x. More...
 
std::function< double(const Vector< double, N > &)> Sampler () const override
 Returns the sampler function. More...
 
Vector< double, N > Gradient (const Vector< double, N > &x) const override
 Returns the gradient vector at given position x. More...
 
double Laplacian (const Vector< double, N > &x) const override
 Returns the Laplacian at given position x. More...
 
- Public Member Functions inherited from CubbyFlow::ScalarField< N >
 ScalarField ()=default
 Default constructor. More...
 
 ~ScalarField () override=default
 Default destructor. More...
 
 ScalarField (const ScalarField &)=default
 Default copy constructor. More...
 
 ScalarField (ScalarField &&) noexcept=default
 Default move constructor. More...
 
ScalarFieldoperator= (const ScalarField &)=default
 Default copy assignment operator. More...
 
ScalarFieldoperator= (ScalarField &&) noexcept=default
 Default move assignment operator. More...
 
- Public Member Functions inherited from CubbyFlow::Field< N >
 Field ()=default
 Default constructor. More...
 
virtual ~Field ()=default
 Default virtual destructor. More...
 
 Field (const Field &)=default
 Default copy constructor. More...
 
 Field (Field &&) noexcept=default
 Default move constructor. More...
 
Fieldoperator= (const Field &)=default
 Default copy assignment operator. More...
 
Fieldoperator= (Field &&) noexcept=default
 Default move assignment operator. More...
 

Static Public Member Functions

static Builder GetBuilder ()
 Returns builder for CustomScalarField. More...
 

Detailed Description

template<size_t N>
class CubbyFlow::CustomScalarField< N >

N-D scalar field with custom field function.

Constructor & Destructor Documentation

◆ CustomScalarField() [1/3]

template<size_t N>
CubbyFlow::CustomScalarField< N >::CustomScalarField ( std::function< double(const Vector< double, N > &)>  customFunction,
double  derivativeResolution = 1e-3 
)

Constructs a field with given function.

This constructor creates a field with user-provided function object. To compute derivatives, such as gradient and Laplacian, finite differencing is used. Thus, the differencing resolution also can be provided as the last parameter.

◆ CustomScalarField() [2/3]

template<size_t N>
CubbyFlow::CustomScalarField< N >::CustomScalarField ( std::function< double(const Vector< double, N > &)>  customFunction,
std::function< Vector< double, N >(const Vector< double, N > &)>  customGradientFunction,
double  derivativeResolution = 1e-3 
)

Constructs a field with given field and gradient function.

This constructor creates a field with user-provided field and gradient function objects. To compute Laplacian, finite differencing is used. Thus, the differencing resolution also can be provided as the last parameter.

◆ CustomScalarField() [3/3]

template<size_t N>
CubbyFlow::CustomScalarField< N >::CustomScalarField ( std::function< double(const Vector< double, N > &)>  customFunction,
std::function< Vector< double, N >(const Vector< double, N > &)>  customGradientFunction,
std::function< double(const Vector< double, N > &)>  customLaplacianFunction 
)

Constructs a field with given field, gradient, and Laplacian function.

Member Function Documentation

◆ GetBuilder()

template<size_t N>
static Builder CubbyFlow::CustomScalarField< N >::GetBuilder ( )
static

Returns builder for CustomScalarField.

◆ Gradient()

template<size_t N>
Vector<double, N> CubbyFlow::CustomScalarField< N >::Gradient ( const Vector< double, N > &  x) const
overridevirtual

Returns the gradient vector at given position x.

Reimplemented from CubbyFlow::ScalarField< N >.

◆ Laplacian()

template<size_t N>
double CubbyFlow::CustomScalarField< N >::Laplacian ( const Vector< double, N > &  x) const
overridevirtual

Returns the Laplacian at given position x.

Reimplemented from CubbyFlow::ScalarField< N >.

◆ Sample()

template<size_t N>
double CubbyFlow::CustomScalarField< N >::Sample ( const Vector< double, N > &  x) const
overridevirtual

Returns the sampled value at given position x.

Implements CubbyFlow::ScalarField< N >.

◆ Sampler()

template<size_t N>
std::function<double(const Vector<double, N>&)> CubbyFlow::CustomScalarField< N >::Sampler ( ) const
overridevirtual

Returns the sampler function.

Reimplemented from CubbyFlow::ScalarField< N >.


The documentation for this class was generated from the following file: