MBDyn-1.7.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
rtaisolver.h
Go to the documentation of this file.
1 /* $Header: /var/cvs/mbdyn/mbdyn/mbdyn-1.0/mbdyn/base/rtaisolver.h,v 1.13 2017/01/12 14:46:10 masarati Exp $ */
2 /*
3  * MBDyn (C) is a multibody analysis code.
4  * http://www.mbdyn.org
5  *
6  * Copyright (C) 1996-2017
7  *
8  * Pierangelo Masarati <masarati@aero.polimi.it>
9  * Paolo Mantegazza <mantegazza@aero.polimi.it>
10  *
11  * Dipartimento di Ingegneria Aerospaziale - Politecnico di Milano
12  * via La Masa, 34 - 20156 Milano, Italy
13  * http://www.aero.polimi.it
14  *
15  * Changing this copyright notice is forbidden.
16  *
17  * This program is free software; you can redistribute it and/or modify
18  * it under the terms of the GNU General Public License as published by
19  * the Free Software Foundation (version 2 of the License).
20  *
21  *
22  * This program is distributed in the hope that it will be useful,
23  * but WITHOUT ANY WARRANTY; without even the implied warranty of
24  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25  * GNU General Public License for more details.
26  *
27  * You should have received a copy of the GNU General Public License
28  * along with this program; if not, write to the Free Software
29  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30  */
31 
32 #ifndef RTAISOLVER_H
33 #define RTAISOLVER_H
34 
35 #include "rtsolver.h"
36 
37 /* RTAISolver - begin */
38 
39 class RTAISolver : public RTSolverBase {
40 private:
41  bool bRTHard;
42  bool bRTlog;
43  const std::string LogProcName;
44 
45  long long lRTPeriod;
46 
47  /* if eRTMode == MBRTAI_SEMAPHORE */
48  void *RTSemPtr_in;
49  void *RTSemPtr_out;
50 
51  void *mbxlog;
52  int RTStpFlag;
53  int t_tot;
54  long long t0, t1;
56 
57 public:
60  long long lRTPeriod,
61  unsigned long RTStackSize,
62  bool bRTAllowNonRoot,
63  int RTCpuMap,
64  bool bRTHard,
65  bool bRTlog,
66  const std::string& LogProcName);
67  ~RTAISolver(void);
68 
69  // write contribution to restart file
70  std::ostream& Restart(std::ostream& out) const;
71  // very first setup, to be always performed
72  void Setup(void);
73  // initialization to be performed only if real-time is requested
74  void Init(void);
75  // check whether stop is commanded by real-time
76  bool IsStopCommanded(void);
77  // to be performed when stop is commanded by someone else
78  void StopCommanded(void);
79  // write real-time related message when stop commanded by someone else
80  void Log(void);
81  // wait for period to expire
82  void Wait(void);
83 };
84 
85 /* RTAISolver - end */
86 
87 extern RTSolverBase *
89 
90 #endif // RTAISOLVER_H
91 
void * RTSemPtr_in
Definition: rtaisolver.h:48
~RTAISolver(void)
Definition: rtaisolver.cc:78
unsigned long RTStackSize
Definition: rtsolver.h:59
void Init(void)
Definition: rtaisolver.cc:148
void Wait(void)
Definition: rtaisolver.cc:337
void * mbxlog
Definition: rtaisolver.h:51
long long lRTPeriod
Definition: rtaisolver.h:45
void StopCommanded(void)
Definition: rtaisolver.cc:320
void Setup(void)
Definition: rtaisolver.cc:129
long long t0
Definition: rtaisolver.h:54
RTMode eRTMode
Definition: rtsolver.h:54
RTAISolver(Solver *pS, RTMode eRTMode, long long lRTPeriod, unsigned long RTStackSize, bool bRTAllowNonRoot, int RTCpuMap, bool bRTHard, bool bRTlog, const std::string &LogProcName)
Definition: rtaisolver.cc:50
RTSolverBase * ReadRTAISolver(Solver *pS, MBDynParser &HP)
Definition: rtaisolver.cc:377
bool bRTHard
Definition: rtaisolver.h:41
const std::string LogProcName
Definition: rtaisolver.h:43
Definition: solver.h:78
std::ostream & Restart(std::ostream &out) const
Definition: rtaisolver.cc:88
void * RTSemPtr_out
Definition: rtaisolver.h:49
int or_counter
Definition: rtaisolver.h:55
int RTCpuMap
Definition: rtsolver.h:61
Solver * pS
Definition: rtsolver.h:52
bool IsStopCommanded(void)
Definition: rtaisolver.cc:309
int RTStpFlag
Definition: rtaisolver.h:52
bool bRTlog
Definition: rtaisolver.h:42
void Log(void)
Definition: rtaisolver.cc:329
bool bRTAllowNonRoot
Definition: rtsolver.h:60
long long t1
Definition: rtaisolver.h:54