aboutsummaryrefslogtreecommitdiff
path: root/CarpetDev/CarpetIOF5/src/simulation.cc
diff options
context:
space:
mode:
authorErik Schnetter <schnetter@aei.mpg.de>2005-04-25 16:10:00 +0000
committerErik Schnetter <schnetter@aei.mpg.de>2005-04-25 16:10:00 +0000
commitc3697a07c1256db7185c24750a4d3ca0506436d4 (patch)
tree207d09d80c0a369522f3ab83677d46fd8f0fa86d /CarpetDev/CarpetIOF5/src/simulation.cc
parent384d2acbe1f33481841c38823853fbd22976903c (diff)
CarpetIOF5: Start an I/O thorn that uses the F5 file format
darcs-hash:20050425161012-891bb-e7d03751330723d007d3dc97b0d56addc3ccda48.gz
Diffstat (limited to 'CarpetDev/CarpetIOF5/src/simulation.cc')
-rw-r--r--CarpetDev/CarpetIOF5/src/simulation.cc68
1 files changed, 68 insertions, 0 deletions
diff --git a/CarpetDev/CarpetIOF5/src/simulation.cc b/CarpetDev/CarpetIOF5/src/simulation.cc
new file mode 100644
index 000000000..7db365ddd
--- /dev/null
+++ b/CarpetDev/CarpetIOF5/src/simulation.cc
@@ -0,0 +1,68 @@
+#include <cassert>
+#include <string>
+#include <sstream>
+
+#include <hdf5.h>
+
+#include "cctk.h"
+
+#include "simulation.hh"
+#include "utils.hh"
+
+
+
+namespace CarpetIOF5 {
+
+ namespace F5 {
+
+ using std::ostringstream;
+
+
+
+ simulation_t::
+ simulation_t (timestep_t & timestep,
+ char const * const name)
+ : m_timestep (timestep)
+ {
+ ostringstream buf;
+ buf << name;
+ m_name = buf.str();
+
+ m_hdf5_simulation
+ = open_or_create_group (m_timestep.get_hdf5_timestep(),
+ m_name.c_str());
+ assert (m_hdf5_simulation >= 0);
+
+ assert (invariant());
+ }
+
+
+
+ simulation_t::
+ ~ simulation_t()
+ {
+ herr_t const herr = H5Gclose (m_hdf5_simulation);
+ assert (! herr);
+ }
+
+
+
+ hid_t simulation_t::
+ get_hdf5_simulation()
+ const
+ {
+ return m_hdf5_simulation;
+ }
+
+
+
+ bool simulation_t::
+ invariant()
+ const
+ {
+ return m_hdf5_simulation >= 0;
+ }
+
+ } // namespace F5
+
+} // namespace CarpetIOF5