OPAL (Object Oriented Parallel Accelerator Library) 2024.2
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
51 typedef typename PLayout::AmrProcMap_t AmrProcMap_t;
52 typedef typename PLayout::AmrGrid_t AmrGrid_t;
53 typedef typename PLayout::AmrGeometry_t AmrGeometry_t;
54 typedef typename PLayout::AmrIntVect_t AmrIntVect_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
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>
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
121private:
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
191private:
193};
194
195
196#include "Amr/BoxLibParticle.hpp"
197
198#endif
ParticleLayout< T, Dim > PLayout
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
BoxLibParticle(PLayout *layout)
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 scatter(ParticleAttrib< FT > &attrib, AmrField_t &f, ParticleAttrib< Vektor< PT, Dim > > &pp, const ParticleAttrib< int > &pbin, int bin=-1, int level=0)
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
AmrParticleLevelCounter< size_t, size_t > ParticleLevelCounter_t
PLayout::AmrVectorField_t AmrVectorField_t
PLayout::AmrField_t AmrField_t
PLayout::AmrScalarFieldContainer_t AmrScalarFieldContainer_t
PLayout::AmrVectorFieldContainer_t AmrVectorFieldContainer_t
PLayout::SingleParticlePos_t SingleParticlePos_t
PLayout::ParticleIndex_t ParticleIndex_t
Timing::TimerRef TimerRef