MBDyn-1.7.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
hint_impl.h
Go to the documentation of this file.
1 /* $Header: /var/cvs/mbdyn/mbdyn/mbdyn-1.0/mbdyn/base/hint_impl.h,v 1.21 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 #ifndef HINT_IMPL_H
33 #define HINT_IMPL_H
34 
35 /* include del programma */
36 #include <sstream>
37 #include "dataman.h"
38 #include "tpldrive_impl.h"
39 
40 extern Hint *
41 ParseHint(DataManager *pDM, const char *s);
42 
43 class ParsableHint : public Hint {
44 protected:
45  char *sHint;
46 
47 public:
48  ParsableHint(const char *s);
49  virtual ~ParsableHint(void);
50 };
51 
52 class DriveHint : public ParsableHint {
53 public:
54  DriveHint(const char *s);
55  virtual ~DriveHint(void);
56 
58 };
59 
60 template <class T>
61 class TplVecHint : public ParsableHint {
62 public:
63  TplVecHint(const char *s);
64  virtual ~TplVecHint(void);
65 
66  T pCreateVec(DataManager *pDM) const;
67 };
68 
69 template <class T>
71 : ParsableHint(s)
72 {
73  NO_OP;
74 }
75 
76 template <class T>
78 {
79  NO_OP;
80 }
81 
82 template <class T>
83 T
85 {
86  std::istringstream in(sHint);
87  InputStream In(in);
88 
89  MBDynParser HP(pDM->GetMathParser(), In, "TplVecHint::pCreateVec");
90  HP.ExpectArg();
91 
92  T vec(mb_zero<T>());
93  HP.Get(vec);
94 
95  return vec;
96 }
97 
100 
101 template <class T>
102 class TplDriveHint : public DriveHint {
103 public:
104  TplDriveHint(const char *s);
105  virtual ~TplDriveHint(void);
107 };
108 
109 template <class T>
111 : DriveHint(s)
112 {
113  NO_OP;
114 }
115 
116 template <class T>
118 {
119  NO_OP;
120 }
121 
122 template <class T>
125 {
126  std::istringstream in(sHint);
127  InputStream In(in);
128 
129  MBDynParser HP(pDM->GetMathParser(), In, "TplDriveHint::pCreateDrive");
130  HP.ExpectArg();
131  HP.SetDataManager(pDM);
132 
133  return HP.GetTplDriveCaller<T>();
134 }
135 
138 
139 #endif /* HINT_IMPL_H */
140 
Definition: hint.h:38
TplDriveHint< Vec6 > TplDriveHint6
Definition: hint_impl.h:137
virtual void ExpectArg(void)
Definition: parser.cc:798
MathParser & GetMathParser(void) const
Definition: dataman.h:341
virtual ~TplVecHint(void)
Definition: hint_impl.h:77
ParsableHint(const char *s)
Definition: hint_impl.cc:90
TplDriveHint(const char *s)
Definition: hint_impl.h:110
#define NO_OP
Definition: myassert.h:74
TplVecHint< Vec3 > TplVecHint3
Definition: hint_impl.h:98
TplDriveHint< Vec3 > TplDriveHint3
Definition: hint_impl.h:136
virtual ~TplDriveHint(void)
Definition: hint_impl.h:117
virtual ~ParsableHint(void)
Definition: hint_impl.cc:96
DriveCaller * pCreateDrive(DataManager *pDM) const
Definition: hint_impl.cc:117
TplDriveCaller< T > * pCreateDrive(DataManager *pDM) const
Definition: hint_impl.h:124
DriveHint(const char *s)
Definition: hint_impl.cc:105
char * sHint
Definition: hint_impl.h:45
virtual ~DriveHint(void)
Definition: hint_impl.cc:111
T pCreateVec(DataManager *pDM) const
Definition: hint_impl.h:84
TplVecHint(const char *s)
Definition: hint_impl.h:70
Hint * ParseHint(DataManager *pDM, const char *s)
Definition: hint_impl.cc:37
TplVecHint< Vec6 > TplVecHint6
Definition: hint_impl.h:99