Skip to content

Commit

Permalink
added output_prefix for statprops
Browse files Browse the repository at this point in the history
  • Loading branch information
nsimakov committed Feb 25, 2016
1 parent d27b139 commit 09b1d49
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 11 deletions.
12 changes: 9 additions & 3 deletions src/geoflow/stats.C
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@


#include <cmath>
#include <sstream>

//#include <advisor-annotate.h>

Expand All @@ -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)
Expand All @@ -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()
Expand Down Expand Up @@ -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<<statprops->output_prefix<<"finalstats."<<setw(6)<< setfill('0') <<internal<<statprops->runid<<std::ends;
FILE *fp = fopen(filename.str().c_str(), "wt");
//printf("runid=%d\n",statprops->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,
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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);

Expand Down
2 changes: 2 additions & 0 deletions src/header/stats.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 6 additions & 2 deletions src/main/titan.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
15 changes: 9 additions & 6 deletions src/tecplot/outsum.C
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,16 @@
#include "../header/hpfem.h"
#include "../header/stats.hpp"

#include <sstream>
#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<<statprops->output_prefix<<"output_summary."<<setw(6)<< setfill('0') <<internal<<statprops->runid<<std::ends;
FILE *fp = fopen(filename.str().c_str(), "at");

if(timeprops->ifstart())
fprintf(fp, "Summary of Output from Titan2D\n\n");
Expand All @@ -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<<statprops->output_prefix<<"statout_lhs."<<setw(6)<< setfill('0') <<internal<<statprops->runid<<std::ends;
FILE *fp = fopen(filename.str().c_str(), "w");
fprintf(fp, "%2d %6d %16.10g %16.10g %16.10g %16.10g %16.10g %16.10g %16.10g\n", statprops->lhs.refnum,
statprops->lhs.runid, statprops->timereached, statprops->vstar * matprops->Vslump, statprops->hmax,
statprops->xcen, statprops->ycen, statprops->xyminmax[1] - statprops->xyminmax[0],
Expand Down

0 comments on commit 09b1d49

Please sign in to comment.