MBDyn-1.7.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
modalext.cc
Go to the documentation of this file.
1 /* $Header: /var/cvs/mbdyn/mbdyn/mbdyn-1.0/mbdyn/struct/modalext.cc,v 1.44 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 #include "mbconfig.h" /* This goes first in every *.c,*.cc file */
33 
34 #include "dataman.h"
35 #include "extedge.h"
36 #include "modalext.h"
37 #include "modaledge.h"
38 
39 #include <fstream>
40 #include <cerrno>
41 
42 /* ExtModalForceBase - begin */
43 
45 {
46  NO_OP;
47 }
48 
49 /* ExtModalForceBase - end */
50 
51 /* ExtModalForce - begin */
52 
54 {
55  NO_OP;
56 }
57 
59 {
60  NO_OP;
61 }
62 
63 bool
64 ExtModalForce::Prepare(ExtFileHandlerBase *pEFH, unsigned uLabel, bool bRigid, unsigned uModes)
65 {
66  bool bResult = true;
67 
68  switch (pEFH->NegotiateRequest()) {
70  break;
71 
73  std::ostream *outfp = pEFH->GetOutStream();
74  if (outfp) {
75  *outfp << MBC_MODAL
76  << ' ' << bRigid
77  << ' ' << uModes
78  << std::endl;
79 
80 #ifdef USE_SOCKET
81  } else {
82  char buf[sizeof(uint32_t) + sizeof(uint32_t)];
83  uint32_t *uint32_ptr;
84 
85  uint32_ptr = (uint32_t *)&buf[0];
86  uint32_ptr[0] = MBC_MODAL;
87  if (bRigid) {
88  uint32_ptr[0] |= MBC_REF_NODE;
89  }
90 
91  uint32_ptr[1] = uModes;
92 
93  ssize_t rc = send(pEFH->GetOutFileDes(),
94  (const void *)buf, sizeof(buf),
95  pEFH->GetSendFlags());
96  if (rc == -1) {
97  int save_errno = errno;
98  char *err_msg = strerror(save_errno);
99  silent_cerr("ExtModalForce(" << uLabel << "): "
100  "negotiation request send() failed "
101  "(" << save_errno << ": " << err_msg << ")"
102  << std::endl);
104 
105  } else if (rc != sizeof(buf)) {
106  silent_cerr("ExtModalForce(" << uLabel << "): "
107  "negotiation request send() failed "
108  "(sent " << rc << " of " << sizeof(buf) << " bytes)"
109  << std::endl);
111  }
112 #endif // USE_SOCKET
113  }
114  } break;
115 
117  unsigned type;
118  bool bR;
119  unsigned uM;
120 
121  std::istream *infp = pEFH->GetInStream();
122  if (infp) {
123  *infp >> type >> bR >> uM;
124  if (type != MBC_MODAL) {
125  return false;
126  }
127 
128 #ifdef USE_SOCKET
129  } else {
130  char buf[sizeof(uint32_t) + sizeof(uint32_t)];
131  uint32_t *uint32_ptr;
132 
133  ssize_t rc = recv(pEFH->GetInFileDes(),
134  (void *)buf, sizeof(buf),
135  pEFH->GetRecvFlags());
136  if (rc == -1) {
137  int save_errno = errno;
138  char *err_msg = strerror(save_errno);
139  silent_cerr("ExtModalForce(" << uLabel << "): "
140  "negotiation response recv() failed "
141  "(" << save_errno << ": " << err_msg << ")"
142  << std::endl);
144 
145  } else if (rc != sizeof(buf)) {
146  silent_cerr("ExtModalForce(" << uLabel << "): "
147  "negotiation response recv() failed "
148  "(got " << rc << " of " << sizeof(buf) << " bytes)"
149  << std::endl);
151  }
152 
153  uint32_ptr = (uint32_t *)&buf[0];
154  type = (uint32_ptr[0] & MBC_MODAL_NODAL_MASK);
155  bR = (uint32_ptr[0] & MBC_REF_NODE);
156 
157  uM = uint32_ptr[1];
158 #endif // USE_SOCKET
159  }
160 
161  if (type != MBC_MODAL) {
162  silent_cerr("ExtModalForce(" << uLabel << "): "
163  "negotiation response failed: expecting MBC_MODAL "
164  "(=" << MBC_MODAL << "), got " << type
165  << std::endl);
166  bResult = false;
167  }
168 
169  if ((bRigid && !bR) || (!bRigid && bR)) {
170  silent_cerr("ExtModalForce(" << uLabel << "): "
171  "negotiation response failed: reference node configuration mismatch "
172  "(local=" << (bRigid ? "yes" : "no") << ", remote=" << (bR ? "yes" : "no") << ")"
173  << std::endl);
174  bResult = false;
175  }
176 
177  if (uM != uModes) {
178  silent_cerr("ExtModalForce(" << uLabel << "): "
179  "negotiation response failed: mode number mismatch "
180  "(local=" << uModes << ", remote=" << uM << ")"
181  << std::endl);
182  bResult = false;
183  }
184  } break;
185 
186  default:
188  }
189 
190  return bResult;
191 }
192 
193 unsigned
194 ExtModalForce::Recv(ExtFileHandlerBase *pEFH, unsigned uFlags, unsigned& uLabel,
195  Vec3& f, Vec3& m, std::vector<doublereal>& fv)
196 {
197  std::istream *infp = pEFH->GetInStream();
198  if (infp) {
199  return RecvFromStream(*infp, uFlags, uLabel, f, m, fv);
200 
201  } else {
202  return RecvFromFileDes(pEFH->GetInFileDes(), pEFH->GetRecvFlags(),
203  uFlags, uLabel, f, m, fv);
204  }
205 }
206 
207 void
208 ExtModalForce::Send(ExtFileHandlerBase *pEFH, unsigned uFlags, unsigned uLabel,
209  const Vec3& x, const Mat3x3& R, const Vec3& v, const Vec3& w,
210  const std::vector<doublereal>& q,
211  const std::vector<doublereal>& qP)
212 {
213  std::ostream *outfp = pEFH->GetOutStream();
214  if (outfp) {
215  return SendToStream(*outfp, uFlags, uLabel, x, R, v, w, q, qP);
216 
217  } else {
218  return SendToFileDes(pEFH->GetOutFileDes(), pEFH->GetSendFlags(),
219  uFlags, uLabel, x, R, v, w, q, qP);
220  }
221 }
222 
223 unsigned
224 ExtModalForce::RecvFromStream(std::istream& inf, unsigned uFlags, unsigned& uLabel,
225  Vec3& f, Vec3& m, std::vector<doublereal>& fv)
226 {
227  if ((uFlags & ExtModalForceBase::EMF_RIGID)) {
228  doublereal df[3], dm[3];
229  inf
230  >> df[0] >> df[1] >> df[2]
231  >> dm[0] >> dm[1] >> dm[2];
232  f = Vec3(df);
233  m = Vec3(dm);
234  }
235 
236  if ((uFlags & ExtModalForceBase::EMF_MODAL)) {
237  for (std::vector<doublereal>::iterator i = fv.begin(); i != fv.end(); ++i) {
238  doublereal d;
239  inf >> d;
240  *i = d;
241  }
242  }
243 
244  return uFlags;
245 }
246 
247 unsigned
248 ExtModalForce::RecvFromFileDes(int infd, int recv_flags,
249  unsigned uFlags, unsigned& uLabel,
250  Vec3& f, Vec3& m, std::vector<doublereal>& fv)
251 {
252 #ifdef USE_SOCKET
253  ssize_t rc;
254  size_t size;
255 
256  if ((uFlags & ExtModalForceBase::EMF_RIGID)) {
257  size = 3*sizeof(doublereal);
258 
259  rc = recv(infd, (void *)f.pGetVec(), size, recv_flags);
260  if (rc != (ssize_t)size) {
261  // error
262  }
263  rc = recv(infd, (void *)m.pGetVec(), size, recv_flags);
264  if (rc != (ssize_t)size) {
265  // error
266  }
267  }
268 
269  if ((uFlags & ExtModalForceBase::EMF_MODAL)) {
270  size = fv.size()*sizeof(doublereal);
271  rc = recv(infd, (void *)&fv[0], size, recv_flags);
272  if (rc != (ssize_t)size) {
273  // error
274  }
275  }
276 
277  return uFlags;
278 #else // ! USE_SOCKET
280 #endif // ! USE_SOCKET
281 }
282 
283 void
284 ExtModalForce::SendToStream(std::ostream& outf, unsigned uFlags, unsigned uLabel,
285  const Vec3& x, const Mat3x3& R, const Vec3& v, const Vec3& w,
286  const std::vector<doublereal>& q,
287  const std::vector<doublereal>& qP)
288 {
289  if ((uFlags & ExtModalForceBase::EMF_RIGID)) {
290  outf
291  << x << std::endl
292  << R << std::endl
293  << v << std::endl
294  << w << std::endl;
295  }
296 
297  if ((uFlags & ExtModalForceBase::EMF_MODAL)) {
298  for (unsigned i = 0; i < q.size(); i++) {
299  outf << q[i] << " " << qP[i] << std::endl;
300  }
301  }
302 }
303 
304 void
305 ExtModalForce::SendToFileDes(int outfd, int send_flags,
306  unsigned uFlags, unsigned uLabel,
307  const Vec3& x, const Mat3x3& R, const Vec3& v, const Vec3& w,
308  const std::vector<doublereal>& q,
309  const std::vector<doublereal>& qP)
310 {
311 #ifdef USE_SOCKET
312  if ((uFlags & ExtModalForceBase::EMF_RIGID)) {
313  send(outfd, (const void *)x.pGetVec(), 3*sizeof(doublereal), send_flags);
314  send(outfd, (const void *)R.pGetMat(), 9*sizeof(doublereal), send_flags);
315  send(outfd, (const void *)v.pGetVec(), 3*sizeof(doublereal), send_flags);
316  send(outfd, (const void *)w.pGetVec(), 3*sizeof(doublereal), send_flags);
317  }
318 
319  if ((uFlags & ExtModalForceBase::EMF_MODAL)) {
320  send(outfd, (const void *)&q[0], q.size()*sizeof(doublereal), send_flags);
321  send(outfd, (const void *)&qP[0], qP.size()*sizeof(doublereal), send_flags);
322  }
323 #else // ! USE_SOCKET
325 #endif // ! USE_SOCKET
326 }
327 
328 /* ExtModalForce - end */
329 
330 /* ModalExt - begin */
331 
332 /* Costruttore */
333 ModalExt::ModalExt(unsigned int uL,
334  DataManager *pDM,
335  const Modal *pmodal,
336  const StructNode *pnode,
337  bool bOutputAccelerations,
338  ExtFileHandlerBase *pEFH,
339  ExtModalForceBase* pEMF,
340  bool bSendAfterPredict,
341  int iCoupling,
343  flag fOut)
344 : Elem(uL, fOut),
345 ExtForce(uL, pDM, pEFH, bSendAfterPredict, iCoupling, fOut),
346 pModal(pmodal),
347 pNode(pnode),
348 bOutputAccelerations(bOutputAccelerations),
349 pEMF(pEMF),
350 uFlags(ExtModalForceBase::EMF_NONE),
351 F(Zero3),
352 M(Zero3)
353 {
354  ASSERT((pModal != 0) || (pNode != 0));
355  ASSERT(pEMF != 0);
356 
357  ASSERT((bm & ExtModalForceBase::EMF_ALL) != 0);
358  ASSERT((bm & ~ExtModalForceBase::EMF_ALL) == 0);
359 
360  if (bm & ExtModalForceBase::EMF_MODAL) {
361  f.resize(pModal->uGetNModes());
362 
363  // Temporary?
364  q.resize(pModal->uGetNModes());
365  qP.resize(pModal->uGetNModes());
366 
367  ASSERT(pModal->uGetNModes() > 0);
369 
370  } else {
371  f.resize(0);
372  q.resize(0);
373  qP.resize(0);
374  }
375 
376  if (bm & ExtModalForceBase::EMF_RIGID) {
377  ASSERT(pNode != 0);
379  }
380 }
381 
383 {
384  if (pEMF) {
385  SAFEDELETE(pEMF);
386  }
387 }
388 
389 bool
391 {
392  return pEMF->Prepare(pEFH, GetLabel(),
394  pModal ? pModal->uGetNModes() : 0);
395 }
396 
397 /*
398  * Send output to companion software
399  */
400 void
402 {
403  Vec3 x;
404  Mat3x3 R;
405  Vec3 v;
406  Vec3 w;
407 
409  x = pNode->GetXCurr();
410  R = pNode->GetRCurr();
411  v = pNode->GetVCurr();
412  w = pNode->GetWCurr();
413 
414  } else {
415  x = Zero3;
416  R = Eye3;
417  v = Zero3;
418  w = Zero3;
419  }
420 
421  // Temporary?
423  const VecN& a = pModal->GetA();
424  const VecN& b = pModal->GetB();
425  for (unsigned i = 0; i < q.size(); i++) {
426  q[i] = a(i + 1);
427  qP[i] = b(i + 1);
428  }
429  }
430 
431  pEMF->Send(pEFH, uFlags, GetLabel(), x, R, v, w, q, qP);
432 
433 #if 0
434  if (uFlags & ExtModalForceBase::EMF_RIGID) {
435  const StructNode *pNode = pModal->pGetModalNode();
436 
437  Mat3x3 RT = pNode->GetRCurr().Transpose();
438  outf << pNode->GetLabel()
439  << " " << pNode->GetXCurr()
440  << " " << pNode->GetRCurr()
441  << " " << RT*pNode->GetVCurr()
442  << " " << RT*pNode->GetWCurr();
443  if (bOutputAccelerations) {
444  outf
445  << " " << pNode->GetXPPCurr()
446  << " " << pNode->GetWPCurr();
447  }
448  outf << std::endl;
449  }
450 
451  if (uFlags & ExtModalForceBase::EMF_MODAL) {
452  const VecN& a = pModal->GetA();
453  const VecN& b = pModal->GetB();
454  const VecN& bP = pModal->GetBP();
455  for (integer i = 1; i < pModal->uGetNModes(); i++) {
456  outf << a(i) << " " << b(i);
457  if (bOutputAccelerations) {
458  outf << " " << bP(i);
459  }
460  outf << std::endl;
461  }
462  }
463 #endif
464 }
465 
466 void
468 {
469  unsigned uLabel = 0;
470  unsigned uOutFlags = pEMF->Recv(pEFH, uFlags, uLabel, F, M, f);
471 
472  if (uOutFlags & ExtModalForceBase::EMF_ERR) {
473  silent_cerr("ModalExt(" << GetLabel() << "): "
474  "error while reading modal force data" << std::endl);
476  }
477 
478  if (uFlags != uOutFlags) {
479  silent_cerr("ModalExt(" << GetLabel() << "): "
480  "error while reading modal force data "
481  "(" << uOutFlags << "!=" << uFlags << ")"
482  << std::endl);
484  }
485 }
486 
489 {
490  return Force::EXTERNALMODAL;
491 }
492 
493 void
494 ModalExt::WorkSpaceDim(integer* piNumRows, integer* piNumCols) const
495 {
496  if (iCoupling == COUPLING_NONE) {
497  *piNumRows = 0;
498  *piNumCols = 0;
499 
500  } else {
501  *piNumRows = (pNode ? 6 : 0) + (pModal ? pModal->uGetNModes() : 0);
502  *piNumCols = 1;
503  }
504 }
505 
508  doublereal dCoef,
509  const VectorHandler& XCurr,
510  const VectorHandler& XPrimeCurr)
511 {
512  ExtForce::Recv();
513 
514  if (iCoupling == COUPLING_NONE) {
515  WorkVec.Resize(0);
516  return WorkVec;
517  }
518 
519  integer iR, iC;
520  WorkSpaceDim(&iR, &iC);
521  WorkVec.ResizeReset(iR);
522 
523  integer iIdx = 1;
525  integer iFirstIndex = pNode->iGetFirstMomentumIndex();
526 
527  for (integer iCnt = 1; iCnt <= 6; iCnt++) {
528  WorkVec.PutRowIndex(iCnt, iFirstIndex + iCnt);
529  }
530 
531  WorkVec.Put(1, F);
532  WorkVec.Put(4, M);
533  }
534 
535  if (pNode) {
536  iIdx += 6;
537  }
538 
540  integer iModalIndex = pModal->iGetModalIndex() + pModal->uGetNModes() + 1;
541  for (integer iMode = 0; iMode < pModal->uGetNModes(); iMode++) {
542  WorkVec.PutItem(iIdx + iMode, iModalIndex + iMode, f[iMode]);
543  }
544  }
545 
546  return WorkVec;
547 }
548 
549 void
551 {
552  if (bToBeOutput()) {
553  if (OH.UseText(OutputHandler::FORCES)) {
554  std::ostream& out = OH.Forces();
555 
557  out << GetLabel() << "#" << pNode->GetLabel()
558  << " " << F << " " << M
559  << std::endl;
560  }
561 
563  unsigned cnt = 0;
564  const std::vector<unsigned int>& ML(pModal->GetModeList());
565  for (std::vector<doublereal>::const_iterator i = f.begin(); i != f.end(); ++i) {
566  out << GetLabel() << '.' << ML[cnt]
567  << " " << *i << std::endl;
568  cnt++;
569  }
570  }
571  }
572 
573  /* TODO: NetCDF */
574  }
575 }
576 
577 void
578 ModalExt::GetConnectedNodes(std::vector<const Node *>& connectedNodes) const
579 {
580  if (pNode) {
581  connectedNodes.resize(1);
582  connectedNodes[0] = pNode;
583  } else {
584  connectedNodes.resize(0);
585  }
586 }
587 
588 Elem*
590  MBDynParser& HP,
591  unsigned int uLabel)
592 {
593  ExtFileHandlerBase *pEFH;
594  int iCoupling;
595 
596  bool bSendAfterPredict;
597  ReadExtForce(pDM, HP, uLabel, pEFH, bSendAfterPredict, iCoupling);
598 
599  const StructNode *pNode = 0;
600  const Modal *pModal = 0;
601  if (HP.IsKeyWord("reference" "node")) {
602  pNode = pDM->ReadNode<const StructNode, Node::STRUCTURAL>(HP);
603 
604  } else {
605  pModal = pDM->ReadElem<const Modal, Elem::JOINT>(HP);
606  pNode = pModal->pGetModalNode();
607  }
608 
609  bool bOutputAccelerations(false);
610  if (HP.IsKeyWord("accelerations")) {
611  bOutputAccelerations = true;
612  }
613 
614  // safe default: both rigid and modal, if possible
616  if (pNode == 0) {
618 
619  } else if (pModal == 0) {
621  }
622 
623  if (HP.IsKeyWord("type")) {
624  if (HP.IsKeyWord("rigid")) {
626  } else if (HP.IsKeyWord("modal")) {
628  } else if (HP.IsKeyWord("all")) {
630  } else {
631  silent_cerr("ModalExt(" << uLabel << "): unknown ModalExt type "
632  " at line " << HP.GetLineData() << std::endl);
634  }
635  }
636 
637  if ((bm & ExtModalForceBase::EMF_RIGID) && pNode == 0) {
638  silent_cerr("ModalExt(" << uLabel << "): \"rigid\" needs rigid body motion "
639  "at line " << HP.GetLineData() << std::endl);
641  }
642 
643  if ((bm & ExtModalForceBase::EMF_MODAL) && pModal == 0) {
644  silent_cerr("ModalExt(" << uLabel << "): \"modal\" needs modal joint "
645  "at line " << HP.GetLineData() << std::endl);
647  }
648 
649  ExtModalForceBase *pEMF = 0;
650  if (dynamic_cast<ExtFileHandlerEDGE *>(pEFH) != 0) {
651  // EDGE needs two separate ModalExt elements,
652  // one for the rigid part and one for the modal part
653 
654  switch (bm & ExtModalForceBase::EMF_ALL) {
655  case ExtModalForceBase::EMF_RIGID:
657  ExtRigidForceEDGE(pDM));
658  break;
659 
660  case ExtModalForceBase::EMF_MODAL:
662  ExtModalForceEDGE(pDM));
663  break;
664 
665  case ExtModalForceBase::EMF_ALL:
666  silent_cerr("ModalExt(" << uLabel << "): "
667  "EDGE ExtFileHandler can only be used "
668  "when ModalExt is either \"rigid\" "
669  "or \"modal\" but not when it is \"all\" "
670  " at line " << HP.GetLineData() << std::endl);
672 
673  default:
674  ASSERT(0);
675  throw ErrGeneric(MBDYN_EXCEPT_ARGS);
676  }
677 
678  // add more types if specific behavior is needed
679 
680  } else {
681  // ExtFileHandler
682  // ExtSocketHandler
683 
684  // wild guess: the default is fine
685  SAFENEW(pEMF, ExtModalForce);
686  }
687 
688  flag fOut = pDM->fReadOutput(HP, Elem::FORCE);
689 
690  if (HP.IsArg()) {
691  silent_cerr("ModalExt(" << uLabel << "): "
692  "semicolon expected at line "
693  << HP.GetLineData() << std::endl);
695  }
696 
697  Elem *pEl = 0;
699  ModalExt(uLabel, pDM, pModal, pNode, bOutputAccelerations,
700  pEFH, pEMF, bSendAfterPredict, iCoupling, bm, fOut));
701 
702  return pEl;
703 }
704 
flag fReadOutput(MBDynParser &HP, const T &t) const
Definition: dataman.h:1064
std::vector< doublereal > f
Definition: modalext.h:154
const ModalNode * pGetModalNode(void) const
Definition: modal.h:395
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 std::istream * GetInStream(void)
Definition: extforce.cc:78
const Vec3 Zero3(0., 0., 0.)
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
virtual bool bToBeOutput(void) const
Definition: output.cc:890
const VecN & GetA(void) const
Definition: modal.h:371
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
Vec3 M
Definition: modalext.h:153
Definition: matvec3.h:98
virtual int GetInFileDes(void)
Definition: extforce.cc:99
virtual int GetOutFileDes(void)
Definition: extforce.cc:85
virtual void ResizeReset(integer)
Definition: vh.cc:55
void Recv(void)
Definition: extforce.cc:798
virtual const Mat3x3 & GetRCurr(void) const
Definition: strnode.h:1012
Type
Definition: force.h:50
Elem * ReadElem(MBDynParser &HP, Elem::Type type) const
Definition: dataman3.cc:2334
integer uGetNModes(void) const
Definition: modal.h:363
Definition: mbc.h:65
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
Elem * ReadModalExtForce(DataManager *pDM, MBDynParser &HP, unsigned int uLabel)
Definition: modalext.cc:589
SubVectorHandler & AssRes(SubVectorHandler &WorkVec, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
Definition: modalext.cc:507
const Mat3x3 Eye3(1., 0., 0., 0., 1., 0., 0., 0., 1.)
virtual bool Prepare(ExtFileHandlerBase *pEFH, unsigned uLabel, bool bRigid, unsigned uModes)=0
#define NO_OP
Definition: myassert.h:74
bool Prepare(ExtFileHandlerBase *pEFH)
Definition: modalext.cc:390
virtual void Output(OutputHandler &OH) const
Definition: modalext.cc:550
virtual void GetConnectedNodes(std::vector< const Node * > &connectedNodes) const
Definition: modalext.cc:578
virtual void PutItem(integer iSubRow, integer iRow, const doublereal &dCoef)
Definition: submat.h:1445
std::vector< doublereal > qP
Definition: modalext.h:158
virtual Negotiate NegotiateRequest(void) const
Definition: extforce.cc:63
virtual bool Prepare(ExtFileHandlerBase *pEFH, unsigned uLabel, bool bRigid, unsigned uModes)
Definition: modalext.cc:64
Definition: modal.h:74
virtual void PutRowIndex(integer iSubRow, integer iRow)=0
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
const VecN & GetB(void) const
Definition: modal.h:379
#define SAFENEW(pnt, item)
Definition: mynewmem.h:695
virtual bool IsKeyWord(const char *sKeyWord)
Definition: parser.cc:910
virtual int GetRecvFlags(void) const
Definition: extforce.cc:106
virtual unsigned Recv(ExtFileHandlerBase *pEFH, unsigned uFlags, unsigned &uLabel, Vec3 &f, Vec3 &m, std::vector< doublereal > &fv)
Definition: modalext.cc:194
virtual integer iGetFirstMomentumIndex(void) const =0
virtual const Vec3 & GetWCurr(void) const
Definition: strnode.h:1030
virtual ~ModalExt(void)
Definition: modalext.cc:382
unsigned int uLabel
Definition: withlab.h:44
virtual const Vec3 & GetWPCurr(void) const
Definition: strnode.h:1042
#define ASSERT(expression)
Definition: colamd.c:977
virtual std::ostream * GetOutStream(void)
Definition: extforce.cc:72
virtual unsigned Recv(ExtFileHandlerBase *pEFH, unsigned uFlags, unsigned &uLabel, Vec3 &f, Vec3 &m, std::vector< doublereal > &fv)=0
unsigned uFlags
Definition: modalext.h:151
#define SAFENEWWITHCONSTRUCTOR(pnt, item, constructor)
Definition: mynewmem.h:698
virtual const Vec3 & GetXCurr(void) const
Definition: strnode.h:310
bool bOutputAccelerations
Definition: modalext.h:149
void Send(ExtFileHandlerBase *pEFH, ExtFileHandlerBase::SendWhen when)
Definition: modalext.cc:401
ExtModalForceBase * pEMF
Definition: modalext.h:150
Mat3x3 Transpose(void) const
Definition: matvec3.h:816
const doublereal * pGetMat(void) const
Definition: matvec3.h:743
integer iGetModalIndex(void) const
Definition: modal.h:391
virtual void Put(integer iRow, const Vec3 &v)
Definition: vh.cc:93
virtual bool IsArg(void)
Definition: parser.cc:807
Definition: elem.h:75
const doublereal * pGetVec(void) const
Definition: matvec3.h:192
virtual Force::Type GetForceType(void) const
Definition: modalext.cc:488
virtual const Vec3 & GetVCurr(void) const
Definition: strnode.h:322
Definition: matvec3n.h:76
static const doublereal a
Definition: hfluid_.h:289
virtual int GetSendFlags(void) const
Definition: extforce.cc:92
virtual const Vec3 & GetXPPCurr(void) const
Definition: strnode.h:334
static doublereal buf[BUFSIZE]
Definition: discctrl.cc:333
double doublereal
Definition: colamd.c:52
int iCoupling
Definition: extforce.h:212
long int integer
Definition: colamd.c:51
virtual HighParser::ErrOut GetLineData(void) const
Definition: parsinc.cc:697
const VecN & GetBP(void) const
Definition: modal.h:383
void WorkSpaceDim(integer *piNumRows, integer *piNumCols) const
Definition: modalext.cc:494
unsigned int GetLabel(void) const
Definition: withlab.cc:62
const std::vector< unsigned int > & GetModeList(void) const
Definition: modal.h:367
Node * ReadNode(MBDynParser &HP, Node::Type type) const
Definition: dataman3.cc:2309
std::vector< doublereal > q
Definition: modalext.h:157
void ReadExtForce(DataManager *pDM, MBDynParser &HP, unsigned int uLabel, ExtFileHandlerBase *&pEFH, bool &bSendAfterPredict, int &iCoupling)
Definition: extforce.cc:1141
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
virtual void Resize(integer iNewSize)=0
std::ostream & Forces(void) const
Definition: output.h:450
Mat3x3 R
bool UseText(int out) const
Definition: output.cc:446
#define SAFEDELETE(pnt)
Definition: mynewmem.h:710