added parameters to the constructors to start generation counting !=0

the parameters are optional and appended in the end
This commit is contained in:
okoenig 2003-08-21 13:02:53 +00:00
commit aac8ff6cb9
3 changed files with 18 additions and 14 deletions

View file

@ -56,12 +56,13 @@ public :
typedef std::vector<double> vDouble;
typedef eoValueParam<std::vector<double> > vDoubleParam;
eoFileSnapshot(std::string _dirname, unsigned _frequency = 1,
std::string _filename = "gen", std::string _delim = " "):
eoFileSnapshot(std::string _dirname, unsigned _frequency = 1, std::string _filename = "gen",
std::string _delim = " ", unsigned _counter = 0, bool _rmFiles = true):
dirname(_dirname), frequency(_frequency),
filename(_filename), delim(_delim), counter(0), boolChanged(true)
filename(_filename), delim(_delim), counter(_counter), boolChanged(true)
{
std::string s = "test -d " + dirname;
int res = system(s.c_str());
// test for (unlikely) errors
if ( (res==-1) || (res==127) )
@ -71,10 +72,13 @@ public :
{
s = std::string("mkdir ")+dirname;
}
else
else if (!res && _rmFiles)
{
s = std::string("/bin/rm ")+dirname+ "/" + filename + "*";
}
else
s = " ";
system(s.c_str());
// all done
}

View file

@ -58,17 +58,17 @@ class eoGnuplot1DSnapshot: public eoFileSnapshot, public eoGnuplot
public:
// Ctor
eoGnuplot1DSnapshot(std::string _dirname, unsigned _frequency = 1,
std::string _filename = "gen", std::string _delim = " ") :
eoFileSnapshot(_dirname, _frequency, _filename, _delim),
std::string _filename = "gen", std::string _delim = " ", unsigned _counter = 0, bool _rmFiles = true) :
eoFileSnapshot(_dirname, _frequency, _filename, _delim, _counter, _rmFiles),
eoGnuplot(_filename,"set data style points"),
pointSize(5)
{}
// Ctor
eoGnuplot1DSnapshot(std::string _dirname, eoRealVectorBounds & _bounds,
unsigned _frequency = 1,
std::string _filename = "gen", std::string _delim = " ") :
eoFileSnapshot(_dirname, _frequency, _filename, _delim),
eoGnuplot1DSnapshot(std::string _dirname, eoRealVectorBounds & _bounds,
unsigned _frequency = 1, std::string _filename = "gen",
std::string _delim = " ", unsigned _counter = 0, bool _rmFiles = true ) :
eoFileSnapshot(_dirname, _frequency, _filename, _delim, _counter, _rmFiles),
eoGnuplot(_filename,"set data style points"),
pointSize(5)
{

View file

@ -119,13 +119,13 @@ private :
class eoCountedStateSaver : public eoUpdater
{
public :
eoCountedStateSaver(unsigned _interval, const eoState& _state, std::string _prefix, bool _saveOnLastCall, std::string _extension = "sav")
: state(_state), interval(_interval), counter(0),
eoCountedStateSaver(unsigned _interval, const eoState& _state, std::string _prefix, bool _saveOnLastCall, std::string _extension = "sav", unsigned _counter = 0)
: state(_state), interval(_interval), counter(_counter),
saveOnLastCall(_saveOnLastCall),
prefix(_prefix), extension(_extension) {}
eoCountedStateSaver(unsigned _interval, const eoState& _state, std::string _prefix = "state", std::string _extension = "sav")
: state(_state), interval(_interval), counter(0),
eoCountedStateSaver(unsigned _interval, const eoState& _state, std::string _prefix = "state", std::string _extension = "sav", unsigned _counter = 0)
: state(_state), interval(_interval), counter(_counter),
saveOnLastCall(true),
prefix(_prefix), extension(_extension) {}