criptic v1
Cosmic Ray Interstellar Propagation Tool using Itô Calculus
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Private Attributes | List of all members
criptic::Geometry Class Reference

A class that describes the geometry of a calculation. More...

#include <Geometry.H>

Public Types

enum  bcType { openBC = 0 , absorbingBC , reflectingBC , periodicBC }
 An enum describing boundary condition types. More...
 

Public Member Functions

 Geometry (const ParmParser &pp)
 Constructor.
 
const RealBoxxBox () const
 Return the domain bounding box.
 
const RealVecxLo () const
 Return low boundary of computational domain.
 
const RealVecxHi () const
 Return high boundary of computational domain.
 
const RealVecxSize () const
 Return size of computational domain.
 
const Vec3< bcType > & bLo () const
 Return low boundary conditions of computational domain.
 
const Vec3< bcType > & bHi () const
 Return high boundary conditions of computational domain.
 
const BoolVecisPeriodic () const
 Return periodicity of problem domain.
 
bool isAnyPeriodic () const
 Return whether the domain is periodic in any dimension.
 
bool isAnyOpen () const
 Return whether the domain is open in any direction.
 
void applyBC (RealVec &x) const
 Apply boundary conditions to a packet.
 
Real periodicLoop (const Real x, const int i, const bool recenter=false) const
 Loop the input coordinate over periodic boundaries.
 
RealVec periodicLoop (const RealVec &x, const bool recenter=false) const
 Loop the input position over periodic boundaries.
 
std::vector< RealBoxperiodicLoopBox (const RealBox &b, const bool recenter=false) const
 Loop the input box over periodic boundaries.
 
bool contains (const RealVec &x) const
 Report if a specified point is in the problem domain.
 
RealVec disp (const RealVec &x1, const RealVec &x2) const
 Get displacement vector between two points.
 
Real dist (const RealVec &x1, const RealVec &x2) const
 Compute distance between two points.
 
Real minBoxDist (const RealVec &x, const RealVec &boxLo, const RealVec &boxHi) const
 Return minimum distance between a point and a box.
 
Real maxBoxDist (const RealVec &x, const RealVec &boxLo, const RealVec &boxHi) const
 Return maximum distance between a point and a box.
 
void minMaxBoxDist2 (const RealVec &x, const RealVec &boxLo, const RealVec &boxHi, RealVec &d2Min, RealVec &d2Max) const
 Compute min and max squared distances between a point and a box.
 
void minMaxBoxDist2 (const RealVec &x, const RealVec &boxLo, const RealVec &boxHi, Real &d2Min, Real &d2Max) const
 Compute min and max squared distances between a point and a box.
 
void minMaxBoxDist (const RealVec &x, const RealVec &boxLo, const RealVec &boxHi, Real &dMin, Real &dMax) const
 Compute min and max squared distances between a point and a box.
 

Private Attributes

Vec3< bcTypebcLo
 
Vec3< bcTypebcHi
 
RealBox box
 
RealVec probSize
 
BoolVec periodicity
 
bool hasPeriodicDim
 

Detailed Description

A class that describes the geometry of a calculation.

This class provides methods to handle boundary conditions, periodicity, and other geometry-related calculations.

Member Enumeration Documentation

◆ bcType

An enum describing boundary condition types.

Enumerator
openBC 
absorbingBC 
reflectingBC 
periodicBC 

Constructor & Destructor Documentation

◆ Geometry()

Geometry::Geometry ( const ParmParser pp)

Constructor.

Parameters
ppThe parameter parser, which contains the input deck

Member Function Documentation

◆ applyBC()

void criptic::Geometry::applyBC ( RealVec x) const
inline

Apply boundary conditions to a packet.

Parameters
xPosition of a packet
pktCR packet properties

This routine applies the boundary conditions to a CR packet. Periodic boundaries will cause packets to loop around the box if they are outside it, reflecting boundaries will reflect the packet position, and reflectingPitchAngle boundaries will reflect the position and pitch angle.

◆ bHi()

const Vec3< bcType > & criptic::Geometry::bHi ( ) const
inline

Return high boundary conditions of computational domain.

Returns
Low boundary condition type

◆ bLo()

const Vec3< bcType > & criptic::Geometry::bLo ( ) const
inline

Return low boundary conditions of computational domain.

Returns
Low boundary condition type

◆ contains()

bool criptic::Geometry::contains ( const RealVec x) const
inline

Report if a specified point is in the problem domain.

Parameters
xPosition of point
Returns
True if input point is in domain, false if not

◆ disp()

RealVec criptic::Geometry::disp ( const RealVec x1,
const RealVec x2 
) const
inline

Get displacement vector between two points.

Parameters
x1First point
x2Second point
Returns
x1 - x2, computed using the periodic metric

This funtion returns the displacement vector between any points points. In non-periodic geometry, this is just the usual vector subtraction, but in periodic geometry dimensions are looped, so that the displacement vector is the shortest path.

◆ dist()

Real criptic::Geometry::dist ( const RealVec x1,
const RealVec x2 
) const
inline

Compute distance between two points.

Parameters
x1First point
x2Second point
Returns
Distance between two points

The distance returned is computed in the periodic metric if the domain is periodic; thus in any periodic dimension the maximum distance between any two points in that dimension is half the box size.

◆ isAnyOpen()

bool criptic::Geometry::isAnyOpen ( ) const
inline

Return whether the domain is open in any direction.

Returns
Whether the domain is open in any direction

◆ isAnyPeriodic()

bool criptic::Geometry::isAnyPeriodic ( ) const
inline

Return whether the domain is periodic in any dimension.

Returns
Whether the domain is periodic in any dimension

◆ isPeriodic()

const BoolVec & criptic::Geometry::isPeriodic ( ) const
inline

Return periodicity of problem domain.

Returns
Whether domain is periodic in each direction

◆ maxBoxDist()

Real criptic::Geometry::maxBoxDist ( const RealVec x,
const RealVec boxLo,
const RealVec boxHi 
) const
inline

Return maximum distance between a point and a box.

Parameters
xLocation of the point
boxLoLocation of lower left corner of box
boxHiLocation of upper right corner of box
Returns
The minimum distance between the point and the box

The distance returned is the distance between the input point and the point contained within the box from which it is farthest. Distance is computed using the periodic distance metric if the domain is periodic. However, it is assumed that the box does not wrap around the periodic boundary.

◆ minBoxDist()

Real criptic::Geometry::minBoxDist ( const RealVec x,
const RealVec boxLo,
const RealVec boxHi 
) const
inline

Return minimum distance between a point and a box.

Parameters
xLocation of the point
boxLoLocation of lower left corner of box
boxHiLocation of upper right corner of box
Returns
The minimum distance between the point and the box

The distance returned is the distance between the input point and the point contained within the box to which it is closest. Distance is computed using the periodic distance metric if the domain is periodic. However, it is assumed that the box does not wrap around the periodic boundary.

◆ minMaxBoxDist()

void criptic::Geometry::minMaxBoxDist ( const RealVec x,
const RealVec boxLo,
const RealVec boxHi,
Real dMin,
Real dMax 
) const
inline

Compute min and max squared distances between a point and a box.

Parameters
xLocation of the point
boxLoLocation of lower left corner of box
boxHiLocation of upper right corner of box
dMinThe minimum distance between the point and the box
dMaxThe maximum distance between the point and the box

The distances copmputed are those between the input point and the points contained within the box from which it is nearest and farthest. Distances are computed using the periodic distance metric if the domain is periodic. However, it is assumed that the box does not wrap around the periodic boundary.

◆ minMaxBoxDist2() [1/2]

void criptic::Geometry::minMaxBoxDist2 ( const RealVec x,
const RealVec boxLo,
const RealVec boxHi,
Real d2Min,
Real d2Max 
) const
inline

Compute min and max squared distances between a point and a box.

Parameters
xLocation of the point
boxLoLocation of lower left corner of box
boxHiLocation of upper right corner of box
d2MinThe minimum squared distance between the point and the box
d2MaxThe maximum sqaured distance between the point and the box

The distances copmputed are those between the input point and the points contained within the box from which it is nearest and farthest. Distances are computed using the periodic distance metric if the domain is periodic. However, it is assumed that the box does not wrap around the periodic boundary.

◆ minMaxBoxDist2() [2/2]

void criptic::Geometry::minMaxBoxDist2 ( const RealVec x,
const RealVec boxLo,
const RealVec boxHi,
RealVec d2Min,
RealVec d2Max 
) const
inline

Compute min and max squared distances between a point and a box.

Parameters
xLocation of the point
boxLoLocation of lower left corner of box
boxHiLocation of upper right corner of box
d2MinThe minimum squared distance between the point and the box
d2MaxThe maximum squared distance between the point and the box

The distances copmputed are those between the input point and the points contained within the box from which it is nearest and farthest. Distances are computed using the periodic distance metric if the domain is periodic. However, it is assumed that the box does not wrap around the periodic boundary. Note that this function differs from minMaxBoxDist2 called with scalar arguments for dMin and dMax in that the squared distances are returned as vectors giving the contribution from each dimension, rather than as scalar sums.

◆ periodicLoop() [1/2]

Real criptic::Geometry::periodicLoop ( const Real  x,
const int  i,
const bool  recenter = false 
) const
inline

Loop the input coordinate over periodic boundaries.

Parameters
xThe position to loop
iThe dimension of the coordinate x
recenterIf true, re-center the domain at (0,0,0)
Returns
The position shifted to lie inside the problem domain

This routine loops a coordinate value to lie in the problem domain. If recenter is false, the value returned is in the problem coordinate system, and thus lies in the range box.lo[i] to box.hi[i]. If recenter is true, the value returned is given in a coordinate system centered on the center of the domain, so the value returned lies in the range -probSize[i]/2 to +probSize[i]/2.

◆ periodicLoop() [2/2]

RealVec criptic::Geometry::periodicLoop ( const RealVec x,
const bool  recenter = false 
) const
inline

Loop the input position over periodic boundaries.

Parameters
xThe position to loop
recenterIf true, re-center the domain at (0,0,0)
Returns
The position shifted to lie inside the problem domain

This routine loops a coordinate value to lie in the problem domain. If recenter is false, the value returned is in the problem coordinate system, and thus lies in the range box.lo to box.hi. If recenter is true, the value returned is given in a coordinate system centered on the center of the domain, so the value returned lies in the range -probSize/2 to +probSize/2.

◆ periodicLoopBox()

std::vector< RealBox > criptic::Geometry::periodicLoopBox ( const RealBox b,
const bool  recenter = false 
) const
inline

Loop the input box over periodic boundaries.

Parameters
bThe box to loop
recenterIf true, re-center the domain at (0,0,0)
Returns
The shifted RealBox objects

Because RealBox objects do not know about periodic boundaries, the way this routine deals with a box that cuts across a periodic boundary is to cut the box at the boundary and return multiple boxes corresponding to the parts that lie on either side of the boundary. That is why the routine returns a vector of RealBox's rather than just a single one: there could potentially be up to eight sub-boxes.

◆ xBox()

const RealBox & criptic::Geometry::xBox ( ) const
inline

Return the domain bounding box.

Returns
Domain bounding box

◆ xHi()

const RealVec & criptic::Geometry::xHi ( ) const
inline

Return high boundary of computational domain.

Returns
High boundary of computational domain

◆ xLo()

const RealVec & criptic::Geometry::xLo ( ) const
inline

Return low boundary of computational domain.

Returns
Low boundary of computational domain

◆ xSize()

const RealVec & criptic::Geometry::xSize ( ) const
inline

Return size of computational domain.

Returns
Size of computational domain

Member Data Documentation

◆ bcHi

Vec3<bcType> criptic::Geometry::bcHi
private

High side boundary condition

◆ bcLo

Vec3<bcType> criptic::Geometry::bcLo
private

Low side boundary condition

◆ box

RealBox criptic::Geometry::box
private

Domain bounding box

◆ hasPeriodicDim

bool criptic::Geometry::hasPeriodicDim
private

Is any dimension periodic?

◆ periodicity

BoolVec criptic::Geometry::periodicity
private

Periodicity of domain in each dimension

◆ probSize

RealVec criptic::Geometry::probSize
private

Size of domain bounding box


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