Loading...
Searching...
No Matches
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.
 
 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.
 
 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.
 
double Sample (const Vector< double, N > &x) const override
 Returns the sampled value at given position x.
 
std::function< double(const Vector< double, N > &)> Sampler () const override
 Returns the sampler function.
 
Vector< double, NGradient (const Vector< double, N > &x) const override
 Returns the gradient vector at given position x.
 
double Laplacian (const Vector< double, N > &x) const override
 Returns the Laplacian at given position x.
 
- Public Member Functions inherited from CubbyFlow::ScalarField< N >
 ScalarField ()=default
 Default constructor.
 
 ~ScalarField () override=default
 Default destructor.
 
 ScalarField (const ScalarField &)=default
 Default copy constructor.
 
 ScalarField (ScalarField &&) noexcept=default
 Default move constructor.
 
ScalarFieldoperator= (const ScalarField &)=default
 Default copy assignment operator.
 
ScalarFieldoperator= (ScalarField &&) noexcept=default
 Default move assignment operator.
 
- Public Member Functions inherited from CubbyFlow::Field< N >
 Field ()=default
 Default constructor.
 
virtual ~Field ()=default
 Default virtual destructor.
 
 Field (const Field &)=default
 Default copy constructor.
 
 Field (Field &&) noexcept=default
 Default move constructor.
 
Fieldoperator= (const Field &)=default
 Default copy assignment operator.
 
Fieldoperator= (Field &&) noexcept=default
 Default move assignment operator.
 

Static Public Member Functions

static Builder GetBuilder ()
 Returns builder for CustomScalarField.
 

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: