2#ifndef AMREX_COORDSYS_H_
3#define AMREX_COORDSYS_H_
4#include <AMReX_Config.H>
43 [[nodiscard]]
bool Ok () const noexcept {
return ok; }
52 [[nodiscard]]
int CoordInt () const noexcept {
return static_cast<int>(
c_sys); }
60 [[nodiscard]]
bool IsRZ () const noexcept {
123 [[nodiscard]]
Real LoEdge (
int point,
int dir)
const noexcept
135 [[nodiscard]]
Real HiEdge (
int point,
int dir)
const noexcept
271 const Real xhi[AMREX_SPACEDIM])
const;
323 std::numeric_limits<Real>::max(),
324 std::numeric_limits<Real>::max())};
Runtime initialization/finalization helpers and global diagnostics.
Fixed-size array types for use on GPU and CPU.
#define BL_ASSERT(EX)
Definition AMReX_BLassert.H:39
Integer-lattice boxes and helpers for defining index-space regions.
#define AMREX_D_DECL(a, b, c)
Definition AMReX_SPACE.H:171
Coordinate system; provides mapping between physical space and index space.
Definition AMReX_CoordSys.H:31
friend std::ostream & operator<<(std::ostream &, const CoordSys &)
Nice ASCII output.
Definition AMReX_CoordSys.cpp:447
const Real * CellSize() const noexcept
Returns the cellsize for each coordinate direction.
Definition AMReX_CoordSys.H:79
const Real * Offset() const noexcept
Returns the offset.
Definition AMReX_CoordSys.H:73
bool Ok() const noexcept
Is ok?
Definition AMReX_CoordSys.H:43
void GetCellLoc(Vector< Real > &loc, const Box ®ion, int dir) const
Return array of physical locations of cell centers in the resize()d input array.
Definition AMReX_CoordSys.cpp:304
GpuArray< Real, 3 > CellSizeArray() const noexcept
Returns the cell sizes as a GpuArray for use on host or device.
Definition AMReX_CoordSys.H:85
void GetVolume(FArrayBox &vol, const Box ®ion) const
Compute cell volumes in given region and place them into resize()d input FAB.
Definition AMReX_CoordSys.cpp:174
IntVect CellIndex(const Real *point) const noexcept
Returns cell-centered index of cell containing point.
Definition AMReX_CoordSys.cpp:135
void LoNode(const IntVect &point, Vector< Real > &loc) const noexcept
Return the location of the lower-left node of the cell.
Definition AMReX_CoordSys.cpp:107
void SetCoord(CoordType coord) noexcept
Set the CoordType.
Definition AMReX_CoordSys.H:46
CoordType Coord() const noexcept
Returns the CoordType.
Definition AMReX_CoordSys.H:49
void SetFaceArea(FArrayBox &a_areafab, const Box ®ion, int dir) const
Compute area of cell faces in given region and given index direction and return the result in input F...
Definition AMReX_CoordSys.cpp:258
int CoordInt() const noexcept
Returns the CoordType as an int.
Definition AMReX_CoordSys.H:52
void GetEdgeVolCoord(Vector< Real > &vc, const Box ®ion, int dir) const
Return array of volume coordinates at cell edges for region in given direction.
Definition AMReX_CoordSys.cpp:323
Real InvCellSize(int dir) const noexcept
Returns the inverse cellsize for the specified coordinate direction.
Definition AMReX_CoordSys.H:94
bool IsCartesian() const noexcept
Is CoordType == cartesian?
Definition AMReX_CoordSys.H:65
Real offset[3]
Definition AMReX_CoordSys.H:318
Real CellCenter(int point, int dir) const noexcept
Returns location of cell center in specified direction.
Definition AMReX_CoordSys.H:103
void GetCellVolCoord(Vector< Real > &vc, const Box ®ion, int dir) const
Return array of volume coordinates at cell centers for region in given direction.
Definition AMReX_CoordSys.cpp:385
friend std::istream & operator>>(std::istream &, CoordSys &)
Nice ASCII input.
Definition AMReX_CoordSys.cpp:467
Real HiEdge(const IntVect &point, int dir) const noexcept
Equivalent to HiEdge(point[dir], dir).
Definition AMReX_CoordSys.H:141
void HiNode(const IntVect &point, Vector< Real > &loc) const noexcept
Return the location of the upper-right node of the cell.
Definition AMReX_CoordSys.cpp:127
Real LoEdge(const IntVect &point, int dir) const noexcept
Equivalent to LoEdge(point[dir], dir).
Definition AMReX_CoordSys.H:129
Real inv_dx[3]
Definition AMReX_CoordSys.H:322
IntVect UpperIndex(const Real *point) const noexcept
Returns nodal index of upper right hand corner of cell containing this point.
Definition AMReX_CoordSys.cpp:161
void SetVolume(FArrayBox &a_volfab, const Box ®ion) const
Compute cell volumes in given region and place them into input FAB.
Definition AMReX_CoordSys.cpp:182
Real AreaHi(const IntVect &point, int dir) const noexcept
Returns hi face area of given cell in direction dir.
Definition AMReX_CoordSys.cpp:582
CoordType c_sys
Definition AMReX_CoordSys.H:317
const Real * InvCellSize() const noexcept
Returns the inverse cellsize for each coordinate direction.
Definition AMReX_CoordSys.H:91
bool IsSPHERICAL() const noexcept
Is CoordType == SPHERICAL?
Definition AMReX_CoordSys.H:55
void HiFace(const IntVect &point, int dir, Vector< Real > &loc) const noexcept
Compute the physical location of the upper face in direction dir.
Definition AMReX_CoordSys.cpp:86
Real HiEdge(int point, int dir) const noexcept
Returns location of hi edge in specified direction.
Definition AMReX_CoordSys.H:135
Real dx[3]
Definition AMReX_CoordSys.H:320
Real Offset(int dir) const noexcept
Returns the offset for the specified coordinate direction.
Definition AMReX_CoordSys.H:76
Real LoEdge(int point, int dir) const noexcept
Returns location of lo edge in specified direction.
Definition AMReX_CoordSys.H:123
void SetDLogA(FArrayBox &a_dlogafab, const Box ®ion, int dir) const
Compute d(log(A))/dr at cell centers in given region and place them into input FAB.
Definition AMReX_CoordSys.cpp:218
GpuArray< Real, 3 > InvCellSizeArray() const noexcept
Returns the inverse cell sizes as a GpuArray for use on host or device.
Definition AMReX_CoordSys.H:97
Real Volume(const IntVect &point) const
Return the physical volume of the specified cell.
Definition AMReX_CoordSys.cpp:495
void LoFace(const IntVect &point, int dir, Vector< Real > &loc) const noexcept
Compute the physical location of the lower face in direction dir.
Definition AMReX_CoordSys.cpp:63
bool ok
Definition AMReX_CoordSys.H:325
void GetDLogA(FArrayBox &dloga, const Box ®ion, int dir) const
Compute d(log(A))/dr at cell centers in given region and return the results in the resize()d input FA...
Definition AMReX_CoordSys.cpp:209
void SetOffset(const Real *x_lo) noexcept
Sets the offset for each coordinate direction.
Definition AMReX_CoordSys.cpp:21
void GetEdgeLoc(Vector< Real > &loc, const Box ®ion, int dir) const
Return array of physical locations of cell edges in the resize()d input array.
Definition AMReX_CoordSys.cpp:285
IntVect LowerIndex(const Real *point) const noexcept
Returns nodal index of lower-left corner of cell containing this point.
Definition AMReX_CoordSys.cpp:148
Real AreaLo(const IntVect &point, int dir) const noexcept
Returns lo face area of given cell in direction dir.
Definition AMReX_CoordSys.cpp:528
void GetFaceArea(FArrayBox &area, const Box ®ion, int dir) const
Compute area of cell faces in given region and given index direction and return the result in resize(...
Definition AMReX_CoordSys.cpp:247
CoordType
Coordinate system type: undefined, Cartesian, cylindrical (RZ), or spherical.
Definition AMReX_CoordSys.H:35
@ RZ
Definition AMReX_CoordSys.H:35
@ undef
Definition AMReX_CoordSys.H:35
@ cartesian
Definition AMReX_CoordSys.H:35
@ SPHERICAL
Definition AMReX_CoordSys.H:35
Real CellSize(int dir) const noexcept
Returns the cellsize for the specified coordinate direction.
Definition AMReX_CoordSys.H:82
bool IsRZ() const noexcept
Is CoordType == RZ?
Definition AMReX_CoordSys.H:60
A Fortran Array of REALs.
Definition AMReX_FArrayBox.H:237
This class is a thin wrapper around std::vector. Unlike vector, Vector::operator[] provides bound che...
Definition AMReX_Vector.H:29
amrex_real Real
Floating Point Type for Fields.
Definition AMReX_REAL.H:79
Definition AMReX_Amr.cpp:50
Fixed-size array that can be used on GPU.
Definition AMReX_Array.H:52