OPAL (Object Oriented Parallel Accelerator Library) 2022.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
37template<class PLayout>
38class BoxLibParticle : public virtual AmrParticleBase<PLayout>
39{
40public:
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
60public:
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
87
100 template <class FT, unsigned Dim, class PT>
101 void scatter(ParticleAttrib<FT>& attrib, AmrField_t& f,
103 const ParticleAttrib<int>& pbin, int bin = -1,
104 int level = 0);
105
117 template <class FT, unsigned Dim, class PT>
120 int lbase, int lfine);
121
122private:
123 /*
124 * AMReX functions adjusted to work with Ippl
125 */
126
137 template <class AType>
139 AmrScalarFieldContainer_t& mf_to_be_filled,
140 int lev_min, int ncomp, int finest_level,
141 const ParticleAttrib<int>& pbin, int bin = -1) const;
142
151 template <class AType>
153 AmrVectorFieldContainer_t& mesh_data,
154 int lev_min, int lev_max);
155
163 template <class AType>
165
166
174 template <class AType>
176 AmrVectorFieldContainer_t& mesh_data,
177 int lev);
178
179
189 template <class AType>
191 const ParticleAttrib<int>& pbin, int bin = -1,
192 int ncomp=1, int particle_lvl_offset = 0) const;
193
194private:
196};
197
198
199#include "BoxLibParticle.hpp"
200
201#endif
amrex::DistributionMapping AmrProcMap_t
Definition: AmrDefs.h:38
amrex::Geometry AmrGeometry_t
Definition: AmrDefs.h:39
amrex::Box AmrBox_t
Definition: AmrDefs.h:50
amrex::IntVect AmrIntVect_t
Definition: AmrDefs.h:48
amrex::Real AmrReal_t
Definition: AmrDefs.h:51
amrex::BoxArray AmrGrid_t
Definition: AmrDefs.h:40
AmrParticleBase< PLayout >::ParticleIndex_t ParticleIndex_t
AmrParticleBase< PLayout >::ParticlePos_t ParticlePos_t
PLayout::AmrIntVect_t AmrIntVect_t
AmrParticleBase< PLayout >::AmrField_t AmrField_t
AmrParticleBase< PLayout >::ParticleLevelCounter_t ParticleLevelCounter_t
PLayout::AmrProcMap_t AmrProcMap_t
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
PLayout::AmrGeometry_t AmrGeometry_t
IpplTimings::TimerRef AssignDensityTimer_m
void InterpolateMultiLevelFort(ParticleAttrib< AType > &pa, AmrVectorFieldContainer_t &mesh_data, int lev)
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
AmrParticleBase< PLayout >::SingleParticlePos_t SingleParticlePos_t
AmrParticleBase< PLayout >::AmrVectorField_t AmrVectorField_t
void gather(ParticleAttrib< FT > &attrib, AmrVectorFieldContainer_t &f, ParticleAttrib< Vektor< PT, Dim > > &pp, int lbase, int lfine)
PLayout::AmrGrid_t AmrGrid_t
AmrParticleBase< PLayout >::AmrVectorFieldContainer_t AmrVectorFieldContainer_t
PLayout::AmrBox_t AmrBox_t
void InterpolateFort(ParticleAttrib< AType > &pa, AmrVectorFieldContainer_t &mesh_data, int lev_min, int lev_max)
amrex::FArrayBox FArrayBox_t
PLayout::AmrReal_t AmrReal_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)
AmrParticleBase< PLayout >::AmrScalarFieldContainer_t AmrScalarFieldContainer_t
void InterpolateSingleLevelFort(ParticleAttrib< AType > &pa, AmrVectorField_t &mesh_data, int lev)
PLayout::ParticlePos_t ParticlePos_t
PLayout::AmrVectorField_t AmrVectorField_t
PLayout::AmrField_t AmrField_t
PLayout::AmrScalarFieldContainer_t AmrScalarFieldContainer_t
PLayout::AmrVectorFieldContainer_t AmrVectorFieldContainer_t
PLayout::ParticleIndex_t ParticleIndex_t
Timing::TimerRef TimerRef
Definition: IpplTimings.h:176