MBDyn-1.7.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
GiNaCViscousConstitutiveLaw< T, Tder > Class Template Reference

#include <ginaccltp.h>

Inheritance diagram for GiNaCViscousConstitutiveLaw< T, Tder >:
Collaboration diagram for GiNaCViscousConstitutiveLaw< T, Tder >:

Public Member Functions

 GiNaCViscousConstitutiveLaw (const T &PStress, std::vector< std::string > &epsilon, std::vector< std::string > &expression)
 
virtual ~GiNaCViscousConstitutiveLaw (void)
 
virtual ConstitutiveLaw< T,
Tder > * 
pCopy (void) const
 
virtual std::ostream & Restart (std::ostream &out) const
 
virtual void Update (const T &Eps, const T &=0.)
 
- Public Member Functions inherited from SymbolicViscousConstitutiveLaw< T, Tder >
 SymbolicViscousConstitutiveLaw (const T &PStress, std::vector< std::string > &epsilonPrime, std::vector< std::string > &expression)
 
virtual ~SymbolicViscousConstitutiveLaw (void)
 
virtual ConstLawType::Type GetConstLawType (void) const
 
- Public Member Functions inherited from ElasticConstitutiveLaw< T, Tder >
 ElasticConstitutiveLaw (const TplDriveCaller< T > *pDC, const T &PStress)
 
virtual ~ElasticConstitutiveLaw (void)
 
void SetValue (DataManager *pDM, VectorHandler &X, VectorHandler &XP, SimulationEntity::Hints *ph=0)
 
virtual HintParseHint (DataManager *pDM, const char *s) const
 
- Public Member Functions inherited from ConstitutiveLaw< T, Tder >
 ConstitutiveLaw (void)
 
virtual ~ConstitutiveLaw (void)
 
virtual void AfterConvergence (const T &Eps, const T &EpsPrime=mb_zero< T >())
 
virtual const T & GetEpsilon (void) const
 
virtual const T & GetEpsilonPrime (void) const
 
virtual const T & GetF (void) const
 
virtual const Tder & GetFDE (void) const
 
virtual const Tder & GetFDEPrime (void) const
 
virtual unsigned int iGetNumDof (void) const
 
virtual std::ostream & DescribeDof (std::ostream &out, const char *prefix="", bool bInitial=false) const
 
virtual void DescribeDof (std::vector< std::string > &desc, bool bInitial=false, int i=-1) const
 
virtual std::ostream & DescribeEq (std::ostream &out, const char *prefix="", bool bInitial=false) const
 
virtual void DescribeEq (std::vector< std::string > &desc, bool bInitial=false, int i=-1) const
 
virtual DofOrder::Order GetDofType (unsigned int i) const
 
- Public Member Functions inherited from WithLabel
 WithLabel (unsigned int uL=0, const std::string &sN="")
 
virtual ~WithLabel (void)
 
void PutLabel (unsigned int uL)
 
void PutName (const std::string &sN)
 
unsigned int GetLabel (void) const
 
const std::string & GetName (void) const
 
- Public Member Functions inherited from SimulationEntity
 SimulationEntity (void)
 
virtual ~SimulationEntity (void)
 
virtual bool bIsValidIndex (unsigned int i) const
 
virtual DofOrder::Order GetEqType (unsigned int i) const
 
virtual void BeforePredict (VectorHandler &, VectorHandler &, VectorHandler &, VectorHandler &) const
 
virtual void AfterPredict (VectorHandler &X, VectorHandler &XP)
 
virtual void Update (const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
 
virtual void DerivativesUpdate (const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
 
virtual void Update (const VectorHandler &XCurr, InverseDynamics::Order iOrder)
 
virtual void AfterConvergence (const VectorHandler &X, const VectorHandler &XP)
 
virtual void AfterConvergence (const VectorHandler &X, const VectorHandler &XP, const VectorHandler &XPP)
 
virtual unsigned int iGetNumPrivData (void) const
 
virtual unsigned int iGetPrivDataIdx (const char *s) const
 
virtual doublereal dGetPrivData (unsigned int i) const
 
virtual std::ostream & OutputAppend (std::ostream &out) const
 
virtual void ReadInitialState (MBDynParser &HP)
 
- Public Member Functions inherited from TplDriveOwner< T >
 TplDriveOwner (const TplDriveCaller< T > *pDC=0)
 
virtual ~TplDriveOwner (void)
 
void Set (const TplDriveCaller< T > *pDC)
 
TplDriveCaller< T > * pGetDriveCaller (void) const
 
Get (const doublereal &dVar) const
 
Get (void) const
 
virtual bool bIsDifferentiable (void) const
 
virtual T GetP (void) const
 

Private Attributes

unsigned dim
 
std::vector< GiNaC::symbol * > gEpsPrime
 
std::vector< GiNaC::ex > gExpr
 
std::vector< std::vector
< GiNaC::ex > > 
gExprDEpsPrime
 

Additional Inherited Members

- Public Types inherited from ConstitutiveLaw< T, Tder >
typedef ConstitutiveLaw< T,
Tder >::ErrNotAvailable 
Err
 
- Public Types inherited from SimulationEntity
typedef std::vector< Hint * > Hints
 
- Protected Member Functions inherited from ElasticConstitutiveLaw< T, Tder >
virtual std::ostream & Restart_int (std::ostream &out) const
 
- Protected Attributes inherited from ElasticConstitutiveLaw< T, Tder >
PreStress
 
- Protected Attributes inherited from ConstitutiveLaw< T, Tder >
Epsilon
 
EpsilonPrime
 
F
 
Tder FDE
 
Tder FDEPrime
 
- Protected Attributes inherited from WithLabel
unsigned int uLabel
 
std::string sName
 
- Protected Attributes inherited from TplDriveOwner< T >
TplDriveCaller< T > * pTplDriveCaller
 

Detailed Description

template<class T, class Tder>
class GiNaCViscousConstitutiveLaw< T, Tder >

Definition at line 374 of file ginaccltp.h.

Constructor & Destructor Documentation

template<class T , class Tder >
GiNaCViscousConstitutiveLaw< T, Tder >::GiNaCViscousConstitutiveLaw ( const T &  PStress,
std::vector< std::string > &  epsilon,
std::vector< std::string > &  expression 
)

Definition at line 403 of file ginaccltp.h.

References GiNaCViscousConstitutiveLaw< T, Tder >::dim, GiNaCViscousConstitutiveLaw< T, Tder >::gEpsPrime, GiNaCViscousConstitutiveLaw< T, Tder >::gExpr, GiNaCViscousConstitutiveLaw< T, Tder >::gExprDEpsPrime, MBDYN_EXCEPT_ARGS, and GiNaCViscousConstitutiveLaw< T, Tder >::Update().

407 : SymbolicViscousConstitutiveLaw<T, Tder>(PStress, epsilonPrime, expression)
408 {
409  if (typeid(T) == typeid(Vec3)) {
410  dim = 3;
411 
412  } else if (typeid(T) == typeid(Vec6)) {
413  dim = 6;
414 
415  } else {
417  }
418 
419  gEpsPrime.resize(dim);
420  gExpr.resize(dim);
421 
422  gExprDEpsPrime.resize(dim);
423  for (unsigned row = 0; row < dim; row++) {
424  gExprDEpsPrime[row].resize(dim);
425  }
426 
427  ConstitutiveLaw<T, Tder>::FDE = mb_zero<Tder>();
428  ConstitutiveLaw<T, Tder>::FDEPrime = mb_zero<Tder>();
429 
430  GiNaC::lst l;
431 
432  for (unsigned row = 0; row < dim; row++) {
433  gEpsPrime[row] = new GiNaC::symbol(epsilonPrime[row]);
434  l.append(*gEpsPrime[row]);
435  }
436 
437  for (unsigned row = 0; row < dim; row++) {
438  try {
439  gExpr[row] = GiNaC::ex(expression[row], l);
440 
441  } catch (std::exception& e) {
442  silent_cerr("GiNaCViscousConstitutiveLaw<T, Tder>: expression #" << row << " parsing "
443  "failed: " << e.what() << std::endl);
444  throw e;
445  }
446 
447  for (unsigned col = 0; col < dim; col++) {
448  try {
449  gExprDEpsPrime[row][col] = gExpr[row].diff(*gEpsPrime[col]);
450 
451  } catch (std::exception& e) {
452  silent_cerr("GiNaCViscousConstitutiveLaw<T, Tder>: expression #" << row << " differentiation "
453  "wrt/ EpsPrime #" << col << " failed: " << e.what()
454  << std::endl);
455  throw e;
456  }
457  }
458  }
459 
460  silent_cout("\tGiNaCViscousConstitutiveLaw:" << std::endl);
461  for (unsigned row = 0; row < dim; row++) {
462  silent_cout("\t\tEpsPrime[" << row << "]: \"" << *gEpsPrime[row] << "\"" << std::endl);
463  }
464  for (unsigned row = 0; row < dim; row++) {
465  silent_cout("\t\tConstitutive law[" << row << "]: \"" << gExpr[row] << "\"" << std::endl);
466  }
467  for (unsigned row = 0; row < dim; row++) {
468  for (unsigned col = 0; col < dim; col++) {
469  silent_cout("\t\tDer[" << row << "]/EpsPrime[" << row << "][" << col << "]: \"" << gExprDEpsPrime[row][col] << "\"" << std::endl);
470  }
471  }
472 
473  // try and evaluate the constitutive law
474  try {
476  }
477  catch (std::exception& e) {
478  silent_cerr("GiNaCViscousConstitutiveLaw<T, Tder>::GiNaCViscousConstitutiveLaw: Update() failed (" << e.what() << ")" << std::endl);
479  throw e;
480  }
481 };
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
Definition: matvec3.h:98
std::vector< GiNaC::ex > gExpr
Definition: ginaccltp.h:381
Definition: matvec6.h:37
std::vector< std::vector< GiNaC::ex > > gExprDEpsPrime
Definition: ginaccltp.h:382
std::vector< GiNaC::symbol * > gEpsPrime
Definition: ginaccltp.h:379
virtual void Update(const T &Eps, const T &=0.)
Definition: ginaccltp.h:535

Here is the call graph for this function:

template<class T , class Tder >
GiNaCViscousConstitutiveLaw< T, Tder >::~GiNaCViscousConstitutiveLaw ( void  )
virtual

Definition at line 484 of file ginaccltp.h.

485 {
486  for (unsigned row = 0; row < dim; row++) {
487  delete gEpsPrime[row];
488  }
489 }
std::vector< GiNaC::symbol * > gEpsPrime
Definition: ginaccltp.h:379

Member Function Documentation

template<class T , class Tder >
ConstitutiveLaw< T, Tder > * GiNaCViscousConstitutiveLaw< T, Tder >::pCopy ( void  ) const
virtual

Implements ConstitutiveLaw< T, Tder >.

Definition at line 492 of file ginaccltp.h.

References SAFENEWWITHCONSTRUCTOR.

493 {
494  ConstitutiveLaw<T, Tder>* pCL = 0;
495 
496  std::vector<std::string> epsilonPrime(dim);
497  std::vector<std::string> expression(dim);
498 
499  for (unsigned row = 0; row < dim; row++) {
500  std::ostringstream epsPrime;
501  std::ostringstream expr;
502 
503  epsPrime << *gEpsPrime[row];
504  expr << gExpr[row];
505 
506  epsilonPrime[row] = epsPrime.str();
507  expression[row] = expr.str();
508  }
509 
512  cl,
514  epsilonPrime, expression));
515 
516  return pCL;
517 }
std::vector< GiNaC::ex > gExpr
Definition: ginaccltp.h:381
#define SAFENEWWITHCONSTRUCTOR(pnt, item, constructor)
Definition: mynewmem.h:698
std::vector< GiNaC::symbol * > gEpsPrime
Definition: ginaccltp.h:379
template<class T , class Tder >
std::ostream & GiNaCViscousConstitutiveLaw< T, Tder >::Restart ( std::ostream &  out) const
virtual

Reimplemented from ConstitutiveLaw< T, Tder >.

Definition at line 520 of file ginaccltp.h.

References ElasticConstitutiveLaw< T, Tder >::Restart_int().

521 {
522  out << "symbolic viscous, epsilonPrime";
523  for (unsigned row = 0; row < dim; row++) {
524  out << ", \"" << *gEpsPrime[row] << "\"";
525  }
526  out << "\", expression";
527  for (unsigned row = 0; row < dim; row++) {
528  out << ", \"" << gExpr[row] << "\"";
529  }
530 
532 }
std::vector< GiNaC::ex > gExpr
Definition: ginaccltp.h:381
virtual std::ostream & Restart_int(std::ostream &out) const
std::vector< GiNaC::symbol * > gEpsPrime
Definition: ginaccltp.h:379

Here is the call graph for this function:

template<class T , class Tder >
void GiNaCViscousConstitutiveLaw< T, Tder >::Update ( const T &  Eps,
const T &  EpsPrime = 0. 
)
virtual

Implements ConstitutiveLaw< T, Tder >.

Definition at line 535 of file ginaccltp.h.

References ConstitutiveLaw< T, Tder >::F, and ConstitutiveLaw< T, Tder >::FDEPrime.

Referenced by GiNaCViscousConstitutiveLaw< T, Tder >::GiNaCViscousConstitutiveLaw(), and GiNaCViscousConstitutiveLaw< doublereal, doublereal >::GiNaCViscousConstitutiveLaw().

537 {
538  GiNaC::lst l;
539 
541 
542  for (unsigned row = 0; row < dim; row++) {
543  l.append(*gEpsPrime[row] == EpsPrime(row + 1));
544  }
545 
546  for (unsigned row = 0; row < dim; row++) {
547  GiNaC::ex f_expr = gExpr[row].subs(l);
548 
550  = GiNaC::ex_to<GiNaC::numeric>(f_expr).to_double();
551 
552  for (unsigned col = 0; col < dim; col++) {
553  GiNaC::ex f_derEpsPrime = gExprDEpsPrime[row][col].subs(l);
554 
555  ConstitutiveLaw<T, Tder>::FDEPrime(row + 1, col + 1)
556  = GiNaC::ex_to<GiNaC::numeric>(f_derEpsPrime).to_double();
557  }
558  }
559 }
std::vector< GiNaC::ex > gExpr
Definition: ginaccltp.h:381
std::vector< std::vector< GiNaC::ex > > gExprDEpsPrime
Definition: ginaccltp.h:382
std::vector< GiNaC::symbol * > gEpsPrime
Definition: ginaccltp.h:379

Member Data Documentation

template<class T , class Tder >
unsigned GiNaCViscousConstitutiveLaw< T, Tder >::dim
private

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