diff --git a/src/geoflow/stats.C b/src/geoflow/stats.C index 87efd66..8e3a1f4 100644 --- a/src/geoflow/stats.C +++ b/src/geoflow/stats.C @@ -25,6 +25,7 @@ #include +#include //#include @@ -44,6 +45,7 @@ StatProps::StatProps(ElementsHashTable *_ElemTable, NodeHashTable* _NodeTable): xyminmax[0] = xyminmax[1] = xyminmax[2] = xyminmax[3] = hxyminmax = 0.0; lhs.refnum = lhs.runid = -1; runid = -1; + output_prefix=""; } StatProps::StatProps(ElementsHashTable *_ElemTable, NodeHashTable* _NodeTable, const H5::CommonFG *parent, const string group_name): EleNodeRef(_ElemTable, _NodeTable) @@ -56,6 +58,7 @@ StatProps::StatProps(ElementsHashTable *_ElemTable, NodeHashTable* _NodeTable, c xyminmax[0] = xyminmax[1] = xyminmax[2] = xyminmax[3] = hxyminmax = 0.0; lhs.refnum = lhs.runid = -1; runid = -1; + output_prefix=""; h5read(parent, group_name); } StatProps::~StatProps() @@ -511,10 +514,11 @@ void out_final_stats(TimeProps* timeprops, StatProps* statprops) int cpuminutes = (cputime % 3600) / 60; int cpuseconds = cputime % 60; - char filename[256]; - sprintf(filename, "finalstats.%06d", statprops->runid); + ostringstream filename; + + filename<output_prefix<<"finalstats."<runid<runid); - FILE* fp = fopen(filename, "w"); //print runid xC yC rC area maxh wall time cpu time fprintf(fp, "%6d %E %E %E %E %E %E %d:%02d:%02d %d:%02d:%02d\n", statprops->runid, statprops->xcen, statprops->ycen, statprops->rmean, statprops->area, statprops->hmax, statprops->timereached, wallhours, @@ -631,6 +635,7 @@ void StatProps::h5write(H5::CommonFG *parent, string group_name) const TiH5_writeDoubleAttribute(group, timereached); TiH5_writeDoubleAttribute(group, xyminmax[4]); TiH5_writeDoubleAttribute(group, hxyminmax); + TiH5_writeStringAttribute(group, output_prefix); lhs.h5write(&group); } @@ -666,6 +671,7 @@ void StatProps::h5read(const H5::CommonFG *parent, const string group_name) TiH5_readDoubleAttribute(group, timereached); TiH5_readDoubleAttribute(group, xyminmax[4]); TiH5_readDoubleAttribute(group, hxyminmax); + TiH5_readStringAttribute(group, output_prefix); lhs.h5read(&group); diff --git a/src/header/stats.hpp b/src/header/stats.hpp index fc5314e..001afd6 100644 --- a/src/header/stats.hpp +++ b/src/header/stats.hpp @@ -113,6 +113,8 @@ class StatProps: public EleNodeRef //! the latin hypercube sampling specific stats LHS_Props lhs; + std::string output_prefix; + //! the constructor initializes a few statistics StatProps(ElementsHashTable *_ElemTable, NodeHashTable* _NodeTable); //! the constructor from hd5 diff --git a/src/main/titan.py b/src/main/titan.py index 8ed6c9a..439cf72 100644 --- a/src/main/titan.py +++ b/src/main/titan.py @@ -576,9 +576,12 @@ def __init__(self,overwrite_output=False): }, 'runid':{'desc':'', 'validator':VarType(int).chk - }, + }, + 'output_prefix':{'desc':'', + 'validator':VarTypeString + }, }, - defaultParameters={'edge_height':None, 'test_height':None, 'test_location':None, 'runid':-1} + defaultParameters={'edge_height':None, 'test_height':None, 'test_location':None, 'runid':-1, 'output_prefix':''} ) self.setStatProps() #setOutlineProps @@ -1046,6 +1049,7 @@ def check_and_remove_filedir_by_wildcard(filename): ui_StatProps['edge_height'], ui_StatProps['test_height'], ui_StatProps['test_location'][0], ui_StatProps['test_location'][1]) self.sim.get_statprops().runid=ui_StatProps['runid'] + self.sim.get_statprops().output_prefix=ui_StatProps['output_prefix'] ####################################################################### # ui_OutlineProps diff --git a/src/tecplot/outsum.C b/src/tecplot/outsum.C index be80223..63cabbd 100644 --- a/src/tecplot/outsum.C +++ b/src/tecplot/outsum.C @@ -22,14 +22,16 @@ #include "../header/hpfem.h" #include "../header/stats.hpp" +#include #define ADAM_HEIGHT_FRAC 0.02 void output_summary(TimeProps* timeprops, StatProps* statprops, int savefileflag) { //FILE *fp=fopen("output_summary.readme","a"); - char filename[256]; - sprintf(filename, "output_summary.%06d", statprops->runid); - FILE *fp = fopen(filename, "a"); + ostringstream filename; + + filename<output_prefix<<"output_summary."<runid<ifstart()) fprintf(fp, "Summary of Output from Titan2D\n\n"); @@ -50,9 +52,10 @@ void output_summary(TimeProps* timeprops, StatProps* statprops, int savefileflag void output_stoch_stats(MatProps* matprops, StatProps* statprops) { - char filename[128]; - sprintf(filename, "statout_lhs.%02d", statprops->lhs.refnum); - FILE *fp = fopen(filename, "w"); + ostringstream filename; + + filename<output_prefix<<"statout_lhs."<runid<lhs.refnum, statprops->lhs.runid, statprops->timereached, statprops->vstar * matprops->Vslump, statprops->hmax, statprops->xcen, statprops->ycen, statprops->xyminmax[1] - statprops->xyminmax[0],