forked from BLAST-WarpX/warpx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOpenPMDHelpFunction.cpp
49 lines (44 loc) · 1.12 KB
/
OpenPMDHelpFunction.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/* Copyright 2023 The WarpX Community
*
* This file is part of WarpX.
*
* Authors: Juliette Pech, Axel Huebl
* License: BSD-3-Clause-LBNL
*/
#include "OpenPMDHelpFunction.H"
#include "Utils/TextMsg.H"
std::string
WarpXOpenPMDFileType ()
{
std::string openPMDFileType;
#ifdef WARPX_USE_OPENPMD
#if openPMD_HAVE_ADIOS2==1
openPMDFileType = "bp";
#elif openPMD_HAVE_ADIOS1==1
openPMDFileType = "bp";
#elif openPMD_HAVE_HDF5==1
openPMDFileType = "h5";
#else
openPMDFileType = "json";
#endif
#else
WARPX_ABORT_WITH_MESSAGE("openPMD-api cannot be used!");
#endif // WARPX_USE_OPENPMD
return openPMDFileType;
}
#ifdef WARPX_USE_OPENPMD
unsigned long
num_already_flushed (openPMD::ParticleSpecies & currSpecies)
{
const auto *const scalar = openPMD::RecordComponent::SCALAR;
unsigned long ParticleFlushOffset = 0;
if (currSpecies.contains("id")) {
if (currSpecies["id"].contains(scalar)) {
if (!currSpecies["id"][scalar].empty()) {
ParticleFlushOffset = currSpecies["id"][scalar].getExtent().at(0);
}
}
}
return ParticleFlushOffset;
}
#endif