IBAMR  IBAMR version 0.20.
Classes | Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
IBTK::CartGridPointwiseFunction< Value, Data, Function > Class Template Reference

Initialize or transform Cartesian patch-interior values with a functor. More...

#include <ibtk/CartGridPointwiseFunction.h>

Inheritance diagram for IBTK::CartGridPointwiseFunction< Value, Data, Function >:
Inheritance graph
[legend]

Classes

struct  Centering
 
struct  Values
 

Public Member Functions

 CartGridPointwiseFunction (std::string object_name, Function function)
 Construct a scalar or vector function, owning the supplied functor. More...
 
 CartGridPointwiseFunction (std::string object_name, Function function, TensorStorage storage)
 Construct a MatrixNd function with explicit tensor storage. More...
 
bool isTimeDependent () const override
 Conservatively report that the supplied function depends on time. More...
 
void setDataOnPatch (int data_idx, SAMRAI::tbox::Pointer< SAMRAI::hier::Variable< NDIM >> var, SAMRAI::tbox::Pointer< SAMRAI::hier::Patch< NDIM >> patch, double data_time, bool initial_time=false, SAMRAI::tbox::Pointer< SAMRAI::hier::PatchLevel< NDIM >> patch_level=nullptr) override
 Apply the callback to the allocated double-precision patch data. More...
 

Private Member Functions

void applyPointwise (Data &data, const SAMRAI::hier::Box< NDIM > &box, const SAMRAI::geom::CartesianPatchGeometry< NDIM > &geometry, double time)
 Evaluate the callback on patch-interior data of the selected centering. More...
 

Private Attributes

Function d_function
 
TensorStorage d_tensor_storage
 

Static Private Attributes

static constexpr bool s_initializes = std::is_invocable_r_v<Value, Function&, const VectorNd&, double, int, int>
 
static constexpr bool s_transforms
 

Methods to set patch interior data.

virtual void setDataOnPatchHierarchy (int data_idx, SAMRAI::tbox::Pointer< SAMRAI::hier::Variable< NDIM >> var, SAMRAI::tbox::Pointer< SAMRAI::hier::PatchHierarchy< NDIM >> hierarchy, double data_time, bool initial_time=false, int coarsest_ln=invalid_level_number, int finest_ln=invalid_level_number)
 Evaluate the function on the patch interiors on the specified levels of the patch hierarchy using the virtual function setDataOnPatch(). More...
 
virtual void setDataOnPatchLevel (int data_idx, SAMRAI::tbox::Pointer< SAMRAI::hier::Variable< NDIM >> var, SAMRAI::tbox::Pointer< SAMRAI::hier::PatchLevel< NDIM >> patch_level, double data_time, bool initial_time=false)
 Evaluate the function on the patch interiors on the specified level of the patch hierarchy using the virtual function setDataOnPatch(). More...
 
std::string d_object_name
 

Detailed Description

template<typename Value, typename Data, typename Function>
class IBTK::CartGridPointwiseFunction< Value, Data, Function >

Data must be CellData, NodeData, SideData, FaceData, or EdgeData with dimension NDIM and scalar type double. Each object supports that centering; data indices supplied at evaluation must refer to allocated data of the corresponding type. This precondition is checked in Debug builds; Release builds use an unchecked static_cast.

Value must be double, VectorNd, VectorXd, or MatrixNd. A double callback is evaluated independently for every depth. VectorNd requires depth NDIM; VectorXd uses the complete depth vector. MatrixNd requires an explicit TensorStorage and the corresponding depth. Symmetric tensor callbacks must return symmetric matrices (checked with Eigen::isApprox()).

Function must support exactly one of these signatures. Scalar results must be convertible to double; vector/tensor results may be Value or compatible Eigen expressions:

Value(const VectorNd& x, double time, int depth, int axis);
Value(const Value& q, const VectorNd& x, double time, int depth, int axis);
Eigen::Matrix< double, NDIM, 1 > VectorNd
Definition: ibtk_utilities.h:299

The first signature initializes data without reading its previous contents. The second transforms initialized data in place. The inherited initial_time argument does not change which signature is invoked.

depth is the scalar depth index, or zero for whole-vector/tensor callbacks. axis is the orientation for side-, face-, and edge-centered data, or invalid_index for cell- and node-centered data. All supported centerings permit collocated values stored across their depths. Components at different staggered locations are never reconstructed into a vector or tensor.

Ghost values are neither read nor modified. Shared patch-boundary values are evaluated on each patch holding them; no synchronization is performed. Callbacks must not modify other patch values through captured references.

See also
make_cart_grid_pointwise_function()

Constructor & Destructor Documentation

◆ CartGridPointwiseFunction() [1/2]

template<typename Value , typename Data , typename Function >
IBTK::CartGridPointwiseFunction< Value, Data, Function >::CartGridPointwiseFunction ( std::string  object_name,
Function  function 
)

◆ CartGridPointwiseFunction() [2/2]

template<typename Value , typename Data , typename Function >
IBTK::CartGridPointwiseFunction< Value, Data, Function >::CartGridPointwiseFunction ( std::string  object_name,
Function  function,
TensorStorage  storage 
)

Member Function Documentation

◆ isTimeDependent()

template<typename Value , typename Data , typename Function >
bool IBTK::CartGridPointwiseFunction< Value, Data, Function >::isTimeDependent
overridevirtual

◆ setDataOnPatch()

template<typename Value , typename Data , typename Function >
void IBTK::CartGridPointwiseFunction< Value, Data, Function >::setDataOnPatch ( int  data_idx,
SAMRAI::tbox::Pointer< SAMRAI::hier::Variable< NDIM >>  var,
SAMRAI::tbox::Pointer< SAMRAI::hier::Patch< NDIM >>  patch,
double  data_time,
bool  initial_time = false,
SAMRAI::tbox::Pointer< SAMRAI::hier::PatchLevel< NDIM >>  patch_level = nullptr 
)
overridevirtual

◆ applyPointwise()

template<typename Value , typename Data , typename Function >
void IBTK::CartGridPointwiseFunction< Value, Data, Function >::applyPointwise ( Data &  data,
const SAMRAI::hier::Box< NDIM > &  box,
const SAMRAI::geom::CartesianPatchGeometry< NDIM > &  geometry,
double  time 
)
private

◆ setDataOnPatchHierarchy()

virtual void IBTK::CartGridFunction::setDataOnPatchHierarchy ( int  data_idx,
SAMRAI::tbox::Pointer< SAMRAI::hier::Variable< NDIM >>  var,
SAMRAI::tbox::Pointer< SAMRAI::hier::PatchHierarchy< NDIM >>  hierarchy,
double  data_time,
bool  initial_time = false,
int  coarsest_ln = invalid_level_number,
int  finest_ln = invalid_level_number 
)
virtualinherited

◆ setDataOnPatchLevel()

virtual void IBTK::CartGridFunction::setDataOnPatchLevel ( int  data_idx,
SAMRAI::tbox::Pointer< SAMRAI::hier::Variable< NDIM >>  var,
SAMRAI::tbox::Pointer< SAMRAI::hier::PatchLevel< NDIM >>  patch_level,
double  data_time,
bool  initial_time = false 
)
virtualinherited

Member Data Documentation

◆ s_initializes

template<typename Value , typename Data , typename Function >
constexpr bool IBTK::CartGridPointwiseFunction< Value, Data, Function >::s_initializes = std::is_invocable_r_v<Value, Function&, const VectorNd&, double, int, int>
staticconstexprprivate

◆ s_transforms

template<typename Value , typename Data , typename Function >
constexpr bool IBTK::CartGridPointwiseFunction< Value, Data, Function >::s_transforms
staticconstexprprivate
Initial value:
=
std::is_invocable_r_v<Value, Function&, const Value&, const VectorNd&, double, int, int>

◆ d_function

template<typename Value , typename Data , typename Function >
Function IBTK::CartGridPointwiseFunction< Value, Data, Function >::d_function
private

◆ d_tensor_storage

template<typename Value , typename Data , typename Function >
TensorStorage IBTK::CartGridPointwiseFunction< Value, Data, Function >::d_tensor_storage
private

◆ d_object_name

std::string IBTK::CartGridFunction::d_object_name
protectedinherited

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