MBDyn-1.7.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
modalext.h
Go to the documentation of this file.
1 /* $Header: /var/cvs/mbdyn/mbdyn/mbdyn-1.0/mbdyn/struct/modalext.h,v 1.29 2017/01/12 14:46:43 masarati Exp $ */
2 /*
3  * MBDyn (C) is a multibody analysis code.
4  * http://www.mbdyn.org
5  *
6  * Copyright (C) 2007-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 /* Forza */
33 
34 #ifndef MODALEXT_H
35 #define MODALEXT_H
36 
37 #include <vector>
38 #include <string>
39 
40 #include "extforce.h"
41 #include "modal.h"
42 
43 /* ExtModalForceBase - begin */
44 
46 public:
47  enum BitMask {
48  EMF_NONE = 0x0U,
49  EMF_RIGID = 0x1U,
50  EMF_MODAL = 0x2U,
52 
55 
58 
60 
61  EMF_ERR = 0x10000000U
62  };
63 
64  virtual ~ExtModalForceBase(void);
65 
66  virtual bool
67  Prepare(ExtFileHandlerBase *pEFH, unsigned uLabel, bool bRigid, unsigned uModes) = 0;
68 
69  /*
70  * Interface:
71  * f force oriented wrt/ the global reference frame
72  * m moment oriented wrt/ the global reference frame,
73  * the pole is the node
74  *
75  * fv modal forces
76  */
77  virtual unsigned
78  Recv(ExtFileHandlerBase *pEFH, unsigned uFlags, unsigned& uLabel,
79  Vec3& f, Vec3& m, std::vector<doublereal>& fv) = 0;
80 
81  /*
82  * Interface:
83  * x position of node wrt/ the global reference frame
84  * R orientation of node wrt/ the global reference frame
85  * v velocity of node wrt/ the global reference frame
86  * w angular velocity of node wrt/ the global reference frame
87  *
88  * q modal coordinates
89  * qP derivatives of modal coordinates
90  */
91  virtual void
92  Send(ExtFileHandlerBase *pEFH, unsigned uFlags, unsigned uLabel,
93  const Vec3& x, const Mat3x3& R, const Vec3& v, const Vec3& w,
94  const std::vector<doublereal>& q,
95  const std::vector<doublereal>& qP) = 0;
96 };
97 
98 /* ExtModalForceBase - end */
99 
100 /* ExtModalForce - begin */
101 
103 public:
104  ExtModalForce(void);
105  virtual ~ExtModalForce(void);
106 
107  virtual bool
108  Prepare(ExtFileHandlerBase *pEFH, unsigned uLabel, bool bRigid, unsigned uModes);
109 
110  virtual unsigned
111  Recv(ExtFileHandlerBase *pEFH, unsigned uFlags, unsigned& uLabel,
112  Vec3& f, Vec3& m, std::vector<doublereal>& fv);
113 
114  virtual void
115  Send(ExtFileHandlerBase *pEFH, unsigned uFlags, unsigned uLabel,
116  const Vec3& x, const Mat3x3& R, const Vec3& v, const Vec3& w,
117  const std::vector<doublereal>& q,
118  const std::vector<doublereal>& qP);
119 
120 protected:
121  virtual unsigned
122  RecvFromStream(std::istream& inf, unsigned uFlags, unsigned& uLabel,
123  Vec3& f, Vec3& m, std::vector<doublereal>& fv);
124  virtual unsigned
125  RecvFromFileDes(int infd, int recv_flags, unsigned uFlags, unsigned& uLabel,
126  Vec3& f, Vec3& m, std::vector<doublereal>& fv);
127 
128  virtual void
129  SendToStream(std::ostream& outf, unsigned uFlags, unsigned uLabel,
130  const Vec3& x, const Mat3x3& R, const Vec3& v, const Vec3& w,
131  const std::vector<doublereal>& q,
132  const std::vector<doublereal>& qP);
133  virtual void
134  SendToFileDes(int outfd, int send_flags, unsigned uFlags, unsigned uLabel,
135  const Vec3& x, const Mat3x3& R, const Vec3& v, const Vec3& w,
136  const std::vector<doublereal>& q,
137  const std::vector<doublereal>& qP);
138 };
139 
140 /* ExtModalForce - end */
141 
142 /* ModalExt - begin */
143 
144 class ModalExt : virtual public Elem, public ExtForce {
145 protected:
146  const Modal *pModal;
147  // if pModal != 0 then pNode == pModal->pGetModalNode()
151  unsigned uFlags;
152 
153  Vec3 F, M;
154  std::vector<doublereal> f;
155 
156  // Temporary?
157  std::vector<doublereal> q;
158  std::vector<doublereal> qP;
159 
163 
164 public:
165  /* Costruttore */
166  ModalExt(unsigned int uL,
167  DataManager *pDM,
168  const Modal *pmodal,
169  const StructNode *pnode,
173  bool bSendAfterPredict,
174  int iCoupling,
176  flag fOut);
177 
178  virtual ~ModalExt(void);
179 
180  /* Tipo di forza */
181  virtual Force::Type GetForceType(void) const;
182 
183  void WorkSpaceDim(integer* piNumRows, integer* piNumCols) const;
184 
186  doublereal dCoef,
187  const VectorHandler& XCurr,
188  const VectorHandler& XPrimeCurr);
189 
190  virtual void Output(OutputHandler& OH) const;
191 
192  /* *******PER IL SOLUTORE PARALLELO******** */
193  /* Fornisce il tipo e la label dei nodi che sono connessi all'elemento
194  * utile per l'assemblaggio della matrice di connessione fra i dofs */
195  virtual void
196  GetConnectedNodes(std::vector<const Node *>& connectedNodes) const;
197  /* ************************************************ */
198 };
199 
200 /* ModalExt - end */
201 
202 class DataManager;
203 class MBDynParser;
204 
205 extern Elem*
207  MBDynParser& HP,
208  unsigned int uLabel);
209 
210 #endif /* MODALEXT_H */
211 
std::vector< doublereal > f
Definition: modalext.h:154
const Modal * pModal
Definition: modalext.h:146
ModalExt(unsigned int uL, DataManager *pDM, const Modal *pmodal, const StructNode *pnode, bool bOutputAccelerations, ExtFileHandlerBase *pEFH, ExtModalForceBase *pEMF, bool bSendAfterPredict, int iCoupling, ExtModalForceBase::BitMask bm, flag fOut)
Definition: modalext.cc:333
virtual ~ExtModalForce(void)
Definition: modalext.cc:58
virtual void Send(ExtFileHandlerBase *pEFH, unsigned uFlags, unsigned uLabel, const Vec3 &x, const Mat3x3 &R, const Vec3 &v, const Vec3 &w, const std::vector< doublereal > &q, const std::vector< doublereal > &qP)
Definition: modalext.cc:208
long int flag
Definition: mbdyn.h:43
Vec3 M
Definition: modalext.h:153
Definition: matvec3.h:98
void Recv(void)
Definition: extforce.cc:798
Type
Definition: force.h:50
bool bSendAfterPredict
Definition: extforce.h:196
virtual ~ExtModalForceBase(void)
Definition: modalext.cc:44
virtual void SendToFileDes(int outfd, int send_flags, unsigned uFlags, unsigned uLabel, const Vec3 &x, const Mat3x3 &R, const Vec3 &v, const Vec3 &w, const std::vector< doublereal > &q, const std::vector< doublereal > &qP)
Definition: modalext.cc:305
SubVectorHandler & AssRes(SubVectorHandler &WorkVec, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
Definition: modalext.cc:507
virtual bool Prepare(ExtFileHandlerBase *pEFH, unsigned uLabel, bool bRigid, unsigned uModes)=0
bool Prepare(ExtFileHandlerBase *pEFH)
Definition: modalext.cc:390
virtual void Output(OutputHandler &OH) const
Definition: modalext.cc:550
Elem * ReadModalExtForce(DataManager *pDM, MBDynParser &HP, unsigned int uLabel)
Definition: modalext.cc:589
virtual void GetConnectedNodes(std::vector< const Node * > &connectedNodes) const
Definition: modalext.cc:578
std::vector< doublereal > qP
Definition: modalext.h:158
virtual bool Prepare(ExtFileHandlerBase *pEFH, unsigned uLabel, bool bRigid, unsigned uModes)
Definition: modalext.cc:64
Definition: modal.h:74
ExtModalForce(void)
Definition: modalext.cc:53
Vec3 F
Definition: modalext.h:153
virtual unsigned RecvFromStream(std::istream &inf, unsigned uFlags, unsigned &uLabel, Vec3 &f, Vec3 &m, std::vector< doublereal > &fv)
Definition: modalext.cc:224
const StructNode * pNode
Definition: modalext.h:148
virtual unsigned RecvFromFileDes(int infd, int recv_flags, unsigned uFlags, unsigned &uLabel, Vec3 &f, Vec3 &m, std::vector< doublereal > &fv)
Definition: modalext.cc:248
virtual void SendToStream(std::ostream &outf, unsigned uFlags, unsigned uLabel, const Vec3 &x, const Mat3x3 &R, const Vec3 &v, const Vec3 &w, const std::vector< doublereal > &q, const std::vector< doublereal > &qP)
Definition: modalext.cc:284
DataManager * pDM
Definition: mbpar.h:252
ExtFileHandlerBase * pEFH
Definition: extforce.h:193
virtual unsigned Recv(ExtFileHandlerBase *pEFH, unsigned uFlags, unsigned &uLabel, Vec3 &f, Vec3 &m, std::vector< doublereal > &fv)
Definition: modalext.cc:194
virtual ~ModalExt(void)
Definition: modalext.cc:382
virtual unsigned Recv(ExtFileHandlerBase *pEFH, unsigned uFlags, unsigned &uLabel, Vec3 &f, Vec3 &m, std::vector< doublereal > &fv)=0
unsigned uFlags
Definition: modalext.h:151
bool bOutputAccelerations
Definition: modalext.h:149
void Send(ExtFileHandlerBase *pEFH, ExtFileHandlerBase::SendWhen when)
Definition: modalext.cc:401
ExtModalForceBase * pEMF
Definition: modalext.h:150
Definition: elem.h:75
virtual Force::Type GetForceType(void) const
Definition: modalext.cc:488
double doublereal
Definition: colamd.c:52
int iCoupling
Definition: extforce.h:212
long int integer
Definition: colamd.c:51
void WorkSpaceDim(integer *piNumRows, integer *piNumCols) const
Definition: modalext.cc:494
std::vector< doublereal > q
Definition: modalext.h:157
virtual void Send(ExtFileHandlerBase *pEFH, unsigned uFlags, unsigned uLabel, const Vec3 &x, const Mat3x3 &R, const Vec3 &v, const Vec3 &w, const std::vector< doublereal > &q, const std::vector< doublereal > &qP)=0
Mat3x3 R