MBDyn-1.7.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
dataman4.cc
Go to the documentation of this file.
1 /* $Header: /var/cvs/mbdyn/mbdyn/mbdyn-1.0/mbdyn/base/dataman4.cc,v 1.170 2017/06/18 23:06:35 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 /* Lettura elementi */
33 
34 #include "mbconfig.h" /* This goes first in every *.c,*.cc file */
35 
36 #include "mbdefs.h"
37 #include "modules.h"
38 
39 #include <float.h>
40 #include <vector>
41 #include <set>
42 
43 #include "dataman.h"
44 #include "dataman_.h"
45 
46 /* Elementi */
47 #include "autostr.h" /* Elementi automatici associati ai nodi dinamici */
48 #include "gravity.h" /* Elemento accelerazione di gravita' */
49 #include "body.h"
50 #include "inertia.h"
51 #include "joint.h"
52 #include "jointreg.h"
53 #include "force.h"
54 #include "beam.h"
55 #include "beam2.h"
56 #include "hbeam.h"
57 #include "aerodyn.h" /* Classe di base degli elementi aerodinamici */
58 #include "rotor.h"
59 #include "aeroelem.h"
60 #include "aeromodal.h"
61 #include "instruments.h"
62 #include "genfm.h"
63 #ifdef USE_EXTERNAL
64 #include "aeroext.h"
65 #endif /* USE_EXTERNAL */
66 
67 #include "driven.h" /* driven elements */
68 #include "genel.h"
69 #include "j2p.h" /* bind di elementi a nodi parametrici */
70 
71 #include "preselem.h"
72 #include "elec.h"
73 #include "therm.h"
74 #include "bulk.h"
75 
76 #include "drive.h"
77 #include "tpldrive.h"
78 
79 #include "loadable.h"
80 
81 #ifdef USE_RTAI
82 #include "rtai_out_elem.h"
83 #endif /* USE_RTAI */
84 
85 #include "socketstream_out_elem.h"
86 #include "socketstreammotionelem.h"
87 
88 #include "membrane.h"
89 #include "shell.h"
90 
92 
93 /* enum delle parole chiave */
94 enum KeyWords {
96  END = 0,
98 
106  BEAM, /* same as BEAM3 */
109 
113 
120  AERODYNAMICBEAM, /* same as AERODYNAMICBEAM3 */
127 
129 
132 
134 
136 
139  LOADABLE, // deprecated
141 
143  SOCKETSTREAM_OUTPUT, // deprecated
145  RTAI_OUTPUT, // deprecated
146 
148 
152 
154 };
155 
156 void
158 {
159  DEBUGCOUTFNAME("DataManager::ReadElems");
160 
161  /* parole chiave del blocco degli elementi */
162  const char* sKeyWords[] = {
163  "end",
164 
165  "elements",
166 
167  "gravity",
168  "body",
169  "automatic" "structural",
170  "joint",
171  "joint" "regularization",
172  "couple",
173  "beam3",
174  "beam",
175  "beam2",
176  "hbeam",
177 
178  "membrane4eas",
179  "shell4eas",
180  "shell4easans",
181 
182  "air" "properties",
183  "gust",
184  "induced" "velocity",
185  "rotor",
186  "aerodynamic" "body",
187  "aerodynamic" "beam3",
188  "aerodynamic" "beam",
189  "aerodynamic" "beam2",
190  "aerodynamic" "external",
191  "aerodynamic" "external" "modal",
192  "aero" "modal",
193  "aircraft" "instruments",
194  "generic" "aerodynamic" "force",
195 
196  "force",
197 
198  "genel",
199  "electric",
200 
201  "thermal",
202 
203  "hydraulic",
204 
205  "bulk",
206  "user" "defined",
207  "loadable", // deprecated
208  "driven",
209 
210  "output" "element",
211  "stream" "output", // deprecated
212  "stream" "motion" "output", // deprecated
213  "RTAI" "output", // deprecated
214 
215  "inertia",
216 
217  "existing",
218  "output",
219  "bind",
220 
221  NULL
222  };
223 
224  /* tabella delle parole chiave */
225  KeyTable K(HP, sKeyWords);
226 
227  /* strutture di conteggio degli elementi letti */
228  for (int i = 0; i < Elem::LASTELEMTYPE; i++) {
229  iNumTypes[i] = ElemData[i].iExpectedNum;
230  }
231 
232  int iMissingElems = Elems.size();
233  DEBUGLCOUT(MYDEBUG_INPUT, "Expected elements: " << iMissingElems << std::endl);
234 
235  ElemVecType::iterator ei = Elems.begin();
236 
237  /* Aggiunta degli elementi strutturali automatici legati ai nodi dinamici */
238  if (ElemData[Elem::AUTOMATICSTRUCTURAL].iExpectedNum > 0) {
239  for (NodeContainerType::const_iterator i = NodeData[Node::STRUCTURAL].NodeContainer.begin();
240  i != NodeData[Node::STRUCTURAL].NodeContainer.end(); ++i)
241  {
242  const DynamicStructNode *pN = dynamic_cast<const DynamicStructNode *>(i->second);
243  if (pN != 0) {
244  // NOTE: could be a modal node
245  if (pN->GetStructNodeType() != StructNode::DYNAMIC) {
246  continue;
247  }
248 
249  Elem *pTmpEl = 0;
250  SAFENEWWITHCONSTRUCTOR(pTmpEl,
252  AutomaticStructElem(pN));
254 
255  *ei = pTmpEl;
256  ++ei;
257 
258  ASSERT(iNumTypes[Elem::AUTOMATICSTRUCTURAL] > 0);
259 
260  iMissingElems--;
261  iNumTypes[Elem::AUTOMATICSTRUCTURAL]--;
263  "Initializing automatic structural element linked to StructuralNode("
264  << pN->GetLabel() << ")" << std::endl);
265  continue;
266  }
267 
268  const DynamicStructDispNode *pDN = dynamic_cast<const DynamicStructDispNode *>(i->second);
269  if (pDN != 0) {
270  // NOTE: could be a modal node
272  continue;
273  }
274 
275  Elem *pTmpEl = 0;
276  SAFENEWWITHCONSTRUCTOR(pTmpEl,
280 
281  *ei = pTmpEl;
282  ++ei;
283 
284  ASSERT(iNumTypes[Elem::AUTOMATICSTRUCTURAL] > 0);
285 
286  iMissingElems--;
287  iNumTypes[Elem::AUTOMATICSTRUCTURAL]--;
289  "Initializing automatic structural element linked to StructDispNode(" << pDN->GetLabel() << ")" << std::endl);
290  continue;
291  }
292  }
293  }
294 
295  KeyWords CurrDesc;
296  while ((CurrDesc = KeyWords(HP.GetDescription())) != END) {
297  if (CurrDesc == OUTPUT) {
298  DEBUGLCOUT(MYDEBUG_INPUT, "Elements to be output: ");
299  Elem::Type Typ;
300  switch (KeyWords(HP.GetWord())) {
301  case BODY: {
302  DEBUGLCOUT(MYDEBUG_INPUT, "bodies" << std::endl);
303  Typ = Elem::BODY;
304  break;
305  }
306 
307  case AUTOMATICSTRUCTURAL: {
308  DEBUGLCOUT(MYDEBUG_INPUT, "automatic structural" << std::endl);
310  break;
311  }
312 
313  case JOINT: {
314  DEBUGLCOUT(MYDEBUG_INPUT, "joints" << std::endl);
315  Typ = Elem::JOINT;
316  break;
317  }
318 
319  case BEAM:
320  case BEAM3: /* same as BEAM */
321  case BEAM2:
322  case HBEAM: {
323  DEBUGLCOUT(MYDEBUG_INPUT, "beams" << std::endl);
324  Typ = Elem::BEAM;
325  break;
326  }
327 
328  case MEMBRANE4EAS:
329  case SHELL4EAS:
330  case SHELL4EASANS: {
331  DEBUGLCOUT(MYDEBUG_INPUT, "shells" << std::endl);
332  Typ = Elem::PLATE;
333  break;
334  }
335 
336  case INDUCEDVELOCITY:
337  case ROTOR: {
338  DEBUGLCOUT(MYDEBUG_INPUT, "induced velocity elements" << std::endl);
339  Typ = Elem::INDUCEDVELOCITY;
340  break;
341  }
342 
343  case AEROMODAL: {
344  DEBUGLCOUT(MYDEBUG_INPUT, "aeromodal" << std::endl);
345  Typ = Elem::AEROMODAL;
346  break;
347  }
348 
349 #ifdef USE_EXTERNAL
350  case AERODYNAMICEXTERNAL:
352  DEBUGLCOUT(MYDEBUG_INPUT, "aerodynamic external" << std::endl);
353  Typ = Elem::EXTERNAL;
354  break;
355  }
356 #endif /* USE_EXTERNAL */
357 
358  case AERODYNAMICBODY:
359  case AERODYNAMICBEAM:
360  case AERODYNAMICBEAM3: /* same as AERODYNAMICBEAM */
361  case AERODYNAMICBEAM2:
362  case AIRCRAFTINSTRUMENTS:
364  DEBUGLCOUT(MYDEBUG_INPUT, "aerodynamic" << std::endl);
365  Typ = Elem::AERODYNAMIC;
366  break;
367  }
368 
369  case FORCE:
370  case COUPLE:
371  {
372  DEBUGLCOUT(MYDEBUG_INPUT, "forces" << std::endl);
373  Typ = Elem::FORCE;
374  break;
375  }
376 
377  case GENEL: {
378  DEBUGLCOUT(MYDEBUG_INPUT, "genels" << std::endl);
379  Typ = Elem::GENEL;
380  break;
381  }
382 
383  case ELECTRIC: {
384  DEBUGLCOUT(MYDEBUG_INPUT, "electric" << std::endl);
385  Typ = Elem::ELECTRIC;
386  break;
387  }
388 
389  case THERMAL: {
390  DEBUGLCOUT(MYDEBUG_INPUT, "thermal" << std::endl);
391  Typ = Elem::THERMAL;
392  break;
393  }
394 
395  case HYDRAULIC: {
396  DEBUGLCOUT(MYDEBUG_INPUT, "hydraulic elements" << std::endl);
397  Typ = Elem::HYDRAULIC;
398  break;
399  }
400 
401  case BULK: {
402  DEBUGLCOUT(MYDEBUG_INPUT, "bulk" << std::endl);
403  Typ = Elem::BULK;
404  break;
405  }
406 
407  case USER_DEFINED:
408  case LOADABLE: {
409  DEBUGLCOUT(MYDEBUG_INPUT, "loadable" << std::endl);
410  Typ = Elem::LOADABLE;
411  break;
412  }
413 
414  case UNKNOWNKEYWORD: {
415  silent_cerr("Error: unknown element type, cannot modify output"
416  << std::endl);
418  }
419 
420  default: {
421  silent_cerr("Error: element type " << sKeyWords[CurrDesc]
422  << " at line " << HP.GetLineData() << " is not allowed"
423  << std::endl);
425  }
426  } /* end switch (KeyWords(HP.GetWord())) */
427 
428  /* Elements list */
429  while (HP.IsArg()) {
430  if (HP.IsKeyWord("range")) {
431  unsigned int uL = (unsigned int)HP.GetInt();
432  unsigned int uEndL = (unsigned int)HP.GetInt();
433  if (uEndL < uL) {
434  silent_cerr("End label " << uEndL
435  << " must be larger than "
436  "or equal to start label "
437  << uL << std::endl);
439  }
440  for ( ; uL <= uEndL; uL++) {
441  Elem* pE = dynamic_cast<Elem *>(pFindElem(Typ, uL));
442  if (pE != 0) {
443  DEBUGLCOUT(MYDEBUG_INPUT, "element " << uL << std::endl);
444  pE->SetOutputFlag(flag(1));
445  if (dynamic_cast<const Modal *>(pE)) {
447  }
448  }
449  }
450 
451  } else {
452  unsigned int uL = (unsigned int)HP.GetInt();
453  Elem* pE = dynamic_cast<Elem *>(pFindElem(Typ, uL));
454  if (pE == 0) {
455  silent_cerr(psElemNames[Typ] << "(" << uL << ") "
456  "is not defined (ignored); output cannot be modified "
457  "at line " << HP.GetLineData()
458  << std::endl);
459  } else {
460  DEBUGLCOUT(MYDEBUG_INPUT, "element " << uL << std::endl);
461  pE->SetOutputFlag(flag(1) | ElemData[Typ].uOutputFlags);
462  if (dynamic_cast<const Modal *>(pE)) {
464  }
465  }
466  }
467  } /* end while (HP.IsArg()) */
468 
469  } else if (CurrDesc == BIND) {
470  Elem* pEl = 0;
472 
473  if (HP.IsKeyWord("air" "properties")) {
475  if (ElemData[t].ElemContainer.empty()) {
476  silent_cerr("air properties not defined; "
477  "cannot bind at line "
478  << HP.GetLineData() << std::endl);
480  }
481  ElemContainerType::iterator ap = ElemData[t].ElemContainer.begin();
482  pEl = ap->second;
483 
484  } else {
485  /* Label dell'elemento */
486  unsigned int uL = HP.GetInt();
487 
488  /* Tipo dell'elemento */
489  switch (KeyWords(HP.GetWord())) {
490  case BODY:
491  t = Elem::BODY;
492  break;
493 
494  case AUTOMATICSTRUCTURAL:
496  break;
497 
498  case JOINT:
499  t = Elem::JOINT;
500  break;
501 
502  case FORCE:
503  case COUPLE:
504  t = Elem::FORCE;
505  break;
506 
507  case INERTIA:
508  t = Elem::INERTIA;
509  break;
510 
511  case BEAM:
512  case BEAM3: /* same as BEAM */
513  case BEAM2:
514  case HBEAM:
515  t = Elem::BEAM;
516  break;
517 
518  case MEMBRANE4EAS:
519  case SHELL4EAS:
520  case SHELL4EASANS:
521  t = Elem::PLATE;
522  break;
523 
524  case INDUCEDVELOCITY:
525  case ROTOR:
527  break;
528 
529  case AEROMODAL:
530  t = Elem::AEROMODAL;
531  break;
532 
533 #ifdef USE_EXTERNAL
534  case AERODYNAMICEXTERNAL:
536  t = Elem::EXTERNAL;
537  break;
538 #endif /* USE_EXTERNAL */
539 
540  case AERODYNAMICBODY:
541  case AERODYNAMICBEAM:
542  case AERODYNAMICBEAM3: /* same as AERODYNAMICBEAM */
543  case AERODYNAMICBEAM2:
544  case AIRCRAFTINSTRUMENTS:
546  t = Elem::AERODYNAMIC;
547  break;
548 
549  case GENEL:
550  t = Elem::GENEL;
551  break;
552 
553  case ELECTRIC:
554  t = Elem::ELECTRIC;
555  break;
556 
557  case THERMAL:
558  t = Elem::THERMAL;
559  break;
560 
561  case HYDRAULIC:
562  t = Elem::HYDRAULIC;
563  break;
564 
565  case BULK:
566  t = Elem::BULK;
567  break;
568 
569  case USER_DEFINED:
570  case LOADABLE:
571  t = Elem::LOADABLE;
572  break;
573 
574  case OUTPUT_ELEMENT:
575  case RTAI_OUTPUT: // deprecated
576  case SOCKETSTREAM_OUTPUT: // deprecated
577  case SOCKETSTREAM_MOTION_OUTPUT: // deprecated
579  << " does not support bind" << std::endl);
580  default:
581  silent_cerr("DataManager::ReadElems: unknown element type (label=" << uL << ") "
582  "at line " << HP.GetLineData() << std::endl);
584  } /* end switch (KeyWords(HP.GetWord())) */
585 
586  pEl = dynamic_cast<Elem*>(pFindElem(t, uL));
587 
588  if (!pEl) {
589  silent_cerr("cannot find " << psElemNames[t] << " (" << uL << ") "
590  "at line " << HP.GetLineData() << std::endl);
592  }
593  }
594 
595  /* Label del nodo parameter */
596  unsigned uL = HP.GetInt();
597 
598  Elem2Param* pNd = pFindNode<Elem2Param, ParameterNode, Node::PARAMETER>(uL);
599  if (pNd == 0) {
600  silent_cerr("can't find parameter node (" << uL << ") "
601  "at line " << HP.GetLineData() << std::endl);
603  }
604 
605  /* Numero d'ordine del dato privato a cui fare il binding */
606  unsigned int i = 0;
607  std::string s;
608  if (HP.IsKeyWord("name") || HP.IsKeyWord("string" /* deprecated */ )) {
609  s = HP.GetStringWithDelims();
610 
611  ASSERT(!s.empty());
612 
613  DEBUGCOUT("binding to " << psElemNames[pEl->GetElemType()]
614  << "(" << pEl->GetLabel() << ") private data "
615  "\"" << s << "\"" << std::endl);
616 
617  i = pEl->iGetPrivDataIdx(s.c_str());
618 
619  } else {
620  if (HP.IsKeyWord("index")) {
621  // may become required
622  NO_OP;
623  }
624  i = HP.GetInt();
625  }
626 
627  /* indice del dato a cui il parametro e' bound */
628  if (i <= 0 || i > pEl->iGetNumPrivData()) {
629  if (!s.empty()) {
630  silent_cerr("error in private data \"" << s << "\" "
631  "for element " << psElemNames[t] << " (" << pEl->GetLabel() << ") "
632  "while binding to ParameterNode(" << uL << ") "
633  "at line " << HP.GetLineData() << std::endl);
634 
635  } else {
636  silent_cerr("error in private data #" << i << " "
637  "for element " << psElemNames[t] << " (" << pEl->GetLabel() << ") "
638  "while binding to ParameterNode(" << uL << ") "
639  "at line " << HP.GetLineData() << std::endl);
640  }
642  }
643 
644  /* fa il binding del ParameterNode all'elemento */
645  DEBUGLCOUT(MYDEBUG_INPUT, "Binding " << psElemNames[t]
646  << " (" << pEl->GetLabel() << ") "
647  "to Parameter " << pNd->GetLabel() << std::endl);
648  pNd->Bind(pEl, i);
649 
650  /* Gust is attached to air properties... */
651  } else if (CurrDesc == GUST) {
652  if (ElemData[Elem::AIRPROPERTIES].ElemContainer.empty()) {
653  silent_cerr("air properties not defined; "
654  "cannot add gust at line "
655  << HP.GetLineData() << std::endl);
657  }
658  ElemContainerType::iterator ap = ElemData[Elem::AIRPROPERTIES].ElemContainer.begin();
659  dynamic_cast<AirProperties *>(ap->second)->AddGust(ReadGustData(this, HP));
660 
661  /* gestisco a parte gli elementi automatici strutturali, perche'
662  * sono gia' stati costruiti altrove e li devo solo inizializzare;
663  * eventualmente si puo' fare altrimenti */
664  } else if (CurrDesc == AUTOMATICSTRUCTURAL) {
665  AutomaticStructDispElem* pASD = ReadElem<AutomaticStructDispElem, Elem::AUTOMATICSTRUCTURAL>(HP);
666  ASSERT(pASD != 0);
667  AutomaticStructElem* pAS = dynamic_cast<AutomaticStructElem *>(pASD);
668  if (pAS) {
669  DEBUGCOUT("reading AutomaticStructElem(" << pAS->GetLabel() << ")" << std::endl);
670 
671  /* forse e' il caso di usare il riferimento del nodo? */
672 
673  /* NOTE: i primi due sono gestiti direttamente
674  * dagli elementi con inerzia, e quindi non sono usati */
675  Vec3 q(HP.GetVecAbs(::AbsRefFrame));
676  Vec3 g(HP.GetVecAbs(::AbsRefFrame));
677  Vec3 qp(HP.GetVecAbs(::AbsRefFrame));
678  Vec3 gp(HP.GetVecAbs(::AbsRefFrame));
679 
680  DEBUGCOUT("Q = " << q << std::endl
681  << "G = " << g << std::endl
682  << "Qp = " << qp << std::endl
683  << "Gp = " << gp << std::endl);
684 
685  pAS->Init(q, g, qp, gp);
686 
687  } else {
688  DEBUGCOUT("reading AutomaticStructDispElem(" << pASD->GetLabel() << ")" << std::endl);
689 
690  Vec3 q(HP.GetVecAbs(::AbsRefFrame));
691  Vec3 qp(HP.GetVecAbs(::AbsRefFrame));
692 
693  DEBUGCOUT("Q = " << q << std::endl
694  << "Qp = " << qp << std::endl);
695 
696  pASD->Init(q, qp);
697  }
698 
699  /* <<<< D E F A U L T >>>> : Read one element and create it */
700  /* default: leggo un elemento e lo creo */
701  } else {
702  /* puntatore all'elemento */
703  Elem* pE = 0;
704 
705  unsigned int uLabel;
706  switch (CurrDesc) {
707  /* Qui vengono elencati gli elementi unici, che non richiedono label
708  * (per ora: accelerazione di gravita' e proprieta' dell'aria */
709 
710  /* Accelerazione di gravita' */
711  case GRAVITY: {
712  silent_cout("Reading Gravity" << std::endl);
713 
714  if (iNumTypes[Elem::GRAVITY]-- <= 0) {
715  DEBUGCERR("");
716  silent_cerr("line " << HP.GetLineData() << ": "
717  ": Gravity is not defined" << std::endl);
718 
720  }
721 
722  pE = ReadGravity(this, HP);
723  uLabel = 1;
724  InsertElem(ElemData[Elem::GRAVITY], uLabel, pE);
725 
726  *ei = pE;
727  ++ei;
728 
729  break;
730  }
731 
732  /* Elementi aerodinamici: proprieta' dell'aria */
733  case AIRPROPERTIES: {
734  silent_cout("Reading AirProperties" << std::endl);
735 
736  if (iNumTypes[Elem::AIRPROPERTIES]-- <= 0) {
737  DEBUGCERR("");
738  silent_cerr("line " << HP.GetLineData() << ": "
739  "AirProperties is not defined"
740  << std::endl);
741 
743  }
744 
745  uLabel = 1;
746 
747  pE = ReadAirProperties(this, HP);
748  if (pE != 0) {
750 
751  *ei = pE;
752  ++ei;
753  }
754 
755  break;
756  }
757 
758  /* Elemento generico: legge la label e fa un nuovo switch */
759  default: {
760  /* legge la label */
761  uLabel = unsigned(HP.GetInt());
762 
763  /* in base al tipo, avviene l'allocazione */
764  switch (CurrDesc) {
765  case DRIVEN: {
766  /* Reads the driver */
767  DriveCaller* pDC = HP.GetDriveCaller();
768  std::vector<std::string> hints;
769 
770  for (unsigned i = 1; HP.IsKeyWord("hint"); i++) {
771  const char *hint = HP.GetStringWithDelims(HighParser::DEFAULTDELIM, false);
772  if (hint == 0) {
773  silent_cerr("Driven(" << uLabel << "): "
774  "unable to read hint #" << i
775  << " at line " << HP.GetLineData()
776  << std::endl);
778  }
779  hints.push_back(hint);
780  }
781 
782  HP.ExpectDescription();
783  KeyWords CurrDriven = KeyWords(HP.GetDescription());
784 
785 #ifdef DEBUG
786  switch (CurrDriven) {
787  case FORCE:
788  case BODY:
789  case JOINT:
791  case COUPLE:
792  case BEAM:
793  case BEAM3: /* same as BEAM */
794  case BEAM2:
795  case HBEAM:
796  case SHELL4EAS:
797  case SHELL4EASANS:
798 
799  case INDUCEDVELOCITY:
800  case ROTOR:
801  case AERODYNAMICBODY:
802  case AERODYNAMICBEAM:
803  case AERODYNAMICBEAM3: /* same as AERODYNAMICBEAM */
804  case AERODYNAMICBEAM2:
805  case AIRCRAFTINSTRUMENTS:
807 
808  case GENEL:
809  case ELECTRIC:
810 
811  case THERMAL:
812 
813  case HYDRAULIC:
814 
815  case BULK:
816  case USER_DEFINED:
817  case LOADABLE:
818  case EXISTING:
819  DEBUGLCOUT(MYDEBUG_INPUT, "OK, this element can be driven" << std::endl);
820  break;
821 
822  case OUTPUT_ELEMENT:
823  case RTAI_OUTPUT: // deprecated
824  case SOCKETSTREAM_OUTPUT: // deprecated
825  case SOCKETSTREAM_MOTION_OUTPUT: // deprecated
827  << " cannot be driven" << std::endl);
829 
830  default:
831  DEBUGCERR("warning, this element cannot be driven" << std::endl);
832  break;
833  }
834 #endif /* DEBUG */
835 
836  Elem **ppE = 0;
837  bool bExisting(false);
838  if (CurrDriven == EXISTING) {
839  bExisting = true;
840  iMissingElems++;
841  CurrDriven = KeyWords(HP.GetWord());
842  unsigned int uL = (unsigned int)HP.GetInt();
843  if (uL != uLabel) {
844  silent_cerr("Error: the driving element must have "
845  "the same label of the driven one"
846  << std::endl);
847 
849  }
850 
851  /* FIXME: use pFindElem() instead? */
852  switch (CurrDriven) {
853  case FORCE:
854  ppE = ppFindElem(Elem::FORCE, uLabel);
855  break;
856 
857  case BODY:
858  ppE = ppFindElem(Elem::BODY, uLabel);
859  break;
860 
861  case JOINT:
862  ppE = ppFindElem(Elem::JOINT, uLabel);
863  break;
864 
866  ppE = ppFindElem(Elem::JOINT_REGULARIZATION, uLabel);
867  break;
868 
869  case COUPLE:
870  ppE = ppFindElem(Elem::FORCE, uLabel);
871  break;
872 
873  case BEAM:
874  case BEAM3: /* same as BEAM */
875  case BEAM2:
876  case HBEAM:
877  ppE = ppFindElem(Elem::BEAM, uLabel);
878  break;
879 
880  case MEMBRANE4EAS:
881  case SHELL4EAS:
882  case SHELL4EASANS:
883  ppE = ppFindElem(Elem::PLATE, uLabel);
884  break;
885 
886  case INDUCEDVELOCITY:
887  case ROTOR:
888  ppE = ppFindElem(Elem::INDUCEDVELOCITY, uLabel);
889  break;
890 
891  case AERODYNAMICBODY:
892  case AERODYNAMICBEAM:
893  case AERODYNAMICBEAM3: /* same as AERODYNAMICBEAM */
894  case AERODYNAMICBEAM2:
895  case AIRCRAFTINSTRUMENTS:
897  ppE = ppFindElem(Elem::AERODYNAMIC, uLabel);
898  break;
899 
900  case GENEL:
901  ppE = ppFindElem(Elem::GENEL, uLabel);
902  break;
903 
904  case ELECTRIC:
905  ppE = ppFindElem(Elem::ELECTRIC, uLabel);
906  break;
907 
908  case THERMAL:
909  ppE = ppFindElem(Elem::THERMAL, uLabel);
910  break;
911 
912  case HYDRAULIC:
913  ppE = ppFindElem(Elem::HYDRAULIC, uLabel);
914  break;
915 
916  case BULK:
917  ppE = ppFindElem(Elem::BULK, uLabel);
918  break;
919 
920  case USER_DEFINED:
921  case LOADABLE:
922  ppE = ppFindElem(Elem::LOADABLE, uLabel);
923  break;
924 
925  default:
926  DEBUGCERR("warning, this element can't be driven" << std::endl);
927  break;
928 
929  } /*switch (CurrDriven) */
930 
931  if (ppE == NULL) {
932  silent_cerr("Error: element " << uLabel
933  << "cannot be driven since it doesn't exist"
934  << std::endl);
935 
937  }
938 
939  pE = *ppE;
940 
941  flag fOut = fReadOutput(HP, pE->GetElemType());
942  pE->SetOutputFlag(fOut);
943 
944  } else {
945  unsigned int uDummy = (unsigned int)HP.GetInt();
946  if (uDummy != uLabel) {
947  silent_cerr("Error: the element label "
948  "(" << uDummy << ") "
949  "must be the same of the driving element "
950  "(" << uLabel << ") at line "
951  << HP.GetLineData() << std::endl);
952 
954  }
955 
956  /* Reads the true element */
957  ppE = ReadOneElem(HP, uLabel, "", CurrDriven);
958  if (ppE == NULL) {
959  DEBUGCERR("");
960  silent_cerr("error in allocation of element "
961  << uLabel << std::endl);
962 
964  }
965 
966  pE = *ppE;
967  } /* if (CurrDriven == EXISTING) {..} else {..} */
968 
969  SimulationEntity::Hints *pHints = 0;
970  if (!hints.empty()) {
971  for (std::vector<std::string>::const_iterator i = hints.begin();
972  i != hints.end(); ++i)
973  {
974  Hint *ph = pE->ParseHint(this, i->c_str());
975  if (ph != 0) {
976  if (pHints == 0) {
977  pHints = new SimulationEntity::Hints;
978  }
979  pHints->push_back(ph);
980  }
981  }
982  }
983 
984  /* Creates the driver for the element */
985  Elem* pEl = 0;
987  DrivenElem,
988  DrivenElem(this, pDC, pE, pHints));
989 
990  if (bExisting) {
991  ElemVecType::iterator eitmp = Elems.begin();
992  for (; eitmp != Elems.end(); ++eitmp) {
993  if (*eitmp == pE) {
994  *eitmp = pEl;
995  break;
996  }
997  }
998 
999  ASSERT(eitmp != Elems.end());
1000 
1001  } else {
1002  *ei = pEl;
1003  ++ei;
1004  }
1005 
1006  /* Substitutes the element with the driver */
1007  pE = *ppE = pEl;
1008 
1009  break;
1010  } /* end case DRIVEN: */
1011 
1012  /* <<<< N O R M A L E L E M E N T S >>>>> */
1013  /* Normal element */
1014  case FORCE:
1015 
1016  case BODY:
1017  case INERTIA:
1018  case JOINT:
1019  case JOINT_REGULARIZATION:
1020  case COUPLE:
1021  case BEAM:
1022  case BEAM3: /* same as BEAM */
1023  case BEAM2:
1024  case HBEAM:
1025  case MEMBRANE4EAS:
1026  case SHELL4EAS:
1027  case SHELL4EASANS:
1028 
1029  case GUST:
1030  case INDUCEDVELOCITY:
1031  case ROTOR:
1032  case AERODYNAMICBODY:
1033  case AERODYNAMICBEAM:
1034  case AERODYNAMICBEAM3: /* same as AERODYNAMICBEAM */
1035  case AERODYNAMICBEAM2:
1036  case AIRCRAFTINSTRUMENTS:
1038 #ifdef USE_EXTERNAL
1039  case AERODYNAMICEXTERNAL:
1041 #endif /* USE_EXTERNAL */
1042  case AEROMODAL:
1043 
1044  case GENEL:
1045  case ELECTRIC:
1046 
1047  case THERMAL:
1048 
1049  case HYDRAULIC:
1050 
1051  case BULK:
1052  case USER_DEFINED:
1053  case LOADABLE:
1054 
1055  case OUTPUT_ELEMENT:
1056  case RTAI_OUTPUT: // deprecated
1057  case SOCKETSTREAM_OUTPUT: // deprecated
1058  case SOCKETSTREAM_MOTION_OUTPUT: // deprecated
1059  {
1060  Elem **ppE = 0;
1061 
1062  /* Nome dell'elemento */
1063  std::string sName;
1064  if (HP.IsKeyWord("name")) {
1065  const char *sTmp = HP.GetStringWithDelims();
1066  if (sTmp == 0) {
1067  silent_cerr("error - element type "
1068  << sKeyWords[CurrDesc] << ": "
1069  "unable to parse name"
1070  " at line " << HP.GetLineData()
1071  << std::endl);
1073  }
1074  sName = sTmp;
1075  }
1076 
1077 #ifdef USE_RUNTIME_LOADING
1078  if ((CurrDesc == LOADABLE || CurrDesc == USER_DEFINED)
1079  && !moduleInitialized)
1080  {
1082  moduleInitialized = true;
1083  }
1084 #endif // USE_RUNTIME_LOADING
1085 
1086  ppE = ReadOneElem(HP, uLabel, sName, CurrDesc);
1087 
1088  if (ppE != 0) {
1089  pE = *ppE;
1090  if (!sName.empty() && sName != pE->GetName()) {
1091  pE->PutName(sName);
1092  }
1093 
1094  *ei = *ppE;
1095  ++ei;
1096  }
1097 
1098  break;
1099  } /* end case 'Normal elements'*/
1100 
1101  /* in caso di tipo sconosciuto */
1102  case UNKNOWNKEYWORD: {
1103  DEBUGCERR("");
1104  silent_cerr("error - unknown element type at line "
1105  << HP.GetLineData() << std::endl);
1106 
1108  }
1109 
1110  default: {
1111  DEBUGCERR("");
1112  silent_cerr("error - element type " << sKeyWords[CurrDesc]
1113  << " at line " << HP.GetLineData()
1114  << " is not allowed " << std::endl);
1115 
1117  }
1118  } /* end switch (CurrDesc) 'in base al tipo' */
1119 
1120  } /* end case default: 'Elemento generico' */
1121  } /* end switch (CurrDesc) 'Elemento generico' */
1122 
1123  /* verifica dell'allocazione */
1124  if (pE != 0) {
1125  /* decrementa il totale degli elementi mancanti */
1126  iMissingElems--;
1127  }
1128 
1129  } /* end <<<< D E F A U L T >>>> : Read one element and create it */
1130  /* end default: leggo un elemento e lo creo */
1131 
1132  } /* while ((CurrDesc = KeyWords(HP.GetDescription())) != END) */
1133 
1134  if (KeyWords(HP.GetWord()) != ELEMENTS) {
1135  DEBUGCERR("");
1136  silent_cerr("<end: elements;> expected at line"
1137  << HP.GetLineData() << std::endl);
1138 
1140  }
1141 
1142  /* Se non c'e' il punto e virgola finale */
1143  if (HP.IsArg()) {
1144  DEBUGCERR("");
1145  silent_cerr("semicolon expected at line " << HP.GetLineData()
1146  << std::endl);
1147 
1149  }
1150 
1151  if (iMissingElems > 0) {
1152  DEBUGCERR("");
1153  silent_cerr("error: " << iMissingElems
1154  << " elements are missing;" << std::endl);
1155  for (int iCnt = 0; iCnt < Elem::LASTELEMTYPE; iCnt++) {
1156  if (iNumTypes[iCnt] > 0) {
1157  silent_cerr(" " << iNumTypes[iCnt]
1158  << ' ' << psElemNames[iCnt] << std::endl);
1159  }
1160  }
1161 
1163  }
1164 
1165  /* Linka gli elementi che generano forze d'inerzia all'elemento
1166  * accelerazione di gravita' */
1167  if (!ElemData[Elem::GRAVITY].ElemContainer.empty()) {
1168  Gravity* pGrav = dynamic_cast<Gravity *>(ElemData[Elem::GRAVITY].ElemContainer.begin()->second);
1169  ASSERT(pGrav != 0);
1170 
1171  for (int iCnt = 0; iCnt < Elem::LASTELEMTYPE; iCnt++) {
1172  if (ElemData[iCnt].bGeneratesInertiaForces()
1173  && !ElemData[iCnt].ElemContainer.empty())
1174  {
1175  for (ElemContainerType::const_iterator p = ElemData[iCnt].ElemContainer.begin();
1176  p != ElemData[iCnt].ElemContainer.end(); ++p)
1177  {
1178  ElemGravityOwner *pGO = Cast<ElemGravityOwner>(p->second);
1179 
1180  ASSERT(pGO != 0);
1181  pGO->PutGravity(pGrav);
1182  }
1183  }
1184  }
1185  }
1186 
1187  /* Linka gli elementi che usano le proprieta' dell'aria all'elemento
1188  * proprieta' dell'aria */
1189  if (!ElemData[Elem::AIRPROPERTIES].ElemContainer.empty()) {
1190  AirProperties* pProp = dynamic_cast<AirProperties *>(ElemData[Elem::AIRPROPERTIES].ElemContainer.begin()->second);
1191  ASSERT(pProp != 0);
1192 
1193  for (int iCnt = 0; iCnt < Elem::LASTELEMTYPE; iCnt++) {
1194  if (ElemData[iCnt].bUsesAirProperties()
1195  && !ElemData[iCnt].ElemContainer.empty())
1196  {
1197  for (ElemContainerType::const_iterator p = ElemData[iCnt].ElemContainer.begin();
1198  p != ElemData[iCnt].ElemContainer.end(); ++p)
1199  {
1200  AerodynamicElem *pAE = Cast<AerodynamicElem>(p->second);
1201 
1202  ASSERT(pAE != 0);
1203  pAE->PutAirProperties(pProp);
1204  }
1205  }
1206  }
1207 
1208  } else { /* '' */
1209  /* Esegue un controllo per vedere se esistono elementi aerodinamici
1210  * ma non sono definite le proprieta' dell'aria, nel qual caso
1211  * il calcolo deve essere arrestato */
1212  bool bStop(false);
1213 
1214  for (int iCnt = 0; iCnt < Elem::LASTELEMTYPE; iCnt++) {
1215  if (ElemData[iCnt].bUsesAirProperties()
1216  && !ElemData[iCnt].ElemContainer.empty())
1217  {
1218  for (ElemContainerType::const_iterator p = ElemData[iCnt].ElemContainer.begin();
1219  p != ElemData[iCnt].ElemContainer.end(); ++p)
1220  {
1221  if (dynamic_cast<AerodynamicElem *>(p->second)->NeedsAirProperties()) {
1222  if (!bStop) {
1223  silent_cerr("The following aerodynamic elements "
1224  "are defined: " << std::endl);
1225  bStop = true;
1226  }
1227  }
1228  }
1229  }
1230  }
1231 
1232  if (bStop) {
1233  silent_cerr("while no air properties are defined; aborting..."
1234  << std::endl);
1235 
1237  }
1238  }
1239 
1240 #ifdef DEBUG
1241  ASSERT(ei == Elems.end());
1242 
1243  /* count & initialize element array */
1244  unsigned iNumElems = 0;
1245  for (int iCnt = 0; iCnt < Elem::LASTELEMTYPE; iCnt++) {
1246  iNumElems += ElemData[iCnt].ElemContainer.size();
1247  }
1248  ASSERT(iNumElems == Elems.size());
1249 #endif // DEBUG
1250 
1251  DEBUGLCOUT(MYDEBUG_INPUT, "End of elements data" << std::endl);
1252 } /* End of DataManager::ReadElems() */
1253 
1254 Elem**
1255 DataManager::ReadOneElem(MBDynParser& HP, unsigned int uLabel, const std::string& sName, int CurrType)
1256 {
1257  Elem* pE = 0;
1258  Elem** ppE = 0;
1259 
1260  switch (KeyWords(CurrType)) {
1261  /* forza */
1262  case FORCE:
1263  case COUPLE:
1264  {
1265  bool bCouple(false);
1266  if (KeyWords(CurrType) == FORCE) {
1267  silent_cout("Reading Force(" << uLabel << ( sName.empty() ? "" : ( std::string(", \"") + sName + "\"" ) ) << ")" << std::endl);
1268 
1269  } else /* if(KeyWords(CurrType) == COUPLE) */ {
1270  bCouple = true;
1271  silent_cout("Reading Couple(" << uLabel << ( sName.empty() ? "" : ( std::string(", \"") + sName + "\"" ) ) << ")" << std::endl);
1272  }
1273 
1274  if (iNumTypes[Elem::FORCE]-- <= 0) {
1275  DEBUGCERR("");
1276  silent_cerr("line " << HP.GetLineData()
1277  << ": Force(" << uLabel << ") "
1278  << "exceeds force elements number" << std::endl);
1279 
1281  }
1282 
1283  /* verifica che non sia gia' definito */
1284  if (pFindElem(Elem::FORCE, uLabel) != NULL) {
1285  DEBUGCERR("");
1286  silent_cerr("line " << HP.GetLineData()
1287  << ": Force(" << uLabel << ") "
1288  "already defined" << std::endl);
1289 
1291  }
1292 
1293  /* allocazione e creazione */
1294  pE = ReadForce(this, HP, uLabel, bCouple);
1295  if (pE != 0) {
1296  ppE = InsertElem(ElemData[Elem::FORCE], uLabel, pE);
1297  }
1298 
1299  break;
1300  }
1301 
1302  case BODY: {
1303  silent_cout("Reading Body(" << uLabel << ( sName.empty() ? "" : ( std::string(", \"") + sName + "\"" ) ) << ")" << std::endl);
1304 
1305  if (iNumTypes[Elem::BODY]-- <= 0) {
1306  DEBUGCERR("");
1307  silent_cerr("line " << HP.GetLineData()
1308  << ": Body(" << uLabel << ") "
1309  "exceeds rigid body elements number" << std::endl);
1310 
1312  }
1313 
1314  /* verifica che non sia gia' definito */
1315  if (pFindElem(Elem::BODY, uLabel) != NULL) {
1316  DEBUGCERR("");
1317  silent_cerr("line " << HP.GetLineData()
1318  << ": Body(" << uLabel << ") "
1319  "already defined" << std::endl);
1320 
1322  }
1323 
1324  /* allocazione e creazione */
1325  pE = ReadBody(this, HP, uLabel);
1326  if (pE != 0) {
1327  ppE = InsertElem(ElemData[Elem::BODY], uLabel, pE);
1328  }
1329 
1330  break;
1331  }
1332 
1333  /* vincoli */
1334  case JOINT: {
1335  silent_cout("Reading Joint(" << uLabel << ( sName.empty() ? "" : ( std::string(", \"") + sName + "\"" ) ) << ")" << std::endl);
1336 
1337  if (iNumTypes[Elem::JOINT]-- <= 0) {
1338  DEBUGCERR("");
1339  silent_cerr("line " << HP.GetLineData()
1340  << ": Joint(" << uLabel << ") "
1341  "exceeds joint elements number" << std::endl);
1342 
1344  }
1345 
1346  /* verifica che non sia gia' definito */
1347  if (pFindElem(Elem::JOINT, uLabel) != NULL) {
1348  DEBUGCERR("");
1349  silent_cerr("line " << HP.GetLineData()
1350  << ": Joint(" << uLabel << ") "
1351  "already defined" << std::endl);
1352 
1354  }
1355 
1356  /* allocazione e creazione */
1358  - iNumTypes[Elem::JOINT] - 1;
1359  DofOwner* pDO = DofData[DofOwner::JOINT].pFirstDofOwner + i;
1360 
1361  pE = ReadJoint(this, HP, pDO, uLabel);
1362  if (pE != 0) {
1363  ppE = InsertElem(ElemData[Elem::JOINT], uLabel, pE);
1364  }
1365 
1366  /* attenzione: i Joint aggiungono DofOwner e quindi devono
1367  * completare la relativa struttura */
1368  break;
1369  }
1370 
1371  /* regolarizzazione vincoli */
1372  case JOINT_REGULARIZATION: {
1373  silent_cout("Reading JointRegularization(" << uLabel << ( sName.empty() ? "" : ( std::string(", \"") + sName + "\"" ) ) << ")" << std::endl);
1374 
1375  if (iNumTypes[Elem::JOINT_REGULARIZATION]-- <= 0) {
1376  DEBUGCERR("");
1377  silent_cerr("line " << HP.GetLineData()
1379  << "(" << uLabel << ")"
1380  " exceeds " << psElemNames[Elem::JOINT_REGULARIZATION]
1381  << " elements number" << std::endl);
1382 
1384  }
1385 
1386  /* verifica che non sia gia' definito */
1387  if (pFindElem(Elem::JOINT_REGULARIZATION, uLabel) != NULL) {
1388  DEBUGCERR("");
1389  silent_cerr("line " << HP.GetLineData()
1391  << "(" << uLabel << ")"
1392  << " already defined" << std::endl);
1393 
1395  }
1396 
1397  /* allocazione e creazione */
1398  pE = ReadJointRegularization(this, HP, uLabel);
1399  if (pE != 0) {
1400  ppE = InsertElem(ElemData[Elem::JOINT_REGULARIZATION], uLabel, pE);
1401  }
1402 
1403  /* attenzione: i Joint aggiungono DofOwner e quindi devono
1404  * completare la relativa struttura */
1405  break;
1406  }
1407 
1408  /* trave */
1409  case BEAM:
1410  case BEAM3: /* same as BEAM */
1411  case BEAM2:
1412  case HBEAM: {
1413  silent_cout("Reading Beam(" << uLabel << ( sName.empty() ? "" : ( std::string(", \"") + sName + "\"" ) ) << ")" << std::endl);
1414 
1415  if (iNumTypes[Elem::BEAM]-- <= 0) {
1416  DEBUGCERR("");
1417  silent_cerr("line " << HP.GetLineData() << ": "
1418  "Beam(" << uLabel << ") "
1419  "exceeds beam elements number" << std::endl);
1420 
1422  }
1423 
1424  /* verifica che non sia gia' definito */
1425  if (pFindElem(Elem::BEAM, uLabel) != NULL) {
1426  DEBUGCERR("");
1427  silent_cerr("line " << HP.GetLineData() << ": "
1428  "Beam(" << uLabel << ") "
1429  "already defined" << std::endl);
1430 
1432  }
1433 
1434  /* allocazione e creazione */
1435  switch (KeyWords(CurrType)) {
1436  case BEAM3:
1437  case BEAM: /* same as BEAM3 */
1438  pE = ReadBeam(this, HP, uLabel);
1439  break;
1440 
1441  case BEAM2:
1442  pE = ReadBeam2(this, HP, uLabel);
1443  break;
1444 
1445  case HBEAM:
1446  pE = ReadHBeam(this, HP, uLabel);
1447  break;
1448 
1449  default:
1451  }
1452 
1453  if (pE != 0) {
1454  ppE = InsertElem(ElemData[Elem::BEAM], uLabel, pE);
1455  }
1456 
1457  break;
1458  }
1459 
1460  /* shell */
1461  case MEMBRANE4EAS:
1462  case SHELL4EAS:
1463  case SHELL4EASANS: {
1464  const char *sType;
1465  switch (KeyWords(CurrType)) {
1466  case MEMBRANE4EAS:
1467  sType = "Membrane";
1468  break;
1469 
1470  case SHELL4EAS:
1471  case SHELL4EASANS:
1472  sType = "Shell";
1473  break;
1474 
1475  default:
1477  }
1478 
1479  silent_cout("Reading " << sType << "(" << uLabel << ( sName.empty() ? "" : ( std::string(", \"") + sName + "\"" ) ) << ")" << std::endl);
1480 
1481  if (iNumTypes[Elem::PLATE]-- <= 0) {
1482  DEBUGCERR("");
1483  silent_cerr("line " << HP.GetLineData() << ": "
1484  << sType << "(" << uLabel << ") "
1485  "exceeds plate elements number" << std::endl);
1486 
1488  }
1489 
1490  /* verifica che non sia gia' definito */
1491  if (pFindElem(Elem::PLATE, uLabel) != NULL) {
1492  DEBUGCERR("");
1493  silent_cerr("line " << HP.GetLineData() << ": "
1494  << sType << "(" << uLabel << ") "
1495  "already defined" << std::endl);
1496 
1498  }
1499 
1500  /* allocazione e creazione */
1502  - iNumTypes[Elem::PLATE] - 1;
1503  DofOwner* pDO = DofData[DofOwner::PLATE].pFirstDofOwner + i;
1504 
1505  /* allocazione e creazione */
1506  switch (KeyWords(CurrType)) {
1507  case MEMBRANE4EAS:
1508  pE = ReadMembrane4EAS(this, HP, pDO, uLabel);
1509  break;
1510 
1511  case SHELL4EAS:
1512  pE = ReadShell4EAS(this, HP, pDO, uLabel);
1513  break;
1514 
1515  case SHELL4EASANS:
1516  pE = ReadShell4EASANS(this, HP, pDO, uLabel);
1517  break;
1518 
1519  default:
1521  }
1522 
1523  if (pE != 0) {
1524  ppE = InsertElem(ElemData[Elem::PLATE], uLabel, pE);
1525  }
1526 
1527  break;
1528  }
1529 
1530  /* Elementi aerodinamici: rotori */
1531  case ROTOR:
1532  case INDUCEDVELOCITY: {
1533  silent_cout("Reading InducedVelocity(" << uLabel << ( sName.empty() ? "" : ( std::string(", \"") + sName + "\"" ) ) << ")" << std::endl);
1534 
1535  switch (KeyWords(CurrType)) {
1536  case ROTOR:
1537  silent_cerr("InducedVelocity(" << uLabel << "): deprecated \"rotor\", use \"induced velocity\" of type \"rotor\" instead at line " << HP.GetLineData() << std::endl);
1538  break;
1539 
1540  case INDUCEDVELOCITY:
1541  if (HP.IsKeyWord("rotor")) {
1542  // continue
1543  } else {
1544  silent_cerr("InducedVelocity(" << uLabel << "): unknown \"induced velocity\" type at line " << HP.GetLineData() << " (missing \"rotor\" keyword?)" << std::endl);
1546  }
1547  break;
1548 
1549  default:
1551  }
1552 
1553  if (iNumTypes[Elem::INDUCEDVELOCITY]-- <= 0) {
1554  DEBUGCERR("");
1555  silent_cerr("InducedVelocity(" << uLabel << "): "
1556  "exceeds induced velocity elements number "
1557  "at line " << HP.GetLineData() << std::endl);
1558 
1560  }
1561 
1562  /* verifica che non sia gia' definito */
1563  if (pFindElem(Elem::INDUCEDVELOCITY, uLabel) != NULL) {
1564  DEBUGCERR("");
1565  silent_cerr("InducedVelocity(" << uLabel << ") "
1566  "already defined at line "
1567  << HP.GetLineData() << std::endl);
1568 
1570  }
1571 
1572  /* allocazione e creazione */
1574  - iNumTypes[Elem::INDUCEDVELOCITY] - 1;
1575  DofOwner* pDO = DofData[DofOwner::INDUCEDVELOCITY].pFirstDofOwner + i;
1576 
1577  pE = ReadRotor(this, HP, pDO, uLabel);
1578  if (pE != 0) {
1579  ppE = InsertElem(ElemData[Elem::INDUCEDVELOCITY], uLabel, pE);
1580  }
1581 
1582  break;
1583  }
1584 
1585  /* Elementi aerodinamici: modale */
1586  case AEROMODAL: {
1587  silent_cout("Reading AeroModal(" << uLabel << ( sName.empty() ? "" : ( std::string(", \"") + sName + "\"" ) ) << ")" << std::endl);
1588 
1589  if (iNumTypes[Elem::AEROMODAL]-- <= 0) {
1590  DEBUGCERR("");
1591  silent_cerr("line " << HP.GetLineData() << ": "
1592  "AeroModal(" << uLabel << ") "
1593  "exceeds aeromodal elements number" << std::endl);
1594 
1596  }
1597 
1598  /* verifica che non sia gia' definito */
1599  if (pFindElem(Elem::AEROMODAL, uLabel) != NULL) {
1600  DEBUGCERR("");
1601  silent_cerr("line " << HP.GetLineData() << ": "
1602  "AeroModal(" << uLabel << ") "
1603  "already defined" << std::endl);
1604 
1606  }
1607 
1608  /* allocazione e creazione */
1610  - iNumTypes[Elem::AEROMODAL] - 1;
1611  DofOwner* pDO = DofData[DofOwner::AEROMODAL].pFirstDofOwner + i;
1612 
1613  pE = ReadAerodynamicModal(this, HP, pDO, uLabel);
1614  if (pE != 0) {
1615  ppE = InsertElem(ElemData[Elem::AEROMODAL], uLabel, pE);
1616  }
1617 
1618  break;
1619  }
1620 
1621  /* Elementi aerodinamici: aeromodal */
1622  case AERODYNAMICEXTERNAL:
1623  case AERODYNAMICEXTERNALMODAL: {
1624 #ifdef USE_EXTERNAL
1625  silent_cout("Reading External(" << uLabel << ( sName.empty() ? "" : ( std::string(", \"") + sName + "\"" ) ) << ")" << std::endl);
1626 
1627  if (iNumTypes[Elem::EXTERNAL]-- <= 0) {
1628  DEBUGCERR("");
1629  silent_cerr("line " << HP.GetLineData() << ": "
1630  "External(" << uLabel << ") "
1631  "exceeds external elements number" << std::endl);
1632 
1634  }
1635 
1636  /* verifica che non sia gia' definito */
1637  if (pFindElem(Elem::EXTERNAL, uLabel) != NULL) {
1638  DEBUGCERR("");
1639  silent_cerr("line " << HP.GetLineData() << ": "
1640  "External(" << uLabel << ") "
1641  "already defined" << std::endl);
1642 
1644  }
1645 
1646  /* allocazione e creazione */
1647  switch (KeyWords(CurrType)) {
1648  case AERODYNAMICEXTERNAL:
1649  pE = ReadAerodynamicExternal(this, HP, uLabel);
1650  break;
1651 
1653  pE = ReadAerodynamicExternalModal(this, HP, uLabel);
1654  break;
1655 
1656  default:
1657  ASSERTMSG(0, "You shouldn't have reached this point");
1658  break;
1659  }
1660  if (pE != 0) {
1661  ppE = InsertElem(ElemData[Elem::EXTERNAL], uLabel, pE);
1662  }
1663 #else /* !USE_EXTERNAL */
1664  silent_cerr("You need mpi and -DUSE_AERODYNAMIC_EXTERNAL "
1665  << "to use this type of elements." << std::endl);
1667 #endif /* !USE_EXTERNAL */
1668  break;
1669  }
1670 
1671  case AERODYNAMICBODY:
1672  case AERODYNAMICBEAM:
1673  case AERODYNAMICBEAM3: /* same as AERODYNAMICBEAM */
1674  case AERODYNAMICBEAM2:
1675  case AIRCRAFTINSTRUMENTS:
1676  case GENERICAERODYNAMICFORCE: {
1677  silent_cout("Reading AerodynamicElement(" << uLabel << ( sName.empty() ? "" : ( std::string(", \"") + sName + "\"" ) ) << ")" << std::endl);
1678 
1679  if (iNumTypes[Elem::AERODYNAMIC]-- <= 0) {
1680  DEBUGCERR("");
1681  silent_cerr("line " << HP.GetLineData() << ": "
1682  "AerodynamicElement(" << uLabel << ") "
1683  "exceeds aerodynamic elements number" << std::endl);
1684 
1686  }
1687 
1688  /* verifica che non sia gia' definito */
1689  if (pFindElem(Elem::AERODYNAMIC, uLabel) != NULL) {
1690  DEBUGCERR("");
1691  silent_cerr("line " << HP.GetLineData() << ": "
1692  "AerodynamicElement(" << uLabel << ") "
1693  "already defined" << std::endl);
1694 
1696  }
1697 
1698  /* allocazione e creazione */
1700  - iNumTypes[Elem::AERODYNAMIC] - 1;
1701  DofOwner* pDO = DofData[DofOwner::AERODYNAMIC].pFirstDofOwner + i;
1702 
1703  /* allocazione e creazione */
1704  switch (KeyWords(CurrType)) {
1705  case AERODYNAMICBODY:
1706  pE = ReadAerodynamicBody(this, HP, pDO, uLabel);
1707  break;
1708 
1709  case AERODYNAMICBEAM3:
1710  case AERODYNAMICBEAM: /* same as BEAM3 */
1711  pE = ReadAerodynamicBeam(this, HP, pDO, uLabel);
1712  break;
1713 
1714  case AERODYNAMICBEAM2:
1715  pE = ReadAerodynamicBeam2(this, HP, pDO, uLabel);
1716  break;
1717 
1718  case AIRCRAFTINSTRUMENTS:
1719  pE = ReadAircraftInstruments(this, HP, pDO, uLabel);
1720  break;
1721 
1723  pE = ReadGenericAerodynamicForce(this, HP, pDO, uLabel);
1724  break;
1725 
1726  default:
1727  ASSERTMSG(0, "You shouldn't have reached this point");
1728  break;
1729  }
1730  if (pE != 0) {
1731  ppE = InsertElem(ElemData[Elem::AERODYNAMIC], uLabel, pE);
1732  }
1733 
1734  break;
1735  }
1736 
1737  /* genel */
1738  case GENEL: {
1739  silent_cout("Reading Genel(" << uLabel << ( sName.empty() ? "" : ( std::string(", \"") + sName + "\"" ) ) << ")" << std::endl);
1740 
1741  if (iNumTypes[Elem::GENEL]-- <= 0) {
1742  DEBUGCERR("");
1743  silent_cerr("line " << HP.GetLineData() << ": "
1744  "Genel(" << uLabel << ") "
1745  "exceeds genel elements number" << std::endl);
1746 
1748  }
1749 
1750  /* verifica che non sia gia' definito */
1751  if (pFindElem(Elem::GENEL, uLabel) != NULL) {
1752  DEBUGCERR("");
1753  silent_cerr("line " << HP.GetLineData() << ": "
1754  "Genel(" << uLabel << ") "
1755  "already defined" << std::endl);
1756 
1758  }
1759 
1760  /* allocazione e creazione */
1762  - iNumTypes[Elem::GENEL] - 1;
1763  DofOwner* pDO = DofData[DofOwner::GENEL].pFirstDofOwner + i;
1764 
1765  pE = ReadGenel(this, HP, pDO, uLabel);
1766  if (pE != 0) {
1767  ppE = InsertElem(ElemData[Elem::GENEL], uLabel, pE);
1768  }
1769 
1770  break;
1771  }
1772 
1773  /* elementi idraulici */
1774  case HYDRAULIC: {
1775  silent_cout("Reading HydraulicElement(" << uLabel << ( sName.empty() ? "" : ( std::string(", \"") + sName + "\"" ) ) << ")" << std::endl);
1776 
1777  if (iNumTypes[Elem::HYDRAULIC]-- <= 0) {
1778  DEBUGCERR("");
1779  silent_cerr("line " << HP.GetLineData() << ": "
1780  "HydraulicElement(" << uLabel << ") "
1781  "exceeds hydraulic elements number" << std::endl);
1782 
1784  }
1785 
1786  /* verifica che non sia gia' definito */
1787  if (pFindElem(Elem::HYDRAULIC, uLabel) != NULL) {
1788  DEBUGCERR("");
1789  silent_cerr("line " << HP.GetLineData() << ": "
1790  "HydraulicElement(" << uLabel << ") "
1791  "already defined" << std::endl);
1792 
1794  }
1795 
1796  /* allocazione e creazione */
1798  - iNumTypes[Elem::HYDRAULIC] - 1;
1799  DofOwner* pDO = DofData[DofOwner::HYDRAULIC].pFirstDofOwner + i;
1800 
1801  pE = ReadHydraulicElem(this, HP, pDO, uLabel);
1802  if (pE != 0) {
1803  ppE = InsertElem(ElemData[Elem::HYDRAULIC], uLabel, pE);
1804  }
1805 
1806  /* attenzione: gli elementi elettrici aggiungono DofOwner
1807  * e quindi devono completare la relativa struttura */
1808 
1809  break;
1810  }
1811 
1812  /* elementi elettrici */
1813  case ELECTRIC: {
1814  silent_cout("Reading ElectricElement(" << uLabel << ( sName.empty() ? "" : ( std::string(", \"") + sName + "\"" ) ) << ")" << std::endl);
1815 
1816  if (iNumTypes[Elem::ELECTRIC]-- <= 0) {
1817  DEBUGCERR("");
1818  silent_cerr("line " << HP.GetLineData() << ": "
1819  "ElectricElement(" << uLabel << ") "
1820  "exceeds electric elements number" << std::endl);
1821 
1823  }
1824 
1825  /* verifica che non sia gia' definito */
1826  if (pFindElem(Elem::ELECTRIC, uLabel) != NULL) {
1827  DEBUGCERR("");
1828  silent_cerr("line " << HP.GetLineData() << ": "
1829  "ElectricElement(" << uLabel << ") "
1830  "already defined" << std::endl);
1831 
1833  }
1834 
1835  /* allocazione e creazione */
1837  - iNumTypes[Elem::ELECTRIC] - 1;
1838  DofOwner* pDO = DofData[DofOwner::ELECTRIC].pFirstDofOwner + i;
1839 
1840  pE = ReadElectric(this, HP, pDO, uLabel);
1841  if (pE != 0) {
1842  ppE = InsertElem(ElemData[Elem::ELECTRIC], uLabel, pE);
1843  }
1844 
1845  /* attenzione: gli elementi elettrici aggiungono DofOwner
1846  * e quindi devono completare la relativa struttura */
1847 
1848  break;
1849  }
1850 
1851  /* elementi termici */
1852  case THERMAL: {
1853  silent_cout("Reading ThermalElement(" << uLabel << ( sName.empty() ? "" : ( std::string(", \"") + sName + "\"" ) ) << ")" << std::endl);
1854 
1855  if (iNumTypes[Elem::THERMAL]-- <= 0) {
1856  DEBUGCERR("");
1857  silent_cerr("line " << HP.GetLineData() << ": "
1858  "ThermalElement(" << uLabel << ") "
1859  "exceeds thermal elements number" << std::endl);
1860 
1862  }
1863 
1864  /* verifica che non sia gia' definito */
1865  if (pFindElem(Elem::THERMAL, uLabel) != NULL) {
1866  DEBUGCERR("");
1867  silent_cerr("line " << HP.GetLineData() << ": "
1868  "ThermalElement(" << uLabel << ") "
1869  "already defined" << std::endl);
1870 
1872  }
1873 
1874  /* allocazione e creazione */
1876  - iNumTypes[Elem::THERMAL] - 1;
1877  DofOwner* pDO = DofData[DofOwner::THERMAL].pFirstDofOwner + i;
1878 
1879  pE = ReadThermal(this, HP, pDO, uLabel);
1880  if (pE != 0) {
1881  ppE = InsertElem(ElemData[Elem::THERMAL], uLabel, pE);
1882  }
1883 
1884  /* attenzione: gli elementi termici aggiungono DofOwner
1885  * e quindi devono completare la relativa struttura */
1886 
1887  break;
1888  }
1889 
1890  /* elementi bulk */
1891  case BULK: {
1892  silent_cout("Reading BulkElement(" << uLabel << ( sName.empty() ? "" : ( std::string(", \"") + sName + "\"" ) ) << ")" << std::endl);
1893 
1894  if (iNumTypes[Elem::BULK]-- <= 0) {
1895  DEBUGCERR("");
1896  silent_cerr("line " << HP.GetLineData() << ": "
1897  "BulkElement(" << uLabel << ") "
1898  "exceeds bulk elements number" << std::endl);
1899 
1901  }
1902 
1903  /* verifica che non sia gia' definito */
1904  if (pFindElem(Elem::BULK, uLabel) != NULL) {
1905  DEBUGCERR("");
1906  silent_cerr("line " << HP.GetLineData() << ": "
1907  "BulkElement(" << uLabel << ") "
1908  "already defined" << std::endl);
1909 
1911  }
1912 
1913  /* allocazione e creazione */
1914  pE = ReadBulk(this, HP, uLabel);
1915  if (pE != 0) {
1916  ppE = InsertElem(ElemData[Elem::BULK], uLabel, pE);
1917  }
1918 
1919  break;
1920  }
1921 
1922  /* elementi loadable */
1923  case USER_DEFINED:
1924  case LOADABLE: {
1925  silent_cout("Reading LoadableElement(" << uLabel << ( sName.empty() ? "" : ( std::string(", \"") + sName + "\"" ) ) << ")" << std::endl);
1926 
1927  if (iNumTypes[Elem::LOADABLE]-- <= 0) {
1928  DEBUGCERR("");
1929  silent_cerr("line " << HP.GetLineData() << ": "
1930  "LoadableElement(" << uLabel << ") "
1931  "exceeds loadable elements number" << std::endl);
1932 
1934  }
1935 
1936  /* verifica che non sia gia' definito */
1937  if (pFindElem(Elem::LOADABLE, uLabel) != NULL) {
1938  DEBUGCERR("");
1939  silent_cerr("line " << HP.GetLineData() << ": "
1940  "LoadableElement(" << uLabel << ") "
1941  "already defined" << std::endl);
1942 
1944  }
1945 
1946  /* allocazione e creazione */
1948  - iNumTypes[Elem::LOADABLE] - 1;
1949  DofOwner* pDO = DofData[DofOwner::LOADABLE].pFirstDofOwner + i;
1950 
1951  if (KeyWords(CurrType) == USER_DEFINED) {
1952  pE = ParseUserDefinedElem(uLabel, pDO, this, HP);
1953  } else {
1954  pE = ReadLoadable(this, HP, pDO, uLabel);
1955  }
1956 
1957  if (pE != 0) {
1958  ppE = InsertElem(ElemData[Elem::LOADABLE], uLabel, pE);
1959  }
1960 
1961  break;
1962  }
1963 
1964  case RTAI_OUTPUT: // deprecated
1965 #ifndef USE_RTAI
1966  silent_cout("need --with-rtai to allow RTMBDyn mailboxes; "
1967  "using stream output instead..." << std::endl);
1968 #endif /* ! USE_RTAI */
1969  /* fall thru... */
1970 
1971  case OUTPUT_ELEMENT:
1972  case SOCKETSTREAM_OUTPUT: // deprecated
1973  case SOCKETSTREAM_MOTION_OUTPUT: // deprecated
1974  {
1975  silent_cout("Reading StreamOutElem(" << uLabel << ( sName.empty() ? "" : ( std::string(", \"") + sName + "\"" ) ) << ")" << std::endl);
1976 
1977  if (iNumTypes[Elem::SOCKETSTREAM_OUTPUT]-- <= 0) {
1978  DEBUGCERR("");
1979  silent_cerr("line " << HP.GetLineData() << ": "
1980  "StreamOutElem(" << uLabel << ") "
1981  "exceeds stream output elements number" << std::endl);
1982 
1984  }
1985 
1986  /* verifica che non sia gia' definito */
1987  if (pFindElem(Elem::SOCKETSTREAM_OUTPUT, uLabel) != NULL) {
1988  DEBUGCERR("");
1989  silent_cerr("line " << HP.GetLineData() << ": "
1990  "StreamOutElem(" << uLabel << ") "
1991  "already defined" << std::endl);
1992 
1994  }
1995 
1996  /* allocazione e creazione */
1997  StreamOutElem::Type eType;
1998  StreamContent::Type sType;
1999  switch (KeyWords(CurrType)) {
2000  case RTAI_OUTPUT:
2001  case SOCKETSTREAM_OUTPUT:
2002  pedantic_cerr("SocketStreamElem(" << uLabel << "): "
2003  "deprecated in favour of 'output element: <label>, socket stream, ...' "
2004  "at line " << HP.GetLineData() << std::endl);
2006  sType = StreamContent::VALUES;
2007  break;
2008 
2010  pedantic_cerr("SocketStreamMotionElem(" << uLabel << "): "
2011  "deprecated in favour of 'output element: <label>, socket stream, motion, ...' "
2012  "at line " << HP.GetLineData() << std::endl);
2014  sType = StreamContent::MOTION;
2015  break;
2016 
2017  default:
2018  eType = StreamOutElem::UNDEFINED;
2019  sType = StreamContent::UNKNOWN;
2020  break;
2021  }
2022 
2023  pE = ReadOutputElem(this, HP, uLabel, eType, sType);
2024 
2025  if (pE != 0) {
2026  ppE = InsertElem(ElemData[Elem::SOCKETSTREAM_OUTPUT], uLabel, pE);
2027  }
2028  break;
2029  }
2030 
2031  case INERTIA: {
2032  silent_cout("Reading Inertia(" << uLabel << ( sName.empty() ? "" : ( std::string(", \"") + sName + "\"" ) ) << ")" << std::endl);
2033 
2034  Vec3 x(Zero3);
2035  if (HP.IsKeyWord("position")) {
2036  x = HP.GetPosAbs(::AbsRefFrame);
2037  }
2038 
2039  Mat3x3 R(Eye3);
2040  Mat3x3 RT(Eye3);
2041  if (HP.IsKeyWord("orientation")) {
2042  R = HP.GetRotAbs(::AbsRefFrame);
2043  RT = R.Transpose();
2044  }
2045 
2046  std::set<const ElemGravityOwner *> elements;
2047  Elem::Type Type = Elem::UNKNOWN;
2048  bool bOut(false);
2049  bool bLog(true);
2050  bool bAlways(false);
2051  while (HP.IsArg()) {
2052  if (HP.IsKeyWord("output")) {
2053  do {
2054  if (HP.IsKeyWord("no")) {
2055  bLog = false;
2056  bOut = false;
2057 
2058  } else if (HP.IsKeyWord("yes")) {
2059  bLog = false;
2060  bOut = true;
2061 
2062  } else if (HP.IsKeyWord("log")) {
2063  bLog = true;
2064  bOut = false;
2065 
2066  } else if (HP.IsKeyWord("both")) {
2067  bLog = true;
2068  bOut = true;
2069 
2070  } else if (HP.IsKeyWord("always")) {
2071  bAlways = true;
2072 
2073  } else {
2074  silent_cerr("Inertia(" << uLabel << "): "
2075  "unknown output mode "
2076  "at line " << HP.GetLineData()
2077  << std::endl);
2079  }
2080 
2081  } while(HP.IsKeyWord("output"));
2082 
2083  break;
2084 
2085  } else if (HP.IsKeyWord("body")) {
2086  Type = Elem::BODY;
2087 
2088  } else if (HP.IsKeyWord("joint")) {
2089  Type = Elem::JOINT;
2090 
2091  } else if (HP.IsKeyWord("user" "defined") || HP.IsKeyWord("loadable")) {
2092  Type = Elem::LOADABLE;
2093 
2094 #if 0
2095  } else if (HP.IsKeyWord("...")) {
2096  /* other types with inertia */
2097 #endif
2098  }
2099 
2100  if (Type == Elem::UNKNOWN) {
2101  if (!sName.empty()) {
2102  silent_cerr("Inertia(" << uLabel << ", \"" << sName << "\"): ");
2103  } else {
2104  silent_cerr("Inertia(" << uLabel << "): ");
2105  }
2106  silent_cerr("unknown or undefined element type "
2107  "at line " << HP.GetLineData() << std::endl);
2109  }
2110 
2111  /*
2112  * FIXME: duplicate check?
2113  */
2114 
2115  if (HP.IsKeyWord("all")) {
2116  for (ElemContainerType::const_iterator i = ElemData[Type].ElemContainer.begin();
2117  i != ElemData[Type].ElemContainer.end(); ++i)
2118  {
2119  ElemGravityOwner *pEl = dynamic_cast<ElemGravityOwner *>(i->second);
2120  if (pEl == 0) {
2121  silent_cerr(psElemNames[Type]
2122  << "(" << i->second->GetLabel() << "): "
2123  "not a gravity related element "
2124  "at line " << HP.GetLineData()
2125  << std::endl);
2127  }
2128 
2129  if (elements.find(pEl) != elements.end()) {
2130  silent_cerr(psElemNames[Type]
2131  << "(" << pEl->GetLabel() << "): "
2132  " duplicate label at line "
2133  << HP.GetLineData() << std::endl);
2135  }
2136  elements.insert(pEl);
2137  }
2138 
2139  } else {
2140  unsigned int uL = (unsigned int)HP.GetInt();
2141  Elem *pTmpEl = pFindElem(Type, uL);
2142  if (pTmpEl == 0) {
2143  silent_cerr("Inertia(" << uLabel << "): "
2144  "unable to find " << psElemNames[Type]
2145  << "(" << uL << ") "
2146  "at line " << HP.GetLineData() << std::endl);
2148  }
2149 
2150  ElemGravityOwner *pEl = dynamic_cast<ElemGravityOwner *>(pTmpEl);
2151  if (pEl == 0) {
2152  silent_cerr("Inertia(" << uLabel << "): "
2153  << psElemNames[Type]
2154  << "(" << uL << "): "
2155  "not a gravity related element "
2156  "at line " << HP.GetLineData()
2157  << std::endl);
2159  }
2160 
2161  if (elements.find(pEl) != elements.end()) {
2162  silent_cerr("Inertia(" << uLabel << "): "
2163  << psElemNames[Type] << "(" << uL << ") "
2164  "is duplicate at line " << HP.GetLineData()
2165  << std::endl);
2167  }
2168 
2169  elements.insert(pEl);
2170  }
2171  } /* end while (HP.IsArg()) */
2172 
2173  flag fOut = fReadOutput(HP, Elem::BODY);
2174  if (bLog) {
2175  fOut |= Inertia::OUTPUT_LOG; // was 0x2
2176  }
2177  if (bOut) {
2178  fOut |= Inertia::OUTPUT_OUT; // was 0x4
2179  }
2180  if (bAlways) {
2181  if (iNumTypes[Elem::INERTIA]-- <= 0) {
2182  DEBUGCERR("");
2183  silent_cerr("line " << HP.GetLineData() << ": "
2184  "Inertia(" << uLabel << ") "
2185  "exceeds inertia elements number" << std::endl);
2186 
2188  }
2189 
2190  /* verifica che non sia gia' definito */
2191  if (pFindElem(Elem::INERTIA, uLabel) != NULL) {
2192  DEBUGCERR("");
2193  silent_cerr("line " << HP.GetLineData() << ": "
2194  "Inertia(" << uLabel << ") "
2195  "already defined" << std::endl);
2196 
2198  }
2199 
2200  fOut |= Inertia::OUTPUT_ALWAYS; // was 0x8
2201  }
2202 
2203 
2205  Inertia(uLabel, sName, elements, x, R, OutHdl.Log(), fOut));
2206  if (pE != 0) {
2207  if (bAlways) {
2208  ppE = InsertElem(ElemData[Elem::INERTIA], uLabel, pE);
2209  } else {
2210  SAFEDELETE(pE);
2211  pE = 0;
2212  }
2213  }
2214 
2215  break;
2216  }
2217 
2218  /* In case the element type is not correct */
2219  default:
2220  silent_cerr("You shouldn't be here" << std::endl);
2221 
2223  }
2224 
2225  /* Ritorna il puntatore al puntatore all'elemento appena costruito */
2226  return ppE;
2227 }
Definition: hint.h:38
flag fReadOutput(MBDynParser &HP, const T &t) const
Definition: dataman.h:1064
Elem * ReadJointRegularization(DataManager *pDM, MBDynParser &HP, unsigned int uLabel)
Definition: jointreg.cc:527
Elem * ReadGravity(DataManager *pDM, MBDynParser &HP)
Definition: gravity.cc:237
ElemVecType Elems
Definition: dataman.h:609
void PutName(const std::string &sN)
Definition: withlab.cc:56
Elem * ReadAerodynamicBeam(DataManager *pDM, MBDynParser &HP, const DofOwner *pDO, unsigned int uLabel)
Definition: aeroelem.cc:2268
virtual StructDispNode::Type GetStructDispNodeType(void) const
Definition: strnode.cc:1101
void module_initialize(void)
Definition: modules.cc:44
ElemContainerType ElemContainer
Definition: dataman.h:591
const Vec3 Zero3(0., 0., 0.)
long int flag
Definition: mbdyn.h:43
Elem * ReadShell4EASANS(DataManager *pDM, MBDynParser &HP, const DofOwner *pDO, unsigned int uLabel)
Definition: shelleasans.cc:869
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
Elem * ReadAerodynamicModal(DataManager *pDM, MBDynParser &HP, const DofOwner *pDO, unsigned int uLabel)
Definition: aeromodal.cc:612
Definition: matvec3.h:98
#define DEBUGCOUTFNAME(fname)
Definition: myassert.h:256
void PutGravity(const Gravity *pG)
Definition: gravity.cc:201
Elem * ReadOutputElem(DataManager *pDM, MBDynParser &HP, unsigned int uLabel, StreamOutElem::Type eType, StreamContent::Type sType)
virtual integer GetInt(integer iDefval=0)
Definition: parser.cc:1050
void Init(const Vec3 &b, const Vec3 &bp)
Definition: autostr.cc:69
Mat3x3 GetRotAbs(const ReferenceFrame &rf)
Definition: mbpar.cc:1857
Elem ** InsertElem(ElemDataStructure &eldata, unsigned int uLabel, Elem *pE)
Definition: dataman.h:595
virtual Hint * ParseHint(DataManager *pDM, const char *s) const
Definition: simentity.cc:76
virtual void PutAirProperties(const AirProperties *pAP)
Definition: aerodyn.cc:717
OutputHandler OutHdl
Definition: dataman.h:105
virtual unsigned int iGetPrivDataIdx(const char *s) const
Definition: simentity.cc:142
Gust * ReadGustData(const DataManager *pDM, MBDynParser &HP)
Definition: gust.cc:190
Elem * ReadAircraftInstruments(DataManager *pDM, MBDynParser &HP, const DofOwner *pDO, unsigned int uLabel)
Definition: instruments.cc:268
#define ASSERTMSG(expr, msg)
Definition: myassert.h:219
const Mat3x3 Eye3(1., 0., 0., 0., 1., 0., 0., 0., 1.)
#define DEBUGCERR(msg)
Definition: myassert.h:235
#define NO_OP
Definition: myassert.h:74
virtual Elem::Type GetElemType(void) const =0
Elem * ReadMembrane4EAS(DataManager *pDM, MBDynParser &HP, const DofOwner *pDO, unsigned int uLabel)
Definition: membraneeas.cc:594
Elem * ReadJoint(DataManager *pDM, MBDynParser &HP, const DofOwner *pDO, unsigned int uLabel)
Definition: joint.cc:187
Elem * ReadShell4EAS(DataManager *pDM, MBDynParser &HP, const DofOwner *pDO, unsigned int uLabel)
Definition: shelleas.cc:1272
std::vector< Hint * > Hints
Definition: simentity.h:89
Elem * ReadThermal(DataManager *pDM, MBDynParser &HP, const DofOwner *pDO, unsigned int uLabel)
Definition: therm.cc:82
Elem * ReadLoadable(DataManager *pDM, MBDynParser &HP, const DofOwner *pDO, unsigned int uLabel)
Definition: userelem.cc:87
Definition: dataman4.cc:96
NodeContainerType NodeContainer
Definition: dataman.h:731
Elem * ReadHydraulicElem(DataManager *pDM, MBDynParser &HP, const DofOwner *pDO, unsigned int uLabel)
Definition: preselem.cc:93
Elem * ReadAirProperties(DataManager *pDM, MBDynParser &HP)
Definition: aerodyn.cc:521
virtual void ExpectDescription(void)
Definition: parser.cc:789
Elem * ReadBody(DataManager *pDM, MBDynParser &HP, unsigned int uLabel)
Definition: body.cc:1937
Elem * ReadForce(DataManager *pDM, MBDynParser &HP, unsigned int uLabel, bool bCouple)
Definition: force.cc:246
Elem * pFindElem(Elem::Type Typ, unsigned int uElem, unsigned int iDeriv) const
Definition: elman.cc:650
const ReferenceFrame AbsRefFrame(0, Vec3(0., 0., 0), Mat3x3(1., 0., 0., 0., 1., 0., 0., 0., 1.), Vec3(0., 0., 0), Vec3(0., 0., 0), EULER_123)
Elem * ReadBeam2(DataManager *pDM, MBDynParser &HP, unsigned int uLabel)
Definition: beam2.cc:1329
virtual bool IsKeyWord(const char *sKeyWord)
Definition: parser.cc:910
virtual void Bind(const Elem *pEl, unsigned int i)
Definition: j2p.cc:53
int GetDescription(void)
Definition: parser.cc:730
struct DataManager::NodeDataStructure NodeData[Node::LASTNODETYPE]
#define DEBUGCOUT(msg)
Definition: myassert.h:232
Vec3 GetPosAbs(const ReferenceFrame &rf)
Definition: mbpar.cc:1401
virtual const char * GetStringWithDelims(enum Delims Del=DEFAULTDELIM, bool escape=true)
Definition: parser.cc:1228
void ReadElems(MBDynParser &HP)
Definition: dataman4.cc:157
Elem * ReadAerodynamicBody(DataManager *pDM, MBDynParser &HP, const DofOwner *pDO, unsigned int uLabel)
Definition: aeroelem.cc:1361
#define ASSERT(expression)
Definition: colamd.c:977
Elem ** ppFindElem(Elem::Type Typ, unsigned int uElem) const
Definition: elman.cc:629
Elem * ReadRotor(DataManager *pDM, MBDynParser &HP, const DofOwner *pDO, unsigned int uLabel)
Definition: rotor.cc:2573
KeyWords
Definition: dataman4.cc:94
#define SAFENEWWITHCONSTRUCTOR(pnt, item, constructor)
Definition: mynewmem.h:698
Elem * ReadAerodynamicBeam2(DataManager *pDM, MBDynParser &HP, const DofOwner *pDO, unsigned int uLabel)
Definition: aeroelem.cc:3167
static int iNumTypes[Elem::LASTELEMTYPE]
Definition: dataman4.cc:91
void Init(const Vec3 &b, const Vec3 &g, const Vec3 &bp, const Vec3 &gp)
Definition: autostr.cc:428
Elem * ReadElectric(DataManager *pDM, MBDynParser &HP, const DofOwner *pDO, unsigned int uLabel)
Definition: elec.cc:156
Elem ** ReadOneElem(MBDynParser &HP, unsigned int uLabel, const std::string &sName, int CurrType)
Definition: dataman4.cc:1255
virtual unsigned int iGetNumPrivData(void) const
Definition: simentity.cc:136
Vec3 GetVecAbs(const ReferenceFrame &rf)
Definition: mbpar.cc:1641
Mat3x3 Transpose(void) const
Definition: matvec3.h:816
Definition: j2p.h:40
virtual bool IsArg(void)
Definition: parser.cc:807
Definition: elem.h:75
Type
Definition: elem.h:91
const char * psElemNames[]
Definition: enums.cc:39
virtual int GetWord(void)
Definition: parser.cc:1083
Elem * ReadGenel(DataManager *pDM, MBDynParser &HP, const DofOwner *pDO, unsigned int uLabel)
Definition: genel.cc:71
Elem * ReadBulk(DataManager *pDM, MBDynParser &HP, unsigned int uLabel)
Definition: bulk.cc:39
Elem * ReadHBeam(DataManager *pDM, MBDynParser &HP, unsigned int uLabel)
Definition: hbeam.cc:1091
std::ostream & Log(void) const
Definition: output.h:541
Elem * ReadBeam(DataManager *pDM, MBDynParser &HP, unsigned int uLabel)
Definition: beam.cc:1876
DriveCaller * GetDriveCaller(bool bDeferred=false)
Definition: mbpar.cc:2033
Elem * ReadGenericAerodynamicForce(DataManager *pDM, MBDynParser &HP, unsigned int uLabel)
void OutputOpen(const OutputHandler::OutFiles out)
Definition: dataman.cc:677
virtual void SetOutputFlag(flag f=flag(1))
Definition: output.cc:896
struct DataManager::@30 DofData[DofOwner::LASTDOFTYPE]
const std::string & GetName(void) const
Definition: withlab.cc:68
virtual HighParser::ErrOut GetLineData(void) const
Definition: parsinc.cc:697
virtual StructNode::Type GetStructNodeType(void) const
Definition: strnode.cc:2946
unsigned int GetLabel(void) const
Definition: withlab.cc:62
struct DataManager::ElemDataStructure ElemData[Elem::LASTELEMTYPE]
#define DEBUGLCOUT(level, msg)
Definition: myassert.h:244
Mat3x3 R
UserDefinedElem * ParseUserDefinedElem(unsigned uLabel, DofOwner *pDO, DataManager *const pDM, MBDynParser &HP)
Definition: userelem.cc:61
#define SAFEDELETE(pnt)
Definition: mynewmem.h:710