22 #ifndef FUB_AMREX_DEBUG_OUTPUT_HPP
23 #define FUB_AMREX_DEBUG_OUTPUT_HPP
40 using Hierarchy = ::amrex::Vector<::amrex::MultiFab>;
52 void SaveData(const ::amrex::MultiFab& mf,
const std::string& name,
53 const ::amrex::Geometry& geom,
54 ::amrex::SrcComp component = ::amrex::SrcComp(0));
57 const ::amrex::Geometry& geom,
58 ::amrex::SrcComp first_component = ::amrex::SrcComp(0));
60 void SaveData(const ::amrex::Vector<const ::amrex::MultiFab*>& hierarchy,
61 const std::string& name,
62 const ::amrex::Vector<const ::amrex::Geometry*>& geomhier,
63 ::amrex::SrcComp component = ::amrex::SrcComp(0));
65 void SaveData(const ::amrex::Vector<::amrex::MultiFab>& hierarchy,
66 const std::string& name,
67 const ::amrex::Vector<::amrex::Geometry>& geomhier,
68 ::amrex::SrcComp component = ::amrex::SrcComp(0));
70 void SaveData(const ::amrex::Vector<const ::amrex::MultiFab*>& hierarchy,
72 const ::amrex::Vector<const ::amrex::Geometry*>& geomhier,
73 ::amrex::SrcComp first_component = ::amrex::SrcComp(0));
75 void SaveData(const ::amrex::Vector<::amrex::MultiFab>& hierarchy,
77 const ::amrex::Vector<::amrex::Geometry>& geomhier,
78 ::amrex::SrcComp first_component = ::amrex::SrcComp(0));
145 void SaveData(const ::amrex::MultiFab& mf,
const std::string& name,
146 const ::amrex::Geometry& geom,
147 ::amrex::SrcComp component = ::amrex::SrcComp(0));
151 const ::amrex::Geometry& geom,
152 ::amrex::SrcComp first_component = ::amrex::SrcComp(0));
154 void SaveData(const ::amrex::Vector<const ::amrex::MultiFab*>& hierarchy,
155 const std::string& name,
156 const ::amrex::Vector<const ::amrex::Geometry*>& geomhier,
157 ::amrex::SrcComp component = ::amrex::SrcComp(0));
159 void SaveData(const ::amrex::Vector<::amrex::MultiFab>& hierarchy,
160 const std::string& name,
161 const ::amrex::Vector<::amrex::Geometry>& geomhier,
162 ::amrex::SrcComp component = ::amrex::SrcComp(0));
164 void SaveData(const ::amrex::Vector<const ::amrex::MultiFab*>& hierarchy,
166 const ::amrex::Vector<const ::amrex::Geometry*>& geomhier,
167 ::amrex::SrcComp first_component = ::amrex::SrcComp(0));
169 void SaveData(const ::amrex::Vector<::amrex::MultiFab>& hierarchy,
171 const ::amrex::Vector<::amrex::Geometry>& geomhier,
172 ::amrex::SrcComp first_component = ::amrex::SrcComp(0));
176 explicit operator bool() const noexcept {
return snapshot_ ==
nullptr; }
181 return p1.snapshot_ == p2.snapshot_;
216 void FlushData(
const std::string& directory,
int cycle = -1,
238 const std::shared_ptr<DebugStorage>& storage);
Definition: OutputAtFrequencyOrInterval.hpp:32
This output method enables a debug storage and manages its output in every time step.
Definition: output/DebugOutput.hpp:234
std::string directory_
This is the base directory where the snapshots will be output to.
Definition: output/DebugOutput.hpp:245
DebugOutput(const ProgramOptions &opts, const std::shared_ptr< DebugStorage > &storage)
Read program options from opts and enable the storage.
void operator()(const GriddingAlgorithm &grid) override
Write out the debug storage on the grid.
This class is a possibly empty handle to a existing DebugSnapshotProxy.
Definition: output/DebugOutput.hpp:132
void SaveData(const ::amrex::Vector< const ::amrex::MultiFab * > &hierarchy, const DebugSnapshot::ComponentNames &names, const ::amrex::Vector< const ::amrex::Geometry * > &geomhier, ::amrex::SrcComp first_component=::amrex::SrcComp(0))
Saves a current hierarchy state with given component names.
void SaveData(const ::amrex::MultiFab &mf, const DebugSnapshot::ComponentNames &names, const ::amrex::Geometry &geom, ::amrex::SrcComp first_component=::amrex::SrcComp(0))
Saves a current hierarchy state with given component names.
void SaveData(const ::amrex::MultiFab &mf, const std::string &name, const ::amrex::Geometry &geom, ::amrex::SrcComp component=::amrex::SrcComp(0))
Saves a current hierarchy state with given component names.
void SaveData(const ::amrex::Vector<::amrex::MultiFab > &hierarchy, const DebugSnapshot::ComponentNames &names, const ::amrex::Vector<::amrex::Geometry > &geomhier, ::amrex::SrcComp first_component=::amrex::SrcComp(0))
Saves a current hierarchy state with given component names.
friend bool operator==(const DebugSnapshotProxy &p1, const DebugSnapshotProxy &p2) noexcept
Returns true if both proxy objects point to the same snapshot.
Definition: output/DebugOutput.hpp:179
DebugSnapshotProxy()=default
Initializes an empty proxy snapshot.
void SaveData(const ::amrex::Vector<::amrex::MultiFab > &hierarchy, const std::string &name, const ::amrex::Vector<::amrex::Geometry > &geomhier, ::amrex::SrcComp component=::amrex::SrcComp(0))
Saves a current hierarchy state with given component names.
DebugSnapshot * snapshot_
Pointer to the real snapshot.
Definition: output/DebugOutput.hpp:186
DebugSnapshotProxy(DebugSnapshot &snapshot)
Initializes a proxy snapshot for a real snapshot.
Definition: output/DebugOutput.hpp:138
void SaveData(const ::amrex::Vector< const ::amrex::MultiFab * > &hierarchy, const std::string &name, const ::amrex::Vector< const ::amrex::Geometry * > &geomhier, ::amrex::SrcComp component=::amrex::SrcComp(0))
Saves a current hierarchy state with given component names.
This class stores debug data for a debug output for a single hierarchy state.
Definition: output/DebugOutput.hpp:38
std::vector< GeomHierarchy > saved_geometries_
Each SaveData will append a hierarchy of corresponding geometries.
Definition: output/DebugOutput.hpp:122
void SaveData(const ::amrex::Vector<::amrex::MultiFab > &hierarchy, const ComponentNames &names, const ::amrex::Vector<::amrex::Geometry > &geomhier, ::amrex::SrcComp first_component=::amrex::SrcComp(0))
Saves a current hierarchy state with given component names.
const std::vector< Hierarchy > & GetHierarchies() const noexcept
Returns all the hierarchies which are stored via SaveData.
const std::vector< ComponentNames > & GetNames() const noexcept
Returns all the component names which are stored via SaveData.
void SaveData(const ::amrex::MultiFab &mf, const ComponentNames &names, const ::amrex::Geometry &geom, ::amrex::SrcComp first_component=::amrex::SrcComp(0))
Saves a current hierarchy state with given component names.
DebugSnapshot()=default
Initializes an empty snapshot.
const std::vector< GeomHierarchy > & GetGeometries() const noexcept
Returns all the associated geometries which are stored via SaveData.
std::vector< std::tuple< Hierarchy, ComponentNames, GeomHierarchy > > GatherFields(::amrex::IndexType location) const
Collects all hierachies and associated names which are stored on the specified location.
::amrex::Vector< std::string > ComponentNames
Definition: output/DebugOutput.hpp:42
::amrex::Vector<::amrex::Geometry > GeomHierarchy
Definition: output/DebugOutput.hpp:41
void SaveData(const ::amrex::Vector< const ::amrex::MultiFab * > &hierarchy, const ComponentNames &names, const ::amrex::Vector< const ::amrex::Geometry * > &geomhier, ::amrex::SrcComp first_component=::amrex::SrcComp(0))
Saves a current hierarchy state with given component names.
void SaveData(const ::amrex::MultiFab &mf, const std::string &name, const ::amrex::Geometry &geom, ::amrex::SrcComp component=::amrex::SrcComp(0))
Saves a current hierarchy state with given component names.
const std::string GetSnapshotDirectory() const
Returns the directory in which the output will be saved to.
Definition: output/DebugOutput.hpp:112
void SaveData(const ::amrex::Vector<::amrex::MultiFab > &hierarchy, const std::string &name, const ::amrex::Vector<::amrex::Geometry > &geomhier, ::amrex::SrcComp component=::amrex::SrcComp(0))
Saves a current hierarchy state with given component names.
::amrex::Vector<::amrex::MultiFab > Hierarchy
Definition: output/DebugOutput.hpp:40
std::vector< Hierarchy > saved_hierarchies_
Each SaveData will append a hierarchy.
Definition: output/DebugOutput.hpp:116
void MakeUniqueComponentNames()
Changes component names that appear more than once by appending assending numbers to each.
void SaveData(const ::amrex::Vector< const ::amrex::MultiFab * > &hierarchy, const std::string &name, const ::amrex::Vector< const ::amrex::Geometry * > &geomhier, ::amrex::SrcComp component=::amrex::SrcComp(0))
Saves a current hierarchy state with given component names.
std::vector< ComponentNames > names_per_hierarchy_
Each SaveData will append a list of names on the hierachy.
Definition: output/DebugOutput.hpp:119
void ClearAll()
Deletes all currently stored data.
void SetSnapshotDirectory(const std::string &snapshot_directory)
Sets the directory in which the output will be saved to.
Definition: output/DebugOutput.hpp:107
std::string snapshot_directory_
output directory of storage;
Definition: output/DebugOutput.hpp:125
This class stores a list of snapshots and returns proxy objects to those.
Definition: output/DebugOutput.hpp:201
bool IsEnabled() const noexcept
Checks if debug storage is enabled.
Definition: output/DebugOutput.hpp:207
void FlushData(const std::string &directory, int cycle=-1, Duration time_point=Duration(0.0))
Writes data to disk and clears all data present in the storage.
void Disable()
Definition: output/DebugOutput.hpp:210
std::list< DebugSnapshot > saved_snapshots_
List of snapshots.
Definition: output/DebugOutput.hpp:224
DebugStorage()=default
Initializes the storage.
bool is_enabled_
If this is false no data will be saved.
Definition: output/DebugOutput.hpp:227
int cycle_
Definition: output/DebugOutput.hpp:229
void ClearAll()
Deletes all currently stored snapshots in the debug storage.
Definition: output/DebugOutput.hpp:220
void Enable()
Definition: output/DebugOutput.hpp:209
DebugSnapshotProxy AddSnapshot(const std::string &snapshot_directory)
Adds snapshot with given directory name to storage.
This class modifies and initializes a PatchLevel in a PatchHierarchy.
Definition: AMReX/GriddingAlgorithm.hpp:60
The amrex namespace.
Definition: AverageState.hpp:33
bool operator!=(const DebugSnapshotProxy &p1, const DebugSnapshotProxy &p2) noexcept
Returns true if both proxy objects point to different snapshots.
Definition: output/DebugOutput.hpp:190
std::chrono::duration< double > Duration
Definition: Duration.hpp:31
std::map< std::string, pybind11::object > ProgramOptions
Definition: ProgramOptions.hpp:40