From 9d361701f41d0f6b0056de48aabfb9f7f3aa7823 Mon Sep 17 00:00:00 2001 From: Erik Schnetter Date: Sun, 5 Jun 2005 22:14:00 +0000 Subject: CarpetIOF5: Put a unique simulation ID into each timestep darcs-hash:20050605221456-891bb-12a12814b06258c94078cdc33d122e82850ed316.gz --- CarpetDev/CarpetIOF5/interface.ccl | 8 ++++++++ CarpetDev/CarpetIOF5/src/timestep.cc | 8 ++++++++ 2 files changed, 16 insertions(+) (limited to 'CarpetDev/CarpetIOF5') 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 #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 (UniqueSimulationID (cctkGH)); + write_or_check_attribute (m_hdf5_timestep, "simulation id", job_id); + } + assert (invariant()); } -- cgit v1.2.3