diff options
author | Erik Schnetter <schnetter@aei.mpg.de> | 2005-06-05 22:14:00 +0000 |
---|---|---|
committer | Erik Schnetter <schnetter@aei.mpg.de> | 2005-06-05 22:14:00 +0000 |
commit | 9d361701f41d0f6b0056de48aabfb9f7f3aa7823 (patch) | |
tree | edefe13bb4dadc6cc4336b31cd5b74a4f5a39024 /CarpetDev/CarpetIOF5 | |
parent | a86ebe0c9aa5a6227b49bbefca4886ba3d4a823d (diff) |
CarpetIOF5: Put a unique simulation ID into each timestep
darcs-hash:20050605221456-891bb-12a12814b06258c94078cdc33d122e82850ed316.gz
Diffstat (limited to 'CarpetDev/CarpetIOF5')
-rw-r--r-- | CarpetDev/CarpetIOF5/interface.ccl | 8 | ||||
-rw-r--r-- | CarpetDev/CarpetIOF5/src/timestep.cc | 8 |
2 files changed, 16 insertions, 0 deletions
diff --git a/CarpetDev/CarpetIOF5/interface.ccl b/CarpetDev/CarpetIOF5/interface.ccl index 2d8dd3139..db9d9c014 100644 --- a/CarpetDev/CarpetIOF5/interface.ccl +++ b/CarpetDev/CarpetIOF5/interface.ccl @@ -22,3 +22,11 @@ REQUIRES FUNCTION Coord_GroupSystem CCTK_INT FUNCTION IO_TruncateOutputFiles \ (CCTK_POINTER_TO_CONST IN cctkGH) REQUIRES FUNCTION IO_TruncateOutputFiles + + + +# Return a pointer to an unmodifiable C string +# which contains a unique ID for this simulation +CCTK_POINTER_TO_CONST \ +FUNCTION UniqueSimulationID (CCTK_POINTER_TO_CONST IN cctkGH) +USES FUNCTION UniqueSimulationID diff --git a/CarpetDev/CarpetIOF5/src/timestep.cc b/CarpetDev/CarpetIOF5/src/timestep.cc index a5ad7b0f9..37d37cd20 100644 --- a/CarpetDev/CarpetIOF5/src/timestep.cc +++ b/CarpetDev/CarpetIOF5/src/timestep.cc @@ -7,6 +7,7 @@ #include <hdf5.h> #include "cctk.h" +#include "cctk_Functions.h" #include "timestep.hh" #include "utils.hh" @@ -50,6 +51,13 @@ namespace CarpetIOF5 { assert (m_hdf5_timestep >= 0); write_or_check_attribute (m_hdf5_timestep, "time", time); + if (CCTK_IsFunctionAliased ("UniqueSimulationID")) { + cGH const * const cctkGH = get_file().get_cctkGH(); + char const * const job_id + = static_cast<char const *> (UniqueSimulationID (cctkGH)); + write_or_check_attribute (m_hdf5_timestep, "simulation id", job_id); + } + assert (invariant()); } |