MBDyn-1.7.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
NLPViscoElasticCLR< T, Tder, Typ > Struct Template Reference
Inheritance diagram for NLPViscoElasticCLR< T, Tder, Typ >:
Collaboration diagram for NLPViscoElasticCLR< T, Tder, Typ >:

Public Member Functions

virtual ConstitutiveLaw< T,
Tder > * 
Read (const DataManager *pDM, MBDynParser &HP, ConstLawType::Type &CLType)
 
- Public Member Functions inherited from ConstitutiveLawRead< T, Tder >
virtual ~ConstitutiveLawRead (void)
 

Detailed Description

template<class T, class Tder, ConstLawType::Type Typ>
struct NLPViscoElasticCLR< T, Tder, Typ >

Definition at line 322 of file constltp_nlp.cc.

Member Function Documentation

template<class T , class Tder , ConstLawType::Type Typ>
virtual ConstitutiveLaw<T, Tder>* NLPViscoElasticCLR< T, Tder, Typ >::Read ( const DataManager pDM,
MBDynParser HP,
ConstLawType::Type CLType 
)
inlinevirtual

Implements ConstitutiveLawRead< T, Tder >.

Definition at line 324 of file constltp_nlp.cc.

References ConstLawType::ELASTIC, MBDynParser::Get(), IncludeParser::GetLineData(), GetPreStress(), HighParser::GetReal(), HighParser::IsKeyWord(), MBDYN_EXCEPT_ARGS, ParseScalarFunction(), SAFENEWWITHCONSTRUCTOR, ConstLawType::VISCOELASTIC, and ConstLawType::VISCOUS.

325  {
326  ConstitutiveLaw<T, Tder>* pCL = 0;
327 
328  unsigned dim;
329  if (typeid(T) == typeid(doublereal)) {
330  dim = 1;
331 
332  } else if (typeid(T) == typeid(Vec3)) {
333  dim = 3;
334 
335  } else if (typeid(T) == typeid(Vec6)) {
336  dim = 6;
337 
338  } else {
339  silent_cerr("Invalid dimensionality "
340  "for NLP viscoelastic constitutive law "
341  "at line " << HP.GetLineData()
342  << std::endl);
344  }
345 
346  /* stiffness */
347  Tder FDE0(mb_zero<Tder>());
348  bool bElastic(false);
349  std::vector<const DifferentiableScalarFunction *> FDEsc(dim);
350  for (unsigned i = 0; i < dim; i++) {
351  FDEsc[i] = 0;
352  }
353 
354 
355  if (Typ & ConstLawType::ELASTIC) {
356  FDE0 = HP.Get(FDE0);
357 
358  bElastic = !IsNull<Tder>(FDE0);
359  for (unsigned i = 0; i < dim; i++) {
360  if (!HP.IsKeyWord("null")) {
361  const BasicScalarFunction *const sc
362  = ParseScalarFunction(HP, (DataManager *const)pDM);
363  FDEsc[i] = dynamic_cast<const DifferentiableScalarFunction *>(sc);
364  if (FDEsc[i] == 0) {
365  silent_cerr("NLPViscoElasticCLR: "
366  "stiffness scalar function #" << i << " "
367  "at line " << HP.GetLineData() << " "
368  "must be differentiable" << std::endl);
370  }
371  bElastic = true;
372  }
373  }
374  }
375 
376  /* damping */
377  Tder FDEPrime0(mb_zero<Tder>());
378  bool bViscous(false);
379  std::vector<const DifferentiableScalarFunction *> FDEPrimesc(dim);
380  for (unsigned i = 0; i < dim; i++) {
381  FDEPrimesc[i] = 0;
382  }
383 
384  if (Typ & ConstLawType::VISCOUS) {
385  if ((Typ & ConstLawType::ELASTIC) && HP.IsKeyWord("proportional")) {
386  FDEPrime0 = FDE0*HP.GetReal();
387  } else {
388  FDEPrime0 = HP.Get(FDEPrime0);
389  }
390 
391 
392  bViscous = !IsNull<Tder>(FDEPrime0);
393  for (unsigned i = 0; i < dim; i++) {
394  if (!HP.IsKeyWord("null")) {
395  const BasicScalarFunction *const sc
396  = ParseScalarFunction(HP, (DataManager *const)pDM);
397  FDEPrimesc[i] = dynamic_cast<const DifferentiableScalarFunction *>(sc);
398  if (FDEPrimesc[i] == 0) {
399  silent_cerr("NLPViscoElasticCLR: "
400  "damping scalar function #" << i << " "
401  "at line " << HP.GetLineData() << " "
402  "must be differentiable" << std::endl);
404  }
405  bViscous = true;
406  }
407  }
408  }
409 
410  /* Prestress and prestrain */
411  T PreStress(mb_zero<T>());
412  GetPreStress(HP, PreStress);
413  TplDriveCaller<T>* pTplDC = GetPreStrain<T>(pDM, HP);
414 
415  if (bElastic && bViscous) {
417  } else if (bElastic) {
418  CLType = ConstLawType::ELASTIC;
419  } else if (bViscous) {
420  CLType = ConstLawType::VISCOUS;
421  } else {
422  /* needs to be at least elastic... */
423  CLType = ConstLawType::ELASTIC;
424  }
425 
427  SAFENEWWITHCONSTRUCTOR(pCL, L,
428  L(pTplDC, PreStress,
429  CLType,
430  FDE0, FDEsc,
431  FDEPrime0, FDEPrimesc));
432 
433  return pCL;
434  };
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
Definition: matvec3.h:98
Definition: matvec6.h:37
virtual bool IsKeyWord(const char *sKeyWord)
Definition: parser.cc:910
#define SAFENEWWITHCONSTRUCTOR(pnt, item, constructor)
Definition: mynewmem.h:698
void GetPreStress(MBDynParser &HP, T &PreStress)
virtual doublereal Get(const doublereal &d)
Definition: mbpar.cc:2213
double doublereal
Definition: colamd.c:52
virtual HighParser::ErrOut GetLineData(void) const
Definition: parsinc.cc:697
const BasicScalarFunction *const ParseScalarFunction(MBDynParser &HP, DataManager *const pDM)
virtual doublereal GetReal(const doublereal &dDefval=0.0)
Definition: parser.cc:1056

Here is the call graph for this function:


The documentation for this struct was generated from the following file: