ImpactX
PushAll.H
Go to the documentation of this file.
1 /* Copyright 2022-2023 The Regents of the University of California, through Lawrence
2  * Berkeley National Laboratory (subject to receipt of any required
3  * approvals from the U.S. Dept. of Energy). All rights reserved.
4  *
5  * This file is part of ImpactX.
6  *
7  * Authors: Axel Huebl
8  * License: BSD-3-Clause-LBNL
9  */
10 #ifndef IMPACTX_PUSH_ALL_H
11 #define IMPACTX_PUSH_ALL_H
12 
14 
15 
16 namespace impactx
17 {
29  template<typename T_Element>
30  void push_all (
32  T_Element & element,
33  [[maybe_unused]] int step,
34  [[maybe_unused]] bool omp_parallel = true
35  )
36  {
37  // preparing to access reference particle data: RefPart
38  RefPart & ref_part = pc.GetRefParticle();
39 
40  // push reference particle in global coordinates
41  element(ref_part);
42 
43  // loop over refinement levels
44  int const nLevel = pc.finestLevel();
45  for (int lev = 0; lev <= nLevel; ++lev)
46  {
47  // loop over all particle boxes
49 #ifdef AMREX_USE_OMP
50 #pragma omp parallel if (amrex::Gpu::notInLaunchRegion() && omp_parallel)
51 #endif
52  for (ParIt pti(pc, lev); pti.isValid(); ++pti) {
53  // push beam particles relative to reference particle
54  element(pti, ref_part);
55  } // end loop over all particle boxes
56  } // env mesh-refinement level loop
57  }
58 
59 } // namespace impactx
60 
61 #endif // IMPACTX_PUSH_ALL_H
impactx::ParIter iterator
amrex iterator for particle boxes
Definition: ImpactXParticleContainer.H:131
Definition: ImpactX.cpp:31
RefPart & GetRefParticle()
Definition: ImpactXParticleContainer.cpp:155
void push_all(ImpactXParticleContainer &pc, T_Element &element, [[maybe_unused]] int step, [[maybe_unused]] bool omp_parallel=true)
Definition: PushAll.H:30
Definition: ReferenceParticle.H:29
Definition: ImpactXParticleContainer.H:126