C++ mpi module for stochmagnet_main Package
SMOMPI_BeamRunner.hpp
1 #ifndef SMOMPI_BeamRunner_HPP
2 #define SMOMPI_BeamRunner_HPP
3 
4 //runner header
5 #include "CORE_Run.h"
6 
7 //LL beam
8 #include "SMOMPI_LandauLifschitzBeam.h"
9 
10 //loader headers
11 #include "SM_LandauLifschitzLoader.h"
12 #include "SM_MonteCarloLoader.h"
13 
14 //cycle loader header
15 #include "SM_CycleLoader.h"
16 
17 //stochastic output loader header
18 #include "SM_StochasticOutputLoader.h"
19 
20 //mpi header
21 #include "MPI_Run.h"
22 #include "MPI_WorldToWorldMessage.h"
23 #include "MPI_Chrono.h"
24 
25 
26 template<class BEAM,class STOCHASTIC_OUTPUT> requires ( ! functions_type::isBaseOf<SM_StochasticJs,STOCHASTIC_OUTPUT>)
27 tBoolean SMOMPI_BeamRunner::RunBeam(const tBoolean& isTemplatedRun,
28  BEAM& beam,
29  STOCHASTIC_OUTPUT& stochasticOutput) {
30 
31  if (isTemplatedRun) {
32  return beam.runWithSCStochasticFunctions(stochasticOutput);
33  } else {
34  return beam.run(stochasticOutput);
35  }
36 }
37 
38 //BEAM RUNNER
39 //===========
40 template<class STOCHASTIC_OUTPUT>
41 tBoolean SMOMPI_BeamRunner::Run(const CORE_Run& runner,
42  STOCHASTIC_OUTPUT& stochasticOutput,
43  const CORE_OptionsList& options) {
44 
45 
46  tBoolean succeeds=true;
47 
48 
49 
50  //MPI environment
52 
53  //current id of the MPI core
54  const tMPICoreId& coreId=mpiEnv.getCoreId();
55 
56  //number of MPI cores
57  const tMPICoreId& coresNumber=mpiEnv.getCoresNumber();
58 
59 
60  //prefix of core
61  int nDigits=(int)(log(coresNumber)/log(10.)+1);
62  tString corePrefix="_g"+functions_numeric::toString(coreId,nDigits)+"p"+functions_numeric::toString(coresNumber,nDigits);
63 
64 
65  //memory size
66  std::valarray<tMemSize> memorySizePerCore;
67  tString memorySizeSymbol="Mo";
68  tReal memorySizeUnit=1024*1024;
69  tMemSize memSize;
70 
71  try {
72  //run the program
73  MPI_Chrono chrono;
74  chrono.start();
75 
76 
77  //1. loader Step
78  //=================
79 
80 
81  //read the IO data from options
82 
83  tString outputPath,outputPrefix;
84  runner.ReadOutputOptions(options,outputPath,outputPrefix);
85 
86  //std::cout<<"outputPath:"<<outputPath<<"\n";
87  //std::cout<<"outputPrefix:"<<outputPrefix<<"\n";
88  //create output path
89  if (!CORE_IO::Exists(outputPath)) CORE_IO::CreatePath(outputPath);
90 
91 
92  if (coreId==0) {
93  //allocate only core 0 memory
94  memorySizePerCore.resize(coresNumber);
95 
96  //save the options into default file
97  options.saveToFile();
98 
99  //get the output stream created from options command line
100  CORE_Out& log=runner.Out();
101 
102  //print the header of the log file or append
103  log<<"log file created by "+runner.GetSoftName()<<" "<<runner.GetVersion()<<" at date ";
104  log<<CORE_Chrono::GetDate();
105  log<<"\n";
106 
107  //print the number of threads in log
108  log<<"number of cores:"<<coresNumber<<"\n";
109 
110  log<<"size of int :"<<sizeof(tInteger)<<"\n";
111  log<<"size of real :"<<sizeof(tReal)<<"\n";
112 
113 
114 
115  }
116 
117 
118  //create the beam
119  CORE_UniquePointer<SM_Beam> uBeam=runner.GetClassFactory().NewUniqueInstance<SM_Beam>("SM_Beam",options);
120 
121  //verify the beam can be created
122  if (uBeam.get()==null) {
123  std::cout<<"impossible to create the beam from options values \n";
124  return false;
125  }
126 
127  //casting for templated method
128  SMOMPI_LandauLifschitzBeam *llBeam=dynamic_cast<SMOMPI_LandauLifschitzBeam*>(uBeam.get());
129  SM_MonteCarloBeam *mcBeam=dynamic_cast<SM_MonteCarloBeam*>(uBeam.get());
130 
131  //load the beam form options
132  if (llBeam!=null) succeeds=SM_LandauLifschitzLoader::LoadLandauLifschitzBeamFromOptions(*llBeam,options);
133  if (mcBeam!=null) succeeds=SM_MonteCarloLoader::LoadMonteCarloBeamFromOptions(*mcBeam,options);
134 
135  //verify the beam option has been loaded
136  if (succeeds==false) {
137  std::cout<<"impossible to load the beam from options values \n";
138  return false;
139 
140  }
141 
142  //random jump
143  uBeam->getStochasticFunctions().randomSeed(coresNumber,coreId);
144 
145  //load the stochastic data
147 
148  //set the index of the stochastic output
149  stochasticOutput.setIndex(coreId,-1,coresNumber);
150 
151  //adimensionize the stochastic data
152  stochasticOutput.adimensionize(uBeam->getSystem().getMaterial());
153 
154  //simulate the data
155  tBoolean isTemplatedRun=false;
156  options.getOptionValue("is-templated-run",isTemplatedRun);
157 
158  //save S at cycle
159  tBoolean isSSaved=true;
160  options.getOptionValue("is-S-Saved",isSSaved);
161 
162 
163 
164 
165  //duration of initialization
166  tULLInt loaderDuration=chrono.stop();//duration in ss
167  MPI_WorldToWorldMessage::AllReduce(mpiEnv,loaderDuration,MPI_MAX);
168 
169 
170  //2.discretization step
171 
172  //start the chrono
173  chrono.start();
174 
175  //discretize the beam
176  uBeam->discretize();
177 
178 
179  //save the network
180  uBeam->getSystem().getNetwork().saveToFile(CORE_IO::GetAbsolutePath(outputPath+"/"+outputPrefix+corePrefix+".net"));
181 
182  //duration of discretization
183  tULLInt discretizationDuration=chrono.stop();//duration in s
184  MPI_WorldToWorldMessage::AllReduce(mpiEnv,discretizationDuration,MPI_MAX);
185 
186  //memory size per core array;
187  memSize=uBeam->getMemorySize();
188  memSize+=stochasticOutput.getMemorySize();
189  MPI_WorldToWorldMessage::Gather(mpiEnv,0,memSize,memorySizePerCore);
190 
191  if (coreId==0) {
192  //get the output stream created from options command line
193  CORE_Out& log=runner.Out();
194 
195  //print the beam in log
196  log<<"\n\n beam:"<<uBeam->toString()<<"\n";
197  //templated run
198  log<<"templated run : "<<isTemplatedRun<<"\n";
199  //print the stochastic
200  log<<"\n\n stochastic Output:"<<stochasticOutput.toString()<<"\n";
201 
202  log<<"Memory size for all cores after discretization: "<<(((tReal)memSize)/memorySizeUnit)<<"\n";
203 
204  log<<"loader duration :"<<loaderDuration<<" s="<<chrono.ConvertDurationToString(loaderDuration)<<" \n";
205 
206  //get the output stream created from options command line
207  log<<"discretization duration :"<<discretizationDuration<<" s="<<chrono.ConvertDurationToString(discretizationDuration)<<" \n";
208 
209  tInteger c=0;
210  memSize=0;
211  for (const auto& mem:memorySizePerCore) {
212  log<<"\t memory for core "<<c<<":"<<(((tReal) mem)/memorySizeUnit)<<" "<<memorySizeSymbol<<"\n";
213  memSize+=mem;
214  }
215 
216  }
217 
218 
219 
220  //start the chrono
221  chrono.start();
222 
223  if (llBeam!=null) succeeds=RunBeam(isTemplatedRun,*llBeam,stochasticOutput);
224  else if (mcBeam!=null) succeeds=RunBeam(isTemplatedRun,*mcBeam,stochasticOutput);
225 
226  //end the chrono
227  tULLInt runningDuration=chrono.stop();//duration in s
228  MPI_WorldToWorldMessage::AllReduce(mpiEnv,runningDuration,MPI_MAX);
229  if (coreId==0) {
230  //get the output stream created from options command line
231  CORE_Out& log=runner.Out();
232  log<<"running duration :"<<runningDuration<<" s="<<chrono.ConvertDurationToString(runningDuration)<<"\n";
233  }
234  //memory size
235  memSize=uBeam->getMemorySize();
236  memSize+=stochasticOutput.getMemorySize();
237  MPI_WorldToWorldMessage::Gather(mpiEnv,0,memSize,memorySizePerCore);
238 
239  //save the last value of S
240  if (coreId==0) {
241  //get the output stream created from options command line
242  CORE_Out& log=runner.Out();
243 
244  tInteger c=0;
245  memSize=0;
246  for (const auto& mem:memorySizePerCore) {
247  log<<"\t memory for core "<<c<<":"<<(((tReal)mem)/memorySizeUnit)<<" "<<memorySizeSymbol<<"\n";
248  memSize+=mem;
249  }
250  log<<"Memory size for all cores after running beam: "<<(((tReal)memSize)/memorySizeUnit)<<"\n";
251 
252 
253  tULLInt totalDuration=loaderDuration+discretizationDuration+runningDuration;
254  log<<"total duration :"<<totalDuration<<" s="<<chrono.ConvertDurationToString(totalDuration)<<"\n";
255 
256 
257  }
258 
259  //save S at end of time
260  if (isSSaved) {
261  std::stringstream comment;
262  comment<<"Direction of magnetic moments at end of last simulation for "<<coreId<<"/"<<coresNumber<<" nParticles:"<<uBeam->getSystem().getNetwork().getParticlesNumber()<<" nHaloParticles:"<<uBeam->getSystem().getNetwork().getHaloParticlesNumber()<<" ";
263  if (llBeam!=null) comment<<"time="<<llBeam->getLLSystem().getTime();
264  comment<<"\n";
265  uBeam->getSystem().getMagneticMomentDirections().saveToFile(comment.str(),CORE_IO::GetAbsolutePath(outputPath+"/"+outputPrefix+corePrefix+"-St.txt"),12);
266 
267  }
268 
269  } catch(SM_Exception& e) {
270  std::cerr<<e.getMessage()<<"\n";
271  }
272  return succeeds;
273 
274 
275 }
276 
277 //CYCLE BEAM RUNNER
278 //==================
279 template<class BEAM_CYCLE,class STOCHASTIC_OUTPUT>
280 tBoolean SMOMPI_BeamRunner::Run(const CORE_Run& runner,
281  SM_BeamCycle<BEAM_CYCLE>& cycleManager,
282  STOCHASTIC_OUTPUT& stochasticOutput,
283  const CORE_OptionsList& options) {
284 
285 
286 
287 
288 
289  //MPI environment
291 
292  //current id of the MPI core
293  const tMPICoreId& coreId=mpiEnv.getCoreId();
294 
295  //number of MPI cores
296  const tMPICoreId& coresNumber=mpiEnv.getCoresNumber();
297 
298  tBoolean succeeds=true;
299 
300  //prefix of core
301  int nDigits=(int)(log(coresNumber)/log(10.)+1);
302  tString corePrefix="_g"+functions_numeric::toString(coreId,nDigits)+"p"+functions_numeric::toString(coresNumber,nDigits);
303 
304  //memory size
305  std::valarray<tULLInt> memorySizePerCore;
306  tString memorySizeSymbol="Mo";
307  tULLInt memorySizeUnit=1024*1024;
308  tULLInt memSize;
309 
310  try {
311 
312  //chrono of the program
313  MPI_Chrono totalChrono;
314  totalChrono.start();
315 
316  //step chrono
317  MPI_Chrono chrono;
318  chrono.start();
319 
320  //step duration
321  tULLInt duration=0;
322 
323 
324  //1. loader Step
325  //=================
326 
327 
328  //read the IO data from options
329 
330  tString outputPath,outputPrefix;
331  runner.ReadOutputOptions(options,outputPath,outputPrefix);
332 
333  //std::cout<<"outputPath:"<<outputPath<<"\n";
334  //std::cout<<"outputPrefix:"<<outputPrefix<<"\n";
335  //create output path
336  if (!CORE_IO::Exists(outputPath)) CORE_IO::CreatePath(outputPath);
337 
338  //simulate the data
339  tBoolean isTemplatedRun=false;
340  options.getOptionValue("is-templated-run",isTemplatedRun);
341 
342  //save S at cycle
343  tBoolean isSSaved=true;
344  options.getOptionValue("is-S-Saved",isSSaved);
345 
346 
347  if (coreId==0) {
348 
349 
350  //allocate only core 0 memory
351  memorySizePerCore.resize(coresNumber);
352 
353  //save the options into default file
354  options.saveToFile();
355 
356  //get the output stream created from options command line
357  CORE_Out& log=runner.Out();
358 
359  //print the header of the log file or append
360  log<<"log file created by "+runner.GetSoftName()<<" "<<runner.GetVersion()<<" at date ";
361  log<<CORE_Chrono::GetDate();
362  log<<"\n";
363 
364  //print the number of threads in log
365  log<<"number of cores:"<<coresNumber<<"\n";
366 
367  log<<"size of int :"<<sizeof(tInteger)<<"\n";
368  log<<"size of real :"<<sizeof(tReal)<<"\n";
369  }
370 
371 
372  //create the beam
373  CORE_UniquePointer<SM_Beam> uBeam=runner.GetClassFactory().NewUniqueInstance<SM_Beam>("SM_Beam",options);
374  if (uBeam.get()==null) {
375  std::cout<<"impossible to create the beam from options values \n";
376  return false;
377  }
378 
379  //verify the beam can be created
380  if (uBeam.get()==null) {
381  std::cout<<"impossible to create the beam from options values \n";
382  return false;
383  }
384 
385  //beam casting
386  SMOMPI_LandauLifschitzBeam *llBeam=dynamic_cast<SMOMPI_LandauLifschitzBeam*>(uBeam.get());
387  SM_MonteCarloBeam *mcBeam=dynamic_cast<SM_MonteCarloBeam*>(uBeam.get());
388 
389  //load the bam
390  if (llBeam!=null) succeeds=SM_LandauLifschitzLoader::LoadLandauLifschitzBeamFromOptions(*llBeam,options);
391  if (mcBeam!=null) succeeds=SM_MonteCarloLoader::LoadMonteCarloBeamFromOptions(*mcBeam,options);
392 
393  if (succeeds==false) {
394  std::cout<<"impossible to load the beam from options values \n";
395  return false;
396 
397  }
398 
399 
400  //random seed
401  if (uBeam->hasStochasticFunctions()) {
402  uBeam->getStochasticFunctions().randomSeed(coresNumber,coreId);
403  }
404 
405 
406 
407  //Load the cycle
408  SM_CycleLoader::LoadCycleFromOptions(cycleManager,options);
409 
410  //load the stochastic data
412 
413  //set ndex of the stochoutput which is the index of core
414  stochasticOutput.setIndex(coreId,-1,coresNumber);
415 
416  //prefix of the stochastic output
417  tString soPrefix=stochasticOutput.getPrefix();
418 
419  //adimensionize the stochastic data
420  stochasticOutput.adimensionize(uBeam->getSystem().getMaterial());
421 
422  //duration of loader
423  duration=chrono.stop();//duration in ss
424  MPI_WorldToWorldMessage::AllReduce(mpiEnv,duration,MPI_MAX);
425 
426  //start the chrono
427  chrono.start();
428 
429  //discretize the beam
430  uBeam->discretize();
431 
432  //memory size
433  memSize=uBeam->getMemorySize();
434  MPI_WorldToWorldMessage::Gather(mpiEnv,0,memSize,memorySizePerCore);
435 
436  //duration of discretization
437  duration=chrono.stop();//duration in s
438  MPI_WorldToWorldMessage::AllReduce(mpiEnv,duration,MPI_MAX);
439  if (coreId==0) {
440  //get the output stream created from options command line
441  CORE_Out& log=runner.Out();
442 
443  //print the beam in log
444  log<<"\n\n beam:"<<uBeam->toString()<<"\n";
445  log<<"templated run : "<<isTemplatedRun<<"\n";
446 
447  //print the cycle:
448  log<<"\n\n cycle manager:"<<cycleManager.toString()<<"\n";
449 
450  //print the stochastic
451  log<<"\n\n stochastic Output:"<<stochasticOutput.toString()<<"\n";
452 
453 
454  log<<"loader duration :"<<duration<<" s="<<chrono.ConvertDurationToString(duration)<<" \n";
455 
456  log<<"duration for discretization :"<<duration<<" ms="<<chrono.ConvertDurationToString(duration)<<"\n";
457 
458 
459  tInteger c=0;
460  memSize=0;
461  for (const auto& mem:memorySizePerCore) {
462  log<<"\t memory for core "<<c<<":"<<((tReal)(mem/memorySizeUnit))<<" "<<memorySizeSymbol<<"\n";
463  memSize+=mem;
464  }
465  log<<"Memory size for all cores after discretization: "<<((tReal)(memSize/memorySizeUnit))<<"\n";
466  }
467 
468 
469  tIndex iCycleStep=0;
470 
471  //open the cycle
472  if (!cycleManager.open(*uBeam.get(),stochasticOutput,coreId,iCycleStep)) {
473  std::cout<<"impossible to init cycle step \n";
474  return false;
475  }
476 
477 
478  while (!cycleManager.isCycleFinished(iCycleStep,*uBeam.get())) {
479 
480  //start the chrono for the cycle step
481  chrono.start();
482 
483  //update seed if necessary
484 
485  if (uBeam->hasStochasticFunctions()) {
486  if (cycleManager.isSeedUpdatedPerCycleStep()) {
487  if (coreId==0) {
488  std::cout<<"set the seed for the step of cycle "<<iCycleStep<<" to "<<cycleManager.getSeedPerCycleStep()<<"\n";
489  }
490  uBeam->getStochasticFunctions().setSeed(cycleManager.getSeedPerCycleStep());
491 
492  }
493 
494  }
495 
496  //run the step of cycle with prefix indexed with the index of the cycle
497  if (cycleManager.isStochasticOutputSavedAtEachStep()) {
498  stochasticOutput.setPrefix(soPrefix+"-"+std::to_string(iCycleStep)+"c");
499  } else {
500  stochasticOutput.setPrefix("");
501  }
502 
503  //std::cout<<"begin running Beam for "<<iCycleStep<<" cycle step for core "<<coreId<<" isTemplatedRun:"<<isTemplatedRun<<"\n";
504  if (llBeam!=null) succeeds=RunBeam(isTemplatedRun,*llBeam,stochasticOutput);
505  else if (mcBeam!=null) succeeds=RunBeam(isTemplatedRun,*mcBeam,stochasticOutput);
506  //std::cout<<"end running Beam for "<<iCycleStep<<" cycle step for core "<<coreId<<"\n";
507 
508  //duration of the cycle step
509  duration=chrono.stop();//duration in s
510  MPI_WorldToWorldMessage::AllReduce(mpiEnv,duration,MPI_MAX);
511 
512  //save the last value of S
513  if (coreId==0) {
514  //get the output stream created from options command line
515  CORE_Out& log=runner.Out();
516  //end the chrono
517  log<<" duration for beam run at cycle "<<iCycleStep<<":"<<duration<<" s="<<chrono.ConvertDurationToString(duration)<<"\n";
518  }
519  //save S at end of time
520  if (isSSaved) {
521  std::stringstream comment;
522  comment<<"Direction of magnetic moments at end of last simulation for "<<coreId<<"/"<<coresNumber<<" nParticles:"<<uBeam->getSystem().getNetwork().getParticlesNumber()<<" nHaloParticles:"<<uBeam->getSystem().getNetwork().getHaloParticlesNumber()<<" ";
523  if (llBeam!=null) comment<<"time="<<llBeam->getLLSystem().getTime();
524  comment<<"\n";
525  uBeam->getSystem().getMagneticMomentDirections().saveToFile(comment.str(),CORE_IO::GetAbsolutePath(outputPath+"/"+outputPrefix+corePrefix+"-St.txt"),12);
526 
527  }
528 
529  //next step of the cycle
530  //std::cout<<"next cycle step for core "<<coreId<<"\n";
531  cycleManager.nextCycleStep(iCycleStep,*uBeam.get(),coreId,stochasticOutput);
532 
533  //synchronize before next step
534  mpiEnv.synchronize();
535  iCycleStep++;
536 
537  }
538  //std::cout<<" cycle is closed for core "<<coreId<<"\n";
539  //close the cycle
540  cycleManager.close(iCycleStep,*uBeam.get());
541 
542  duration=totalChrono.stop();
543  MPI_WorldToWorldMessage::AllReduce(mpiEnv,duration,MPI_MAX);
544 
545  //memory size
546  memSize=uBeam->getMemorySize();
547  MPI_WorldToWorldMessage::Gather(mpiEnv,0,memSize,memorySizePerCore);
548 
549 
550  if (coreId==0) {
551  //get the output stream created from options command line
552  CORE_Out& log=runner.Out();
553  log<<"cycle duration :"<<duration<<" s="<<chrono.ConvertDurationToString(duration)<<"\n";
554 
555  tInteger c=0;
556  memSize=0;
557  for (const auto& mem:memorySizePerCore) {
558  log<<"\t memory for core "<<c<<":"<<((tReal)(mem/memorySizeUnit))<<" "<<memorySizeSymbol<<"\n";
559  memSize+=mem;
560  }
561  log<<"Memory size for all cores after running cycle: "<<((tReal)(memSize/memorySizeUnit))<<"\n";
562  }
563 
564  //re-update the prefix
565  stochasticOutput.setPrefix(soPrefix);
566 
567  } catch(SM_Exception& e) {
568  std::cerr<<e.getMessage()<<"\n";
569  }
570  return succeeds;
571 
572 
573 }
574 
575 
576 
577 
578 #endif
static tString GetDate()
return the current date as a string
Definition: CORE_Chrono.h:194
tString getMessage() const
return the message of the exception
Definition: CORE_Exception.h:80
static tString GetAbsolutePath(const tString &path)
get the absolute path of the path
Definition: CORE_IO.h:365
static tBoolean Exists(const tString &f)
return true if the file or the path exists
Definition: CORE_IO.h:91
static tBoolean CreatePath(const tString &path)
create a path
Definition: CORE_IO.h:99
This class is an list of options.
Definition: CORE_OptionsList.h:36
tBoolean saveToFile(const tString &fileName) const
save the options to the file by theme
Definition: CORE_OptionsList.cpp:328
tBoolean getOptionValue(const tString &optName, tString &optValue) const
get the option value
Definition: CORE_OptionsList.h:334
this class describes the output stream by default write on standart output
Definition: CORE_Out.h:28
This class is a Run class for core package.
Definition: CORE_Run.h:44
static void ReadOutputOptions(const CORE_OptionsList &options, tString &outputPath, tString &outputPrefix)
read the output path &prefix from options
Definition: CORE_Run.cpp:354
static CORE_ClassFactory & GetClassFactory()
return the class factory
Definition: CORE_Run.h:227
static const tString & GetSoftName()
get soft name
Definition: CORE_Run.h:115
static CORE_Out & Out()
return the output stream
Definition: CORE_Run.h:184
static const tString & GetVersion()
get the version
Definition: CORE_Run.h:129
This class is a time class to manage time within an environment.
Definition: MPI_Chrono.h:20
void start()
start the chrono
Definition: MPI_Chrono.h:114
tULLInt stop() const
stop the chrono
Definition: MPI_Chrono.h:121
static tString ConvertDurationToString(tULLInt duration)
convert the duration the duration to string
Definition: MPI_Chrono.h:151
This class is a Environment class to define MPI world.
Definition: MPI_Environment.h:36
const tMPICoreId & getCoreId() const
get the id of the current process of this environment
Definition: MPI_Environment.h:200
const tMPICoreId & getCoresNumber() const
get the number of cores of this environment of common environment
Definition: MPI_Environment.h:180
tBoolean synchronize() const
wait that all the cores has finished her job
Definition: MPI_Environment.h:280
static MPI_Environment & GetEnvironment()
get the environment
Definition: MPI_Run.h:114
static tBoolean Gather(const MPI_Environment &env, const tMPICoreId &dstCore, const T &srcData, std::valarray< T > &dstData)
blocking gathering a data from all cores of enviroments to the dest core
Definition: MPI_WorldToWorldMessage.h:306
static tBoolean AllReduce(const MPI_Environment &env, T &data, const tMPIOperation &op)
compute a data from data of others cores and to data of core 0 and copy the values to all cores
Definition: MPI_WorldToWorldMessage.h:703
static tBoolean Run(const CORE_Run &runner, STOCHASTIC_OUTPUT &stochasticOutput, const CORE_OptionsList &options)
compute the stochastic output from options
Definition: SMOMPI_BeamRunner.hpp:41
This class describes an OpenMP/MPI implementation simulation of a beam of trajectoris for a Laudau-Li...
Definition: SMOMPI_LandauLifschitzBeam.h:20
This class is an interface of Beam Cycle class for Stoch Microm package.
Definition: SM_BeamCycle.h:20
tBoolean close(const tIndex &iCycle, const SM_Beam &beam)
return true if the cycle is close without error
Definition: SM_BeamCycle.h:186
void nextCycleStep(const tIndex &iCycleStep, SM_Beam &beam, const SM_StochasticOutputComponent &output)
next step of the cycle of beam run
Definition: SM_BeamCycle.h:162
const tULLInt & getSeedPerCycleStep() const
get the seed
Definition: SM_BeamCycle.h:124
virtual tString toString() const override
return the string representation of the class
Definition: SM_BeamCycle.h:193
tBoolean open(SM_Beam &beam, SM_StochasticOutputComponent &stochasticOutput, const tInteger &outputId, tIndex &iCycleStep)
init the cycle of beam run
Definition: SM_BeamCycle.h:150
tBoolean isCycleFinished(const tIndex &iCycle, const SM_Beam &beam)
return true if the cycle is finished
Definition: SM_BeamCycle.h:178
const tBoolean & isStochasticOutputSavedAtEachStep() const
get if the output is saved at each step
Definition: SM_BeamCycle.h:97
const tBoolean & isSeedUpdatedPerCycleStep() const
return true if the seed is generated at each cycle step
Definition: SM_BeamCycle.h:111
This class defines a general stochastic beam of trajectories of system.
Definition: SM_Beam.h:61
static tBoolean LoadCycleFromOptions(SM_BeamCycle< T > &cycle, const CORE_OptionsList &options)
load the cycle from options
Definition: SM_CycleLoader.h:94
this class describes the exceptions raised for SM package
Definition: SM_Exception.h:14
SM_LandauLifschitzSystem & getLLSystem()
get the landau lifschitz system
Definition: SM_LandauLifschitzBeam.h:82
static tBoolean LoadLandauLifschitzBeamFromOptions(SM_LandauLifschitzBeam &beam, const CORE_OptionsList &options)
load the beam from options
Definition: SM_LandauLifschitzLoader.cpp:8
const tReal & getTime() const
get the time
Definition: SM_LandauLifschitzSystem.h:214
This class is a simulation of a Monte Carlo for spins system.
Definition: SM_MonteCarloBeam.h:17
static tBoolean LoadMonteCarloBeamFromOptions(SM_MonteCarloBeam &beam, const CORE_OptionsList &options)
load the beam from options
Definition: SM_MonteCarloLoader.cpp:5
static tBoolean LoadStochasticOutputFromOptions(SM_StochasticTrajectory &stochasticOutput, const CORE_OptionsList &options)
load the stochastic output from options
Definition: SM_StochasticOutputLoader.cpp:31