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