Add the precision of double in the ouput of moSampling
git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@2044 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
parent
b9d12d7f6d
commit
a22f1e58d7
1 changed files with 19 additions and 0 deletions
|
|
@ -74,6 +74,8 @@ public:
|
|||
{
|
||||
checkpoint = new moCheckpoint<Neighbor>(*continuator);
|
||||
add(_stat, _monitoring);
|
||||
// precision of the output by default
|
||||
precisionOutput = std::cout.precision();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -128,6 +130,14 @@ public:
|
|||
localSearch->setContinuator(*continuator);
|
||||
}
|
||||
|
||||
/**
|
||||
* to set the precision of the output file
|
||||
* @param _precision precision of the output (number of digit)
|
||||
*/
|
||||
void precision(unsigned int _precision) {
|
||||
precisionOutput = _precision;
|
||||
}
|
||||
|
||||
/**
|
||||
* to export the vectors of values into one file
|
||||
* @param _filename file name
|
||||
|
|
@ -149,6 +159,11 @@ public:
|
|||
throw std::runtime_error(str);
|
||||
}
|
||||
|
||||
// set the precision of the output
|
||||
os.precision(precisionOutput);
|
||||
for (unsigned int j = 0; j < monitorVec.size(); j++)
|
||||
monitorVec[j]->precision(precisionOutput);
|
||||
|
||||
// all vector have the same size
|
||||
unsigned vecSize = monitorVec[0]->size();
|
||||
|
||||
|
|
@ -176,6 +191,7 @@ public:
|
|||
throw std::runtime_error(str);
|
||||
}
|
||||
|
||||
monitorVec[_col]->precision(precisionOutput);
|
||||
monitorVec[_col]->fileExport(_filename, _openFile);
|
||||
}
|
||||
|
||||
|
|
@ -214,6 +230,9 @@ protected:
|
|||
|
||||
std::vector< moVectorMonitor<EOT> *> monitorVec;
|
||||
|
||||
// precision of the output
|
||||
unsigned int precisionOutput;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue