C++ mpi module for stochmagnet_main Package
SM_LandauLifschitzBeam.hpp
1 #ifndef SM_LandauLifschitzBeam_HPP
2 #define SM_LandauLifschitzBeam_HPP
3 
4 template<class StochOutputImplement>
6  const std::function<void(const tReal&,const tReal& ,const tReal&,tReal& )>& F) {
7 
8  tString routineName="SM_Beam::stochasticJRun<O>,F";
10 
11  tBoolean ok=true;
12 
13  //get the system
15 
16  //open the stochastic at the beginning of the simulations running of the beam
17  if (!outputSData.open(*this)) {
18  std::cout<<"stochastic output "<<outputSData.getIdentityString()<<" not compatible with the system \n";
19  return false;
20  }
21 
22 
23  tIndex s0,s1;
24  getBeamSize(s0,s1);
25 
26  //get the stochastic function
28 
29  for (tIndex s=s0;s<s1;s++) {
30 
31 
32 
33  //St=S0
34  if (!system.initializeMagneticMomentDirections()) {
35  throw CORE_Exception("stochmagnet/landauLifschitz",
36  "SM_LandauLifschitzBeam::stochasticJRun(SM_StochasticOutput<StochOutputImplement>& outputSData,F)",
37  "initialization of S(t=0) failed");
38  }
39  //open the stochastic output the simulation 0 of the system
40  outputSData.open(s,system);
41 
42  //running the system until the equilibrium
44 
45  //running the system during loop steppers number
46  ok= ok && system.stochasticJRun(getStepsNumber(),sf,outputSData,F);
47 
48  //close the outputSData for simulation s at the end of simulations
49  outputSData.close(s,system,ok);
50  }
51 
52 
53  //close the stochastic output at the end of the runnings of the simulations
54  outputSData.close(*this);
55 
56  CORE_Profiler::EndCallRoutine(routineName);
57 
58  return true;
59 }
60 
61 #endif
this class describes the exceptions raised for CORE package
Definition: CORE_Exception.h:17
tString getIdentityString() const
retrun the string identification of the class
Definition: CORE_Object.h:321
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
const SM_System & getSystem() const
get the system
Definition: SM_Beam.h:264
const SM_MultiStochasticFunctionsInterface & getStochasticFunctions() const
get the stochastic functions
Definition: SM_Beam.h:236
const tIndex & getBeamSize() const
get the beam size
Definition: SM_Beam.h:166
const tIndex & getStepsNumber() const
get the number of steps for stochastic computation
Definition: SM_Beam.h:207
const tIndex & getPreconditioningStepsNumber() const
get the number of steps for precoditioning
Definition: SM_Beam.h:194
tBoolean stochasticJRun(SM_StochasticOutput< StochOutputImplement > &outputSData, const std::function< void(const tReal &, const tReal &, const tReal &, tReal &)> &F)
run the simulations
Definition: SM_LandauLifschitzBeam.hpp:5
This class is a simulation of one trajectory class for Stoch Magnet package.
Definition: SM_LandauLifschitzSystem.h:59
tBoolean stochasticJRun(const tIndex &steppersNumber, SM_StochasticFunctionsInterface &stochasticFunctions, const std::function< void(const tReal &, const tReal &, const tReal &, tReal &)> &F)
compute the steppers number of system for reaching the relaxed state
Definition: SM_LandauLifschitzSystem.cpp:130
virtual tBoolean initializeMagneticMomentDirections() override
initialize magnetic moments direction _ time step index = 0
Definition: SM_LandauLifschitzSystem.h:188
This class describes a stochastic functions based on same random number generator which implement ran...
Definition: SM_StochasticFunctionsInterface.h:18
this class implements the virtual methods of its base class SM_StochasticOutputComponent with templat...
Definition: SM_StochasticOutput.h:24
tBoolean close(const tIndex &s, const SM_System &system, const tBoolean &hasSucceeded)
close the stochastic data for the simulation s
Definition: SM_StochasticOutput.h:172
tBoolean open(const SM_Beam &beam)
open the stochastic data
Definition: SM_StochasticOutput.h:147