chombo-discharge
Loading...
Searching...
No Matches
CD_BoxLoopsImplem.H
Go to the documentation of this file.
1/* chombo-discharge
2 * Copyright © 2021 SINTEF Energy Research.
3 * Please refer to Copyright.txt and LICENSE in the chombo-discharge root directory.
4 */
5
12#ifndef CD_BoxLoopsImplem_H
13#define CD_BoxLoopsImplem_H
14
15// Our includes
16#include <CD_NamespaceHeader.H>
17
18template <typename Functor>
19ALWAYS_INLINE void
21{
22
24
25 const int* lo = computeBox.loVect();
26 const int* hi = computeBox.hiVect();
27
28 // TLDR: This runs through all cells in the computeBox and calls the kernel function.
29#if CH_SPACEDIM == 3
30 for (int k = lo[2]; k <= hi[2]; k += a_stride[2]) {
31#endif
32 for (int j = lo[1]; j <= hi[1]; j += a_stride[1]) {
33 CD_PRAGMA_SIMD
34 for (int i = lo[0]; i <= hi[0]; i += a_stride[0]) {
35 func(IntVect(D_DECL(i, j, k)));
36 }
37 }
38#if CH_SPACEDIM == 3
39 }
40#endif
41}
42
43template <typename Functor>
44ALWAYS_INLINE void
46{
47 for (IVSIterator iter(a_ivs); iter.ok(); ++iter) {
48 a_kernel(iter());
49 }
50}
51
52template <typename Functor>
53ALWAYS_INLINE void
60
61template <typename Functor>
62ALWAYS_INLINE void
64{
65
66 // TLDR: This runs through all cells in the vof-iterator and calls the kernel.
67 for (iter.reset(); iter.ok(); ++iter) {
68 a_kernel(iter());
69 }
70}
71
72template <typename Functor>
73ALWAYS_INLINE void
75{
76
77 // TLDR: This runs through all cells in the vof-iterator and calls the kernel.
78 for (iter.reset(); iter.ok(); ++iter) {
79 a_kernel(iter());
80 }
81}
82
83template <typename T, typename Functor>
84ALWAYS_INLINE void
86{
87 const std::vector<T>& stdVec = ((Vector<T>&)a_subset).stdVector();
88
89 for (const auto& v : stdVec) {
90 a_kernel(v);
91 }
92}
93
94#include <CD_NamespaceFooter.H>
95
96#endif
Base class for a tracer particle solver. This solver can advance particles in a pre-defined velocity ...
Definition CD_TracerParticleSolver.H:37
TracerParticleSolver()
Default constructor.
Definition CD_TracerParticleSolverImplem.H:25
ALWAYS_INLINE void loop(const Box &a_computeBox, Functor &&kernel, const IntVect &a_stride=IntVect::Unit)
Launch a C++ kernel over a regular grid.
Definition CD_BoxLoopsImplem.H:20