1#ifndef AMREX_GEOMETRY_H_
2#define AMREX_GEOMETRY_H_
3#include <AMReX_Config.H>
21class DistributionMapping;
99 int const* is_per =
nullptr)
noexcept;
127 static_cast<int>(
c_sys) };
131 static void Setup (
const RealBox* rb =
nullptr,
int coord = -1,
int const* isper =
nullptr) noexcept;
151 void define (const
Box& dom, const
RealBox* rb =
nullptr,
int coord = -1,
int const* is_per =
nullptr) noexcept;
168 void define (const
Box& dom, const
RealBox& rb,
int coord,
Array<
int,AMREX_SPACEDIM> const& is_per) noexcept;
240#if AMREX_SPACEDIM == 1
242 auto coord = geomdata.
Coord();
255 constexpr Real pi =
Real(3.1415926535897932);
256 vol = (4.0_rt / 3.0_rt) * pi *
dx[0] * (rl * rl + rl * rr + rr * rr);
259#elif AMREX_SPACEDIM == 2
261 auto coord = geomdata.
Coord();
274 constexpr Real pi =
Real(3.1415926535897932);
275 vol = pi * (r_l + r_r) *
dx[0] *
dx[1];
284 Real theta_r = geomdata.
ProbLo()[1] +
static_cast<Real>(point[1]+1) *
dx[1];
286 constexpr Real twoThirdsPi =
static_cast<Real>(2.0 * 3.1415926535897932 / 3.0);
287 vol = twoThirdsPi * (std::cos(theta_l) - std::cos(theta_r)) *
dx[0] *
288 (r_r*r_r + r_r*r_l + r_l*r_l);
297 vol =
dx[0] *
dx[1] *
dx[2];
406 for (
int i = 0; i < AMREX_SPACEDIM; ++i) {
414 for (
int i = 0; i < AMREX_SPACEDIM; ++i) {
#define BL_ASSERT(EX)
Definition AMReX_BLassert.H:39
#define AMREX_ASSERT(EX)
Definition AMReX_BLassert.H:38
#define AMREX_FORCE_INLINE
Definition AMReX_Extension.H:119
#define AMREX_INLINE
Definition AMReX_Extension.H:127
#define AMREX_GPU_HOST_DEVICE
Definition AMReX_GpuQualifiers.H:20
Array4< Real > fine
Definition AMReX_InterpFaceRegister.cpp:90
Array4< Real const > crse
Definition AMReX_InterpFaceRegister.cpp:92
#define AMREX_D_TERM(a, b, c)
Definition AMReX_SPACE.H:172
#define AMREX_D_DECL(a, b, c)
Definition AMReX_SPACE.H:171
Geometry * getDefaultGeometry() noexcept
Definition AMReX.H:321
static AMReX * top() noexcept
Definition AMReX.H:310
A collection of Boxes stored in an Array.
Definition AMReX_BoxArray.H:553
__host__ __device__ IntVectND< dim > length() const noexcept
Return the length of the BoxND.
Definition AMReX_Box.H:154
__host__ __device__ BoxND & coarsen(int ref_ratio) noexcept
Coarsen BoxND by given (positive) refinement ratio. NOTE: if type(dir) = CELL centered: lo <- lo/rati...
Definition AMReX_Box.H:722
__host__ __device__ BoxND & refine(int ref_ratio) noexcept
Refine BoxND by given (positive) refinement ratio. NOTE: if type(dir) = CELL centered: lo <- lo*ratio...
Definition AMReX_Box.H:698
Coordinate System.
Definition AMReX_CoordSys.H:24
Real inv_dx[3]
Definition AMReX_CoordSys.H:244
CoordType c_sys
Definition AMReX_CoordSys.H:239
Real dx[3]
Definition AMReX_CoordSys.H:242
@ RZ
Definition AMReX_CoordSys.H:27
@ cartesian
Definition AMReX_CoordSys.H:27
Calculates the distribution of FABs to MPI processes.
Definition AMReX_DistributionMapping.H:43
A Fortran Array of REALs.
Definition AMReX_FArrayBox.H:231
Rectangular problem domain geometry.
Definition AMReX_Geometry.H:74
Geometry(Geometry &&rhs) noexcept=default
Real ProbLo(int dir) const noexcept
Returns the lo end of the problem domain in specified direction.
Definition AMReX_Geometry.H:183
GpuArray< ParticleReal, 3 > ProbLoArrayInParticleReal() const noexcept
Definition AMReX_Geometry.H:195
bool outsideRoundoffDomain(ParticleReal x, ParticleReal y, ParticleReal z) const
Returns true if a point is outside the roundoff domain. All particles with positions inside the round...
Definition AMReX_Geometry.cpp:688
void GetVolume(MultiFab &vol, const BoxArray &grds, const DistributionMapping &dm, int grow) const
Define a multifab of areas and volumes with given grow factor.
Definition AMReX_Geometry.cpp:207
void refine(IntVect const &rr)
Definition AMReX_Geometry.H:412
void coarsen(IntVect const &rr)
Definition AMReX_Geometry.H:404
GpuArray< ParticleReal, 3 > ProbHiArrayInParticleReal() const noexcept
Definition AMReX_Geometry.H:199
const Real * ProbHi() const noexcept
Returns the hi end of the problem domain in each dimension.
Definition AMReX_Geometry.H:181
GpuArray< ParticleReal, 3 > roundoff_hi
Definition AMReX_Geometry.H:461
__host__ static __device__ Real Volume(const IntVect &point, const GeometryData &geomdata)
Return the volume of the specified cell.
Definition AMReX_Geometry.H:234
bool is_periodic[3]
Definition AMReX_Geometry.H:454
bool isAnyPeriodic() const noexcept
Is domain periodic in any direction?
Definition AMReX_Geometry.H:334
GpuArray< ParticleReal, 3 > roundoff_lo
Definition AMReX_Geometry.H:461
Array< int, 3 > setPeriodicity(Array< int, 3 > const &period) noexcept
Definition AMReX_Geometry.H:394
friend std::istream & operator>>(std::istream &, Geometry &)
Nice ASCII input.
Definition AMReX_Geometry.cpp:25
static void ResetDefaultProbDomain(const RealBox &rb) noexcept
Definition AMReX_Geometry.cpp:183
Box domain
Definition AMReX_Geometry.H:464
void GetFaceArea(MultiFab &area, const BoxArray &grds, const DistributionMapping &dm, int dir, int grow) const
Compute area of cell faces in given region and stuff stuff the results into the passed MultiFab.
Definition AMReX_Geometry.cpp:298
Real ProbHi(int dir) const noexcept
Returns the hi end of the problem domain in specified direction.
Definition AMReX_Geometry.H:185
Geometry(const Geometry &rhs)=default
int period(int dir) const noexcept
What's period in specified direction?
Definition AMReX_Geometry.H:354
Geometry & operator=(const Geometry &rhs)=default
const Box & Domain() const noexcept
Returns our rectangular domain.
Definition AMReX_Geometry.H:211
GpuArray< int, 3 > isPeriodicArray() const noexcept
Definition AMReX_Geometry.H:348
const RealBox & ProbDomain() const noexcept
Returns the problem domain.
Definition AMReX_Geometry.H:171
void Domain(const Box &bx) noexcept
Sets our rectangular domain.
Definition AMReX_Geometry.H:213
Periodicity periodicity() const noexcept
Definition AMReX_Geometry.H:356
Array< int, 3 > isPeriodic() const noexcept
Definition AMReX_Geometry.H:343
void GetDLogA(MultiFab &dloga, const BoxArray &grds, const DistributionMapping &dm, int dir, int grow) const
Compute d(log(A))/dr at cell centers in given region and stuff the results into the passed MultiFab.
Box growNonPeriodicDomain(IntVect const &ngrow) const noexcept
Return domain box with non-periodic directions grown by ngrow.
Definition AMReX_Geometry.cpp:479
void periodicShift(const Box &target, const Box &src, Vector< IntVect > &out) const noexcept
Compute Array of shifts which will translate src so that it will intersect target with non-zero inter...
Definition AMReX_Geometry.cpp:369
static void Setup(const RealBox *rb=nullptr, int coord=-1, int const *isper=nullptr) noexcept
Read static values from ParmParse database.
Definition AMReX_Geometry.cpp:108
Real ProbLength(int dir) const noexcept
Returns length of problem domain in specified dimension.
Definition AMReX_Geometry.H:209
void computeRoundoffDomain()
Compute the roundoff domain. Public because it contains an extended host / device lambda.
Definition AMReX_Geometry.cpp:515
const Real * ProbLo() const noexcept
Returns the lo end of the problem domain in each dimension.
Definition AMReX_Geometry.H:179
GeometryData data() const noexcept
Returns non-static copy of geometry's stored data.
Definition AMReX_Geometry.H:124
Geometry() noexcept
The default constructor.
Definition AMReX_Geometry.cpp:45
void define(const Box &dom, const RealBox *rb=nullptr, int coord=-1, int const *is_per=nullptr) noexcept
Definition AMReX_Geometry.cpp:70
GpuArray< Real, 3 > ProbHiArray() const noexcept
Definition AMReX_Geometry.H:191
Box growPeriodicDomain(IntVect const &ngrow) const noexcept
Return domain box with periodic directions grown by ngrow.
Definition AMReX_Geometry.cpp:491
Real ProbSize() const noexcept
Returns the overall size of the domain by multiplying the ProbLength's together.
Definition AMReX_Geometry.H:204
bool insideRoundoffDomain(ParticleReal x, ParticleReal y, ParticleReal z) const
Returns true if a point is inside the roundoff domain. All particles with positions inside the roundo...
Definition AMReX_Geometry.cpp:700
void ProbDomain(const RealBox &rb) noexcept
Sets the problem domain.
Definition AMReX_Geometry.H:173
GpuArray< Real, 3 > ProbLoArray() const noexcept
Definition AMReX_Geometry.H:187
bool isAllPeriodic() const noexcept
Is domain periodic in all directions?
Definition AMReX_Geometry.H:339
bool isPeriodic(int dir) const noexcept
Is the domain periodic in the specified direction?
Definition AMReX_Geometry.H:332
static void ResetDefaultPeriodicity(const Array< int, 3 > &is_per) noexcept
Definition AMReX_Geometry.cpp:192
RealBox prob_domain
Definition AMReX_Geometry.H:455
GpuArray< ParticleReal, 3 > const & RoundOffLo() const
Returns roundoff domain's lower end.
Definition AMReX_Geometry.H:444
static void ResetDefaultCoord(int coord) noexcept
Definition AMReX_Geometry.cpp:199
GpuArray< ParticleReal, 3 > const & RoundOffHi() const
Returns roundoff domain's higher end.
Definition AMReX_Geometry.H:448
Periodicity periodicity(const Box &b) const noexcept
Definition AMReX_Geometry.H:362
A collection (stored as an array) of FArrayBox objects.
Definition AMReX_MultiFab.H:40
This provides length of period for periodic domains. 0 means it is not periodic in that direction....
Definition AMReX_Periodicity.H:17
A Box with real dimensions.
Definition AMReX_RealBox.H:26
__host__ __device__ const Real * lo() const &noexcept
Returns lo side.
Definition AMReX_RealBox.H:51
__host__ __device__ const Real * hi() const &noexcept
Returns hide side.
Definition AMReX_RealBox.H:56
__host__ __device__ Real length(int dir) const noexcept
Returns length in specified direction.
Definition AMReX_RealBox.H:67
This class is a thin wrapper around std::vector. Unlike vector, Vector::operator[] provides bound che...
Definition AMReX_Vector.H:28
amrex_real Real
Floating Point Type for Fields.
Definition AMReX_REAL.H:79
amrex_particle_real ParticleReal
Floating Point Type for Particles.
Definition AMReX_REAL.H:90
__host__ __device__ BoxND< dim > coarsen(const BoxND< dim > &b, int ref_ratio) noexcept
Coarsen BoxND by given (positive) coarsening ratio.
Definition AMReX_Box.H:1407
__host__ __device__ BoxND< dim > grow(const BoxND< dim > &b, int i) noexcept
Grow BoxND in all directions by given amount.
Definition AMReX_Box.H:1278
__host__ __device__ BoxND< dim > refine(const BoxND< dim > &b, int ref_ratio) noexcept
Definition AMReX_Box.H:1457
std::array< T, N > Array
Definition AMReX_Array.H:25
Definition AMReX_Amr.cpp:49
__host__ __device__ void ignore_unused(const Ts &...)
This shuts up the compiler about unused variables.
Definition AMReX.H:138
IntVectND< 3 > IntVect
IntVect is an alias for amrex::IntVectND instantiated with AMREX_SPACEDIM.
Definition AMReX_BaseFwd.H:30
const Geometry & DefaultGeometry()
Definition AMReX_Geometry.H:501
std::istream & operator>>(std::istream &is, BoxND< dim > &bx)
Read from istream.
Definition AMReX_Box.H:1821
std::ostream & operator<<(std::ostream &os, AmrMesh const &amr_mesh)
Definition AMReX_AmrMesh.cpp:1236
Definition AMReX_Geometry.H:25
Box domain
Definition AMReX_Geometry.H:56
__host__ __device__ Real ProbLo(int dir) const noexcept
Definition AMReX_Geometry.H:37
__host__ __device__ Real CellSize(int dir) const noexcept
Definition AMReX_Geometry.H:31
__host__ __device__ int Coord() const noexcept
Coordinates type.
Definition AMReX_Geometry.H:52
__host__ __device__ const Box & Domain() const noexcept
Returns our rectangular domain.
Definition AMReX_Geometry.H:46
Real dx[3]
Definition AMReX_Geometry.H:57
__host__ __device__ Real ProbHi(int dir) const noexcept
Definition AMReX_Geometry.H:43
__host__ __device__ const Real * CellSize() const noexcept
Returns the cellsize for each coordinate direction.
Definition AMReX_Geometry.H:28
int coord
Definition AMReX_Geometry.H:59
__host__ __device__ int isPeriodic(const int i) const noexcept
Returns whether the domain is periodic in the given direction.
Definition AMReX_Geometry.H:49
int is_periodic[3]
Definition AMReX_Geometry.H:58
__host__ __device__ const Real * ProbLo() const noexcept
Returns the lo end of the problem domain in each dimension.
Definition AMReX_Geometry.H:34
RealBox prob_domain
Definition AMReX_Geometry.H:55
__host__ __device__ const Real * ProbHi() const noexcept
Returns the hi end of the problem domain in each dimension.
Definition AMReX_Geometry.H:40
Fixed-size array that can be used on GPU.
Definition AMReX_Array.H:40