chombo-discharge
Loading...
Searching...
No Matches
Source
Utilities
CD_OpenMP.H
Go to the documentation of this file.
1
/*
2
* SPDX-FileCopyrightText: 2021-2026 SINTEF Energy Research
3
*
4
* SPDX-License-Identifier: GPL-3.0-or-later
5
*/
6
13
#ifndef CD_OPENMP_H
14
#define CD_OPENMP_H
15
16
// Chombo includes
17
#include <IntVectSet.H>
18
#include <List.H>
19
20
// Our includes
21
#include <CD_NamespaceHeader.H>
22
23
#ifdef _OPENMP
24
25
// Thread-safe reduction operator for taking the union of IntVectSet
26
inline
void
27
ThreadSafeIVSUnion
(
IntVectSet
&
ivsInOut
,
const
IntVectSet
&
ivsIn
)
noexcept
28
{
29
ivsInOut
|=
ivsIn
;
30
}
31
#pragma omp declare reduction(+ : IntVectSet : ThreadSafeIVSUnion(omp_out, omp_in))
32
33
// Thread-safe catenation for a particle list.
34
template
<
typename
P>
35
inline
void
36
ThreadSafeCatenation
(
List<P>
&
particlesOut
,
List<P>
&
particlesIn
)
noexcept
37
{
38
particlesOut
.catenate(
particlesIn
);
39
}
40
41
// Thread-safe join for a particle list.
42
template
<
typename
P>
43
inline
void
44
ThreadSafeJoin
(
List<P>
&
particlesOut
,
List<P>
&
particlesIn
)
noexcept
45
{
46
particlesOut
.join(
particlesIn
);
47
}
48
49
// Thread-safe minimum of pair<Real, RealVect>.
50
inline
void
51
ThreadSafePairMin
(
std::pair<Real, RealVect>
&
ompOut
,
const
std::pair<Real, RealVect>
&
ompIn
)
noexcept
52
{
53
ompOut
= (
ompIn
.first <
ompOut
.first) ?
ompIn
:
ompOut
;
54
}
55
#pragma omp declare reduction(pairmin : std::pair<Real, RealVect> : ThreadSafePairMin(omp_out, omp_in)) \
56
initializer(omp_priv = omp_orig)
57
58
// Thread-safe maximum of pair<Real, RealVect>.
59
inline
void
60
ThreadSafePairMax
(
std::pair<Real, RealVect>
&
ompOut
,
const
std::pair<Real, RealVect>
&
ompIn
)
noexcept
61
{
62
ompOut
= (
ompIn
.first >
ompOut
.first) ?
ompIn
:
ompOut
;
63
}
64
#pragma omp declare reduction(pairmax : std::pair<Real, RealVect> : ThreadSafePairMax(omp_out, omp_in)) \
65
initializer(omp_priv = omp_orig)
66
67
#endif
68
69
#include <CD_NamespaceFooter.H>
70
71
#endif
TracerParticleSolver
Base class for a tracer particle solver. This solver can advance particles in a pre-defined velocity ...
Definition
CD_TracerParticleSolver.H:38
TracerParticleSolver::TracerParticleSolver
TracerParticleSolver()
Default constructor.
Definition
CD_TracerParticleSolverImplem.H:26
Generated by
1.9.8