chombo-discharge
Loading...
Searching...
No Matches
CD_DataOpsImplem.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_DATAOPSIMPLEM_H
14#define CD_DATAOPSIMPLEM_H
15
16// Chombo includes
17#include <CH_Timer.H>
18
19// Our includes
20#include <CD_NamespaceHeader.H>
21
22template <typename T>
23void
25{
26 CH_TIME("DataOps::setValue");
27
28 const DisjointBoxLayout& dbl = a_lhs.disjointBoxLayout();
29 const DataIterator& dit = dbl.dataIterator();
30
31 const int nbox = dit.size();
32
33#pragma omp parallel for schedule(runtime)
34 for (int mybox = 0; mybox < nbox; mybox++) {
35 const DataIndex& din = dit[mybox];
36
37 a_lhs[din].setVal(a_value);
38 }
39}
40
41template <typename T>
42int
44{
45 return ((a_value > 0.0) - (a_value < 0.0));
46}
47
48template <typename T>
49void
51{
52 CH_TIME("DataOps::copy(EBAMRData)");
53
54 CH_assert(a_dst.size() == a_src.size());
55 CH_assert(a_dstInterv.size() == a_srcInterv.size());
56
57 for (int lvl = 0; lvl < a_dst.size(); lvl++) {
58 CH_assert(a_dst[lvl]->nComp() > a_dstInterv.end());
59 CH_assert(a_src[lvl]->nComp() > a_srcInterv.end());
60
61 a_src[lvl]->localCopyTo(a_srcInterv, *a_dst[lvl], a_dstInterv);
62 }
63}
64
65#include <CD_NamespaceFooter.H>
66
67#endif
static int sgn(const T a_value)
Sign function. Returns +/- if the value is > 0 or < 0.
Definition CD_DataOpsImplem.H:43
static void setValue(LevelData< MFInterfaceFAB< T > > &a_lhs, const T &a_value)
Set value in an MFInterfaceFAB data holder.
Definition CD_DataOpsImplem.H:24
static void copy(MFAMRCellData &a_dst, const MFAMRCellData &a_src)
Copy data from one data holder to another.
Definition CD_DataOps.cpp:1201
Base class for a tracer particle solver. This solver can advance particles in a pre-defined velocity ...
Definition CD_TracerParticleSolver.H:38