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

#include <ginaccltp.h>

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

Public Member Functions

 GiNaCViscoElasticConstitutiveLaw (const TplDriveCaller< T > *pDC, const T &PStress, std::vector< std::string > &epsilon, std::vector< std::string > &epsilonPrime, std::vector< std::string > &expression)
 
virtual ~GiNaCViscoElasticConstitutiveLaw (void)
 
virtual ConstitutiveLaw< T,
Tder > * 
pCopy (void) const
 
virtual std::ostream & Restart (std::ostream &out) const
 
virtual void Update (const T &Eps, const T &=mb_zero< T >())
 
- Public Member Functions inherited from SymbolicViscoElasticConstitutiveLaw< T, Tder >
 SymbolicViscoElasticConstitutiveLaw (const TplDriveCaller< T > *pDC, const T &PStress, std::vector< std::string > &epsilon, std::vector< std::string > &epsilonPrime, std::vector< std::string > &expression)
 
virtual ~SymbolicViscoElasticConstitutiveLaw (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 * > gEps
 
std::vector< GiNaC::symbol * > gEpsPrime
 
std::vector< GiNaC::ex > gExpr
 
std::vector< std::vector
< GiNaC::ex > > 
gExprDEps
 
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 GiNaCViscoElasticConstitutiveLaw< T, Tder >

Definition at line 691 of file ginaccltp.h.

Constructor & Destructor Documentation

template<class T , class Tder >
GiNaCViscoElasticConstitutiveLaw< T, Tder >::GiNaCViscoElasticConstitutiveLaw ( const TplDriveCaller< T > *  pDC,
const T &  PStress,
std::vector< std::string > &  epsilon,
std::vector< std::string > &  epsilonPrime,
std::vector< std::string > &  expression 
)

Definition at line 724 of file ginaccltp.h.

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

730 : SymbolicViscoElasticConstitutiveLaw<T, Tder>(pDC, PStress, epsilon, epsilonPrime, expression)
731 {
732  if (typeid(T) == typeid(Vec3)) {
733  dim = 3;
734 
735  } else if (typeid(T) == typeid(Vec6)) {
736  dim = 6;
737 
738  } else {
740  }
741 
742  gEps.resize(dim);
743  gEpsPrime.resize(dim);
744  gExpr.resize(dim);
745 
746  gExprDEps.resize(dim);
747  gExprDEpsPrime.resize(dim);
748  for (unsigned row = 0; row < dim; row++) {
749  gExprDEps[row].resize(dim);
750  gExprDEpsPrime[row].resize(dim);
751  }
752 
753  ConstitutiveLaw<T, Tder>::FDE = mb_zero<Tder>();
754  ConstitutiveLaw<T, Tder>::FDEPrime = mb_zero<Tder>();
755 
756  GiNaC::lst l;
757 
758  for (unsigned row = 0; row < dim; row++) {
759  gEps[row] = new GiNaC::symbol(epsilon[row]);
760  l.append(*gEps[row]);
761  gEpsPrime[row] = new GiNaC::symbol(epsilonPrime[row]);
762  l.append(*gEpsPrime[row]);
763  }
764 
765  for (unsigned row = 0; row < dim; row++) {
766  try {
767  gExpr[row] = GiNaC::ex(expression[row], l);
768 
769  } catch (std::exception& e) {
770  silent_cerr("GiNaCViscoElasticConstitutiveLaw<T, Tder>: expression #" << row << " parsing "
771  "failed: " << e.what() << std::endl);
772  throw e;
773  }
774 
775  for (unsigned col = 0; col < dim; col++) {
776  try {
777  gExprDEps[row][col] = gExpr[row].diff(*gEps[col]);
778 
779  } catch (std::exception& e) {
780  silent_cerr("GiNaCViscoElasticConstitutiveLaw<T, Tder>: expression #" << row << " differentiation "
781  "wrt/ Eps #" << col << "failed: "
782  << e.what() << std::endl);
783  throw e;
784  }
785 
786  try {
787  gExprDEpsPrime[row][col] = gExpr[row].diff(*gEpsPrime[col]);
788 
789  } catch (std::exception& e) {
790  silent_cerr("GiNaCViscoElasticConstitutiveLaw<T, Tder>: expression #" << row << " differentiation "
791  "wrt/ EpsPrime #" << col << "failed: "
792  << e.what() << std::endl);
793  throw e;
794  }
795  }
796  }
797 
798  silent_cout("\tGiNaCViscoElasticConstitutiveLaw:" << std::endl);
799  for (unsigned row = 0; row < dim; row++) {
800  silent_cout("\t\tEps[" << row << "]: \"" << *gEps[row] << "\"" << std::endl);
801  }
802  for (unsigned row = 0; row < dim; row++) {
803  silent_cout("\t\tEpsPrime[" << row << "]: \"" << *gEpsPrime[row] << "\"" << std::endl);
804  }
805  for (unsigned row = 0; row < dim; row++) {
806  silent_cout("\t\tConstitutive law[" << row << "]: \"" << gExpr[row] << "\"" << std::endl);
807  }
808  for (unsigned row = 0; row < dim; row++) {
809  for (unsigned col = 0; col < dim; col++) {
810  silent_cout("\t\tDer[" << row << "]/Eps[" << row << "][" << col << "]: \"" << gExprDEps[row][col] << "\"" << std::endl);
811  }
812  }
813  for (unsigned row = 0; row < dim; row++) {
814  for (unsigned col = 0; col < dim; col++) {
815  silent_cout("\t\tDer[" << row << "]/EpsPrime[" << row << "][" << col << "]: \"" << gExprDEpsPrime[row][col] << "\"" << std::endl);
816  }
817  }
818 
819  // try and evaluate the constitutive law
820  try {
822  }
823  catch (std::exception& e) {
824  silent_cerr("GiNaCViscoElasticConstitutiveLaw<T, Tder>::GiNaCViscoElasticConstitutiveLaw: Update() failed (" << e.what() << ")" << std::endl);
825  throw e;
826  }
827 }
std::vector< GiNaC::ex > gExpr
Definition: ginaccltp.h:699
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
Definition: matvec3.h:98
virtual void Update(const T &Eps, const T &=mb_zero< T >())
Definition: ginaccltp.h:891
std::vector< GiNaC::symbol * > gEpsPrime
Definition: ginaccltp.h:697
std::vector< std::vector< GiNaC::ex > > gExprDEpsPrime
Definition: ginaccltp.h:701
Definition: matvec6.h:37
std::vector< std::vector< GiNaC::ex > > gExprDEps
Definition: ginaccltp.h:700
std::vector< GiNaC::symbol * > gEps
Definition: ginaccltp.h:696

Here is the call graph for this function:

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

Definition at line 830 of file ginaccltp.h.

831 {
832  for (unsigned row = 0; row < dim; row++) {
833  delete gEps[row];
834  delete gEpsPrime[row];
835  }
836 };
std::vector< GiNaC::symbol * > gEpsPrime
Definition: ginaccltp.h:697
std::vector< GiNaC::symbol * > gEps
Definition: ginaccltp.h:696

Member Function Documentation

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

Implements ConstitutiveLaw< T, Tder >.

Definition at line 839 of file ginaccltp.h.

References SAFENEWWITHCONSTRUCTOR.

Referenced by GiNaCViscoElasticConstitutiveLaw< doublereal, doublereal >::pCopy().

840 {
841  ConstitutiveLaw<T, Tder>* pCL = 0;
842 
843  std::vector<std::string> epsilon(dim);
844  std::vector<std::string> epsilonPrime(dim);
845  std::vector<std::string> expression(dim);
846 
847  for (unsigned row = 0; row < dim; row++) {
848  std::ostringstream eps;
849  std::ostringstream epsPrime;
850  std::ostringstream expr;
851 
852  eps << *gEps[row];
853  epsPrime << *gEpsPrime[row];
854  expr << gExpr[row];
855 
856  epsilon[row] = eps.str();
857  epsilonPrime[row] = epsPrime.str();
858  expression[row] = expr.str();
859  }
860 
863  cl,
866  epsilon, epsilonPrime, expression));
867 
868  return pCL;
869 }
std::vector< GiNaC::ex > gExpr
Definition: ginaccltp.h:699
std::vector< GiNaC::symbol * > gEpsPrime
Definition: ginaccltp.h:697
virtual ConstitutiveLaw< T, Tder > * pCopy(void) const
Definition: ginaccltp.h:839
#define SAFENEWWITHCONSTRUCTOR(pnt, item, constructor)
Definition: mynewmem.h:698
std::vector< GiNaC::symbol * > gEps
Definition: ginaccltp.h:696
template<class T , class Tder >
std::ostream & GiNaCViscoElasticConstitutiveLaw< T, Tder >::Restart ( std::ostream &  out) const
virtual

Reimplemented from ConstitutiveLaw< T, Tder >.

Definition at line 872 of file ginaccltp.h.

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

873 {
874  out << "symbolic viscoelastic, epsilon";
875  for (unsigned row = 0; row < dim; row++) {
876  out << ", \"" << *gEps[row] << "\"";
877  }
878  out << "\", epsilon prime";
879  for (unsigned row = 0; row < dim; row++) {
880  out << ", \"" << *gEpsPrime[row] << "\"";
881  }
882  out << "\", expression";
883  for (unsigned row = 0; row < dim; row++) {
884  out << ", \"" << gExpr[row] << "\"";
885  }
886 
888 }
std::vector< GiNaC::ex > gExpr
Definition: ginaccltp.h:699
std::vector< GiNaC::symbol * > gEpsPrime
Definition: ginaccltp.h:697
virtual std::ostream & Restart_int(std::ostream &out) const
std::vector< GiNaC::symbol * > gEps
Definition: ginaccltp.h:696

Here is the call graph for this function:

template<class T , class Tder >
void GiNaCViscoElasticConstitutiveLaw< T, Tder >::Update ( const T &  Eps,
const T &  EpsPrime = mb_zero<T>() 
)
virtual

Implements ConstitutiveLaw< T, Tder >.

Definition at line 891 of file ginaccltp.h.

References ConstitutiveLaw< T, Tder >::F, ConstitutiveLaw< T, Tder >::FDE, ConstitutiveLaw< T, Tder >::FDEPrime, and TplDriveOwner< T >::Get().

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

893 {
894  GiNaC::lst l;
895 
898 
900 
901  for (unsigned row = 0; row < dim; row++) {
902  l.append(*gEps[row] == e(row + 1));
903  l.append(*gEpsPrime[row] == EpsPrime(row + 1));
904  }
905 
907 
908  for (unsigned row = 0; row < dim; row++) {
909  GiNaC::ex f_expr = gExpr[row].subs(l);
910 
912  += GiNaC::ex_to<GiNaC::numeric>(f_expr).to_double();
913 
914  for (unsigned col = 0; col < dim; col++) {
915  GiNaC::ex f_derEps = gExprDEps[row][col].subs(l);
916 
917  ConstitutiveLaw<T, Tder>::FDE(row + 1, col + 1)
918  = GiNaC::ex_to<GiNaC::numeric>(f_derEps).to_double();
919 
920  GiNaC::ex f_derEpsPrime = gExprDEpsPrime[row][col].subs(l);
921 
922  ConstitutiveLaw<T, Tder>::FDEPrime(row + 1, col + 1)
923  = GiNaC::ex_to<GiNaC::numeric>(f_derEpsPrime).to_double();
924  }
925  }
926 }
std::vector< GiNaC::ex > gExpr
Definition: ginaccltp.h:699
std::vector< GiNaC::symbol * > gEpsPrime
Definition: ginaccltp.h:697
std::vector< std::vector< GiNaC::ex > > gExprDEpsPrime
Definition: ginaccltp.h:701
std::vector< std::vector< GiNaC::ex > > gExprDEps
Definition: ginaccltp.h:700
T Get(void) const
Definition: tpldrive.h:113
std::vector< GiNaC::symbol * > gEps
Definition: ginaccltp.h:696

Here is the call graph for this function:

Member Data Documentation

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

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