MAIA bb96820c
Multiphysics at AIA
Loading...
Searching...
No Matches
CartesianGrid< nDim >::azimuthalBbox Struct Reference

#include <cartesiangrid.h>

Public Member Functions

void init (MFloat angle, MInt periodicDir1, MInt periodicDir2, MInt noLayers)
 
MInt azimuthalSide (const MFloat phi)
 
MFloat azimuthalCenter ()
 
MFloat azimuthalBoundary (const MFloat *coords, MInt side)
 
MInt index (const MFloat *coord, MInt dir)
 

Public Attributes

MFloat azimuthalAngle = F0
 
MFloat minCoord [nDim]
 
MFloat boxLength [nDim]
 
MInt nBins [nDim]
 
MFloatminPer3 = nullptr
 
MFloatmaxPer3 = nullptr
 
MFloat center = F0
 
MInt axDir = -1
 
MInt perDir1 = -1
 
MInt perDir2 = -1
 
MInt noHaloLayers = -1
 

Detailed Description

template<MInt nDim>
struct CartesianGrid< nDim >::azimuthalBbox

Definition at line 276 of file cartesiangrid.h.

Member Function Documentation

◆ azimuthalBoundary()

template<MInt nDim>
MFloat CartesianGrid< nDim >::azimuthalBbox::azimuthalBoundary ( const MFloat coords,
MInt  side 
)
inline

Definition at line 310 of file cartesiangrid.h.

310 {
311 MInt perSize2 = nBins[perDir2];
312 MInt ind1 = index(coords, perDir1);
313 MInt ind2 = index(coords, perDir2);
314 if(side < 0) {
315 MFloat minPhi = center - F1B2 * azimuthalAngle; // std::numeric_limits<MFloat>::max();
316 for(MInt i = -(noHaloLayers + 1); i < (noHaloLayers + 2); i++) {
317 MInt ind1_ = ind1 + i;
318 ind1_ = mMax(0, mMin(ind1_, nBins[perDir1] - 1));
319 MInt ind2_ = ind2 + i;
320 ind2_ = mMax(0, mMin(ind2_, nBins[perDir2] - 1));
321 minPhi = mMin(minPhi, minPer3[ind1 * perSize2 + ind2_]);
322 minPhi = mMin(minPhi, minPer3[ind1_ * perSize2 + ind2]);
323 }
324 return minPhi;
325 } else if(side > 0) {
326 MFloat maxPhi = center + F1B2 * azimuthalAngle; //-std::numeric_limits<MFloat>::max();
327 for(MInt i = -(noHaloLayers + 1); i < (noHaloLayers + 2); i++) {
328 MInt ind1_ = ind1 + i;
329 ind1_ = mMax(0, mMin(ind1_, nBins[perDir1] - 1));
330 MInt ind2_ = ind2 + i;
331 ind2_ = mMax(0, mMin(ind2_, nBins[perDir2] - 1));
332 maxPhi = mMax(maxPhi, maxPer3[ind1 * perSize2 + ind2_]);
333 maxPhi = mMax(maxPhi, maxPer3[ind1_ * perSize2 + ind2]);
334 }
335 return maxPhi;
336 } else {
337 mTerm(1, AT_, "side = 0?");
338 }
339 }
void mTerm(const MInt errorCode, const MString &location, const MString &message)
Definition: functions.cpp:29
constexpr T mMin(const T &x, const T &y)
Definition: functions.h:90
constexpr T mMax(const T &x, const T &y)
Definition: functions.h:94
int32_t MInt
Definition: maiatypes.h:62
double MFloat
Definition: maiatypes.h:52
MInt index(const MFloat *coord, MInt dir)

◆ azimuthalCenter()

template<MInt nDim>
MFloat CartesianGrid< nDim >::azimuthalBbox::azimuthalCenter ( )
inline

Definition at line 309 of file cartesiangrid.h.

309{ return center; }

◆ azimuthalSide()

template<MInt nDim>
MInt CartesianGrid< nDim >::azimuthalBbox::azimuthalSide ( const MFloat  phi)
inline

Definition at line 301 of file cartesiangrid.h.

301 {
302 MFloat mid = center;
303 if(mid > phi) {
304 return -1;
305 } else {
306 return 1;
307 }
308 }

◆ index()

template<MInt nDim>
MInt CartesianGrid< nDim >::azimuthalBbox::index ( const MFloat coord,
MInt  dir 
)
inline

Definition at line 340 of file cartesiangrid.h.

340 {
341 MInt ind = -1;
342 ind = (MInt)((coord[dir] - minCoord[dir]) * nBins[dir] / boxLength[dir]);
343 if(ind < 0)
344 ind = 0;
345 else if(ind >= nBins[dir])
346 ind = nBins[dir] - 1;
347
348 return ind;
349 }

◆ init()

template<MInt nDim>
void CartesianGrid< nDim >::azimuthalBbox::init ( MFloat  angle,
MInt  periodicDir1,
MInt  periodicDir2,
MInt  noLayers 
)
inline

Definition at line 289 of file cartesiangrid.h.

289 {
290 azimuthalAngle = angle;
291 perDir1 = periodicDir1;
292 perDir2 = periodicDir2;
293 noHaloLayers = noLayers;
294 MInt perSize1 = nBins[perDir1];
295 MInt perSize2 = nBins[perDir2];
298 mAlloc(minPer3, perSize1 * perSize2, "minPer3", std::numeric_limits<MFloat>::max(), AT_);
299 mAlloc(maxPer3, perSize1 * perSize2, "maxPer3", -std::numeric_limits<MFloat>::max(), AT_);
300 }
void mAlloc(T *&a, const MLong N, const MString &objectName, MString function)
allocates memory for one-dimensional array 'a' of size N
Definition: alloc.h:173
MBool mDeallocate(T *&a)
deallocates the memory previously allocated for element 'a'
Definition: alloc.h:544

Member Data Documentation

◆ axDir

template<MInt nDim>
MInt CartesianGrid< nDim >::azimuthalBbox::axDir = -1

Definition at line 284 of file cartesiangrid.h.

◆ azimuthalAngle

template<MInt nDim>
MFloat CartesianGrid< nDim >::azimuthalBbox::azimuthalAngle = F0

Definition at line 277 of file cartesiangrid.h.

◆ boxLength

template<MInt nDim>
MFloat CartesianGrid< nDim >::azimuthalBbox::boxLength[nDim]

Definition at line 279 of file cartesiangrid.h.

◆ center

template<MInt nDim>
MFloat CartesianGrid< nDim >::azimuthalBbox::center = F0

Definition at line 283 of file cartesiangrid.h.

◆ maxPer3

template<MInt nDim>
MFloat* CartesianGrid< nDim >::azimuthalBbox::maxPer3 = nullptr

Definition at line 282 of file cartesiangrid.h.

◆ minCoord

template<MInt nDim>
MFloat CartesianGrid< nDim >::azimuthalBbox::minCoord[nDim]

Definition at line 278 of file cartesiangrid.h.

◆ minPer3

template<MInt nDim>
MFloat* CartesianGrid< nDim >::azimuthalBbox::minPer3 = nullptr

Definition at line 281 of file cartesiangrid.h.

◆ nBins

template<MInt nDim>
MInt CartesianGrid< nDim >::azimuthalBbox::nBins[nDim]

Definition at line 280 of file cartesiangrid.h.

◆ noHaloLayers

template<MInt nDim>
MInt CartesianGrid< nDim >::azimuthalBbox::noHaloLayers = -1

Definition at line 287 of file cartesiangrid.h.

◆ perDir1

template<MInt nDim>
MInt CartesianGrid< nDim >::azimuthalBbox::perDir1 = -1

Definition at line 285 of file cartesiangrid.h.

◆ perDir2

template<MInt nDim>
MInt CartesianGrid< nDim >::azimuthalBbox::perDir2 = -1

Definition at line 286 of file cartesiangrid.h.


The documentation for this struct was generated from the following file: