Hipace
src
diagnostics
OpenPMDWriter.H
Go to the documentation of this file.
1
/* Copyright 2020-2022
2
*
3
* This file is part of HiPACE++.
4
*
5
* Authors: AlexanderSinn, MaxThevenet, Severin Diederichs
6
* License: BSD-3-Clause-LBNL
7
*/
8
#ifndef OPENPMDWRITER_H_
9
#define OPENPMDWRITER_H_
10
11
#include "
diagnostics/Diagnostic.H
"
12
#include "
particles/beam/MultiBeam.H
"
13
#include "
particles/beam/BeamParticleContainer.H
"
14
#include "
laser/MultiLaser.H
"
15
16
#include <
AMReX_REAL.H
>
17
#include <
AMReX_IntVect.H
>
18
#include <
AMReX_RealVect.H
>
19
#include <
AMReX_MultiFab.H
>
20
#include <
AMReX_AmrCore.H
>
21
22
#include <cstdint>
23
#include <vector>
24
25
#ifdef HIPACE_USE_OPENPMD
26
# include <openPMD/openPMD.hpp>
27
#endif
28
30
enum struct
OpenPMDWriterCallType
{
beams
,
fields
};
31
32
#ifdef HIPACE_USE_OPENPMD
34
class
OpenPMDWriter
35
{
36
private
:
44
void
SetupPos(openPMD::ParticleSpecies& currSpecies,
BeamParticleContainer
& beam,
45
const
unsigned
long
long
& np,
const
amrex::Geometry
& geom);
46
53
void
SetupRealProperties (openPMD::ParticleSpecies& currSpecies,
54
const
amrex::Vector<std::string>
& real_comp_names,
55
const
unsigned
long
long
np);
56
64
void
WriteBeamParticleData (
MultiBeam
&
beams
, openPMD::Iteration iteration,
65
const
amrex::Geometry
& geom,
66
const
amrex::Vector< std::string >
beamnames);
67
74
void
WriteFieldData (
const
FieldDiagnosticData
& fd,
const
MultiLaser
& a_multi_laser,
75
openPMD::Iteration iteration);
76
79
amrex::Vector<std::string>
m_int_names {
80
"id"
81
};
82
85
amrex::Vector<std::string>
m_real_names {
86
"position_x"
,
"position_y"
,
"position_z"
,
87
"weighting"
,
88
"momentum_x"
,
"momentum_y"
,
"momentum_z"
89
};
90
92
amrex::Vector<std::string>
m_real_names_spin {
93
"spin_x"
,
"spin_y"
,
"spin_z"
94
};
95
97
std::unique_ptr< openPMD::Series > m_outputSeries;
98
100
std::string m_openpmd_backend =
"default"
;
101
103
amrex::Vector<uint64_t>
m_offset;
104
105
std::vector<std::vector<std::shared_ptr<uint64_t>>> m_uint64_beam_data {};
106
std::vector<std::vector<std::shared_ptr<amrex::ParticleReal>>> m_real_beam_data {};
107
108
public
:
110
explicit
OpenPMDWriter ();
111
114
void
InitDiagnostics ();
115
121
void
InitBeamData (
MultiBeam
&
beams
,
const
amrex::Vector< std::string >
beamnames);
122
133
void
WriteDiagnostics (
134
const
amrex::Vector<FieldDiagnosticData>
& field_diag,
MultiBeam
& a_multi_beam,
135
const
MultiLaser
& a_multi_laser,
const
amrex::Real physical_time,
const
int
output_step,
136
const
amrex::Vector< std::string >
beamnames,
137
amrex::Vector<amrex::Geometry>
const
& geom3D,
138
const
OpenPMDWriterCallType
call_type);
139
145
void
CopyBeams (
MultiBeam
&
beams
,
const
amrex::Vector< std::string >
beamnames);
146
149
void
flush ();
150
152
std::string m_file_prefix;
153
155
bool
m_openpmd_viewer_workaround =
true
;
156
};
157
158
#endif
// HIPACE_USE_OPENPMD
159
160
#endif
// OPENPMDWRITER_H_
AMReX_AmrCore.H
AMReX_IntVect.H
AMReX_MultiFab.H
AMReX_REAL.H
AMReX_RealVect.H
BeamParticleContainer.H
Diagnostic.H
MultiBeam.H
MultiLaser.H
OpenPMDWriterCallType
OpenPMDWriterCallType
Whether the beam, the field data is written, or if it is just flushing the stored data.
Definition:
OpenPMDWriter.H:30
OpenPMDWriterCallType::fields
@ fields
OpenPMDWriterCallType::beams
@ beams
BeamParticleContainer
Container for particles of 1 beam species.
Definition:
BeamParticleContainer.H:68
MultiBeam
Definition:
MultiBeam.H:15
MultiLaser
Definition:
MultiLaser.H:99
amrex::Geometry
amrex::Vector
FieldDiagnosticData
This struct holds data for one field diagnostic on one MR level.
Definition:
Diagnostic.H:21
Generated by
1.9.1