MBDyn-1.7.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
TimeStepControl.h
Go to the documentation of this file.
1 /*
2  * MBDyn (C) is a multibody analysis code.
3  * http://www.mbdyn.org
4  *
5  * Copyright (C) 1996-2017
6  *
7  * Pierangelo Masarati <masarati@aero.polimi.it>
8  * Paolo Mantegazza <mantegazza@aero.polimi.it>
9  *
10  * Dipartimento di Ingegneria Aerospaziale - Politecnico di Milano
11  * via La Masa, 34 - 20156 Milano, Italy
12  * http://www.aero.polimi.it
13  *
14  * Changing this copyright notice is forbidden.
15  *
16  * This program is free software; you can redistribute it and/or modify
17  * it under the terms of the GNU General Public License as published by
18  * the Free Software Foundation (version 2 of the License).
19  *
20  *
21  * This program is distributed in the hope that it will be useful,
22  * but WITHOUT ANY WARRANTY; without even the implied warranty of
23  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24  * GNU General Public License for more details.
25  *
26  * You should have received a copy of the GNU General Public License
27  * along with this program; if not, write to the Free Software
28  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
29  */
30 
31  /*
32  * With the contribution of Ankit Aggarwal <ankit.ankit.aggarwal@gmail.com>
33  * during Google Summer of Code 2016
34  */
35 
36 
37 #ifndef TIMESTEPCONTROL_H
38 #define TIMESTEPCONTROL_H
39 
40 #include "mbconfig.h"
41 
42 #include <map>
43 
44 class TimeStepControl;
45 #include "solver.h"
46 #include "drive_.h"
47 
48 extern void InitTimeStepData(void);
49 extern void DestroyTimeStepData(void);
50 
51 
53 protected:
55 
56 public:
57  TimeStepControl(void) { NO_OP; };
58  virtual ~TimeStepControl(void) { NO_OP; };
59  virtual doublereal dGetNewStepTime(StepIntegrator::StepChange currStep, doublereal iPerformedIters) = 0;
60  virtual void SetDriveHandler(const DriveHandler* driveHandler) = 0;
61  virtual void Init(integer iMaxIterations, doublereal dMinTimeStep, const DriveOwner& MaxTimeStep, doublereal dInitialTimeStep) = 0;
62 };
63 
65 
66 class TimeStepRead {
67 public:
68  virtual ~TimeStepRead(void) { NO_OP; };
69  virtual TimeStepControl *Read(Solver *s, MBDynParser& HP) = 0;
70 };
71 
72 class NoChange : public TimeStepControl {
73 private:
75 
76 public:
77  NoChange(Solver * s);
78  ~NoChange(void) { NO_OP; };
80  void SetDriveHandler(const DriveHandler* driveHandler) { NO_OP; };
81  void Init(integer iMaxIterations, doublereal dMinTimeStep, const DriveOwner& MaxTimeStep, doublereal dInitialTimeStep);
82 };
83 
84 class ChangeStep : public TimeStepControl {
85 private:
90 
91 public:
93  ~ChangeStep(void) {
95  };
96 
98  void SetDriveHandler(const DriveHandler* driveHandler);
99  void Init(integer iMaxIterations, doublereal dMinTimeStep, const DriveOwner& MaxTimeStep, doublereal dInitialTimeStep);
100 };
101 
102 class Factor : public TimeStepControl {
103 private:
117 
118 public:
119  Factor(Solver *s,
126  ~Factor(void) { NO_OP; };
128  void SetDriveHandler(const DriveHandler* driveHandler) { NO_OP; };
129  void Init(integer iMaxIterations, doublereal dMinTimeStep, const DriveOwner& MaxTimeStep, doublereal dInitialTimeStep);
130 };
131 
132 #endif // TIMESTEPCONTROL_H
void Init(integer iMaxIterations, doublereal dMinTimeStep, const DriveOwner &MaxTimeStep, doublereal dInitialTimeStep)
doublereal dGetNewStepTime(StepIntegrator::StepChange Why, doublereal iPerformedIters)
doublereal dReductionFactor
void Init(integer iMaxIterations, doublereal dMinTimeStep, const DriveOwner &MaxTimeStep, doublereal dInitialTimeStep)
doublereal iStepsAfterRaise
DriveOwner MaxTimeStep
Factor(Solver *s, doublereal dReductionFactor, doublereal iStepsBeforeReduction, doublereal dRaiseFactor, doublereal iStepsBeforeRaise, doublereal iMinIters, doublereal iMaxIters)
ChangeStep(Solver *s, DriveCaller *pStrategyChangeDrive)
virtual void SetDriveHandler(const DriveHandler *driveHandler)=0
doublereal iStepsAfterReduction
Solver * s
doublereal dMinTimeStep
#define NO_OP
Definition: myassert.h:74
Solver * s
virtual TimeStepControl * Read(Solver *s, MBDynParser &HP)=0
DriveCaller * pStrategyChangeDrive
bool bLastChance
void SetDriveHandler(const DriveHandler *driveHandler)
void SetDriveHandler(const DriveHandler *driveHandler)
void Init(integer iMaxIterations, doublereal dMinTimeStep, const DriveOwner &MaxTimeStep, doublereal dInitialTimeStep)
void DestroyTimeStepData(void)
doublereal iStepsBeforeReduction
NoChange(Solver *s)
virtual ~TimeStepRead(void)
~Factor(void)
TimeStepControl * ReadTimeStepData(Solver *s, MBDynParser &HP)
doublereal iMaxIters
doublereal dGetNewStepTime(StepIntegrator::StepChange currStep, doublereal iPerformedIters)
~NoChange(void)
doublereal dGetNewStepTime(StepIntegrator::StepChange currStep, doublereal iPerformedIters)
doublereal dMinTimeStep
virtual doublereal dGetNewStepTime(StepIntegrator::StepChange currStep, doublereal iPerformedIters)=0
doublereal dCurrTimeStep
Definition: solver.h:78
doublereal iWeightedPerformedIters
void InitTimeStepData(void)
DriveOwner MaxTimeStep
virtual ~TimeStepControl(void)
void SetDriveHandler(const DriveHandler *driveHandler)
Solver * s
doublereal iMinIters
virtual void Init(integer iMaxIterations, doublereal dMinTimeStep, const DriveOwner &MaxTimeStep, doublereal dInitialTimeStep)=0
doublereal dRaiseFactor
doublereal iStepsBeforeRaise
double doublereal
Definition: colamd.c:52
long int integer
Definition: colamd.c:51
~ChangeStep(void)
#define SAFEDELETE(pnt)
Definition: mynewmem.h:710