MBDyn-1.7.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
jointreg.h File Reference
#include <cfloat>
#include "joint.h"
Include dependency graph for jointreg.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  JointRegularization
 
class  TikhonovRegularization
 
class  DynamicRegularization
 
class  JacobianRegularization
 

Functions

ElemReadJointRegularization (DataManager *pDM, MBDynParser &HP, unsigned int uLabel)
 

Function Documentation

Elem* ReadJointRegularization ( DataManager pDM,
MBDynParser HP,
unsigned int  uLabel 
)

Definition at line 527 of file jointreg.cc.

References DEBUGCERR, DEBUGCOUTFNAME, IncludeParser::GetLineData(), HighParser::GetReal(), Elem::iGetNumDof(), HighParser::IsArg(), HighParser::IsKeyWord(), Elem::JOINT, Elem::JOINT_REGULARIZATION, LASTKEYWORD, MBDYN_EXCEPT_ARGS, DataManager::pFindElem(), NestedElem::pGetElem(), psElemNames, and SAFENEWWITHCONSTRUCTOR.

Referenced by DataManager::ReadOneElem().

530 {
531  DEBUGCOUTFNAME("ReadRegularizationJoint");
532 
533  const char* sKeyWords[] = {
534  "tikhonov",
535  "dynamic",
536  "jacobian",
537 
538  0
539  };
540 
541  /* enum delle parole chiave */
542  enum KeyWords {
543  UNKNOWN = -1,
544 
545  TIKHONOV = 0,
546  DYNAMIC,
547  JACOBIAN,
548 
550  };
551 
552  /* tabella delle parole chiave */
553  KeyTable K(HP, sKeyWords);
554 
555  /* lettura del tipo di vincolo */
556  KeyWords CurrKeyWord = KeyWords(HP.IsKeyWord());
557 
558 #ifdef DEBUG
559  if (CurrKeyWord >= 0) {
560  std::cout << "joint regularization type: " << sKeyWords[CurrKeyWord] << std::endl;
561  }
562 #endif // DEBUG
563 
564  Elem* pEl = 0;
565 
566  switch (CurrKeyWord) {
567 
568  case TIKHONOV:
569  case DYNAMIC:
570  case JACOBIAN:
571  {
572  Elem *pTmpEl = pDM->pFindElem(Elem::JOINT, uLabel);
573  Joint *pJ = dynamic_cast<Joint *>(pTmpEl);
574  if (pJ == 0) {
575  DrivenElem *pDE = dynamic_cast<DrivenElem *>(pTmpEl);
576  if (pDE != 0) {
577  pJ = dynamic_cast<Joint *>(pDE->pGetElem());
578  }
579  }
580 
581  if (pJ == 0) {
583  << "(" << uLabel << "): "
584  "unable to find "
586  << "(" << uLabel << ") "
587  "at line " << HP.GetLineData()
588  << std::endl);
590  }
591 
592  unsigned iNumDofs = pJ->iGetNumDof();
593  if (iNumDofs == 0) {
595  << "(" << uLabel << "): "
596  "no dofs for "
598  << "(" << uLabel << ") "
599  "at line " << HP.GetLineData()
600  << std::endl);
602 
603  }
604 
605  std::vector<doublereal> dC(iNumDofs);
606  if (HP.IsKeyWord("list")) {
607  for (unsigned iCnt = 0; iCnt < iNumDofs; iCnt++) {
608  dC[iCnt] = HP.GetReal();
609  }
610 
611  } else if (HP.IsArg()) {
612  doublereal d = HP.GetReal();
613 
614  for (unsigned iCnt = 0; iCnt < iNumDofs; iCnt++) {
615  dC[iCnt] = d;
616  }
617 
618  } else {
619  for (unsigned iCnt = 0; iCnt < iNumDofs; iCnt++) {
620  dC[iCnt] = 1e-6;
621  }
622  }
623 
624  switch (CurrKeyWord) {
625  case TIKHONOV:
628  TikhonovRegularization(uLabel, pJ, dC, 0));
629  break;
630 
631  case DYNAMIC:
634  DynamicRegularization(uLabel, pJ, dC, 0));
635  break;
636 
637  case JACOBIAN:
640  JacobianRegularization(uLabel, pJ, dC, 0));
641  break;
642 
643  default:
645  }
646 
647  } break;
648 
649  /* Aggiungere qui altri vincoli */
650 
651  default:
652  break;
653  }
654 
655  /* Se non c'e' il punto e virgola finale */
656  if (pEl == 0) {
657  DEBUGCERR("");
658  silent_cerr("error in allocation of "
660  << "(" << uLabel << ")" << std::endl);
661 
663  }
664 
665  if (HP.IsArg()) {
666  silent_cerr("semicolon expected at line " << HP.GetLineData()
667  << std::endl);
669  }
670 
671  return pEl;
672 } /* ReadJointRegularization() */
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
#define DEBUGCOUTFNAME(fname)
Definition: myassert.h:256
#define DEBUGCERR(msg)
Definition: myassert.h:235
Elem * pFindElem(Elem::Type Typ, unsigned int uElem, unsigned int iDeriv) const
Definition: elman.cc:650
virtual bool IsKeyWord(const char *sKeyWord)
Definition: parser.cc:910
KeyWords
Definition: dataman4.cc:94
#define SAFENEWWITHCONSTRUCTOR(pnt, item, constructor)
Definition: mynewmem.h:698
virtual unsigned int iGetNumDof(void) const
Definition: elem.cc:118
virtual bool IsArg(void)
Definition: parser.cc:807
Definition: elem.h:75
const char * psElemNames[]
Definition: enums.cc:39
Definition: joint.h:50
double doublereal
Definition: colamd.c:52
virtual Elem * pGetElem(void) const
Definition: nestedelem.cc:60
virtual HighParser::ErrOut GetLineData(void) const
Definition: parsinc.cc:697
virtual doublereal GetReal(const doublereal &dDefval=0.0)
Definition: parser.cc:1056

Here is the call graph for this function: