IBAMR
An adaptive and distributed-memory parallel implementation of the immersed boundary (IB) method
Static Public Member Functions | List of all members
IBTK::IndexUtilities Class Reference

Class IndexUtilities is a utility class that defines simple functions such as conversion routines between physical coordinates and Cartesian index space. More...

#include </home/runner/work/IBAMR/IBAMR/ibtk/include/ibtk/IndexUtilities.h>

Static Public Member Functions

static SAMRAI::hier::Index< NDIM > coarsen (const SAMRAI::hier::Index< NDIM > &i_fine, const SAMRAI::hier::Index< NDIM > &ratio)
 
static SAMRAI::hier::Index< NDIM > refine (const SAMRAI::hier::Index< NDIM > &i_coarsen, const SAMRAI::hier::Index< NDIM > &ratio)
 
template<class DoubleArray >
static SAMRAI::hier::Index< NDIM > getCellIndex (const DoubleArray &X, const double *x_lower, const double *x_upper, const double *dx, const SAMRAI::hier::Index< NDIM > &ilower, const SAMRAI::hier::Index< NDIM > &iupper)
 
template<class DoubleArray >
static SAMRAI::hier::Index< NDIM > getCellIndex (const DoubleArray &X, const SAMRAI::tbox::Pointer< SAMRAI::geom::CartesianPatchGeometry< NDIM > > &patch_geom, const SAMRAI::hier::Box< NDIM > &patch_box)
 
template<class DoubleArray >
static SAMRAI::hier::Index< NDIM > getCellIndex (const DoubleArray &X, const SAMRAI::tbox::Pointer< SAMRAI::geom::CartesianGridGeometry< NDIM > > &grid_geom, const SAMRAI::hier::IntVector< NDIM > &ratio)
 
template<class DoubleArray >
static SAMRAI::hier::Index< NDIM > getAssignedCellIndex (const DoubleArray &X, const SAMRAI::tbox::Pointer< SAMRAI::geom::CartesianGridGeometry< NDIM > > &grid_geom, const SAMRAI::hier::IntVector< NDIM > &ratio)
 
template<typename Vector >
static Vector getCellCenter (const SAMRAI::hier::Patch< NDIM > &patch, const SAMRAI::pdat::CellIndex< NDIM > &cell_idx)
 
static IBTK::VectorNd getCellCenter (const SAMRAI::hier::Patch< NDIM > &patch, const SAMRAI::pdat::CellIndex< NDIM > &cell_idx)
 
template<typename Vector >
static Vector getCellCenter (const SAMRAI::tbox::Pointer< SAMRAI::geom::CartesianGridGeometry< NDIM > > &grid_geom, const SAMRAI::hier::IntVector< NDIM > &ratio, const SAMRAI::pdat::CellIndex< NDIM > &cell_idx)
 
template<typename Vector >
static Vector getSideCenter (const SAMRAI::hier::Patch< NDIM > &patch, const SAMRAI::pdat::SideIndex< NDIM > &side_idx)
 
static IBTK::VectorNd getSideCenter (const SAMRAI::hier::Patch< NDIM > &patch, const SAMRAI::pdat::SideIndex< NDIM > &side_idx)
 
template<typename Vector >
static Vector getSideCenter (const SAMRAI::tbox::Pointer< SAMRAI::geom::CartesianGridGeometry< NDIM > > &grid_geom, const SAMRAI::hier::IntVector< NDIM > &ratio, const SAMRAI::pdat::SideIndex< NDIM > &side_idx)
 
static IBTK::VectorNd getSideCenter (const SAMRAI::tbox::Pointer< SAMRAI::geom::CartesianGridGeometry< NDIM > > &grid_geom, const SAMRAI::hier::IntVector< NDIM > &ratio, const SAMRAI::pdat::SideIndex< NDIM > &side_idx)
 
static int mapIndexToInteger (const SAMRAI::hier::Index< NDIM > &i, const SAMRAI::hier::Index< NDIM > &domain_lower, const SAMRAI::hier::Index< NDIM > &num_cells, const int depth, const int offset=0, const SAMRAI::hier::IntVector< NDIM > &periodic_shift=SAMRAI::hier::IntVector< NDIM >(0))
 Map (i,j,k,d) index for a DOF defined for a SAMRAI variable on a particular patch level to a positive integer. Such a mapping can be useful for creating an application ordering (AO) between SAMRAI and PETSc data structures. More...
 
static SAMRAI::hier::IntVector< NDIM > partitionPatchBox (std::vector< SAMRAI::hier::Box< NDIM > > &overlap_boxes, std::vector< SAMRAI::hier::Box< NDIM > > &nonoverlap_boxes, const SAMRAI::hier::Box< NDIM > &patch_box, const SAMRAI::hier::IntVector< NDIM > &box_size, const SAMRAI::hier::IntVector< NDIM > &overlap_size)
 Partition a patch box into subdomains of size box_size and into equal number of overlapping subdomains whose overlap region is defined by overlap_size. More...
 

Detailed Description

Class IndexUtilities is a utility class that defines simple functions such as conversion routines between physical coordinates and Cartesian index space.

Member Function Documentation

◆ getAssignedCellIndex()

template<class DoubleArray >
SAMRAI::hier::Index< NDIM > IBTK::IndexUtilities::getAssignedCellIndex ( const DoubleArray &  X,
const SAMRAI::tbox::Pointer< SAMRAI::geom::CartesianGridGeometry< NDIM > > &  grid_geom,
const SAMRAI::hier::IntVector< NDIM > &  ratio 
)
inlinestatic
Returns
The cell index corresponding to location X relative to the corner of the computational domain specified by the grid geometry object. Unlike getCellIndex(), this function assigns points on upper boundaries to the cells inside the domain (instead of in the ghost region) which makes it more suitable for partitioning purposes.

This function does not shift points on periodic domains. It is up to the caller to correctly shift X with respect to periodicity before calling this function.

See also
SAMRAI::geom::CartesianGridGeometry

◆ getCellCenter() [1/3]

template<typename Vector >
Vector IBTK::IndexUtilities::getCellCenter ( const SAMRAI::hier::Patch< NDIM > &  patch,
const SAMRAI::pdat::CellIndex< NDIM > &  cell_idx 
)
inlinestatic
Returns
The spatial coordinate of the given cell center.
Parameters
patchThe patch on which the cell lives.
cell_idxThe CellIndex describing the current cell.

◆ getCellCenter() [2/3]

VectorNd IBTK::IndexUtilities::getCellCenter ( const SAMRAI::hier::Patch< NDIM > &  patch,
const SAMRAI::pdat::CellIndex< NDIM > &  cell_idx 
)
inlinestatic
Returns
The spatial coordinate of the given cell center.
Parameters
patchThe patch on which the cell lives.
cell_idxThe CellIndex describing the current cell.

◆ getCellCenter() [3/3]

template<typename Vector >
Vector IBTK::IndexUtilities::getCellCenter ( const SAMRAI::tbox::Pointer< SAMRAI::geom::CartesianGridGeometry< NDIM > > &  grid_geom,
const SAMRAI::hier::IntVector< NDIM > &  ratio,
const SAMRAI::pdat::CellIndex< NDIM > &  cell_idx 
)
inlinestatic
Returns
The spatial coordinate of the given cell center.
Parameters
grid_geomThe grid geometry provides the extents of the computational domain.
ratioRefinement ratio.
cell_idxThe CellIndex describing the current cell.

◆ getCellIndex() [1/3]

template<class DoubleArray >
SAMRAI::hier::Index< NDIM > IBTK::IndexUtilities::getCellIndex ( const DoubleArray &  X,
const double *  x_lower,
const double *  x_upper,
const double *  dx,
const SAMRAI::hier::Index< NDIM > &  ilower,
const SAMRAI::hier::Index< NDIM > &  iupper 
)
inlinestatic
Returns
The cell index corresponding to location X relative to x_lower and x_upper for the specified Cartesian grid spacings dx and box extents ilower and iupper.
Note
Because of round-off error in floating point, this routine cannot guarantee that the same spatial location X is assigned the same cell index for different patches. To obtain a unique index, use the globalized version.
See also
SAMRAI::geom::CartesianPatchGeometry
SAMRAI::geom::CartesianPatchGeometry

◆ getCellIndex() [2/3]

template<class DoubleArray >
SAMRAI::hier::Index< NDIM > IBTK::IndexUtilities::getCellIndex ( const DoubleArray &  X,
const SAMRAI::tbox::Pointer< SAMRAI::geom::CartesianGridGeometry< NDIM > > &  grid_geom,
const SAMRAI::hier::IntVector< NDIM > &  ratio 
)
inlinestatic
Returns
The cell index corresponding to location X relative to the corner of the computational domain specified by the grid geometry object.
See also
SAMRAI::geom::CartesianGridGeometry

◆ getCellIndex() [3/3]

template<class DoubleArray >
SAMRAI::hier::Index< NDIM > IBTK::IndexUtilities::getCellIndex ( const DoubleArray &  X,
const SAMRAI::tbox::Pointer< SAMRAI::geom::CartesianPatchGeometry< NDIM > > &  patch_geom,
const SAMRAI::hier::Box< NDIM > &  patch_box 
)
inlinestatic
Returns
The cell index corresponding to location X relative to the extents of the supplied Cartesian grid patch geometry and patch box.
Note
Because of round-off error in floating point, this routine cannot guarantee that the same spatial location X is assigned the same cell index for different patches. To obtain a unique index, use the globalized version (i.e., the one that uses a SAMRAI::geom::CartesianGridGeometry) instead.
See also
SAMRAI::geom::CartesianPatchGeometry

◆ getSideCenter() [1/4]

template<typename Vector >
Vector IBTK::IndexUtilities::getSideCenter ( const SAMRAI::hier::Patch< NDIM > &  patch,
const SAMRAI::pdat::SideIndex< NDIM > &  side_idx 
)
inlinestatic
Returns
The spatial coordinate of the given side center.
Parameters
patchThe patch on which the cell lives.
side_idxThe SideIndex describing the current side.

◆ getSideCenter() [2/4]

VectorNd IBTK::IndexUtilities::getSideCenter ( const SAMRAI::hier::Patch< NDIM > &  patch,
const SAMRAI::pdat::SideIndex< NDIM > &  side_idx 
)
inlinestatic
Returns
The spatial coordinate of the given side center.
Parameters
patchThe patch on which the cell lives.
side_idxThe SideIndex describing the current side.

◆ getSideCenter() [3/4]

template<typename Vector >
Vector IBTK::IndexUtilities::getSideCenter ( const SAMRAI::tbox::Pointer< SAMRAI::geom::CartesianGridGeometry< NDIM > > &  grid_geom,
const SAMRAI::hier::IntVector< NDIM > &  ratio,
const SAMRAI::pdat::SideIndex< NDIM > &  side_idx 
)
inlinestatic
Returns
The spatial coordinate of the given side center.
Parameters
grid_geomThe grid geometry provides the extents of the computational domain.
ratioRefinement ratio.
side_idxThe SideIndex describing the current side.

◆ getSideCenter() [4/4]

VectorNd IBTK::IndexUtilities::getSideCenter ( const SAMRAI::tbox::Pointer< SAMRAI::geom::CartesianGridGeometry< NDIM > > &  grid_geom,
const SAMRAI::hier::IntVector< NDIM > &  ratio,
const SAMRAI::pdat::SideIndex< NDIM > &  side_idx 
)
inlinestatic
Returns
The spatial coordinate of the given side center.
Parameters
grid_geomThe grid geometry provides the extents of the computational domain.
ratioRefinement ratio.
side_idxThe SideIndex describing the current side.

◆ mapIndexToInteger()

int IBTK::IndexUtilities::mapIndexToInteger ( const SAMRAI::hier::Index< NDIM > &  i,
const SAMRAI::hier::Index< NDIM > &  domain_lower,
const SAMRAI::hier::Index< NDIM > &  num_cells,
const int  depth,
const int  offset = 0,
const SAMRAI::hier::IntVector< NDIM > &  periodic_shift = SAMRAI::hier::IntVector<NDIM>(0) 
)
inlinestatic

Map (i,j,k,d) index for a DOF defined for a SAMRAI variable on a particular patch level to a positive integer. Such a mapping can be useful for creating an application ordering (AO) between SAMRAI and PETSc data structures.

Parameters
iAMR index representing the (i,j,k) array data index for a variable on particular patch level.
domain_lowerLower index of the domain for that patch level, assuming that the patch level covers the entire domain.
num_cellsNumber of data array cells for a patch level, which is assumed to cover the entire domain. It can be thought of size of the rectangular array that can store the variable data for the patch level that covers the entire domain. For a cc-variable the number of data array cells are same as patch level cells. For a sc-variable, the number of cells for the normal component exceeds the patch level cells by 1 in the normal direction.
depthData depth.
offsetComponent offset. This is useful for getting unique values for different components of the variable, e.g., a sc-variable. Different components can have different depth.
periodic_shiftPeriodic shift in each direction.
Returns
The linear mapping of an AMR index to a continuous non-negative integer space.

◆ partitionPatchBox()

SAMRAI::hier::IntVector< NDIM > IBTK::IndexUtilities::partitionPatchBox ( std::vector< SAMRAI::hier::Box< NDIM > > &  overlap_boxes,
std::vector< SAMRAI::hier::Box< NDIM > > &  nonoverlap_boxes,
const SAMRAI::hier::Box< NDIM > &  patch_box,
const SAMRAI::hier::IntVector< NDIM > &  box_size,
const SAMRAI::hier::IntVector< NDIM > &  overlap_size 
)
inlinestatic

Partition a patch box into subdomains of size box_size and into equal number of overlapping subdomains whose overlap region is defined by overlap_size.

Returns
Total number of subdomains the patch box got partitioned intoin various dimensions.
Note
The overlap boxes are obtained from nonoverlap_boxes by growing them suitably.

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