1 #ifndef SM_StochasticOutputList_H
2 #define SM_StochasticOutputList_H
5 #include "SM_StochasticOutput.h"
8 #include "SM_StochasticOutputComponent.h"
32 std::vector<CORE_UniquePointer<SM_StochasticOutputComponent>> mStochasticOutputList;
89 for(
const auto& sd : mStochasticOutputList) {
90 mem+=sd->getContentsMemorySize();
98 inline static CORE_UniquePointer<SelfClass>
New() {
99 return CORE_UniquePointer<SelfClass>(
new SelfClass(),
108 mStochasticOutputList.resize(0);
115 return mStochasticOutputList.size();
121 return mStochasticOutputList;
126 return mStochasticOutputList;
131 inline void add(CORE_UniquePointer<SM_StochasticOutputComponent> data) {
132 mStochasticOutputList.push_back(std::move(data));
139 return mStochasticOutputList[i].get();
148 for(
auto& SOutput:mStochasticOutputList) SOutput->setOutputPath(path);
154 virtual void setPrefix(
const tString& prefix)
override {
156 for(
auto& SOutput:mStochasticOutputList) SOutput->setPrefix(prefix);
163 for(
auto& SOutput:mStochasticOutputList) SOutput->adimensionize(material);
171 const int& rootIndex,
172 const int& n)
final {
174 for(
auto& SOutput:mStochasticOutputList) SOutput->setIndex(index,rootIndex,n);
184 for(
auto& p : mStochasticOutputList) {
185 ok=p->openComponent(beam) && ok;
196 for(
auto& p : mStochasticOutputList) {
197 ok=ok && p->openComponent(s,system);
209 for(
auto& p : mStochasticOutputList) {
210 ok=p->storeComponent(system) && ok;
220 inline tBoolean
close(
const tIndex& s,
const SM_System& system,
const tBoolean& hasSucceeded) {
222 for(
auto& p : mStochasticOutputList) {
223 ok=p->closeComponent(s,system,hasSucceeded) && ok;
233 for(
auto& p : mStochasticOutputList) {
234 ok=p->closeComponent(beam) && ok;
237 auto iP=mStochasticOutputList.begin();
238 if (iP!=mStochasticOutputList.end()) {
252 const tIndex& rawValuesNumber,
253 const std::valarray<tReal>& rawValues)
override {
255 auto iP=mStochasticOutputList.begin();
256 if (iP!=mStochasticOutputList.end()) {
257 (*iP)->closePackedSimulations(beam,rawValuesNumber,rawValues);
273 tString routineName=
"SM_StochasticOutputList::toString()";
275 std::stringstream ret;
276 ret<<SM_StochasticOutput<SM_StochasticOutputList>::toString()<<
"\n";
277 for(
auto& p : mStochasticOutputList) {
278 ret<<
"\t"<<p->toString()<<
"\n";
class Free introduced for deleting a smart pointer
Definition: CORE_Object.h:113
static void EndCallRoutine(const tString &routineName)
end calling routine
Definition: CORE_Profiler.h:91
static void StartCallRoutine(const tString &routineName)
start calling routine
Definition: CORE_Profiler.h:61
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 stores stochastic outpus computed for each trajectory of a simulation of trajectories of a...
Definition: SM_StochasticOutputComponent.h:36
std::valarray< tReal > & getPackedRawValues()
get the packed raw values
Definition: SM_StochasticOutputComponent.h:301
const tIndex & getPackedRawValuesNumber() const
get the packed raw values number
Definition: SM_StochasticOutputComponent.h:286
virtual void setOutputPath(const tString &path)
set the output path
Definition: SM_StochasticOutputComponent.h:172
virtual void setIndex(const int &index, const int &rootIndex, const int &n)
set index of the output component
Definition: SM_StochasticOutputComponent.h:199
virtual void setPrefix(const tString &prefix)
set the prefix of generated files
Definition: SM_StochasticOutputComponent.h:184
This class stores stochastic data list* For parallel only the firs stocchastic values of first output...
Definition: SM_StochasticOutputList.h:19
const std::vector< CORE_UniquePointer< SM_StochasticOutputComponent > > & getStochasticOutputList() const
get the stochastic data list
Definition: SM_StochasticOutputList.h:120
void add(CORE_UniquePointer< SM_StochasticOutputComponent > data)
add a stochastic data
Definition: SM_StochasticOutputList.h:131
virtual void closePackedSimulations(const SM_Beam &beam, const tIndex &rawValuesNumber, const std::valarray< tReal > &rawValues) override
close the raws values for packed simulations
Definition: SM_StochasticOutputList.h:251
tBoolean close(const tIndex &s, const SM_System &system, const tBoolean &hasSucceeded)
close the stochastic data for the simulation s
Definition: SM_StochasticOutputList.h:220
virtual tMemSize getContentsMemorySize() const
return the memory size of the included associations
Definition: SM_StochasticOutputList.h:87
tBoolean open(const SM_Beam &beam)
open the stochastic data
Definition: SM_StochasticOutputList.h:182
tBoolean open(const tIndex &s, const SM_System &system)
open the stochastic data for simulation s
Definition: SM_StochasticOutputList.h:194
tBoolean store(const SM_System &system)
store the stochastic data during the relation method of the system
Definition: SM_StochasticOutputList.h:207
SM_StochasticOutputList(void)
create
Definition: SM_StochasticOutputList.h:45
virtual tString toString() const override
return the string representation of the class
Definition: SM_StochasticOutputList.h:272
std::vector< CORE_UniquePointer< SM_StochasticOutputComponent > > & getStochasticOutputList()
get the stochastic data list
Definition: SM_StochasticOutputList.h:125
virtual void setOutputPath(const tString &path) override
set the output path
Definition: SM_StochasticOutputList.h:146
virtual void setPrefix(const tString &prefix) override
set the prefix of generated files
Definition: SM_StochasticOutputList.h:154
virtual tMemSize getMemorySize() const
return the memory size of the class and the memory size of all its attributes/associations
Definition: SM_StochasticOutputList.h:75
tBoolean close(const SM_Beam &beam)
close stochastic data at the end of all simulations
Definition: SM_StochasticOutputList.h:231
tIndex getSize() const
return the data list size
Definition: SM_StochasticOutputList.h:114
virtual ~SM_StochasticOutputList(void)
destroy
Definition: SM_StochasticOutputList.h:54
const SM_StochasticOutputComponent * get(const tIndex &i)
get a stochastic data
Definition: SM_StochasticOutputList.h:138
virtual void adimensionize(const SM_Material &material) override
adimensionize the output compoent with material characteristic
Definition: SM_StochasticOutputList.h:162
static CORE_UniquePointer< SelfClass > New()
build a new instance of a stochastic data
Definition: SM_StochasticOutputList.h:98
void clear()
clear the data list
Definition: SM_StochasticOutputList.h:107
virtual void setIndex(const int &index, const int &rootIndex, const int &n) final
set index of the output component
Definition: SM_StochasticOutputList.h:170
this class implements the virtual methods of its base class SM_StochasticOutputComponent with templat...
Definition: SM_StochasticOutput.h:24
virtual tMemSize getContentsMemorySize() const
return the memory size of the included associations
Definition: SM_StochasticOutput.h:84
This class is a one simulation of a beam for Stoch Magnet package.
Definition: SM_System.h:53