MBDyn-1.7.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
elman.cc
Go to the documentation of this file.
1 /* $Header: /var/cvs/mbdyn/mbdyn/mbdyn-1.0/mbdyn/base/elman.cc,v 1.95 2017/01/12 14:46:09 masarati Exp $ */
2 /*
3  * MBDyn (C) is a multibody analysis code.
4  * http://www.mbdyn.org
5  *
6  * Copyright (C) 1996-2017
7  *
8  * Pierangelo Masarati <masarati@aero.polimi.it>
9  * Paolo Mantegazza <mantegazza@aero.polimi.it>
10  *
11  * Dipartimento di Ingegneria Aerospaziale - Politecnico di Milano
12  * via La Masa, 34 - 20156 Milano, Italy
13  * http://www.aero.polimi.it
14  *
15  * Changing this copyright notice is forbidden.
16  *
17  * This program is free software; you can redistribute it and/or modify
18  * it under the terms of the GNU General Public License as published by
19  * the Free Software Foundation (version 2 of the License).
20  *
21  *
22  * This program is distributed in the hope that it will be useful,
23  * but WITHOUT ANY WARRANTY; without even the implied warranty of
24  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25  * GNU General Public License for more details.
26  *
27  * You should have received a copy of the GNU General Public License
28  * along with this program; if not, write to the Free Software
29  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30  */
31 
32 /* ElementManager */
33 
34 #include "mbconfig.h" /* This goes first in every *.c,*.cc file */
35 
36 #include <limits>
37 
38 #include "dataman.h"
39 #include "search.h"
40 #include "gravity.h"
41 #include "aerodyn.h"
42 #include "driven.h"
43 
44 #include "aeroelem.h"
45 #include "beam.h"
46 
47 /* DataManager - begin */
48 
49 /* costruttore: resetta i dati */
50 void
52 {
53  /* Reset della struttura ElemData */
54  for (int i = 0; i < Elem::LASTELEMTYPE; i++) {
55  ElemData[i].iExpectedNum = 0;
57  ElemData[i].uFlags = 0U;
58  ElemData[i].DefaultOut(::fDefaultOut == 1); /* Da "output.h" */
59  ElemData[i].OutFile = OutputHandler::UNKNOWN; /* "output.h" */
60  ElemData[i].uOutputFlags = 0U;
61  ElemData[i].od = EULER_123;
62  }
63 
64  /* Add dof type */
76 
77  /* Add file type */
79  ElemData[Elem::AUTOMATICSTRUCTURAL].Desc = "AutomaticStructural";
81 
83  ElemData[Elem::JOINT].Desc = "Joint";
84  ElemData[Elem::JOINT].ShortDesc = "joint";
85 
87  ElemData[Elem::FORCE].Desc = "Force";
88  ElemData[Elem::FORCE].ShortDesc = "force";
89 
91  ElemData[Elem::BEAM].Desc = "Beam";
92  ElemData[Elem::BEAM].ShortDesc = "beam";
94 
96  ElemData[Elem::PLATE].Desc = "Plate";
97  ElemData[Elem::PLATE].ShortDesc = "plate";
98 
100  ElemData[Elem::AIRPROPERTIES].Desc = "AirProperties";
101  ElemData[Elem::AIRPROPERTIES].ShortDesc = "airprops";
102 
104  ElemData[Elem::GRAVITY].Desc = "Gravity";
105  ElemData[Elem::GRAVITY].ShortDesc = "gravity";
107 
109  ElemData[Elem::INDUCEDVELOCITY].Desc = "InducedVelocity";
111 
113  ElemData[Elem::AEROMODAL].Desc = "AerodynamicModal";
114  ElemData[Elem::AEROMODAL].ShortDesc = "aeromodal";
115 
117  ElemData[Elem::AERODYNAMIC].Desc = "Aerodynamic";
120 
122  ElemData[Elem::HYDRAULIC].Desc = "Hydraulic";
124 
126  ElemData[Elem::LOADABLE].Desc = "Loadable";
127  ElemData[Elem::LOADABLE].ShortDesc = "loadable";
128 
130  ElemData[Elem::GENEL].Desc = "Genel";
131  ElemData[Elem::GENEL].ShortDesc = "genel";
132 
134  ElemData[Elem::EXTERNAL].Desc = "External";
136 
138  ElemData[Elem::THERMAL].Desc = "Thermal";
139  ElemData[Elem::THERMAL].ShortDesc = "thermal";
140 
141  /* Inheritance scheme */
161 
162  /* Types that must be unique */
165 
166  /* Types that are used by default in initial assembly */
171 
172  /* Aggiungere qui se un tipo genera forze d'inerzia e quindi
173  * deve essere collegato all'elemento accelerazione di gravita' */
178 
179  /* Aggiungere qui se un tipo usa le proprieta' dell'aria e quindi
180  * deve essere collegato all'elemento proprieta' dell'aria */
186 
187  /* Reset della struttura DriveData */
188  for (int i = 0; i < Drive::LASTDRIVETYPE; i++) {
189  DriveData[i].ppFirstDrive = NULL;
190  DriveData[i].iNum = 0;
191  }
192 }
193 
194 /* distruttore */
195 void
197 {
198  DEBUGCOUT("Entering DataManager::ElemManagerDestructor()" << std::endl);
199 
200  /* Distruzione matrici di lavoro per assemblaggio */
201  if (pWorkMatB != NULL) {
202  DEBUGCOUT("deleting assembly structure, SubMatrix B" << std::endl);
204  }
205 
206  if (pWorkMatA != NULL) {
207  DEBUGCOUT("deleting assembly structure, SubMatrix A" << std::endl);
209  }
210 
211  if (pWorkVec != NULL) {
212  DEBUGCOUT("deleting assembly structure, SubVector" << std::endl);
214  }
215 
216  for (ElemVecType::iterator p = Elems.begin(); p != Elems.end(); ++p) {
217  DEBUGCOUT("deleting element "
218  << psElemNames[(*p)->GetElemType()]
219  << "(" << (*p)->GetLabel() << ")"
220  << std::endl);
221  SAFEDELETE(*p);
222  }
223 
224  /* Distruzione drivers */
225  if (ppDrive != NULL) {
226  Drive** pp = ppDrive;
227  while (pp < ppDrive+iTotDrive) {
228  if (*pp != NULL) {
229  DEBUGCOUT("deleting driver "
230  << (*pp)->GetLabel()
231  << ", type "
232  << psDriveNames[(*pp)->GetDriveType()]
233  << std::endl);
234  SAFEDELETE(*pp);
235  }
236  pp++;
237  }
238 
239  DEBUGCOUT("deleting drivers structure" << std::endl);
241  }
242 }
243 
244 
245 /* Inizializza la struttura dei dati degli elementi ed alloca
246  * l'array degli elementi */
247 void
249 {
250  unsigned iTotElem = 0;
251 
252  /* struttura degli elementi */
253  for (int iCnt = 0; iCnt < Elem::LASTELEMTYPE; iCnt++) {
254  iTotElem += ElemData[iCnt].iExpectedNum;
255  }
256 
257  DEBUGCOUT("iTotElem = " << iTotElem << std::endl);
258 
259  /* FIXME: reverse this:
260  * - read and populate ElemData[iCnt].ElemContainer first
261  * - then create Elems and fill it with Elem*
262  */
263  if (iTotElem > 0) {
264  Elems.resize(iTotElem);
265 
266  /* Inizializza l'iteratore degli elementi usato all'interno
267  * dell'ElemManager */
268  ElemIter.Init(&Elems[0], iTotElem);
269 
270  for (unsigned iCnt = 0; iCnt < iTotElem; iCnt++) {
271  Elems[iCnt] = 0;
272  }
273 
274  } else {
275  silent_cerr("warning, no elements are defined" << std::endl);
276  }
277 
278  /* struttura dei drivers */
279  for (int iCnt = 0; iCnt < Drive::LASTDRIVETYPE; iCnt++) {
280  iTotDrive += DriveData[iCnt].iNum;
281  }
282 
283  DEBUGCOUT("iTotDrive = " << iTotDrive << std::endl);
284 
285  if (iTotDrive > 0) {
287 
288  /* Puo' essere sostituito con un opportuno iteratore: */
289 #if 0
290  VecIter<Drive*> DriveIter(ppDrive, iTotDrive);
291  Drive* pTmp = NULL;
292  if (DriveIter.bGetFirst(pTmp)) {
293  do {
294  pTmp = NULL;
295  } while (DriveIter.bGetNext(pTmp));
296  }
297 #endif
298 
299  Drive** ppTmp = ppDrive;
300  while (ppTmp < ppDrive + iTotDrive) {
301  *ppTmp++ = NULL;
302  }
303 
304  DriveData[0].ppFirstDrive = ppDrive;
305  for (int iCnt = 0; iCnt < Drive::LASTDRIVETYPE-1; iCnt++) {
306  DriveData[iCnt+1].ppFirstDrive =
307  DriveData[iCnt].ppFirstDrive +
308  DriveData[iCnt].iNum;
309  }
310 
311  } else {
312  DEBUGCERR("warning, no drivers are defined" << std::endl);
313  }
314 }
315 
316 /* Prepara per l'assemblaggio */
317 void
319 {
320  Elem* pE = 0;
321  if (ElemIter.bGetFirst(pE)) {
322  do {
323  /* Aggiorna le dimensioni massime degli spazi di lavoro */
324  integer iNumRows = 0;
325  integer iNumCols = 0;
326 
327  pE->WorkSpaceDim(&iNumRows, &iNumCols);
328 
329  if (iNumRows >= 0) {
330  // Assume a full Jacobian matrix
331  if (iNumRows > iMaxWorkNumRowsJac) {
332  iMaxWorkNumRowsJac = iNumRows;
333  DEBUGLCOUT(MYDEBUG_INIT, "Current max work rows number: "
334  << iMaxWorkNumRowsJac << std::endl);
335  }
336 
337  if (iNumCols > iMaxWorkNumColsJac) {
338  iMaxWorkNumColsJac = iNumCols;
339  DEBUGLCOUT(MYDEBUG_INIT, "Current max work cols number: "
340  << iMaxWorkNumColsJac << std::endl);
341  }
342  } else {
343  // Assume a sparse Jacobian matrix
344  iNumRows = std::abs(iNumRows);
345  }
346 
347  const integer iNumItems = iNumRows * iNumCols;
348 
349  if (iNumItems > iMaxWorkNumItemsJac) {
350  iMaxWorkNumItemsJac = iNumItems;
351  }
352 
353  if (iNumRows > iMaxWorkNumRowsRes) {
354  iMaxWorkNumRowsRes = iNumRows;
355  }
356 
357  } while (ElemIter.bGetNext(pE));
358  }
359 
364 
365  /* SubMatrixHandlers */
371 
377 
379 
383 
384  DEBUGCOUT("Creating working matrices:" << iMaxWorkNumRowsJac
385  << " x " << iMaxWorkNumColsJac << std::endl);
386 }
387 
388 /* Assemblaggio dello jacobiano.
389  * Di questa routine e' molto importante l'efficienza, quindi vanno valutate
390  * correttamente le opzioni. */
391 void
393 {
394  DEBUGCOUT("Entering DataManager::AssJac()" << std::endl);
395 
396  ASSERT(pWorkMat != NULL);
397  ASSERT(Elems.begin() != Elems.end());
398 
399  AssJac(JacHdl, dCoef, ElemIter, *pWorkMat);
400 }
401 
402 void
405  VariableSubMatrixHandler& WorkMat)
406 {
407  DEBUGCOUT("Entering DataManager::AssJac()" << std::endl);
408 
409  JacHdl.Reset();
410 
411 #if 0
412  for (int r = 1; r <= JacHdl.iGetNumRows(); r++) {
413  for (int c = 1; c <= JacHdl.iGetNumCols(); c++) {
414  if (JacHdl(r, c) != 0.) {
415  silent_cerr("JacHdl(" << r << "," << c << ")="
416  << JacHdl(r, c) << std::endl);
417  }
418  JacHdl(r, c) = std::numeric_limits<doublereal>::epsilon();
419  }
420  }
421 #endif
422 
423  Elem* pTmpEl = NULL;
424  if (Iter.bGetFirst(pTmpEl)) {
425  do {
426  try {
427  JacHdl += pTmpEl->AssJac(WorkMat, dCoef,
428  *pXCurr, *pXPrimeCurr);
429  }
430  catch (ErrDivideByZero) {
431  silent_cerr("AssJac: divide by zero "
432  "in " << psElemNames[pTmpEl->GetElemType()]
433  << "(" << pTmpEl->GetLabel() << ")"
434  << std::endl);
436  }
437 
438 #if 0
439  silent_cerr("### " << psElemNames[pTmpEl->GetElemType()] << "(" << pTmpEl->GetLabel() <<"):" << std::endl);
440  silent_cerr(JacHdl << std::endl);
441 #endif
442  } while (Iter.bGetNext(pTmpEl));
443  }
444 }
445 
446 void
448 {
449  DEBUGCOUT("Entering DataManager::AssMats()" << std::endl);
450 
451  ASSERT(pWorkMatA != NULL);
452  ASSERT(pWorkMatB != NULL);
453  ASSERT(Elems.begin() != Elems.end());
454 
455  AssMats(A_Hdl, B_Hdl, ElemIter, *pWorkMatA, *pWorkMatB);
456 }
457 
458 void
461  VariableSubMatrixHandler& WorkMatA,
462  VariableSubMatrixHandler& WorkMatB)
463 {
464  DEBUGCOUT("Entering DataManager::AssMats()" << std::endl);
465 
466  /* Versione con iteratore: */
467  Elem* pTmpEl = NULL;
468  if (Iter.bGetFirst(pTmpEl)) {
469  /* Nuova versione, piu' compatta.
470  * La funzione propria AssJac, comune a tutti gli elementi,
471  * scrive nella WorkMat (passata come reference) il contributo
472  * dell'elemento allo jacobiano e restituisce un reference
473  * alla workmat stessa, che viene quindi sommata allo jacobiano.
474  * Ogni elemento deve provvedere al resizing della WorkMat e al
475  * suo reset ove occorra */
476 
477  /* il SubMatrixHandler e' stato modificato in modo da essere
478  * in grado di trasformarsi agevolmente da Full a Sparse
479  * e quindi viene gestito in modo automatico, e del tutto
480  * trasparente, il passaggio da un modo all'altro.
481  * L'elemento switcha la matrice nel modo che ritiene
482  * opportuno; l'operatore += capisce di quale matrice
483  * si sta occupando ed agisce di conseguenza.
484  */
485 
486  /* Con VariableSubMatrixHandler */
487  do {
488  pTmpEl->AssMats(WorkMatA, WorkMatB,
489  *pXCurr, *pXPrimeCurr);
490  A_Hdl += WorkMatA;
491  B_Hdl += WorkMatB;
492  } while (Iter.bGetNext(pTmpEl));
493  }
494 }
495 
496 /* Assemblaggio del residuo */
497 void
499 {
500  DEBUGCOUT("Entering AssRes()" << std::endl);
501 
502  AssRes(ResHdl, dCoef, ElemIter, *pWorkVec);
503 }
504 
505 void
508  SubVectorHandler& WorkVec)
509 {
510  DEBUGCOUT("Entering AssRes()" << std::endl);
511 
512  Elem* pTmpEl = NULL;
513  bool ChangedEqStructure(false);
514  if (Iter.bGetFirst(pTmpEl)) {
515  do {
516  try {
517  ResHdl += pTmpEl->AssRes(WorkVec, dCoef,
518  *pXCurr, *pXPrimeCurr);
519  }
521  ResHdl += WorkVec;
522  ChangedEqStructure = true;
523  }
524  catch (ErrDivideByZero) {
525  silent_cerr("AssRes: divide by zero "
526  "in " << psElemNames[pTmpEl->GetElemType()]
527  << "(" << pTmpEl->GetLabel() << ")"
528  << std::endl);
530  }
531 
532 #if 0
533  silent_cerr("### " << psElemNames[pTmpEl->GetElemType()] << "(" << pTmpEl->GetLabel() <<"):" << std::endl);
534  PrintResidual(ResHdl, -1);
535 #endif
536 
537  } while (Iter.bGetNext(pTmpEl));
538  }
539  if (ChangedEqStructure) {
541  }
542 }
543 
544 void
546 {
547 #ifdef USE_NETCDF
548  for (unsigned et = 0; et < Elem::LASTELEMTYPE; et++) {
549  if (ElemData[et].ElemContainer.size() && OH.UseNetCDF(ElemData[et].OutFile)) {
551  ASSERT(ElemData[et].Desc != 0);
552  ASSERT(ElemData[et].ShortDesc != 0);
553 
554  integer iNumElems = ElemData[et].ElemContainer.size();
555 
556  OutputHandler::AttrValVec attrs(1);
557  attrs[0] = OutputHandler::AttrVal("description", std::string(ElemData[et].Desc) + " elements labels");
558 
559  OutputHandler::NcDimVec dim(1);
560  dim[0] = OH.CreateDim(std::string(ElemData[et].ShortDesc) + "_elem_labels_dim", iNumElems);
561 
562  NcVar *VarLabels = OH.CreateVar(std::string("elem.") + ElemData[et].ShortDesc, ncInt, attrs, dim);
563 
564  ElemContainerType::const_iterator p = ElemData[et].ElemContainer.begin();
565  for (unsigned i = 0; i < unsigned(iNumElems); i++, p++) {
566  VarLabels->set_cur(i);
567  const long l = p->second->GetLabel();
568  VarLabels->put(&l, 1);
569  }
570  }
571  }
572 #endif // USE_NETCDF
573 
574  Elem* pTmpEl = 0;
575  if (ElemIter.bGetFirst(pTmpEl)) {
576  do {
577  pTmpEl->OutputPrepare(OH);
578  } while (ElemIter.bGetNext(pTmpEl));
579  }
580 }
581 
582 void
584 {
585  Elem* pTmpEl = NULL;
586 
587  if (ElemIter.bGetFirst(pTmpEl)) {
588  do {
589  pTmpEl->Output(OH);
590  } while (ElemIter.bGetNext(pTmpEl));
591  }
592 }
593 
594 void
596  const VectorHandler& XP) const
597 {
598  Elem* pTmpEl = NULL;
599 
600  if (ElemIter.bGetFirst(pTmpEl)) {
601  do {
602  pTmpEl->Output(OH, X, XP);
603  } while (ElemIter.bGetNext(pTmpEl));
604  }
605 }
606 
607 /* cerca un elemento qualsiasi */
608 Elem *
609 DataManager::pFindElem(Elem::Type Typ, unsigned int uL) const
610 {
611  if (ElemData[Typ].bIsUnique() && uL == (unsigned)(-1)) {
612  if (!ElemData[Typ].ElemMapToList.empty()) {
613  return ElemData[Typ].ElemMapToList.begin()->second->second;
614  }
615  return 0;
616  }
617 
618  ElemMapToListType::const_iterator p = ElemData[Typ].ElemMapToList.find(uL);
619  if (p == ElemData[Typ].ElemMapToList.end()) {
620  return 0;
621  }
622 
623  return p->second->second;
624 }
625 
626 
627 /* cerca un elemento qualsiasi */
628 Elem **
629 DataManager::ppFindElem(Elem::Type Typ, unsigned int uL) const
630 {
631  if (ElemData[Typ].bIsUnique() && uL == (unsigned)(-1)) {
632  if (!ElemData[Typ].ElemMapToList.empty()) {
633  return &ElemData[Typ].ElemMapToList.begin()->second->second;
634  }
635  return 0;
636  }
637 
638  ASSERT(uL > 0);
639 
640  ElemMapToListType::const_iterator p = ElemData[Typ].ElemMapToList.find(uL);
641  if (p == ElemData[Typ].ElemMapToList.end()) {
642  return 0;
643  }
644 
645  return const_cast<Elem **>(&p->second->second);
646 }
647 
648 /* cerca un elemento qualsiasi */
649 Elem *
650 DataManager::pFindElem(Elem::Type Typ, unsigned int uL,
651  unsigned int iDeriv) const
652 {
653  ASSERT(iDeriv == int(ELEM) || ElemData[Typ].iDerivation & iDeriv);
654 
655  if (ElemData[Typ].bIsUnique() && uL == (unsigned)(-1)) {
656  if (!ElemData[Typ].ElemMapToList.empty()) {
657  return pChooseElem(ElemData[Typ].ElemMapToList.begin()->second->second, iDeriv);
658  }
659  return 0;
660  }
661 
662  ASSERT(uL > 0);
663 
664  ElemMapToListType::const_iterator p = ElemData[Typ].ElemMapToList.find(uL);
665  if (p == ElemData[Typ].ElemMapToList.end()) {
666  return 0;
667  }
668 
669  return pChooseElem(p->second->second, iDeriv);
670 }
671 
672 /* Usata dalle due funzioni precedenti */
673 Elem *
674 DataManager::pChooseElem(Elem* p, unsigned int iDeriv) const
675 {
676  ASSERT(p != NULL);
677 
678  switch (iDeriv) {
679  case ELEM:
680  return p;
681 
682  case DOFOWNER:
683  ASSERT(dynamic_cast<ElemWithDofs *>(p) != NULL);
684  return p;
685 
686  case GRAVITYOWNER:
687  ASSERT(dynamic_cast<ElemGravityOwner *>(p) != NULL);
688  return p;
689 
690  case AIRPROPOWNER:
691  ASSERT(dynamic_cast<AerodynamicElem *>(p) != NULL);
692  return p;
693 
694  case INITIALASSEMBLY:
695  ASSERT(dynamic_cast<InitialAssemblyElem *>(p) != NULL);
696  return p;
697  }
698 
699  /* default */
700  return NULL;
701 }
702 
703 /* cerca un drive qualsiasi */
704 Drive *
705 DataManager::pFindDrive(Drive::Type Typ, unsigned int uL) const
706 {
707  ASSERT(uL > 0);
708 
709  if (DriveData[Typ].iNum == 0) {
710  silent_cerr("FileDrive(" << uL << "): "
711  "no file drivers defined" << std::endl);
712  return 0;
713  }
714 
715  if (DriveData[Typ].ppFirstDrive == 0) {
716  silent_cerr("FileDrive(" << uL << "): "
717  "file drivers can only be dereferenced "
718  "after the \"drivers\" block" << std::endl);
719  return 0;
720  }
721 
722  return pLabelSearch(DriveData[Typ].ppFirstDrive, DriveData[Typ].iNum, uL);
723 }
724 
725 
726 flag
728 {
729  return ElemData[t].bDefaultOut();
730 }
731 
732 /* DataManager - end */
733 
734 
735 /* InitialAssemblyIterator - begin */
736 
739 : pElemData(pED),
740 m_FirstType(Elem::UNKNOWN),
741 m_CurrType(Elem::UNKNOWN)
742 {
743  int iCnt = 0;
744 
745  while (!(*pElemData)[iCnt].bToBeUsedInAssembly()
746  || (*pElemData)[iCnt].ElemContainer.empty())
747  {
748  if (++iCnt >= Elem::LASTELEMTYPE) {
749  break;
750  }
751  }
752 
753  // NOTE: this fails if by chance there's no element
754  // that participates in initial assembly
755  ASSERT(iCnt < Elem::LASTELEMTYPE);
756  ASSERT((*pElemData)[iCnt].ElemContainer.begin() != (*pElemData)[iCnt].ElemContainer.end());
757 
759  m_CurrElem = (*pElemData)[m_FirstType].ElemContainer.begin();
760 }
761 
764 {
765  // FIXME: this should not happen: if there are no elements
766  // that need initial assembly, we shouldn't get here in the
767  // first place
770  }
771 
773  m_CurrElem = (*pElemData)[m_FirstType].ElemContainer.begin();
774 
775  /* La variabile temporanea e' necessaria per il debug. */
776  InitialAssemblyElem* p = dynamic_cast<InitialAssemblyElem *>(m_CurrElem->second);
777  if (p == 0) {
778  DrivenElem *pDE = dynamic_cast<DrivenElem *>(m_CurrElem->second);
779  if (pDE != 0) {
780  p = dynamic_cast<InitialAssemblyElem *>(pDE->pGetElem());
781  }
782  if (p == 0) {
783  p = GetNext();
784  }
785  }
786 
787  return p;
788 }
789 
792 {
793  InitialAssemblyElem* p = 0;
794  do {
795  ++m_CurrElem;
796  if (m_CurrElem == (*pElemData)[m_CurrType].ElemContainer.end()) {
797  int iCnt = int(m_CurrType);
798 
799  do {
800  if (++iCnt >= Elem::LASTELEMTYPE) {
801  return 0;
802  }
803  } while (!(*pElemData)[iCnt].bToBeUsedInAssembly()
804  || (*pElemData)[iCnt].ElemContainer.empty());
805 
806  ASSERT((*pElemData)[iCnt].ElemContainer.begin() != (*pElemData)[iCnt].ElemContainer.end());
807  m_CurrType = Elem::Type(iCnt);
808  m_CurrElem = (*pElemData)[iCnt].ElemContainer.begin();
809  }
810 
811  /* La variabile temporanea e' necessaria per il debug. */
812  p = dynamic_cast<InitialAssemblyElem *>(m_CurrElem->second);
813 
814  if (p == 0) {
815  DrivenElem *pDE = dynamic_cast<DrivenElem *>(m_CurrElem->second);
816  if (pDE != 0) {
817  p = dynamic_cast<InitialAssemblyElem *>(pDE->pGetElem());
818  }
819  }
820 
821 #ifdef DEBUG
822  if (p == 0) {
823  silent_cerr(psElemNames[m_CurrElem->second->GetElemType()]
824  << "(" << m_CurrElem->second->GetLabel() << ")"
825  " is not subjected to initial assembly"
826  << std::endl);
827  }
828 #endif
829  } while (p == 0);
830 
831  return p;
832 }
833 
834 /* InitialAssemblyIterator - end */
835 
integer iMaxWorkNumItemsJac
Definition: dataman.h:628
ElemVecType Elems
Definition: dataman.h:609
Drive * pFindDrive(Drive::Type Typ, unsigned int uL) const
Definition: elman.cc:705
ElemContainerType ElemContainer
Definition: dataman.h:591
const flag fDefaultOut
Definition: output.h:639
virtual integer iGetNumCols(void) const =0
NcBool set_cur(long c0=-1, long c1=-1, long c2=-1, long c3=-1, long c4=-1)
VariableSubMatrixHandler * pWorkMatA
Definition: dataman.h:630
long int flag
Definition: mbdyn.h:43
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
DofOwner::Type DofOwnerType
Definition: dataman.h:565
bool bGetNext(T &TReturn) const
Definition: veciter.h:118
Drive ** ppFirstDrive
Definition: dataman.h:617
bool UseNetCDF(int out) const
Definition: output.cc:491
OrientationDescription od
Definition: dataman.h:573
Elem::Type m_FirstType
Definition: dataman.h:1097
integer iMaxWorkNumRowsRes
Definition: dataman.h:625
Definition: drive.h:89
const DataManager::ElemDataStructure(* pElemData)[Elem::LASTELEMTYPE]
Definition: dataman.h:1096
struct DataManager::@29 DriveData[Drive::LASTDRIVETYPE]
void ElemManager(void)
Definition: elman.cc:51
flag fGetDefaultOutputFlag(const Elem::Type &t) const
Definition: elman.cc:727
#define SAFEDELETEARR(pnt)
Definition: mynewmem.h:713
MySubVectorHandler * pWorkVec
Definition: dataman.h:633
Type
Definition: drive.h:92
virtual void AssRes(VectorHandler &ResHdl, doublereal dCoef)
Definition: elman.cc:498
VariableSubMatrixHandler * pWorkMatB
Definition: dataman.h:631
#define DEBUGCERR(msg)
Definition: myassert.h:235
unsigned int iTotDrive
Definition: dataman.h:622
virtual Elem::Type GetElemType(void) const =0
void ElemOutput(OutputHandler &OH) const
Definition: elman.cc:583
Elem * pChooseElem(Elem *p, unsigned int iDeriv) const
Definition: elman.cc:674
DataManager::ElemContainerType::const_iterator m_CurrElem
Definition: dataman.h:1098
bool bDefaultOut(void) const
Definition: dataman.h:587
virtual void Reset(void)=0
Elem * pFindElem(Elem::Type Typ, unsigned int uElem, unsigned int iDeriv) const
Definition: elman.cc:650
T * pLabelSearch(T **const p, int iSize, unsigned int uL)
Definition: search.h:50
integer iMaxWorkNumRowsJac
Definition: dataman.h:626
void ElemManagerDestructor(void)
Definition: elman.cc:196
Elem::Type m_CurrType
Definition: dataman.h:1099
InitialAssemblyIterator(const DataManager::ElemDataStructure(*pED)[Elem::LASTELEMTYPE])
Definition: elman.cc:737
#define DEBUGCOUT(msg)
Definition: myassert.h:232
virtual void AssJac(MatrixHandler &JacHdl, doublereal dCoef)
Definition: elman.cc:392
integer iMaxWorkNumColsJac
Definition: dataman.h:627
VectorHandler * pXPrimeCurr
Definition: dataman.h:109
bool IsOpen(int out) const
Definition: output.cc:395
virtual void OutputPrepare(OutputHandler &OH)
Definition: output.cc:863
#define ASSERT(expression)
Definition: colamd.c:977
Elem ** ppFindElem(Elem::Type Typ, unsigned int uElem) const
Definition: elman.cc:629
VecIter< Elem * > ElemIter
Definition: dataman.h:612
ElemMapToListType ElemMapToList
Definition: dataman.h:592
Definition: veciter.h:52
#define SAFENEWWITHCONSTRUCTOR(pnt, item, constructor)
Definition: mynewmem.h:698
unsigned int iNum
Definition: dataman.h:618
InitialAssemblyElem * GetNext(void) const
Definition: elman.cc:791
void ElemOutputPrepare(OutputHandler &OH)
Definition: elman.cc:545
static std::stack< cleanup * > c
Definition: cleanup.cc:59
virtual void PrintResidual(const VectorHandler &Res, integer iIterCnt) const
Definition: dataman2.cc:2603
Drive ** ppDrive
Definition: dataman.h:621
void Init(const T *p, unsigned i)
Definition: veciter.h:79
OutputHandler::OutFiles OutFile
Definition: dataman.h:568
Definition: elem.h:75
Type
Definition: elem.h:91
virtual void Output(OutputHandler &OH) const
Definition: output.cc:870
const char * psElemNames[]
Definition: enums.cc:39
void ToBeUsedInAssembly(bool b)
Definition: dataman.h:578
virtual void WorkSpaceDim(integer *piNumRows, integer *piNumCols) const =0
virtual void AssMats(VariableSubMatrixHandler &WorkMatA, VariableSubMatrixHandler &WorkMatB, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
Definition: elem.cc:55
virtual SubVectorHandler & AssRes(SubVectorHandler &WorkVec, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)=0
void GeneratesInertiaForces(bool b)
Definition: dataman.h:579
#define SAFENEWARR(pnt, item, sz)
Definition: mynewmem.h:701
void UsesAirProperties(bool b)
Definition: dataman.h:580
bool bGetFirst(T &TReturn) const
Definition: veciter.h:88
InitialAssemblyElem * GetFirst(void) const
Definition: elman.cc:763
virtual void AssMats(MatrixHandler &A_Hdl, MatrixHandler &B_Hdl)
Definition: elman.cc:447
double doublereal
Definition: colamd.c:52
virtual Elem * pGetElem(void) const
Definition: nestedelem.cc:60
void ElemDataInit(void)
Definition: elman.cc:248
long int integer
Definition: colamd.c:51
unsigned int GetLabel(void) const
Definition: withlab.cc:62
struct DataManager::ElemDataStructure ElemData[Elem::LASTELEMTYPE]
#define DEBUGLCOUT(level, msg)
Definition: myassert.h:244
NcBool put(const ncbyte *vals, long c0=0, long c1=0, long c2=0, long c3=0, long c4=0)
VariableSubMatrixHandler * pWorkMat
Definition: dataman.h:632
virtual VariableSubMatrixHandler & AssJac(VariableSubMatrixHandler &WorkMat, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)=0
virtual integer iGetNumRows(void) const =0
VectorHandler * pXCurr
Definition: dataman.h:108
#define SAFEDELETE(pnt)
Definition: mynewmem.h:710
void ElemAssInit(void)
Definition: elman.cc:318
const char * psDriveNames[]
Definition: enums.cc:351