aboutsummaryrefslogtreecommitdiff
path: root/Carpet/CarpetIOScalar
diff options
context:
space:
mode:
authorErik Schnetter <schnetter@aei.mpg.de>2005-06-05 22:12:00 +0000
committerErik Schnetter <schnetter@aei.mpg.de>2005-06-05 22:12:00 +0000
commitee37736f3257d420de4d042546bb1afef8330393 (patch)
tree77e6e93e3754d541dd78d20f36e2ad3e2419eaee /Carpet/CarpetIOScalar
parent6c6679c932ca5927087a1c9481ce0e6ca69ff3dc (diff)
CarpetIOScalar: Put unique simulation ID into each file
darcs-hash:20050605221248-891bb-7b144657af9cd98a9a4462ae7ef3ec75117be7a8.gz
Diffstat (limited to 'Carpet/CarpetIOScalar')
-rw-r--r--Carpet/CarpetIOScalar/interface.ccl8
-rw-r--r--Carpet/CarpetIOScalar/src/ioscalar.cc26
2 files changed, 34 insertions, 0 deletions
diff --git a/Carpet/CarpetIOScalar/interface.ccl b/Carpet/CarpetIOScalar/interface.ccl
index 5f4deccb1..f7d451c04 100644
--- a/Carpet/CarpetIOScalar/interface.ccl
+++ b/Carpet/CarpetIOScalar/interface.ccl
@@ -13,3 +13,11 @@ CCTK_INT FUNCTION IO_TruncateOutputFiles \
(CCTK_POINTER_TO_CONST IN GH)
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/Carpet/CarpetIOScalar/src/ioscalar.cc b/Carpet/CarpetIOScalar/src/ioscalar.cc
index 60436cf9b..d1a6f80bb 100644
--- a/Carpet/CarpetIOScalar/src/ioscalar.cc
+++ b/Carpet/CarpetIOScalar/src/ioscalar.cc
@@ -10,7 +10,9 @@
#include "cctk.h"
#include "cctk_Arguments.h"
+#include "cctk_Functions.h"
#include "cctk_Parameters.h"
+#include "util_Network.h"
#include "util_String.h"
#include "CactusBase/IOUtil/src/ioGH.h"
@@ -271,6 +273,30 @@ namespace CarpetIOScalar {
// If this is the first time, then write a nice header
if (do_truncate.at(n) && IO_TruncateOutputFiles (cctkGH)) {
file.open (filename, ios::out | ios::trunc);
+ {
+ char run_host [1000];
+ Util_GetHostName (run_host, sizeof run_host);
+#if 0
+ char const * const run_user = CCTK_RunUser();
+#else
+ char const * const run_user = getenv ("USER");
+#endif
+ char run_date [1000];
+ Util_CurrentDate (sizeof run_date, run_date);
+ char run_time [1000];
+ Util_CurrentTime (sizeof run_time, run_time);
+ file << "# Scalar ASCII output created by CarpetIOScalar" << endl
+ << "# created on " << run_host
+ << " by " << run_user
+ << " on " << run_date
+ << " at " << run_time << endl;
+ if (CCTK_IsFunctionAliased ("UniqueSimulationID")) {
+ char const * const job_id
+ = static_cast<char const *> (UniqueSimulationID (cctkGH));
+ file << "# Simulation ID: " << job_id << endl;
+ }
+ }
+ file << "#" << endl;
file << "# " << varname << " (" << alias << ")" << endl;
file << "# iteration time data" << endl;
if (one_file_per_group) {