Block-Structured AMR Software Framework
amrex::CoordSys Class Reference

Coordinate System. More...

#include <AMReX_CoordSys.H>

Inheritance diagram for amrex::CoordSys:
amrex::Geometry

Public Types

enum  CoordType { undef = -1 , cartesian = 0 , RZ = 1 , SPHERICAL = 2 }
 

Public Member Functions

bool Ok () const noexcept
 Is ok? More...
 
void SetCoord (CoordType coord) noexcept
 Set the CoordType. More...
 
CoordType Coord () const noexcept
 Returns the CoordType. More...
 
int CoordInt () const noexcept
 Returns the CoordType as an int. More...
 
bool IsSPHERICAL () const noexcept
 Is CoordType == SPHERICAL? More...
 
bool IsRZ () const noexcept
 Is CoordType == RZ? More...
 
bool IsCartesian () const noexcept
 Is CoordType == cartesian? More...
 
void SetOffset (const Real *x_lo) noexcept
 Sets the offset for each coordinate direction. More...
 
const Real * Offset () const noexcept
 Returns the offset. More...
 
Real Offset (int dir) const noexcept
 Returns the offset for the specified coordinate direction. More...
 
const Real * CellSize () const noexcept
 Returns the cellsize for each coordinate direction. More...
 
Real CellSize (int dir) const noexcept
 Returns the cellsize for the specified coordinate direction. More...
 
GpuArray< Real, AMREX_SPACEDIM > CellSizeArray () const noexcept
 
const Real * InvCellSize () const noexcept
 Returns the inverse cellsize for each coordinate direction. More...
 
Real InvCellSize (int dir) const noexcept
 Returns the inverse cellsize for the specified coordinate direction. More...
 
GpuArray< Real, AMREX_SPACEDIM > InvCellSizeArray () const noexcept
 
Real CellCenter (int point, int dir) const noexcept
 Returns location of cell center in specified direction. More...
 
void CellCenter (const IntVect &point, Vector< Real > &loc) const noexcept
 Return location of cell center. More...
 
void CellCenter (const IntVect &point, Real *loc) const noexcept
 Return location of cell center. More...
 
Real LoEdge (int point, int dir) const noexcept
 Returns location of lo edge in specified direction. More...
 
Real LoEdge (const IntVect &point, int dir) const noexcept
 Equivalent to LoEdge(point[dir], dir). More...
 
Real HiEdge (int point, int dir) const noexcept
 Returns location of hi edge in specified direction. More...
 
Real HiEdge (const IntVect &point, int dir) const noexcept
 Equivalent to HiEdge(point[dir], dir). More...
 
void LoFace (const IntVect &point, int dir, Vector< Real > &loc) const noexcept
 Sets location of lo face into loc. More...
 
void LoFace (const IntVect &point, int dir, Real *loc) const noexcept
 Sets location of lo face into loc. More...
 
void HiFace (const IntVect &point, int dir, Vector< Real > &loc) const noexcept
 Sets location of hi face into loc. More...
 
void HiFace (const IntVect &point, int dir, Real *loc) const noexcept
 Sets location of hi face into loc. More...
 
void LoNode (const IntVect &point, Vector< Real > &loc) const noexcept
 Return location of lower left hand corner. More...
 
void LoNode (const IntVect &point, Real *loc) const noexcept
 Return location of lower left hand corner. More...
 
void HiNode (const IntVect &point, Vector< Real > &loc) const noexcept
 Return location of upper right hand corner. More...
 
void HiNode (const IntVect &point, Real *loc) const noexcept
 Return location of upper right hand corner. More...
 
IntVect CellIndex (const Real *point) const noexcept
 Returns cell centered index of cell containing point. This may return undesired results if point is on a cell boundary. More...
 
IntVect LowerIndex (const Real *point) const noexcept
 Returns node centered index of lower left hand corner of cell containing this point. More...
 
IntVect UpperIndex (const Real *point) const noexcept
 Returns node centered index of upper right hand corner of cell containing this point. More...
 
void SetVolume (FArrayBox &a_volfab, const Box &region) const
 Compute cell volumes in given region and place them into input FAB. More...
 
void GetVolume (FArrayBox &vol, const Box &region) const
 Compute cell volumes in given region and place them into resize()d input FAB. More...
 
void SetDLogA (FArrayBox &a_dlogafab, const Box &region, int dir) const
 Compute d(log(A))/dr at cell centers in given region and place them into input FAB. More...
 
void GetDLogA (FArrayBox &dloga, const Box &region, int dir) const
 Compute d(log(A))/dr at cell centers in given region and return the results in the resize()d input FAB. More...
 
Real Volume (const IntVect &point) const
 Return the volume of the specified cell. More...
 
Real Volume (const Real xlo[AMREX_SPACEDIM], const Real xhi[AMREX_SPACEDIM]) const
 Return the volume of the specified cell. More...
 
void SetFaceArea (FArrayBox &a_areafab, const Box &region, int dir) const
 Compute area of cell faces in given region and given index direction and return the result in input FAB. More...
 
void GetFaceArea (FArrayBox &area, const Box &region, int dir) const
 Compute area of cell faces in given region and given index direction and return the result in resize()d input FAB. More...
 
Real AreaLo (const IntVect &point, int dir) const noexcept
 Returns lo face area of given cell in direction dir. More...
 
Real AreaHi (const IntVect &point, int dir) const noexcept
 Returns hi face area of given cell in direction dir. More...
 
void GetEdgeLoc (Vector< Real > &loc, const Box &region, int dir) const
 Return array of physical locations of cell edges in the resize()d input array. More...
 
void GetCellLoc (Vector< Real > &loc, const Box &region, int dir) const
 Return array of physical locations of cell centers in the resize()d input array. More...
 
void GetEdgeVolCoord (Vector< Real > &vc, const Box &region, int dir) const
 Return array of volume coordinates at cell edges for region in given direction. More...
 
void GetCellVolCoord (Vector< Real > &vc, const Box &region, int dir) const
 Return array of volume coordinates at cell centers for region in given direction. More...
 

Protected Attributes

CoordType c_sys = undef
 
Real offset [AMREX_SPACEDIM]
 
Real dx [AMREX_SPACEDIM] = {AMREX_D_DECL(0.,0.,0.)}
 
Real inv_dx [AMREX_SPACEDIM]
 
bool ok = false
 

Friends

std::ostream & operator<< (std::ostream &, const CoordSys &)
 Nice ASCII output. More...
 
std::istream & operator>> (std::istream &, CoordSys &)
 Nice ASCII input. More...
 

Detailed Description

Coordinate System.

Routines for mapping between physical coordinate system and index space.

Member Enumeration Documentation

◆ CoordType

Enumerator
undef 
cartesian 
RZ 
SPHERICAL 

Member Function Documentation

◆ AreaHi()

Real amrex::CoordSys::AreaHi ( const IntVect point,
int  dir 
) const
noexcept

Returns hi face area of given cell in direction dir.

◆ AreaLo()

Real amrex::CoordSys::AreaLo ( const IntVect point,
int  dir 
) const
noexcept

Returns lo face area of given cell in direction dir.

◆ CellCenter() [1/3]

void amrex::CoordSys::CellCenter ( const IntVect point,
Real *  loc 
) const
noexcept

Return location of cell center.

◆ CellCenter() [2/3]

void amrex::CoordSys::CellCenter ( const IntVect point,
Vector< Real > &  loc 
) const
noexcept

Return location of cell center.

◆ CellCenter() [3/3]

Real amrex::CoordSys::CellCenter ( int  point,
int  dir 
) const
inlinenoexcept

Returns location of cell center in specified direction.

◆ CellIndex()

IntVect amrex::CoordSys::CellIndex ( const Real *  point) const
noexcept

Returns cell centered index of cell containing point. This may return undesired results if point is on a cell boundary.

◆ CellSize() [1/2]

const Real* amrex::CoordSys::CellSize ( ) const
inlinenoexcept

Returns the cellsize for each coordinate direction.

◆ CellSize() [2/2]

Real amrex::CoordSys::CellSize ( int  dir) const
inlinenoexcept

Returns the cellsize for the specified coordinate direction.

◆ CellSizeArray()

GpuArray<Real,AMREX_SPACEDIM> amrex::CoordSys::CellSizeArray ( ) const
inlinenoexcept

◆ Coord()

CoordType amrex::CoordSys::Coord ( ) const
inlinenoexcept

Returns the CoordType.

◆ CoordInt()

int amrex::CoordSys::CoordInt ( ) const
inlinenoexcept

Returns the CoordType as an int.

◆ GetCellLoc()

void amrex::CoordSys::GetCellLoc ( Vector< Real > &  loc,
const Box region,
int  dir 
) const

Return array of physical locations of cell centers in the resize()d input array.

◆ GetCellVolCoord()

void amrex::CoordSys::GetCellVolCoord ( Vector< Real > &  vc,
const Box region,
int  dir 
) const

Return array of volume coordinates at cell centers for region in given direction.

◆ GetDLogA()

void amrex::CoordSys::GetDLogA ( FArrayBox dloga,
const Box region,
int  dir 
) const

Compute d(log(A))/dr at cell centers in given region and return the results in the resize()d input FAB.

◆ GetEdgeLoc()

void amrex::CoordSys::GetEdgeLoc ( Vector< Real > &  loc,
const Box region,
int  dir 
) const

Return array of physical locations of cell edges in the resize()d input array.

◆ GetEdgeVolCoord()

void amrex::CoordSys::GetEdgeVolCoord ( Vector< Real > &  vc,
const Box region,
int  dir 
) const

Return array of volume coordinates at cell edges for region in given direction.

◆ GetFaceArea()

void amrex::CoordSys::GetFaceArea ( FArrayBox area,
const Box region,
int  dir 
) const

Compute area of cell faces in given region and given index direction and return the result in resize()d input FAB.

◆ GetVolume()

void amrex::CoordSys::GetVolume ( FArrayBox vol,
const Box region 
) const

Compute cell volumes in given region and place them into resize()d input FAB.

◆ HiEdge() [1/2]

Real amrex::CoordSys::HiEdge ( const IntVect point,
int  dir 
) const
inlinenoexcept

Equivalent to HiEdge(point[dir], dir).

◆ HiEdge() [2/2]

Real amrex::CoordSys::HiEdge ( int  point,
int  dir 
) const
inlinenoexcept

Returns location of hi edge in specified direction.

◆ HiFace() [1/2]

void amrex::CoordSys::HiFace ( const IntVect point,
int  dir,
Real *  loc 
) const
noexcept

Sets location of hi face into loc.

◆ HiFace() [2/2]

void amrex::CoordSys::HiFace ( const IntVect point,
int  dir,
Vector< Real > &  loc 
) const
noexcept

Sets location of hi face into loc.

◆ HiNode() [1/2]

void amrex::CoordSys::HiNode ( const IntVect point,
Real *  loc 
) const
noexcept

Return location of upper right hand corner.

◆ HiNode() [2/2]

void amrex::CoordSys::HiNode ( const IntVect point,
Vector< Real > &  loc 
) const
noexcept

Return location of upper right hand corner.

◆ InvCellSize() [1/2]

const Real* amrex::CoordSys::InvCellSize ( ) const
inlinenoexcept

Returns the inverse cellsize for each coordinate direction.

◆ InvCellSize() [2/2]

Real amrex::CoordSys::InvCellSize ( int  dir) const
inlinenoexcept

Returns the inverse cellsize for the specified coordinate direction.

◆ InvCellSizeArray()

GpuArray<Real,AMREX_SPACEDIM> amrex::CoordSys::InvCellSizeArray ( ) const
inlinenoexcept

◆ IsCartesian()

bool amrex::CoordSys::IsCartesian ( ) const
inlinenoexcept

Is CoordType == cartesian?

◆ IsRZ()

bool amrex::CoordSys::IsRZ ( ) const
inlinenoexcept

Is CoordType == RZ?

◆ IsSPHERICAL()

bool amrex::CoordSys::IsSPHERICAL ( ) const
inlinenoexcept

Is CoordType == SPHERICAL?

◆ LoEdge() [1/2]

Real amrex::CoordSys::LoEdge ( const IntVect point,
int  dir 
) const
inlinenoexcept

Equivalent to LoEdge(point[dir], dir).

◆ LoEdge() [2/2]

Real amrex::CoordSys::LoEdge ( int  point,
int  dir 
) const
inlinenoexcept

Returns location of lo edge in specified direction.

◆ LoFace() [1/2]

void amrex::CoordSys::LoFace ( const IntVect point,
int  dir,
Real *  loc 
) const
noexcept

Sets location of lo face into loc.

◆ LoFace() [2/2]

void amrex::CoordSys::LoFace ( const IntVect point,
int  dir,
Vector< Real > &  loc 
) const
noexcept

Sets location of lo face into loc.

◆ LoNode() [1/2]

void amrex::CoordSys::LoNode ( const IntVect point,
Real *  loc 
) const
noexcept

Return location of lower left hand corner.

◆ LoNode() [2/2]

void amrex::CoordSys::LoNode ( const IntVect point,
Vector< Real > &  loc 
) const
noexcept

Return location of lower left hand corner.

◆ LowerIndex()

IntVect amrex::CoordSys::LowerIndex ( const Real *  point) const
noexcept

Returns node centered index of lower left hand corner of cell containing this point.

◆ Offset() [1/2]

const Real* amrex::CoordSys::Offset ( ) const
inlinenoexcept

Returns the offset.

◆ Offset() [2/2]

Real amrex::CoordSys::Offset ( int  dir) const
inlinenoexcept

Returns the offset for the specified coordinate direction.

◆ Ok()

bool amrex::CoordSys::Ok ( ) const
inlinenoexcept

Is ok?

◆ SetCoord()

void amrex::CoordSys::SetCoord ( CoordType  coord)
inlinenoexcept

Set the CoordType.

◆ SetDLogA()

void amrex::CoordSys::SetDLogA ( FArrayBox a_dlogafab,
const Box region,
int  dir 
) const

Compute d(log(A))/dr at cell centers in given region and place them into input FAB.

◆ SetFaceArea()

void amrex::CoordSys::SetFaceArea ( FArrayBox a_areafab,
const Box region,
int  dir 
) const

Compute area of cell faces in given region and given index direction and return the result in input FAB.

◆ SetOffset()

void amrex::CoordSys::SetOffset ( const Real *  x_lo)
noexcept

Sets the offset for each coordinate direction.

◆ SetVolume()

void amrex::CoordSys::SetVolume ( FArrayBox a_volfab,
const Box region 
) const

Compute cell volumes in given region and place them into input FAB.

◆ UpperIndex()

IntVect amrex::CoordSys::UpperIndex ( const Real *  point) const
noexcept

Returns node centered index of upper right hand corner of cell containing this point.

◆ Volume() [1/2]

Real amrex::CoordSys::Volume ( const IntVect point) const

Return the volume of the specified cell.

◆ Volume() [2/2]

Real amrex::CoordSys::Volume ( const Real  xlo[AMREX_SPACEDIM],
const Real  xhi[AMREX_SPACEDIM] 
) const

Return the volume of the specified cell.

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  os,
const CoordSys c 
)
friend

Nice ASCII output.

◆ operator>>

std::istream& operator>> ( std::istream &  is,
CoordSys c 
)
friend

Nice ASCII input.

Member Data Documentation

◆ c_sys

CoordType amrex::CoordSys::c_sys = undef
protected

◆ dx

Real amrex::CoordSys::dx[AMREX_SPACEDIM] = {AMREX_D_DECL(0.,0.,0.)}
protected

◆ inv_dx

Real amrex::CoordSys::inv_dx[AMREX_SPACEDIM]
protected
Initial value:
= {AMREX_D_DECL(std::numeric_limits<Real>::infinity(),
std::numeric_limits<Real>::infinity(),
std::numeric_limits<Real>::infinity())}
#define AMREX_D_DECL(a, b, c)
Definition: AMReX_SPACE.H:104

◆ offset

Real amrex::CoordSys::offset[AMREX_SPACEDIM]
protected

◆ ok

bool amrex::CoordSys::ok = false
protected

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