OPAL (Object Oriented Parallel Accelerator Library)  2024.1
OPAL
BoxLibParticle.h
Go to the documentation of this file.
1 //
2 // Class BoxLibParticle
3 // Particle class for AMReX. It works together with BoxLibLayout.
4 // The class does the scatter and gather operations of attributes
5 // to and from the grid. Ippl implements the same functionality in the
6 // attribute class.
7 //
8 // Copyright (c) 2016 - 2020, Matthias Frey, Uldis Locans, Paul Scherrer Institut, Villigen PSI, Switzerland
9 // All rights reserved
10 //
11 // Implemented as part of the PhD thesis
12 // "Precise Simulations of Multibunches in High Intensity Cyclotrons"
13 //
14 // This file is part of OPAL.
15 //
16 // OPAL is free software: you can redistribute it and/or modify
17 // it under the terms of the GNU General Public License as published by
18 // the Free Software Foundation, either version 3 of the License, or
19 // (at your option) any later version.
20 //
21 // You should have received a copy of the GNU General Public License
22 // along with OPAL. If not, see <https://www.gnu.org/licenses/>.
23 //
24 #ifndef BOXLIB_PARTICLE_H
25 #define BOXLIB_PARTICLE_H
26 
28 
29 #include <AMReX_REAL.H>
30 #include <AMReX_IntVect.H>
31 #include <AMReX_Vector.H>
32 #include <AMReX_Utility.H>
33 #include <AMReX_Geometry.H>
34 #include <AMReX_RealBox.H>
35 
36 
37 template<class PLayout>
38 class BoxLibParticle: public virtual AmrParticleBase<PLayout> {
39 
40 public:
45  // Array<std::unique_ptr<MultiFab> >
50 
52  typedef typename PLayout::AmrGrid_t AmrGrid_t;
55  typedef typename PLayout::AmrBox_t AmrBox_t;
56  typedef typename PLayout::AmrReal_t AmrReal_t;
57 
58  typedef amrex::FArrayBox FArrayBox_t;
59 
60 public:
62 
66  BoxLibParticle(PLayout *layout);
67 
81  template <class FT, unsigned Dim, class PT>
84  int lbase, int lfine,
85  const ParticleAttrib<int>& pbin, int bin = -1);
86 
99  template <class FT, unsigned Dim, class PT>
100  void scatter(ParticleAttrib<FT>& attrib, AmrField_t& f,
102  const ParticleAttrib<int>& pbin, int bin = -1,
103  int level = 0);
104 
116  template <class FT, unsigned Dim, class PT>
119  int lbase, int lfine);
120 
121 private:
122  /*
123  * AMReX functions adjusted to work with Ippl
124  */
125 
136  template <class AType>
138  AmrScalarFieldContainer_t& mf_to_be_filled,
139  int lev_min, int ncomp, int finest_level,
140  const ParticleAttrib<int>& pbin, int bin = -1) const;
141 
150  template <class AType>
152  AmrVectorFieldContainer_t& mesh_data,
153  int lev_min, int lev_max);
154 
162  template <class AType>
164 
172  template <class AType>
174  AmrVectorFieldContainer_t& mesh_data,
175  int lev);
176 
186  template <class AType>
188  const ParticleAttrib<int>& pbin, int bin = -1,
189  int ncomp=1, int particle_lvl_offset = 0) const;
190 
191 private:
193 };
194 
195 
196 #include "Amr/BoxLibParticle.hpp"
197 
198 #endif
PLayout::AmrField_t AmrField_t
void AssignDensityFort(ParticleAttrib< AType > &pa, AmrScalarFieldContainer_t &mf_to_be_filled, int lev_min, int ncomp, int finest_level, const ParticleAttrib< int > &pbin, int bin=-1) const
void InterpolateSingleLevelFort(ParticleAttrib< AType > &pa, AmrVectorField_t &mesh_data, int lev)
amrex::BoxArray AmrGrid_t
Definition: AmrDefs.h:40
void AssignCellDensitySingleLevelFort(ParticleAttrib< AType > &pa, AmrField_t &mf, int level, const ParticleAttrib< int > &pbin, int bin=-1, int ncomp=1, int particle_lvl_offset=0) const
IpplTimings::TimerRef AssignDensityTimer_m
amrex::IntVect AmrIntVect_t
Definition: AmrDefs.h:48
AmrParticleBase< PLayout >::AmrVectorFieldContainer_t AmrVectorFieldContainer_t
Timing::TimerRef TimerRef
Definition: IpplTimings.h:176
PLayout::ParticlePos_t ParticlePos_t
AmrParticleBase< PLayout >::SingleParticlePos_t SingleParticlePos_t
amrex::DistributionMapping AmrProcMap_t
Definition: AmrDefs.h:38
amrex::Geometry AmrGeometry_t
Definition: AmrDefs.h:39
PLayout::AmrIntVect_t AmrIntVect_t
amrex::Real AmrReal_t
Definition: AmrDefs.h:51
void gather(ParticleAttrib< FT > &attrib, AmrVectorFieldContainer_t &f, ParticleAttrib< Vektor< PT, Dim > > &pp, int lbase, int lfine)
PLayout::AmrProcMap_t AmrProcMap_t
AmrParticleBase< PLayout >::AmrVectorField_t AmrVectorField_t
PLayout::AmrGrid_t AmrGrid_t
PLayout::ParticleIndex_t ParticleIndex_t
AmrParticleBase< PLayout >::ParticleLevelCounter_t ParticleLevelCounter_t
void InterpolateMultiLevelFort(ParticleAttrib< AType > &pa, AmrVectorFieldContainer_t &mesh_data, int lev)
amrex::FArrayBox FArrayBox_t
PLayout::AmrScalarFieldContainer_t AmrScalarFieldContainer_t
void scatter(ParticleAttrib< FT > &attrib, AmrScalarFieldContainer_t &f, ParticleAttrib< Vektor< PT, Dim > > &pp, int lbase, int lfine, const ParticleAttrib< int > &pbin, int bin=-1)
void InterpolateFort(ParticleAttrib< AType > &pa, AmrVectorFieldContainer_t &mesh_data, int lev_min, int lev_max)
AmrParticleBase< PLayout >::AmrField_t AmrField_t
AmrParticleBase< PLayout >::AmrScalarFieldContainer_t AmrScalarFieldContainer_t
AmrParticleBase< PLayout >::ParticlePos_t ParticlePos_t
PLayout::AmrVectorFieldContainer_t AmrVectorFieldContainer_t
PLayout::AmrReal_t AmrReal_t
PLayout::AmrGeometry_t AmrGeometry_t
AmrParticleBase< PLayout >::ParticleIndex_t ParticleIndex_t
PLayout::AmrBox_t AmrBox_t
amrex::Box AmrBox_t
Definition: AmrDefs.h:50
PLayout::AmrVectorField_t AmrVectorField_t