|
OPAL (Object Oriented Parallel Accelerator Library) 2024.2
OPAL
|
#include <BoxLibLayout.h>
Public Member Functions | |
| BoxLibLayout () | |
| BoxLibLayout (const BoxLibLayout *layout_p) | |
| BoxLibLayout (int nGridPoints, int maxGridSize) | |
| BoxLibLayout (const AmrGeometry_t &geom, const AmrProcMap_t &dmap, const AmrGrid_t &ba) | |
| BoxLibLayout (const AmrGeomContainer_t &geom, const AmrProcMapContainer_t &dmap, const AmrGridContainer_t &ba, const AmrIntArray_t &rr) | |
| void | setBoundingBox (double dh) |
| void | setDomainRatio (const std::vector< double > &ratio) |
| void | update (IpplParticleBase< BoxLibLayout< T, Dim > > &PData, const ParticleAttrib< char > *canSwap=0) |
| void | update (AmrParticleBase< BoxLibLayout< T, Dim > > &PData, int lev_min=0, int lev_max=-1, bool isRegrid=false) |
| AmrIntVect_t | Index (AmrParticleBase< BoxLibLayout< T, Dim > > &p, const unsigned int ip, int level) const |
| AmrIntVect_t | Index (SingleParticlePos_t &R, int lev) const |
| void | buildLevelMask (int lev, const int ncells=1) |
| void | clearLevelMask (int lev) |
| const std::unique_ptr< mask_t > & | getLevelMask (int lev) const |
| void | resize (int maxLevel) |
| void | define (const AmrGeomContainer_t &geom) |
| void | define (const AmrIntVectContainer_t &refRatio) |
| bool | LevelDefined (int level) const |
| int | finestLevel () const |
| int | maxLevel () const |
| AmrIntVect_t | refRatio (int level) const |
| int | MaxRefRatio (int level) const |
| void | setFinestLevel (int finestLevel) |
| void | setMaxLevel (int maxLevel) |
| void | setUpdateFlag (UpdateFlags f, bool val) |
| bool | getUpdateFlag (UpdateFlags f) const |
| ParticleBConds< T, Dim > & | getBConds () |
| void | setBConds (const ParticleBConds< T, Dim > &bc) |
Static Public Attributes | |
| static Vector_t | lowerBound |
| static Vector_t | upperBound |
Protected Member Functions | |
| template<class PPT, class NDI> | |
| void | apply_bconds (unsigned n, PPT &R, const ParticleBConds< T, Dim > &bcs, const NDI &nr) |
Protected Attributes | |
| int | finestLevel_m |
| Current finest level of simluation. | |
| int | maxLevel_m |
| Maximum level allowed. | |
Private Member Functions | |
| void | initBaseBox_m (int nGridPoints, int maxGridSize, double dh=0.04) |
| bool | Where (AmrParticleBase< BoxLibLayout< T, Dim > > &p, const unsigned int ip, int lev_min=0, int lev_max=-1, int nGrow=0) const |
| bool | EnforcePeriodicWhere (AmrParticleBase< BoxLibLayout< T, Dim > > &prt, const unsigned int ip, int lev_min=0, int lev_max=-1) const |
| bool | PeriodicShift (SingleParticlePos_t R) const |
| void | locateParticle (AmrParticleBase< BoxLibLayout< T, Dim > > &p, const unsigned int ip, int lev_min, int lev_max, int nGrow) const |
Private Attributes | |
| AmrIntVectContainer_t | refRatio_m |
| std::vector< std::unique_ptr< mask_t > > | masks_m |
| Refinement ratios [0:finest_level-1]. | |
| ParticleBConds< T, Dim > | BoundConds |
| unsigned int | UpdateOptions |
Definition at line 47 of file BoxLibLayout.h.
| typedef amr::AmrBox_t BoxLibLayout< T, Dim >::AmrBox_t |
Definition at line 74 of file BoxLibLayout.h.
| typedef amr::AmrDomain_t BoxLibLayout< T, Dim >::AmrDomain_t |
Definition at line 73 of file BoxLibLayout.h.
| typedef amr::AmrField_t BoxLibLayout< T, Dim >::AmrField_t |
Definition at line 57 of file BoxLibLayout.h.
| typedef amr::AmrGeomContainer_t BoxLibLayout< T, Dim >::AmrGeomContainer_t |
Definition at line 67 of file BoxLibLayout.h.
| typedef amr::AmrGeometry_t BoxLibLayout< T, Dim >::AmrGeometry_t |
Definition at line 66 of file BoxLibLayout.h.
| typedef amr::AmrGrid_t BoxLibLayout< T, Dim >::AmrGrid_t |
Definition at line 65 of file BoxLibLayout.h.
| typedef amr::AmrGridContainer_t BoxLibLayout< T, Dim >::AmrGridContainer_t |
Definition at line 68 of file BoxLibLayout.h.
| typedef amr::AmrIntArray_t BoxLibLayout< T, Dim >::AmrIntArray_t |
Definition at line 72 of file BoxLibLayout.h.
| typedef amr::AmrIntVect_t BoxLibLayout< T, Dim >::AmrIntVect_t |
Definition at line 70 of file BoxLibLayout.h.
| typedef amr::AmrIntVectContainer_t BoxLibLayout< T, Dim >::AmrIntVectContainer_t |
Definition at line 71 of file BoxLibLayout.h.
| typedef amr::AmrProcMap_t BoxLibLayout< T, Dim >::AmrProcMap_t |
Definition at line 64 of file BoxLibLayout.h.
| typedef amr::AmrProcMapContainer_t BoxLibLayout< T, Dim >::AmrProcMapContainer_t |
Definition at line 69 of file BoxLibLayout.h.
| typedef amr::AmrReal_t BoxLibLayout< T, Dim >::AmrReal_t |
Definition at line 75 of file BoxLibLayout.h.
| typedef amr::AmrScalarFieldContainer_t BoxLibLayout< T, Dim >::AmrScalarFieldContainer_t |
Definition at line 59 of file BoxLibLayout.h.
| typedef amr::AmrVectorField_t BoxLibLayout< T, Dim >::AmrVectorField_t |
Definition at line 58 of file BoxLibLayout.h.
| typedef amr::AmrVectorFieldContainer_t BoxLibLayout< T, Dim >::AmrVectorFieldContainer_t |
Definition at line 60 of file BoxLibLayout.h.
| typedef amrex::BaseFab<int> BoxLibLayout< T, Dim >::basefab_t |
Definition at line 77 of file BoxLibLayout.h.
| typedef ParticleAmrLayout<T,Dim>::Index_t BoxLibLayout< T, Dim >::Index_t |
Definition at line 55 of file BoxLibLayout.h.
| typedef amrex::FabArray<basefab_t> BoxLibLayout< T, Dim >::mask_t |
Definition at line 78 of file BoxLibLayout.h.
| typedef ParticleAmrLayout<T,Dim>::pair_iterator BoxLibLayout< T, Dim >::pair_iterator |
Definition at line 53 of file BoxLibLayout.h.
| typedef ParticleAmrLayout<T,Dim>::pair_t BoxLibLayout< T, Dim >::pair_t |
Definition at line 52 of file BoxLibLayout.h.
| typedef ParticleAttrib<Index_t> BoxLibLayout< T, Dim >::ParticleIndex_t |
Definition at line 62 of file BoxLibLayout.h.
| typedef ParticleAmrLayout<T,Dim>::ParticlePos_t BoxLibLayout< T, Dim >::ParticlePos_t |
Definition at line 61 of file BoxLibLayout.h.
|
inherited |
Definition at line 62 of file ParticleLayout.h.
| typedef ParticleAmrLayout<T,Dim>::SingleParticlePos_t BoxLibLayout< T, Dim >::SingleParticlePos_t |
Definition at line 54 of file BoxLibLayout.h.
|
inherited |
| Enumerator | |
|---|---|
| Dimension | |
Definition at line 58 of file ParticleLayout.h.
|
inherited |
| Enumerator | |
|---|---|
| SWAP | |
| BCONDS | |
| NUMFLAGS | |
| OPTDESTROY | |
| ALL | |
Definition at line 59 of file ParticleLayout.h.
| BoxLibLayout< T, Dim >::BoxLibLayout | ( | ) |
Initializes default Geometry, DistributionMapping and BoxArray.
Definition at line 61 of file BoxLibLayout.hpp.
References Dim, IpplInfo::getNodes(), initBaseBox_m(), ParticleAmrLayout< T, Dim >::ParticleAmrLayout(), and refRatio_m.
Referenced by BoxLibLayout(), EnforcePeriodicWhere(), Index(), locateParticle(), update(), update(), and Where().
| BoxLibLayout< T, Dim >::BoxLibLayout | ( | const BoxLibLayout< T, Dim > * | layout_p | ) |
Given a layout it copies that.
Definition at line 85 of file BoxLibLayout.hpp.
References BoxLibLayout(), Dim, ParticleAmrLayout< T, Dim >::maxLevel_m, ParticleAmrLayout< T, Dim >::ParticleAmrLayout(), refRatio(), and refRatio_m.
| BoxLibLayout< T, Dim >::BoxLibLayout | ( | int | nGridPoints, |
| int | maxGridSize ) |
| nGridPoints | per dimension (nx, ny, nz / nt) |
| maxGridSize | for all levels. |
Definition at line 100 of file BoxLibLayout.hpp.
References Dim, initBaseBox_m(), ParticleAmrLayout< T, Dim >::ParticleAmrLayout(), and refRatio_m.
| BoxLibLayout< T, Dim >::BoxLibLayout | ( | const AmrGeometry_t & | geom, |
| const AmrProcMap_t & | dmap, | ||
| const AmrGrid_t & | ba ) |
Single-level constructor.
| geom | specifies the box domain |
| dmap | is the distribution map for grids |
| ba | is the array of boxes for a level |
Definition at line 110 of file BoxLibLayout.hpp.
References Dim, ParticleAmrLayout< T, Dim >::ParticleAmrLayout(), and refRatio_m.
| BoxLibLayout< T, Dim >::BoxLibLayout | ( | const AmrGeomContainer_t & | geom, |
| const AmrProcMapContainer_t & | dmap, | ||
| const AmrGridContainer_t & | ba, | ||
| const AmrIntArray_t & | rr ) |
Multi-level constructor.
| geom | is basically the physical domain storing the mesh spacing per level |
| dmap | are all distribution maps of grids to core |
| ba | are all boxes of all levels |
| rr | is the refinement ratio among the levels (always the ratio from l to l+1) |
Definition at line 120 of file BoxLibLayout.hpp.
References Dim, ParticleAmrLayout< T, Dim >::ParticleAmrLayout(), and refRatio_m.
|
inlineprotectedinherited |
Definition at line 106 of file ParticleLayout.h.
Referenced by ParticleCashedLayout< T, Dim, Mesh >::update(), ParticleInteractLayout< T, Dim, Mesh >::update(), and ParticleSpatialLayout< T, Dim, Mesh, CachingPolicy >::update().
| void BoxLibLayout< T, Dim >::buildLevelMask | ( | int | lev, |
| const int | ncells = 1 ) |
Build mask for a level used for interpolation from grid to particles to reduce spurious self field forces near coarse-fine interfaces.
Definition at line 416 of file BoxLibLayout.hpp.
References masks_m.
| void BoxLibLayout< T, Dim >::clearLevelMask | ( | int | lev | ) |
Definition at line 477 of file BoxLibLayout.hpp.
|
inline |
Set the geometry of the problem. It is called in AmrBoxLib::initBaseLevel_m().
| geom | geometry of all levels |
Definition at line 252 of file BoxLibLayout.h.
|
inline |
Set the refinement ratios. It is called in AmrBoxLib::initBaseLevel_m().
| refRatio | among levels |
Definition at line 263 of file BoxLibLayout.h.
|
private |
Function from AMReX adjusted to work with Ippl AmrParticleBase class Checks/sets whether the particle has crossed a periodic boundary in such a way that it is on levels lev_min and higher.
| prt | is the bunch information |
| ip | is the local (i.e. to a core) particle index |
| lev_min | to check |
| lev_max | to check |
Definition at line 597 of file BoxLibLayout.hpp.
References BoxLibLayout(), finestLevel(), Index(), PAssert, and PeriodicShift().
Referenced by locateParticle().
|
inline |
Definition at line 763 of file BoxLibLayout.hpp.
References ParticleAmrLayout< T, Dim >::finestLevel_m.
Referenced by EnforcePeriodicWhere(), update(), Where(), and AmrYtWriter::writeBunch().
|
inlineinherited |
| const std::unique_ptr< typename BoxLibLayout< T, Dim >::mask_t > & BoxLibLayout< T, Dim >::getLevelMask | ( | int | lev | ) | const |
Definition at line 485 of file BoxLibLayout.hpp.
References masks_m.
|
inlineinherited |
Definition at line 86 of file ParticleLayout.h.
Referenced by ParticleCashedLayout< T, Dim, Mesh >::getCashedParticles(), ParticleInteractLayout< T, Dim, Mesh >::getPairlist(), IpplParticleBase< Layout_t >::getUpdateFlag(), ParticleCashedLayout< T, Dim, Mesh >::update(), ParticleInteractLayout< T, Dim, Mesh >::update(), ParticleSpatialLayout< T, Dim, Mesh, CachingPolicy >::update(), and ParticleUniformLayout< T, Dim >::update().
| BoxLibLayout< T, Dim >::AmrIntVect_t BoxLibLayout< T, Dim >::Index | ( | AmrParticleBase< BoxLibLayout< T, Dim > > & | p, |
| const unsigned int | ip, | ||
| int | level ) const |
Get the cell of a particle
| p | is the particle data |
| ip | is the local index of the particle in the container |
| level | of the particle |
Definition at line 389 of file BoxLibLayout.hpp.
References BoxLibLayout(), and Index().
Referenced by EnforcePeriodicWhere(), Index(), PeriodicShift(), and Where().
| BoxLibLayout< T, Dim >::AmrIntVect_t BoxLibLayout< T, Dim >::Index | ( | SingleParticlePos_t & | R, |
| int | lev ) const |
Get the cell of a particle
| R | is the position of a particle |
| lev | is the level |
Definition at line 399 of file BoxLibLayout.hpp.
References floor().
|
private |
Set up the box for the whole computation. The AMR object owning the bunch is not yet initialized.
| nGridPoints | per dimension (nx, ny, nz / nt) |
| maxGridSize | for all levels |
| dh | is the mesh enlargement factor |
Definition at line 791 of file BoxLibLayout.hpp.
References IpplInfo::getNodes(), lowerBound, PAssert, and upperBound.
Referenced by BoxLibLayout(), BoxLibLayout(), and setBoundingBox().
|
inline |
Check if an AMR level is well defined
| level | to check |
Definition at line 757 of file BoxLibLayout.hpp.
References ParticleAmrLayout< T, Dim >::maxLevel_m.
Referenced by update().
|
private |
Function from AMReX adjusted to work with Ippl AmrParticleBase class
| p | is basically the bunch |
| ip | is the local particle index |
| lev_min | to check |
| lev_max | to check |
| nGrow | is the number of ghost cells |
Definition at line 710 of file BoxLibLayout.hpp.
References BoxLibLayout(), EnforcePeriodicWhere(), and Where().
Referenced by update().
|
inline |
Definition at line 769 of file BoxLibLayout.hpp.
References ParticleAmrLayout< T, Dim >::maxLevel_m.
|
inline |
| level |
Definition at line 782 of file BoxLibLayout.hpp.
References refRatio_m.
|
private |
Function from AMReX adjusted to work with Ippl AmrParticleBase class
Move the particle to the opposite side of the domain
| R | is the particle position |
Definition at line 642 of file BoxLibLayout.hpp.
References Index(), and PAssert.
Referenced by EnforcePeriodicWhere().
|
inline |
| level |
Definition at line 776 of file BoxLibLayout.hpp.
References refRatio_m.
Referenced by BoxLibLayout().
|
inline |
The particles live initially on the coarsest level. Furthermore, the order the OPAL input file is parsed does not allow us to know the maximum level of the computation. This is known after that the FieldSolver is initialized. Therefore, we need to update the size of the ParGDB containers.
| maxLevel | is set when the FieldSolver is initialized |
Definition at line 235 of file BoxLibLayout.h.
|
inlineinherited |
Definition at line 94 of file ParticleLayout.h.
|
virtual |
This method is used when creating the AMR object. OPAL takes the input argument BBOXINCR that is specified in the field solver command. Up to this point the AMR object is not yet initialized. After that this method shouldn't be called anymore.
| dh | is the mesh enlargement factor |
Implements ParticleAmrLayout< T, Dim >.
Definition at line 131 of file BoxLibLayout.hpp.
References initBaseBox_m().
Referenced by AmrPartBunch::set_meshEnlargement().
| void BoxLibLayout< T, Dim >::setDomainRatio | ( | const std::vector< double > & | ratio | ) |
The Poisson computation domain is per default [-1,1]^3. With this method this can be changed in order to account for the different extent per direction.
| ratio,if | e.g. ratio = [1, 2, 0.75], then the box is [-1, 1] x [-2, 2] x [-0.75, 0.75] |
Definition at line 142 of file BoxLibLayout.hpp.
References Dim, lowerBound, and upperBound.
Referenced by AmrPartBunch::setAmrDomainRatio().
|
inherited |
| finestLevel | of current simulation state |
Definition at line 79 of file ParticleAmrLayout.h.
References finestLevel_m.
|
inherited |
| maxLevel | allowed during simulation run |
Definition at line 85 of file ParticleAmrLayout.h.
References maxLevel_m.
|
inlineinherited |
Definition at line 76 of file ParticleLayout.h.
Referenced by ParticleLayout(), and IpplParticleBase< Layout_t >::setUpdateFlag().
| void BoxLibLayout< T, Dim >::update | ( | AmrParticleBase< BoxLibLayout< T, Dim > > & | PData, |
| int | lev_min = 0, | ||
| int | lev_max = -1, | ||
| bool | isRegrid = false ) |
The proper update method for AMR.
| PData | is basically the bunch |
| lev_min | base level to update |
| lev_max | finest level to update (if -1 update all levels starting from lev_min) |
| isRegrid | in regrid mode a level might be deleted, thus the particle level counter might be invalidated --> we need to iterate through all particles. |
Definition at line 185 of file BoxLibLayout.hpp.
References MsgBuffer::add(), allreduce(), BoxLibLayout(), IpplInfo::Comm, Communicate::COMM_ANY_NODE, finestLevel(), MsgBuffer::get(), MsgBuffer::getBuffer(), IpplInfo::getNodes(), MsgBuffer::getSize(), LevelDefined(), locateParticle(), IpplInfo::myNode(), P_LAYOUT_CYCLE, and P_SPATIAL_TRANSFER_TAG.
| void BoxLibLayout< T, Dim >::update | ( | IpplParticleBase< BoxLibLayout< T, Dim > > & | PData, |
| const ParticleAttrib< char > * | canSwap = 0 ) |
This method shouldn't be called. Otherwise it throws an exception.
Definition at line 171 of file BoxLibLayout.hpp.
References BoxLibLayout().
|
private |
Function from AMReX adjusted to work with Ippl AmrParticleBase class Checks/sets a particles location on levels lev_min and higher.
| p | is the bunch information |
| ip | is the local (i.e. to a core) particle index |
| lev_min | to check |
| lev_max | to check |
| nGrow | is the number of ghost cells |
Definition at line 543 of file BoxLibLayout.hpp.
References BoxLibLayout(), finestLevel(), Index(), and PAssert.
Referenced by locateParticle().
|
privateinherited |
Definition at line 118 of file ParticleLayout.h.
|
protectedinherited |
Current finest level of simluation.
Definition at line 63 of file ParticleAmrLayout.h.
Referenced by BoxLibLayout< T, Dim >::finestLevel(), ParticleAmrLayout(), and setFinestLevel().
|
static |
Lower physical domain boundary (each dimension). It has to be smaller than -1 since all particles are within \([-1, 1]^3\). The real computational domain is multiplied with the mesh enlargement factor (in [%]) in BoxLibLayout::initBaseBox_m().
Definition at line 86 of file BoxLibLayout.h.
Referenced by initBaseBox_m(), and setDomainRatio().
|
private |
Refinement ratios [0:finest_level-1].
Definition at line 382 of file BoxLibLayout.h.
Referenced by buildLevelMask(), clearLevelMask(), and getLevelMask().
|
protectedinherited |
Maximum level allowed.
Definition at line 64 of file ParticleAmrLayout.h.
Referenced by BoxLibLayout< T, Dim >::BoxLibLayout(), BoxLibLayout< T, Dim >::LevelDefined(), BoxLibLayout< T, Dim >::maxLevel(), ParticleAmrLayout(), and setMaxLevel().
|
private |
Definition at line 377 of file BoxLibLayout.h.
Referenced by BoxLibLayout(), BoxLibLayout(), BoxLibLayout(), BoxLibLayout(), BoxLibLayout(), MaxRefRatio(), and refRatio().
|
privateinherited |
Definition at line 121 of file ParticleLayout.h.
|
static |
Upper physical domain boundary (each dimension). It has to be greater than 1 since all particles are within \([-1, 1]^3\). The real computational domain is multiplied with the mesh enlargement factor (in [%]) in BoxLibLayout::initBaseBox_m().
Definition at line 93 of file BoxLibLayout.h.
Referenced by initBaseBox_m(), and setDomainRatio().