1 #ifndef SM_StochasticOutputComponent_H
2 #define SM_StochasticOutputComponent_H
11 #include "SM_Material.h"
53 tInteger mDrawnStepsNumber;
56 tInteger mPackedSimulationsIndex;
59 tInteger mPackedSimulationsNumber;
62 tBoolean mHasLogPerPackedSimulations;
65 tIndex mPackedRawValuesNumber;
68 std::valarray<tReal> mPackedRawValues;
71 std::valarray<tReal> mOutput;
72 std::vector<tString> mOutputDescription;
78 int mRootIndex,mIndex,mIndicesNumber;
93 mPackedSimulationsNumber=1;
94 mPackedSimulationsIndex=0;
95 mHasLogPerPackedSimulations=
true;
96 mPackedRawValues.resize(1);
97 mPackedRawValues[0]=0;
98 mPackedRawValuesNumber=0;
146 mem+=mOutputPath.size()*
sizeof(tChar);
147 mem+=mPrefix.size()*
sizeof(tChar);
148 mem+=
sizeof(tReal)*mPackedRawValues.size();
149 mem+=mOutput.size()*
sizeof(tReal);
150 for(
const auto& d: mOutputDescription) mem+=
sizeof(tChar)*d.length();
163 mOutputPath=c.getOutputPath();
164 mPrefix=c.getPrefix();
165 mDrawnStepsNumber=c.getDrawnStepsNumber();
200 const int& rootIndex,
203 mRootIndex=rootIndex;
228 return mIndicesNumber;
244 return mDrawnStepsNumber;
252 mPackedSimulationsIndex=i;
258 return mPackedSimulationsIndex;
264 mPackedSimulationsNumber=n;
270 return mPackedSimulationsNumber;
275 return mHasLogPerPackedSimulations;
281 mHasLogPerPackedSimulations=v;
287 return mPackedRawValuesNumber;
293 return mPackedRawValuesNumber;
302 return mPackedRawValues;
309 return mPackedRawValues;
317 return mOutputDescription;
324 mOutputDescription=v;
382 const tIndex& rawValuesNumber,
383 const std::valarray<tReal>& rawValues)=0;
399 std::stringstream ret;
401 ret<<
"\t outputPath:"<<mOutputPath<<
"\n";
402 ret<<
"\t prefix:"<<mPrefix<<
"\n";
403 ret<<
"\t drawn steps number:"<<mDrawnStepsNumber<<
"\n";
404 ret<<
"\t output size: "<<mOutput.size()<<
"\n";
405 ret<<
"\t pack:"<<mPackedSimulationsIndex<<
"/"<<mPackedSimulationsNumber<<
"\n";
406 ret<<
"\t output description: ";
407 for(
const auto& d:mOutputDescription) ret<<d<<
"\t";
409 ret<<
"\t has log per packed simulations:"<<mHasLogPerPackedSimulations<<
"\n";
virtual tMemSize getContentsMemorySize() const
return nthe memory size of the included associations
Definition: CORE_Object.h:278
virtual tString toString() const
return the string representation of the object node
Definition: CORE_Object.h:333
This class defines a general stochastic beam of trajectories of system.
Definition: SM_Beam.h:61
This class describes a materials defined by state attributes:
Definition: SM_Material.h:61
This class is a base class for Stoch Microm package.
Definition: SM_Object.h:36
This class stores stochastic outpus computed for each trajectory of a simulation of trajectories of a...
Definition: SM_StochasticOutputComponent.h:36
const std::valarray< tReal > & getPackedRawValues() const
get the packed raw values
Definition: SM_StochasticOutputComponent.h:308
const int & getRootIndex() const
get the root index of the output component
Definition: SM_StochasticOutputComponent.h:222
std::valarray< tReal > & getPackedRawValues()
get the packed raw values
Definition: SM_StochasticOutputComponent.h:301
void setOutputDescription(const std::vector< tString > &v)
et the output description
Definition: SM_StochasticOutputComponent.h:323
virtual void closePackedSimulations(const SM_Beam &beam, const tIndex &rawValuesNumber, const std::valarray< tReal > &rawValues)=0
close the raws values for packed simulations
void setPackedSimulationsNumber(const tInteger &n)
set packed simulations number
Definition: SM_StochasticOutputComponent.h:263
virtual tBoolean closeComponent(const SM_Beam &beam)=0
close stochastic data at the end of all simulations
virtual tBoolean closeComponent(const tIndex &s, const SM_System &system, const tBoolean &hasSucceeded)=0
close the stochastic data for the simulation s
SM_StochasticOutputComponent(void)
create
Definition: SM_StochasticOutputComponent.h:87
virtual tBoolean openComponent(const SM_Beam &beam)=0
open the stochastic data
std::valarray< tReal > & getOutputValues()
get the output values of the stochastic output for writing
Definition: SM_StochasticOutputComponent.h:337
void setIndex(const int &index, const int &n)
set index of the output component
Definition: SM_StochasticOutputComponent.h:210
const tString & getPrefix() const
return the prefix
Definition: SM_StochasticOutputComponent.h:190
const tInteger & getPackedSimulationsIndex() const
get packed simulations index
Definition: SM_StochasticOutputComponent.h:257
const std::vector< tString > & getOutputDescription() const
get the string representation of the output values
Definition: SM_StochasticOutputComponent.h:316
void setDrawnStepsNumber(const tInteger &n)
set the number of steps for drawn for the stochastic output
Definition: SM_StochasticOutputComponent.h:237
tIndex & getPackedRawValuesNumber()
get the packed raw values number
Definition: SM_StochasticOutputComponent.h:292
virtual tString toString() const override
return the string representation of the class
Definition: SM_StochasticOutputComponent.h:398
const tIndex & getPackedRawValuesNumber() const
get the packed raw values number
Definition: SM_StochasticOutputComponent.h:286
virtual void copy(const SM_StochasticOutputComponent &c)
copy
Definition: SM_StochasticOutputComponent.h:162
virtual tMemSize getMemorySize() const
return the memory size of the class and the memory size of all its attributes/associations
Definition: SM_StochasticOutputComponent.h:132
const tBoolean & hasLogPerPackedSimulations() const
return true if the stochastic output has log per pack of simulations
Definition: SM_StochasticOutputComponent.h:274
virtual tBoolean storeComponent(const SM_System &system)=0
store the stochastic data during the relation method of the system
const tInteger & getDrawnStepsNumber() const
get the drawn number to compute the stochastic output
Definition: SM_StochasticOutputComponent.h:243
virtual void setOutputPath(const tString &path)
set the output path
Definition: SM_StochasticOutputComponent.h:172
const tInteger & getPackedSimulationsNumber() const
get packed simulations number
Definition: SM_StochasticOutputComponent.h:269
virtual void setIndex(const int &index, const int &rootIndex, const int &n)
set index of the output component
Definition: SM_StochasticOutputComponent.h:199
virtual tBoolean openComponent(const tIndex &s, const SM_System &system)=0
open the stochastic data for simulation s
virtual void setPrefix(const tString &prefix)
set the prefix of generated files
Definition: SM_StochasticOutputComponent.h:184
const std::valarray< tReal > & getOutputValues() const
get the output values of the stochastic output for reading
Definition: SM_StochasticOutputComponent.h:330
const int & getIndex() const
get the index of the output component
Definition: SM_StochasticOutputComponent.h:217
void setHasLogPerPackedSimulations(const tBoolean &v)
set to true if the stochastic output has log per pack of simulations
Definition: SM_StochasticOutputComponent.h:280
const tString & getOutputPath() const
return the output path
Definition: SM_StochasticOutputComponent.h:178
virtual void adimensionize(const SM_Material &material)=0
adimensionize the output compoent with material characteristic
void setPackedSimulationsIndex(const tInteger &i)
set packed simulations index
Definition: SM_StochasticOutputComponent.h:251
virtual ~SM_StochasticOutputComponent(void)
destroy
Definition: SM_StochasticOutputComponent.h:111
const int & getIndicesNumber() const
get the number of output components
Definition: SM_StochasticOutputComponent.h:227
virtual tMemSize getContentsMemorySize() const
return the memory size of the included associations
Definition: SM_StochasticOutputComponent.h:144
This class is a one simulation of a beam for Stoch Magnet package.
Definition: SM_System.h:53