ImpactX
Loading...
Searching...
No Matches
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#include <AMReX_BLProfiler.H>
16
17
18namespace impactx
19{
32 template<typename T_Element>
33 void push_all (
35 T_Element & element,
36 [[maybe_unused]] int step,
37 [[maybe_unused]] int period,
38 [[maybe_unused]] bool omp_parallel = true
39 )
40 {
41 // performance profiling per element
42 std::string const profile_name = "impactx::push::" + std::string(T_Element::type);
43 BL_PROFILE(profile_name);
44
45 // preparing to access reference particle data: RefPart
46 RefPart & ref_part = pc.GetRefParticle();
47
48 // push reference particle in global coordinates
49 {
50 BL_PROFILE("impactx::push::RefPart");
51 element(ref_part);
52 }
53
54 // loop over refinement levels
55 int const nLevel = pc.finestLevel();
56 for (int lev = 0; lev <= nLevel; ++lev)
57 {
58 // loop over all particle boxes
60#ifdef AMREX_USE_OMP
61#pragma omp parallel if (amrex::Gpu::notInLaunchRegion() && omp_parallel)
62#endif
63 for (ParIt pti(pc, lev); pti.isValid(); ++pti) {
64 // push beam particles relative to reference particle
65 element(pti, ref_part);
66 } // end loop over all particle boxes
67 } // env mesh-refinement level loop
68 }
69
70} // namespace impactx
71
72#endif // IMPACTX_PUSH_ALL_H
#define BL_PROFILE(a)
Definition ImpactXParticleContainer.H:133
impactx::ParIterSoA iterator
amrex iterator for particle boxes
Definition ImpactXParticleContainer.H:136
RefPart & GetRefParticle()
Definition ImpactXParticleContainer.cpp:378
Definition CovarianceMatrixMath.H:25
void push_all(ImpactXParticleContainer &pc, T_Element &element, int step, int period, bool omp_parallel=true)
Definition PushAll.H:33
Definition ReferenceParticle.H:31