C++ main module for stochmagnet Package  1.0
SM_TimeStepper.h
Go to the documentation of this file.
1 #ifndef SM_TimeStepper_H
2 #define SM_TimeStepper_H
3 
4 
5 #include "SM_Object.h"
6 
13 class SM_TimeStepper : public SM_Object {
14 
15  //attributes
16 private :
17 
18  //time step
20 
21  //target time
23 
24  //number of maximum time steps
26 
27  //association
28 
29 
30 
31 public:
32  // CONSTRUCTORS
36  mTimeStep=1.;
37  mTargetTime=10.;
39  }
40 
41  // DESTRUCTORS
44  virtual ~SM_TimeStepper(void) {
45  }
46 
47 public :
48 
49  //Instance building
50  //=================
51 
57  }
58 
59 
60  //MEMORY
61 
75  virtual tMemSize getMemorySize() const {
76  return sizeof(*this)+getContentsMemorySize();
77  }
78 
79  //SET & GET methods
80 
81 
82 public:
86  inline void copy(const SM_TimeStepper& T) {
90  }
94  inline void setTimeStep(const tReal& dt) {
95  ASSERT_IN(dt>EPSILON<tReal>);
96  mTimeStep=dt;
98  }
99 
103  inline const tReal& getTimeStep() const {
104  return mTimeStep;
105  }
109  inline void setTargetTime(const tReal& t) {
110  mTargetTime=t;
112  }
113 
117  inline const tReal& getTargetTime() const {
118  return mTargetTime;
119  }
123  inline void setMaximumTimeStepsNumber( const tIndex& nSteps) {
126  }
130  inline const tIndex& getMaximumTimeStepsNumber() const {
132  }
133 
137  virtual tString toString() const override {
138  std::stringstream ret;
139  //print id
140  ret<<SM_Object::toString()<<"\n";
141  ret<<"dt:"<<mTimeStep<<"\n";
142  ret<<"T:"<<mTargetTime<<"\n";
143  ret<<"iterationsMax:"<<mMaximumTimeStepsNumber<<"\n";
144 
145  //return the value
146  return ret.str();
147 
148  }
149 
150 
151 
152 };
153 
154 
155 #endif
class Free introduced for deleting a smart pointer
Definition: CORE_Object.h:94
virtual tMemSize getContentsMemorySize() const
return nthe memory size of the included associations
Definition: CORE_Object.h:259
virtual tString toString() const
return the string representation of the object node
Definition: CORE_Object.h:314
This class is a base class for Stoch Microm package.
Definition: SM_Object.h:19
This class is describes a time stepper.
Definition: SM_TimeStepper.h:13
tReal mTimeStep
Definition: SM_TimeStepper.h:19
void copy(const SM_TimeStepper &T)
copy the time stepper
Definition: SM_TimeStepper.h:86
tIndex mMaximumTimeStepsNumber
Definition: SM_TimeStepper.h:25
static CORE_UniquePointer< SM_TimeStepper > New()
build a new instance of a TimeStepper
Definition: SM_TimeStepper.h:55
const tReal & getTimeStep() const
return the time step
Definition: SM_TimeStepper.h:103
void setMaximumTimeStepsNumber(const tIndex &nSteps)
set the maximum time steps number
Definition: SM_TimeStepper.h:123
void setTargetTime(const tReal &t)
set the target time
Definition: SM_TimeStepper.h:109
virtual tString toString() const override
turn the class into a string representation
Definition: SM_TimeStepper.h:137
const tIndex & getMaximumTimeStepsNumber() const
return the time steps number
Definition: SM_TimeStepper.h:130
virtual tMemSize getMemorySize() const
return the memory size of the class and the memory size of all its attributes/associations
Definition: SM_TimeStepper.h:75
SM_TimeStepper(void)
create a network class
Definition: SM_TimeStepper.h:35
tReal mTargetTime
Definition: SM_TimeStepper.h:22
const tReal & getTargetTime() const
return the target time
Definition: SM_TimeStepper.h:117
void setTimeStep(const tReal &dt)
set the time step
Definition: SM_TimeStepper.h:94
virtual ~SM_TimeStepper(void)
destroy
Definition: SM_TimeStepper.h:44
#define ASSERT_IN(a)
Definition: functions.h:601
typename std::unique_ptr< T, CORE_Object::Delete > CORE_UniquePointer
Definition: sp.h:8
#define tIndex
Definition: types.h:157
#define tString
Definition: types.h:147
#define tMemSize
Definition: types.h:166
#define tInteger
Definition: types.h:114
#define tReal
Definition: types.h:137