diff -ru EinsteinToolkit/arrangements/CactusUtils/Formaline/src/announce.cc Calpha/arrangements/AEIThorns/Formaline/src/announce.cc --- EinsteinToolkit/arrangements/CactusUtils/Formaline/src/announce.cc 2010-05-03 22:22:20.000000000 -0400 +++ Calpha/arrangements/AEIThorns/Formaline/src/announce.cc 2009-05-03 19:35:32.000000000 -0400 @@ -177,7 +177,8 @@ void const * const ptr = CCTK_ParameterGet ("cctk_run_title", "Cactus", & type); assert (type == PARAMETER_STRING); - char const * const run_title = * static_cast (ptr); + char const * const run_title = + * static_cast (ptr); stores.store ("app_title", run_title); } @@ -284,7 +285,7 @@ { char parameter_filename [10000]; CCTK_ParameterFilename (sizeof parameter_filename, parameter_filename); - stores.store ("parameter_file", parameter_filename); + stores.store ("parameter_filename", parameter_filename); } { @@ -296,8 +297,9 @@ } { - // Don't know what this is for - stores.store ("data_directory", ""); + // Don't know exactly what this is for -- send the IO output + // directory + stores.store ("data_directory", out_dir); } { diff -ru EinsteinToolkit/arrangements/CactusUtils/Formaline/src/file.cc Calpha/arrangements/AEIThorns/Formaline/src/file.cc --- EinsteinToolkit/arrangements/CactusUtils/Formaline/src/file.cc 2010-05-03 22:22:20.000000000 -0400 +++ Calpha/arrangements/AEIThorns/Formaline/src/file.cc 2008-08-29 14:49:38.000000000 -0400 @@ -8,87 +8,104 @@ #include "file.hh" +using namespace std; + namespace Formaline { - - using namespace std; - - - + file:: file (char const * const id, - enum state const st) - : storage (st) + enum state const st, + char const * const p, + file * const par) + : storage (st), path (p), parent (par) { DECLARE_CCTK_PARAMETERS; - + + if (parent) return; + ostringstream filenamebuf; filenamebuf << out_dir << "/" << storage_filename; string const filenamestring = filenamebuf.str(); - + ios::openmode const mode = get_state() == initial ? ios::trunc : ios::app; fil.open (filenamestring.c_str(), mode); - + if (get_state() == initial) { store ("jobid", id); } } - - - + + + file:: ~ file () { - if (get_state() == final) + if (parent) return; + + if (get_state()) { store ("simulation", "done"); } fil.close(); } - - - + + + + file * file:: + open_group (char const * const name) + { + assert (name); + string name1 (name); + if (not name1.empty() and name1[name1.length()-1] != '/') { + name1 = name1 + "/"; + } + return new file (0, get_state (), name1.c_str(), this); + } + + + void file:: store (char const * const key, bool const value) { assert (key); - + ostringstream keybuf; - keybuf << key; + keybuf << path << key; ostringstream valuebuf; valuebuf << (value ? "yes" : "no"); - + ostringstream buf; buf << clean (keybuf.str()) << "=" << clean (valuebuf.str()) << endl; - + write (buf.str()); } - - - + + + void file:: store (char const * const key, CCTK_INT const value) { assert (key); - + ostringstream keybuf; - keybuf << key; + keybuf << path << key; ostringstream valuebuf; valuebuf << value; - + ostringstream buf; buf << clean (keybuf.str()) << "=" << clean (valuebuf.str()) << endl; - + write (buf.str()); } - - - + + + void file:: store (char const * const key, CCTK_REAL const value) @@ -98,7 +115,7 @@ int const prec = numeric_limits::digits10; ostringstream keybuf; - keybuf << key; + keybuf << path << key; ostringstream valuebuf; valuebuf << setprecision(prec) << value; @@ -107,43 +124,50 @@ write (buf.str()); } - - - + + + void file:: store (char const * const key, char const * const value) { assert (key); - + ostringstream keybuf; - keybuf << key; + keybuf << path << key; ostringstream valuebuf; valuebuf << value; - + ostringstream buf; buf << clean (keybuf.str()) << "=" << "\"" << clean (valuebuf.str()) << "\"" << endl; - + write (buf.str()); } - - - + + + void file:: - write (std::string const & msg) + write (string const & msg) { - fil << msg; + if (parent) + { + parent->write (msg); + } + else + { + fil << msg; + } } - - - + + + string file:: clean (string const & txt) const { ostringstream buf; - + for (string::const_iterator p = txt.begin(); p != txt.end(); ++ p) { switch (* p) @@ -154,10 +178,10 @@ default: buf << * p; } } - + return buf.str(); } - - - + + + } // namespace Formaline diff -ru EinsteinToolkit/arrangements/CactusUtils/Formaline/src/file.hh Calpha/arrangements/AEIThorns/Formaline/src/file.hh --- EinsteinToolkit/arrangements/CactusUtils/Formaline/src/file.hh 2010-05-03 22:22:20.000000000 -0400 +++ Calpha/arrangements/AEIThorns/Formaline/src/file.hh 2008-08-29 14:49:38.000000000 -0400 @@ -12,47 +12,54 @@ namespace Formaline { - + class file : public storage { std::ofstream fil; - + std::string const path; + file * const parent; + public: - + file (char const * id, - enum state st); - + enum state st, + char const * p = "", + file * const par = 0); + virtual ~ file (); - + + virtual file * + open_group (char const * name); + virtual void store (char const * key, bool value); - + virtual void store (char const * key, CCTK_INT value); - + virtual void store (char const * key, CCTK_REAL value); - + virtual void store (char const * key, char const * value); - + private: - + void write (std::string const & msg); - + std::string clean (std::string const & txt) const; }; - - - + + + } // namespace Formaline diff -ru EinsteinToolkit/arrangements/CactusUtils/Formaline/src/multistorage.cc Calpha/arrangements/AEIThorns/Formaline/src/multistorage.cc --- EinsteinToolkit/arrangements/CactusUtils/Formaline/src/multistorage.cc 2010-05-03 22:22:20.000000000 -0400 +++ Calpha/arrangements/AEIThorns/Formaline/src/multistorage.cc 2008-08-29 14:49:38.000000000 -0400 @@ -1,93 +1,109 @@ #include "multistorage.hh" +using namespace std; + namespace Formaline { - - using namespace std; - - - + multistorage:: multistorage () { } - - - + + + multistorage:: ~ multistorage () { - for (list::const_iterator it = stores.begin(); - it != stores.end(); - ++ it) + close (); + } + + + + void + multistorage:: + close () + { + for (list::const_iterator + it = stores.begin(); it != stores.end(); ++ it) { delete * it; } + stores.clear (); } - - - + + + void multistorage:: add_storage (storage * const s) { stores.push_front (s); } - - - + + + int multistorage:: num_storages () const { return stores.size(); } - - - + + + + void + multistorage::open_group (multistorage & ms, char const * const name) + { + for (list::const_iterator + it = stores.begin(); it != stores.end(); ++ it) + { + ms.add_storage ((* it)->open_group (name)); + } + } + + + void multistorage:: store (char const * const key, bool const value) const { - for (list::const_iterator it = stores.begin(); - it != stores.end(); - ++ it) + for (list::const_iterator + it = stores.begin(); it != stores.end(); ++ it) { (* it)->store (key, value); } } - - - + + + void multistorage:: store (char const * const key, CCTK_INT const value) const { - for (list::const_iterator it = stores.begin(); - it != stores.end(); - ++ it) + for (list::const_iterator + it = stores.begin(); it != stores.end(); ++ it) { (* it)->store (key, value); } } - - - + + + void multistorage:: store (char const * const key, CCTK_REAL const value) const { - for (list::const_iterator it = stores.begin(); - it != stores.end(); - ++ it) + for (list::const_iterator + it = stores.begin(); it != stores.end(); ++ it) { (* it)->store (key, value); } } - - - + + + void multistorage:: store (char const * const key, char const * const value) const @@ -95,14 +111,13 @@ // Ignore null strings if (value == 0) return; - for (list::const_iterator it = stores.begin(); - it != stores.end(); - ++ it) + for (list::const_iterator + it = stores.begin(); it != stores.end(); ++ it) { (* it)->store (key, value); } } - - - + + + } // namespace Formaline diff -ru EinsteinToolkit/arrangements/CactusUtils/Formaline/src/multistorage.hh Calpha/arrangements/AEIThorns/Formaline/src/multistorage.hh --- EinsteinToolkit/arrangements/CactusUtils/Formaline/src/multistorage.hh 2010-05-03 22:22:20.000000000 -0400 +++ Calpha/arrangements/AEIThorns/Formaline/src/multistorage.hh 2008-08-29 14:49:38.000000000 -0400 @@ -11,51 +11,59 @@ namespace Formaline { - - using namespace std; - - - + class multistorage { - list stores; - + std::list stores; + multistorage (multistorage const &); - + multistorage operator= (multistorage const &); - + public: - + multistorage (); - + ~ multistorage (); - + + void + close (); + + + void add_storage (storage *); - + int num_storages () const; - + + + + void + open_group (multistorage &, char const * name); + + + void store (char const * key, bool value) const; - + void store (char const * key, CCTK_INT value) const; - + void store (char const * key, CCTK_REAL value) const; - + void store (char const * key, char const * value) const; - - - + + + #ifdef HAVE_CCTK_INT1 # ifndef CCTK_INTEGER_PRECISION_1 void @@ -66,7 +74,7 @@ } # endif #endif - + #ifdef HAVE_CCTK_INT2 # ifndef CCTK_INTEGER_PRECISION_2 void @@ -77,7 +85,7 @@ } # endif #endif - + #ifdef HAVE_CCTK_INT4 # ifndef CCTK_INTEGER_PRECISION_4 void @@ -88,7 +96,7 @@ } # endif #endif - + #ifdef HAVE_CCTK_INT8 # ifndef CCTK_INTEGER_PRECISION_8 void @@ -99,7 +107,7 @@ } # endif #endif - + #ifdef HAVE_CCTK_REAL4 # ifndef CCTK_REAL_PRECISION_4 void @@ -110,7 +118,7 @@ } # endif #endif - + #ifdef HAVE_CCTK_REAL8 # ifndef CCTK_REAL_PRECISION_8 void @@ -121,7 +129,7 @@ } # endif #endif - + #ifdef HAVE_CCTK_REAL16 # ifndef CCTK_REAL_PRECISION_16 void @@ -132,7 +140,7 @@ } # endif #endif - + }; diff -ru EinsteinToolkit/arrangements/CactusUtils/Formaline/src/portal.cc Calpha/arrangements/AEIThorns/Formaline/src/portal.cc --- EinsteinToolkit/arrangements/CactusUtils/Formaline/src/portal.cc 2010-05-03 22:22:20.000000000 -0400 +++ Calpha/arrangements/AEIThorns/Formaline/src/portal.cc 2008-08-29 14:49:38.000000000 -0400 @@ -19,15 +19,13 @@ #include "portal.hh" +using namespace std; + namespace Formaline { - - using namespace std; - - static bool is_clean_for_shell (char const * str); @@ -35,11 +33,15 @@ portal:: portal (char const * const id, - enum state const st) - : storage (st) + enum state const st, + char const * const p, + portal * const par) + : storage (st), path (p), parent (par) { DECLARE_CCTK_PARAMETERS; + if (parent) return; + msgbuf << "" << ""; switch (get_state()) @@ -62,15 +64,23 @@ << "jobid" << "" << clean (id) << "" << ""; - } - - - + } + + + portal:: ~ portal () { DECLARE_CCTK_PARAMETERS; + if (parent) + { + parent->msgbuf << msgbuf.str(); + return; + } + + + string const socket_script = "socket-client.pl"; string const socket_data = "socket-data"; @@ -115,9 +125,10 @@ << "my @hostlist = ("; // NUM_PORTAL_ENTRIES must match the size of the - // Formaline::portal_hostname and Formaline::portal_port parameter arrays + // Formaline::portal_hostname and Formaline::portal_port parameter + // arrays #define NUM_PORTAL_ENTRIES 5 - + // add all array parameters which have been set for (int i = 0; i < NUM_PORTAL_ENTRIES; i++) { if (*portal_hostname[i]) { @@ -334,7 +345,20 @@ remove (datafilename); remove (scriptfilename); } - + + + + portal * portal:: + open_group (char const * const name) + { + assert (name); + string name1 (name); + if (not name1.empty() and name1[name1.length()-1] != '/') { + name1 = name1 + "/"; + } + return new portal (0, get_state (), name1.c_str(), this); + } + void portal:: @@ -344,7 +368,7 @@ assert (key); ostringstream keybuf; - keybuf << key; + keybuf << path << key; ostringstream valuebuf; valuebuf << (value ? "true" : "false"); @@ -363,7 +387,7 @@ assert (key); ostringstream keybuf; - keybuf << key; + keybuf << path << key; ostringstream valuebuf; valuebuf << value; @@ -384,7 +408,7 @@ int const prec = numeric_limits::digits10; ostringstream keybuf; - keybuf << key; + keybuf << path << key; ostringstream valuebuf; valuebuf << setprecision(prec) << value; @@ -403,7 +427,7 @@ assert (key); ostringstream keybuf; - keybuf << key; + keybuf << path << key; ostringstream valuebuf; valuebuf << value; diff -ru EinsteinToolkit/arrangements/CactusUtils/Formaline/src/portal.hh Calpha/arrangements/AEIThorns/Formaline/src/portal.hh --- EinsteinToolkit/arrangements/CactusUtils/Formaline/src/portal.hh 2010-05-03 22:22:20.000000000 -0400 +++ Calpha/arrangements/AEIThorns/Formaline/src/portal.hh 2008-08-29 14:49:38.000000000 -0400 @@ -10,47 +10,51 @@ namespace Formaline { - - - + class portal : public storage { - std::ostringstream msgbuf; + std::string const path; + portal * const parent; public: - + portal (char const * id, - enum state st); - + enum state st, + char const * p = "", + portal * const par = 0); + virtual ~ portal (); - + + virtual portal * + open_group (char const * name); + virtual void store (char const * key, bool value); - + virtual void store (char const * key, CCTK_INT value); - + virtual void store (char const * key, CCTK_REAL value); - + virtual void store (char const * key, char const * value); - + private: std::string clean (std::string const & txt) const; }; - - - + + + } // namespace Formaline diff -ru EinsteinToolkit/arrangements/CactusUtils/Formaline/src/rdf.cc Calpha/arrangements/AEIThorns/Formaline/src/rdf.cc --- EinsteinToolkit/arrangements/CactusUtils/Formaline/src/rdf.cc 2010-05-03 22:22:20.000000000 -0400 +++ Calpha/arrangements/AEIThorns/Formaline/src/rdf.cc 2008-08-29 14:49:38.000000000 -0400 @@ -33,7 +33,8 @@ { using namespace std; - // the jobID is shared between this source file and PublishAsRDF.cc + // The jobID is shared between this source file and PublishAsRDF.cc + // ES 2008-04-29: Check this, I think this is wrong string jobID; @@ -56,9 +57,13 @@ rdf:: rdf (char const * const id, enum state const st, - cGH const * const cctkGH) - : storage (st) + cGH const * const cctkGH, + char const * const n, + rdf * const par) + : storage (st), groupname (n), parent (par) { + if (parent) return; + // set the unique ID for this simulation jobID = clean (string (id)); @@ -452,6 +457,14 @@ { DECLARE_CCTK_PARAMETERS; + if (parent) + { + parent->msgbuf << "" << endl + << msgbuf.str() + << "" << endl; + return; + } + // check if anything needs to be done if (msgbuf.str().empty()) return; @@ -526,6 +539,14 @@ + rdf * rdf:: + open_group (char const * const name) + { + return new rdf (0, get_state (), 0, name, this); + } + + + void rdf:: store (char const * const key, bool const value) diff -ru EinsteinToolkit/arrangements/CactusUtils/Formaline/src/rdf.hh Calpha/arrangements/AEIThorns/Formaline/src/rdf.hh --- EinsteinToolkit/arrangements/CactusUtils/Formaline/src/rdf.hh 2010-05-03 22:22:20.000000000 -0400 +++ Calpha/arrangements/AEIThorns/Formaline/src/rdf.hh 2008-08-29 14:49:38.000000000 -0400 @@ -42,7 +42,7 @@ // buffer to keep RDF metadata until the next Update() call extern std::vector rdfPublishList; - // the jobID string + // the jobID std::string extern std::string jobID; std::string clean (std::string const & txt); @@ -53,17 +53,23 @@ class rdf : public storage { - std::ostringstream msgbuf; + std::string const groupname; + rdf * const parent; public: rdf (char const * id, enum state st, - cGH const * cctkGH); + cGH const * cctkGH, // this should probably go away + char const * n = "", + rdf * par = 0); virtual ~ rdf (); + + virtual rdf * + open_group (char const * name); virtual void store (char const * key, diff -ru EinsteinToolkit/arrangements/CactusUtils/Formaline/src/rdf_publisher.cc Calpha/arrangements/AEIThorns/Formaline/src/rdf_publisher.cc --- EinsteinToolkit/arrangements/CactusUtils/Formaline/src/rdf_publisher.cc 2010-05-03 22:22:20.000000000 -0400 +++ Calpha/arrangements/AEIThorns/Formaline/src/rdf_publisher.cc 2008-08-29 14:49:39.000000000 -0400 @@ -296,7 +296,7 @@ extern "C" -void Formaline_RegisterPublishRDF_Callbacks (void) +void Formaline_RegisterPublishRDF_Callbacks (CCTK_ARGUMENTS) { int registered = 0; diff -ru EinsteinToolkit/arrangements/CactusUtils/Formaline/src/senddata.cc Calpha/arrangements/AEIThorns/Formaline/src/senddata.cc --- EinsteinToolkit/arrangements/CactusUtils/Formaline/src/senddata.cc 2010-05-03 22:22:20.000000000 -0400 +++ Calpha/arrangements/AEIThorns/Formaline/src/senddata.cc 2008-08-29 14:49:39.000000000 -0400 @@ -36,6 +36,11 @@ { DECLARE_CCTK_PARAMETERS; + if (verbose) { + CCTK_VInfo (CCTK_THORNSTRING, + "Announcing to %s:%d", hostname.c_str(), port); + } + #if 0 // pair<,> is not a standard STL class typedef pair destination_t; diff -ru EinsteinToolkit/arrangements/CactusUtils/Formaline/src/storage.cc Calpha/arrangements/AEIThorns/Formaline/src/storage.cc --- EinsteinToolkit/arrangements/CactusUtils/Formaline/src/storage.cc 2010-05-03 22:22:20.000000000 -0400 +++ Calpha/arrangements/AEIThorns/Formaline/src/storage.cc 2008-08-29 14:49:39.000000000 -0400 @@ -6,33 +6,29 @@ namespace Formaline { - - using namespace std; - - - + storage:: storage (enum state const st) : m_state (st) { } - - - + + + storage:: ~ storage () { } - - - + + + enum storage::state storage:: get_state () const { return m_state; } - - - + + + } // namespace Formaline diff -ru EinsteinToolkit/arrangements/CactusUtils/Formaline/src/storage.hh Calpha/arrangements/AEIThorns/Formaline/src/storage.hh --- EinsteinToolkit/arrangements/CactusUtils/Formaline/src/storage.hh 2010-05-03 22:22:20.000000000 -0400 +++ Calpha/arrangements/AEIThorns/Formaline/src/storage.hh 2008-08-29 14:49:39.000000000 -0400 @@ -7,55 +7,58 @@ namespace Formaline { - - - + class storage { public: - + enum state { initial, update, final }; - + private: - + enum state m_state; - + public: - + storage (enum state); - + virtual ~ storage (); - + enum state get_state () const; - + + virtual storage * + open_group (char const * name) + = 0; + virtual void store (char const * key, bool value) - = 0; - + = 0; + virtual void store (char const * key, CCTK_INT value) - = 0; - + = 0; + virtual void store (char const * key, CCTK_REAL value) - = 0; - + = 0; + virtual void store (char const * key, char const * value) - = 0; + = 0; + }; - - - + + + } // namespace Formaline -#endif // ifndef FORMALINE_STORAGE_HH +#endif // #ifndef FORMALINE_STORAGE_HH