MBDyn-1.7.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
filedrv.h
Go to the documentation of this file.
1 /* $Header: /var/cvs/mbdyn/mbdyn/mbdyn-1.0/mbdyn/base/filedrv.h,v 1.33 2017/01/12 14:46:09 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 /* file driver */
33 
34 #ifndef FILEDRV_H
35 #define FILEDRV_H
36 
37 #include "mbdyn.h"
38 #include "drive.h"
39 
40 #define MBDYN_FILE_DRIVE_CHECK (-10101)
41 
42 /* FileDrive - begin */
43 
44 class FileDrive : public Drive {
45 protected:
46  std::string sFileName;
49 
50  /* NOTE: pdVal actually points to one doublereal *before* the actual array;
51  * use pdVal[base1idx] or pdVal[base0idx + 1]
52  */
53 
54 public:
55  FileDrive(unsigned int uL, const DriveHandler* pDH,
56  const std::string& s,
57  integer nd, const std::vector<doublereal>& v0);
58  virtual ~FileDrive(void);
59 
60  virtual Drive::Type GetDriveType(void) const;
61 
62  /* Scrive il contributo del DriveCaller al file di restart */
63  virtual std::ostream& Restart(std::ostream& out) const = 0;
64 
65  virtual inline integer iGetNumDrives(void) const;
66 
67  virtual doublereal dGet(const doublereal& t, int i = 1) const;
68 };
69 
70 
71 inline integer
73 {
74  return iNumDrives;
75 }
76 
77 /* FileDrive - end */
78 
79 
80 /* FileDriveCaller - begin */
81 
82 class FileDriveCaller : public DriveCaller {
83 protected:
87 
88 public:
89  FileDriveCaller(const DriveHandler* pDH, const FileDrive* p,
90  integer i, const doublereal& da);
91  virtual ~FileDriveCaller(void);
92 
93  /* Copia */
94  virtual DriveCaller* pCopy(void) const;
95 
96  /* Scrive il contributo del DriveCaller al file di restart */
97  virtual std::ostream& Restart(std::ostream& out) const;
98 
99  /* Restituisce il valore del driver */
100  virtual inline doublereal dGet(const doublereal& dVal) const;
101  /* virtual inline doublereal dGet(void) const; */
102 };
103 
104 
105 inline doublereal
107 {
108  return dAmplitude*pFileDrive->dGet(dVal, iNumDrive);
109 }
110 
111 /* FileDriveCaller - end */
112 
113 class DataManager;
114 class MBDynParser;
115 
117  MBDynParser& HP, unsigned int uLabel);
118 
119 #endif /* FILEDRV_H */
120 
virtual Drive::Type GetDriveType(void) const
Definition: filedrv.cc:82
virtual std::ostream & Restart(std::ostream &out) const =0
Definition: drive.h:89
std::string sFileName
Definition: filedrv.h:46
Type
Definition: drive.h:92
virtual std::ostream & Restart(std::ostream &out) const
Definition: filedrv.cc:129
FileDrive(unsigned int uL, const DriveHandler *pDH, const std::string &s, integer nd, const std::vector< doublereal > &v0)
Definition: filedrv.cc:52
integer iNumDrives
Definition: filedrv.h:47
doublereal * pdVal
Definition: filedrv.h:48
doublereal dAmplitude
Definition: filedrv.h:86
virtual DriveCaller * pCopy(void) const
Definition: filedrv.cc:115
virtual doublereal dGet(const doublereal &t, int i=1) const
Definition: filedrv.cc:88
DataManager * pDM
Definition: mbpar.h:252
virtual ~FileDriveCaller(void)
Definition: filedrv.cc:109
virtual integer iGetNumDrives(void) const
Definition: filedrv.h:72
FileDriveCaller(const DriveHandler *pDH, const FileDrive *p, integer i, const doublereal &da)
Definition: filedrv.cc:99
virtual doublereal dGet(void) const
Definition: drive.h:489
const FileDrive * pFileDrive
Definition: filedrv.h:84
integer iNumDrive
Definition: filedrv.h:85
virtual ~FileDrive(void)
Definition: filedrv.cc:73
static const std::vector< doublereal > v0
Definition: fixedstep.cc:45
double doublereal
Definition: colamd.c:52
Drive * ReadFileDriver(DataManager *pDM, MBDynParser &HP, unsigned int uLabel)
long int integer
Definition: colamd.c:51