1 #ifndef SM_BeamTimeStepRange_H
2 #define SM_BeamTimeStepRange_H
5 #include "SM_BeamCycle.h"
8 #include "SM_LandauLifschitzSystem.h"
25 std::array<tReal,3> mTimeStepLogRange;
83 mem+=mTimeStepLogRange.size()*
sizeof(tReal);
84 mem+=mDtFileName.length()*
sizeof(tChar);
92 static CORE_UniquePointer<SelfClass>
New() {
93 return CORE_UniquePointer<SelfClass>(
new SelfClass(),
106 const tReal *iRange=range.data();
107 for(
auto& Tk:mTimeStepLogRange) {
132 const tInteger& outputId,tIndex& iCycleStep) {
143 if (llSystem==
null)
return false;
152 const tReal& ldt=mTimeStepLogRange[0];
153 tReal dt=pow(10,ldt-12)/tc;
165 std::ofstream file(mDtFileName.c_str(),std::ios::out);
167 std::cout<<
"impossible to open TimeStep Range file "<<mDtFileName<<
"\n";
197 if (llSystem==
null)
return;
207 std::ofstream file(mDtFileName.c_str(),std::ios::app);
216 for(
const auto& r:outputs) {
224 tReal ldt=mTimeStepLogRange[0]+mTimeStepLogRange[2]*(iCycleStep+1);
226 dt=pow(10,ldt-12)/tc;
243 if (llSystem==
null)
return true;
244 tReal ldt=mTimeStepLogRange[0]+mTimeStepLogRange[2]*iCycleStep;
245 return (ldt>=mTimeStepLogRange[1]);
259 std::stringstream ret;
261 ret<<
"\t Cycle time step range:"<<functions_array::toString(mTimeStepLogRange)<<
"\n";
267 inline void printHeader(std::ofstream& file,
const SM_Beam& beam,
const std::vector<tString>& outputDescription)
const {
270 tString str=
"Log of Time Step in ps Range :"+this->
toString();
271 functions_string::replaceAll(
"\n",
"\n#",str);
272 file<<
"#"<<str<<
"\n";
275 functions_string::replaceAll(
"\n",
"\n#",str);
276 file<<
"#"<<str<<
"\n";
278 file<<
"#<dt in s> <number of preconditioning steps> <number of statistic steps>";
279 for(
const auto& d:outputDescription) file<<
"\t"<<d;
class Free introduced for deleting a smart pointer
Definition: CORE_Object.h:113
virtual tMemSize getContentsMemorySize() const
return nthe memory size of the included associations
Definition: CORE_Object.h:278
static const tString & GetSoftName()
get soft name
Definition: CORE_Run.h:115
static const tString & GetVersion()
get the version
Definition: CORE_Run.h:129
This class is an interface of Beam Cycle class for Stoch Microm package.
Definition: SM_BeamCycle.h:20
virtual tString toString() const override
return the string representation of the class
Definition: SM_BeamCycle.h:193
This class is a time step cycle manager for running a cycle of beam class for Stoch Microm package.
Definition: SM_BeamTimeStepRange.h:16
SM_BeamTimeStepRange(void)
create
Definition: SM_BeamTimeStepRange.h:34
virtual ~SM_BeamTimeStepRange(void)
destroy
Definition: SM_BeamTimeStepRange.h:41
tBoolean close(const tIndex &iCycle, const SM_Beam &beam)
return true if the cycle is close without error
Definition: SM_BeamTimeStepRange.h:252
tBoolean isCycleFinished(const tIndex &iCycleStep, const SM_Beam &beam)
return true if the cycle is finished
Definition: SM_BeamTimeStepRange.h:241
virtual tMemSize getMemorySize() const
return the memory size of the class and the memory size of all its attributes/associations
Definition: SM_BeamTimeStepRange.h:70
tBoolean open(SM_Beam &beam, SM_StochasticOutputComponent &stochasticOutput, const tInteger &outputId, tIndex &iCycleStep)
init the cycle of beam run
Definition: SM_BeamTimeStepRange.h:131
void setTimeStepRange(const std::array< tReal, 3 > &range)
set the time step range
Definition: SM_BeamTimeStepRange.h:105
void nextCycleStep(const tIndex &iCycleStep, SM_Beam &beam, const tInteger &outputId, const SM_StochasticOutputComponent &output)
next the cycle of beam run
Definition: SM_BeamTimeStepRange.h:188
virtual tString toString() const override
return the string representation of the class
Definition: SM_BeamTimeStepRange.h:258
void setTimeStepsFileName(const tString &dtfile)
set the temperatures file
Definition: SM_BeamTimeStepRange.h:118
virtual tMemSize getContentsMemorySize() const
return the memory size of the included associations
Definition: SM_BeamTimeStepRange.h:81
static CORE_UniquePointer< SelfClass > New()
create an unique pointer to a new instance of this
Definition: SM_BeamTimeStepRange.h:92
This class defines a general stochastic beam of trajectories of system.
Definition: SM_Beam.h:61
const SM_System & getSystem() const
get the system
Definition: SM_Beam.h:264
virtual tString toString() const override
turn the class into a string representation
Definition: SM_Beam.h:315
void setPreconditioningStepsNumber(const tIndex &n)
set the number of steps of preconditioning
Definition: SM_Beam.h:187
void setStepsNumber(const tIndex &n)
set the number of steps for loop
Definition: SM_Beam.h:201
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
This class is a simulation of one trajectory class for Stoch Magnet package.
Definition: SM_LandauLifschitzSystem.h:59
const SM_TimeStepper & getTimeStepper() const
get the time stepper
Definition: SM_LandauLifschitzSystem.h:200
const tReal & getCharacteristicTime() const
get the characteristic time in s
Definition: SM_Material.h:355
This class stores stochastic outpus computed for each trajectory of a simulation of trajectories of a...
Definition: SM_StochasticOutputComponent.h:36
const std::vector< tString > & getOutputDescription() const
get the string representation of the output values
Definition: SM_StochasticOutputComponent.h:316
const std::valarray< tReal > & getOutputValues() const
get the output values of the stochastic output for reading
Definition: SM_StochasticOutputComponent.h:330
This class is a one simulation of a beam for Stoch Magnet package.
Definition: SM_System.h:53
const SM_Material & getMaterial() const
get the material of the network
Definition: SM_System.h:193
const tReal & getTimeStep() const
return the time step
Definition: SM_TimeStepper.h:108
void setTimeStep(const tReal &dt)
set the time step
Definition: SM_TimeStepper.h:99