18#include "../IO/ParmParser.H"
19#include "../Utils/RealBox.H"
20#include "../Utils/Types.H"
21#include "../Utils/Vec3.H"
44#ifdef TRACK_PITCH_ANGLE
45 , reflectingPitchAngleBC
110 return max(lo, hi).max();
125#ifdef TRACK_PITCH_ANGLE
129 for (
int i = 0; i < 3; i++) {
134 x[i] += 2 * (
box.
lo[i] - x[i]);
136 x[i] -= 2 * (x[i] -
box.
hi[i]);
138#ifdef TRACK_PITCH_ANGLE
139 else if (
bcLo[i] == reflectingPitchAngleBC && x[i] <
box.
lo[i]) {
140 x[i] += 2 * (
box.
lo[i] - x[i]);
142 }
else if (
bcHi[i] == reflectingPitchAngleBC && x[i] >
box.
hi[i]) {
143 x[i] -= 2 * (x[i] -
box.
hi[i]);
167 const bool recenter =
false)
const {
172 if (recenter) x_ -= (
box.
lo[i] +
box.
hi[i]) / 2.0;
192 const bool recenter =
false)
const {
195 for (
int i=0; i<3; i++) x_[i] =
periodicLoop(x_[i], i, recenter);
214 const bool recenter =
false)
const {
215 std::vector<RealBox> vrb;
219 for (
int i=0; i<3; i++) {
220 if (rb.
lo[i] > rb.
hi[i]) {
232 for (
auto r : vrb1) vrb.push_back(r);
233 for (
auto r : vrb2) vrb.push_back(r);
236 if (vrb.size() == 0) vrb.push_back(rb);
246 for (
int i=0; i<3; i++) {
300 for (
int i=0; i<3; i++) {
301 if (boxLo[i] <= x[i] && x[i] <= boxHi[i])
continue;
302 Real dxLo = x[i] - boxLo[i];
304 while (dxLo < 0) dxLo +=
probSize[i];
307 Real dxHi = x[i] - boxHi[i];
309 while (dxHi < 0) dxHi +=
probSize[i];
312 Real dx2Lo = dxLo * dxLo;
313 Real dx2Hi = dxHi * dxHi;
314 d2 += std::max(dx2Lo, dx2Hi);
316 return std::sqrt(d2);
336 for (
int i=0; i<3; i++) {
337 Real dxLo = x[i] - boxLo[i];
339 while (dxLo < 0) dxLo +=
probSize[i];
342 Real dxHi = x[i] - boxHi[i];
344 while (dxHi < 0) dxHi +=
probSize[i];
347 Real dx2Lo = dxLo * dxLo;
348 Real dx2Hi = dxHi * dxHi;
349 d2 += std::max(dx2Lo, dx2Hi);
351 return std::sqrt(d2);
379 for (
int i=0; i<3; i++) {
380 Real dxLo = x[i] - boxLo[i];
382 while (dxLo < 0) dxLo +=
probSize[i];
385 Real dxHi = x[i] - boxHi[i];
387 while (dxHi < 0) dxHi +=
probSize[i];
390 Real dx2Lo = dxLo * dxLo;
391 Real dx2Hi = dxHi * dxHi;
392 d2Max[i] = std::max(dx2Lo, dx2Hi);
393 if (x[i] < boxLo[i] || x[i] > boxHi[i])
394 d2Min[i] = std::min(dx2Lo, dx2Hi);
421 d2Min = d2MinVec.
sum();
422 d2Max = d2MaxVec.
sum();
446 dMin = std::sqrt(d2Min);
447 dMax = std::sqrt(d2Max);
Class to hold data on a CR packet.
A class that holds data to describe a CR packet.
Definition CRPacket.H:28
A class that describes the geometry of a calculation.
Definition Geometry.H:32
bool contains(const RealVec &x) const
Report if a specified point is in the problem domain.
Definition Geometry.H:245
const BoolVec & isPeriodic() const
Return periodicity of problem domain.
Definition Geometry.H:95
bool isAnyOpen() const
Return whether the domain is open in any direction.
Definition Geometry.H:107
const RealBox & xBox() const
Return the domain bounding box.
Definition Geometry.H:59
BoolVec periodicity
Definition Geometry.H:456
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.
Definition Geometry.H:372
bcType
An enum describing boundary condition types.
Definition Geometry.H:39
@ openBC
Definition Geometry.H:40
@ periodicBC
Definition Geometry.H:43
@ reflectingBC
Definition Geometry.H:42
@ absorbingBC
Definition Geometry.H:41
void applyBC(RealVec &x) const
Apply boundary conditions to a packet.
Definition Geometry.H:124
const Vec3< bcType > & bHi() const
Return high boundary conditions of computational domain.
Definition Geometry.H:89
const Vec3< bcType > & bLo() const
Return low boundary conditions of computational domain.
Definition Geometry.H:83
const RealVec & xSize() const
Return size of computational domain.
Definition Geometry.H:77
bool isAnyPeriodic() const
Return whether the domain is periodic in any dimension.
Definition Geometry.H:101
Real maxBoxDist(const RealVec &x, const RealVec &boxLo, const RealVec &boxHi) const
Return maximum distance between a point and a box.
Definition Geometry.H:332
RealVec periodicLoop(const RealVec &x, const bool recenter=false) const
Loop the input position over periodic boundaries.
Definition Geometry.H:191
bool hasPeriodicDim
Definition Geometry.H:458
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.
Definition Geometry.H:414
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.
Definition Geometry.H:439
Real dist(const RealVec &x1, const RealVec &x2) const
Compute distance between two points.
Definition Geometry.H:279
Vec3< bcType > bcHi
Definition Geometry.H:453
RealVec disp(const RealVec &x1, const RealVec &x2) const
Get displacement vector between two points.
Definition Geometry.H:264
RealVec probSize
Definition Geometry.H:455
std::vector< RealBox > periodicLoopBox(const RealBox &b, const bool recenter=false) const
Loop the input box over periodic boundaries.
Definition Geometry.H:213
Vec3< bcType > bcLo
Definition Geometry.H:452
const RealVec & xHi() const
Return high boundary of computational domain.
Definition Geometry.H:71
Real minBoxDist(const RealVec &x, const RealVec &boxLo, const RealVec &boxHi) const
Return minimum distance between a point and a box.
Definition Geometry.H:296
const RealVec & xLo() const
Return low boundary of computational domain.
Definition Geometry.H:65
Real periodicLoop(const Real x, const int i, const bool recenter=false) const
Loop the input coordinate over periodic boundaries.
Definition Geometry.H:165
RealBox box
Definition Geometry.H:454
Class to parse the criptic input deck.
Definition ParmParser.H:37
Class that represents a 3D rectangular prism.
Definition RealBox.H:30
RealVec hi
Definition RealBox.H:166
RealVec lo
Definition RealBox.H:165
Real mag() const
Computes the magnitude of the vector.
Definition Vec3.H:470
T sum() const
Return the sum of the elements.
Definition Vec3.H:561
The primary namespace for criptic objects.
Definition AdvancePacket.H:25
criptic::FieldQty max(const criptic::FieldQty &q1, const criptic::FieldQty &q2)
Take elementwise maximum of two FieldQty objects.
Definition FieldQty.H:277
double Real
Definition Types.H:38