MBDyn-1.7.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
userelem.h
Go to the documentation of this file.
1 /* $Header: /var/cvs/mbdyn/mbdyn/mbdyn-1.0/mbdyn/base/userelem.h,v 1.8 2017/01/12 14:46:11 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 USERELEM_H
33 #define USERELEM_H
34 
35 #include "elem.h"
36 #include "dataman.h"
37 #include "gravity.h"
38 #include "aerodyn.h"
39 
40 // base class for user-defined elements
42  virtual public Elem,
43  public InitialAssemblyElem,
44  public AerodynamicElem,
45  public ElemGravityOwner
46 {
47 protected:
49 
50 public:
51  UserDefinedElem(unsigned uLabel, const DofOwner* pDO);
52  virtual ~UserDefinedElem(void);
53 
54  bool NeedsAirProperties(void) const;
55  void NeedsAirProperties(bool yesno);
56 
57  virtual Elem::Type GetElemType(void) const;
59 };
60 
61 class MBDynParser;
62 class DataManager;
63 
64 // base class for user-defined element parsing
66  virtual ~UserDefinedElemRead( void ) { NO_OP; };
67  virtual UserDefinedElem *
68  Read(unsigned uLabel, const DofOwner* pDO,
69  DataManager* const pDM, MBDynParser& HP) const = 0;
70 };
71 
72 // base class for user-defined element parsing
73 template <class UDE>
74 struct UDERead : public UserDefinedElemRead {
75  virtual ~UDERead( void ) { NO_OP; };
76  virtual UserDefinedElem *
77  Read(unsigned uLabel, const DofOwner* pDO,
78  DataManager* const pDM, MBDynParser& HP) const;
79 };
80 
81 template <class UDE>
83 UDERead<UDE>::Read(unsigned uLabel, const DofOwner* pDO,
84  DataManager* const pDM, MBDynParser& HP) const
85 {
86  return new UDE(uLabel, pDO, pDM, HP);
87 }
88 
89 // "public"
90 extern bool
91 SetUDE(const std::string &s, UserDefinedElemRead *rude);
92 
93 // "private"
94 extern void InitUDE(void);
95 extern void DestroyUDE(void);
96 extern UserDefinedElem *
97 ParseUserDefinedElem(unsigned uLabel, DofOwner* pDO,
98  DataManager* const pDM, MBDynParser& HP);
99 
100 #endif // USERELEM_H
101 
void DestroyUDE(void)
Definition: userelem.cc:134
bool SetUDE(const std::string &s, UserDefinedElemRead *rude)
Definition: userelem.cc:97
#define NO_OP
Definition: myassert.h:74
virtual ~UDERead(void)
Definition: userelem.h:75
void InitUDE(void)
Definition: userelem.cc:107
virtual UserDefinedElem * Read(unsigned uLabel, const DofOwner *pDO, DataManager *const pDM, MBDynParser &HP) const =0
virtual ~UserDefinedElem(void)
Definition: userelem.cc:162
unsigned int uLabel
Definition: withlab.h:44
bool NeedsAirProperties(void) const
Definition: userelem.cc:168
virtual ~UserDefinedElemRead(void)
Definition: userelem.h:66
Definition: elem.h:75
Type
Definition: elem.h:91
UserDefinedElem(unsigned uLabel, const DofOwner *pDO)
Definition: userelem.cc:152
UserDefinedElem * ParseUserDefinedElem(unsigned uLabel, DofOwner *pDO, DataManager *const pDM, MBDynParser &HP)
Definition: userelem.cc:61
virtual UserDefinedElem * Read(unsigned uLabel, const DofOwner *pDO, DataManager *const pDM, MBDynParser &HP) const
Definition: userelem.h:83
virtual AerodynamicElem::Type GetAerodynamicElemType(void) const
Definition: userelem.cc:186
bool needsAirProperties
Definition: userelem.h:48
virtual Elem::Type GetElemType(void) const
Definition: userelem.cc:180