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

Definition at line 311 of file constltp_nlsf.cc.

Member Function Documentation

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

Implements ConstitutiveLawRead< T, Tder >.

Definition at line 313 of file constltp_nlsf.cc.

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

314  {
315  ConstitutiveLaw<T, Tder>* pCL = 0;
316 
317  unsigned dim;
318  if (typeid(T) == typeid(doublereal)) {
319  dim = 1;
320 
321  } else if (typeid(T) == typeid(Vec3)) {
322  dim = 3;
323 
324  } else if (typeid(T) == typeid(Vec6)) {
325  dim = 6;
326 
327  } else {
328  silent_cerr("Invalid dimensionality "
329  "for NLSF viscoelastic constitutive law "
330  "at line " << HP.GetLineData()
331  << std::endl);
333  }
334 
335  /* stiffness */
336  Tder FDE0(mb_zero<Tder>());
337  bool bElastic(false);
338  std::vector<const DifferentiableScalarFunction *> FDEsc(dim);
339  for (unsigned i = 0; i < dim; i++) {
340  FDEsc[i] = 0;
341  }
342 
343  if (Typ & ConstLawType::ELASTIC) {
344  FDE0 = HP.Get(FDE0);
345 
346  bElastic = !IsNull<Tder>(FDE0);
347  for (unsigned i = 0; i < dim; i++) {
348  if (!HP.IsKeyWord("null")) {
349  const BasicScalarFunction *const sc
350  = ParseScalarFunction(HP, (DataManager *const)pDM);
351  FDEsc[i] = dynamic_cast<const DifferentiableScalarFunction *>(sc);
352  if (FDEsc[i] == 0) {
353  silent_cerr("NLSFViscoElasticCLR: "
354  "stiffness scalar function #" << i << " "
355  "at line " << HP.GetLineData() << " "
356  "must be differentiable" << std::endl);
358  }
359  bElastic = true;
360  }
361  }
362  }
363 
364  /* damping */
365  Tder FDEPrime0(mb_zero<Tder>());
366  bool bViscous(false);
367  std::vector<const DifferentiableScalarFunction *> FDEPrimesc(dim);
368  for (unsigned i = 0; i < dim; i++) {
369  FDEPrimesc[i] = 0;
370  }
371 
372  if (Typ & ConstLawType::VISCOUS) {
373  if ((Typ & ConstLawType::ELASTIC) && HP.IsKeyWord("proportional")) {
374  FDEPrime0 = FDE0*HP.GetReal();
375  } else {
376  FDEPrime0 = HP.Get(FDEPrime0);
377  }
378 
379  bViscous = !IsNull<Tder>(FDEPrime0);
380  for (unsigned i = 0; i < dim; i++) {
381  if (!HP.IsKeyWord("null")) {
382  const BasicScalarFunction *const sc
383  = ParseScalarFunction(HP, (DataManager *const)pDM);
384  FDEPrimesc[i] = dynamic_cast<const DifferentiableScalarFunction *>(sc);
385  if (FDEPrimesc[i] == 0) {
386  silent_cerr("NLSFViscoElasticCLR: "
387  "damping scalar function #" << i << " "
388  "at line " << HP.GetLineData() << " "
389  "must be differentiable" << std::endl);
391  }
392  bViscous = true;
393  }
394  }
395  }
396 
397  /* Prestress and prestrain */
398  T PreStress(mb_zero<T>());
399  GetPreStress(HP, PreStress);
400  TplDriveCaller<T>* pTplDC = GetPreStrain<T>(pDM, HP);
401 
402  if (bElastic && bViscous) {
404  } else if (bElastic) {
405  CLType = ConstLawType::ELASTIC;
406  } else if (bViscous) {
407  CLType = ConstLawType::VISCOUS;
408  } else {
409  /* needs to be at least elastic... */
410  CLType = ConstLawType::ELASTIC;
411  }
412 
414  SAFENEWWITHCONSTRUCTOR(pCL, L,
415  L(pTplDC, PreStress,
416  CLType,
417  FDE0, FDEsc,
418  FDEPrime0, FDEPrimesc));
419 
420  return pCL;
421  };
#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: