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

#include <ginaccltp.h>

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

Public Member Functions

 GiNaCElasticConstitutiveLaw (const TplDriveCaller< T > *pDC, const T &PStress, std::vector< std::string > &epsilon, std::vector< std::string > &expression)
 
virtual ~GiNaCElasticConstitutiveLaw (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 SymbolicElasticConstitutiveLaw< T, Tder >
 SymbolicElasticConstitutiveLaw (const TplDriveCaller< T > *pDC, const T &PStress, std::vector< std::string > &epsilon, std::vector< std::string > &expression)
 
virtual ~SymbolicElasticConstitutiveLaw (void)
 
- Public Member Functions inherited from ElasticConstitutiveLaw< T, Tder >
 ElasticConstitutiveLaw (const TplDriveCaller< T > *pDC, const T &PStress)
 
virtual ~ElasticConstitutiveLaw (void)
 
ConstLawType::Type GetConstLawType (void) const
 
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::ex > gExpr
 
std::vector< std::vector
< GiNaC::ex > > 
gExprDEps
 

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 GiNaCElasticConstitutiveLaw< T, Tder >

Definition at line 46 of file ginaccltp.h.

Constructor & Destructor Documentation

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

Definition at line 76 of file ginaccltp.h.

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

81 : SymbolicElasticConstitutiveLaw<T, Tder>(pDC, PStress, epsilon, expression)
82 {
83  if (typeid(T) == typeid(Vec3)) {
84  dim = 3;
85 
86  } else if (typeid(T) == typeid(Vec6)) {
87  dim = 6;
88 
89  } else {
91  }
92 
93  gEps.resize(dim);
94  gExpr.resize(dim);
95 
96  gExprDEps.resize(dim);
97  for (unsigned row = 0; row < dim; row++) {
98  gExprDEps[row].resize(dim);
99  }
100 
101  ConstitutiveLaw<T, Tder>::FDE = mb_zero<Tder>();
102 
103  GiNaC::lst l;
104 
105  for (unsigned row = 0; row < dim; row++) {
106  gEps[row] = new GiNaC::symbol(epsilon[row]);
107  l.append(*gEps[row]);
108  }
109 
110  for (unsigned row = 0; row < dim; row++) {
111  try {
112  gExpr[row] = GiNaC::ex(expression[row], l);
113 
114  } catch (std::exception& e) {
115  silent_cerr("GiNaCElasticConstitutiveLaw<T, Tder>: expression #" << row << " parsing "
116  "failed: " << e.what() << std::endl);
117  throw e;
118  }
119 
120  for (unsigned col = 0; col < dim; col++) {
121  try {
122  gExprDEps[row][col] = gExpr[row].diff(*gEps[col]);
123 
124  } catch (std::exception& e) {
125  silent_cerr("GiNaCElasticConstitutiveLaw<T, Tder>: expression #" << row << " differentiation "
126  "wrt/ Eps #" << col << "failed: "
127  << e.what() << std::endl);
128  throw e;
129  }
130  }
131  }
132 
133  silent_cout("\tGiNaCElasticConstitutiveLaw:" << std::endl);
134  for (unsigned row = 0; row < dim; row++) {
135  silent_cout("\t\tEps[" << row << "]: \"" << *gEps[row] << "\"" << std::endl);
136  }
137  for (unsigned row = 0; row < dim; row++) {
138  silent_cout("\t\tConstitutive law[" << row << "]: \"" << gExpr[row] << "\"" << std::endl);
139  }
140  for (unsigned row = 0; row < dim; row++) {
141  for (unsigned col = 0; col < dim; col++) {
142  silent_cout("\t\tDer[" << row << "]/Eps[" << row << "][" << col << "]: \"" << gExprDEps[row][col] << "\"" << std::endl);
143  }
144  }
145 
146  // try and evaluate the constitutive law
147  try {
149  }
150  catch (std::exception& e) {
151  silent_cerr("GiNaCElasticConstitutiveLaw<T, Tder>::GiNaCElasticConstitutiveLaw: Update() failed (" << e.what() << ")" << std::endl);
152  throw e;
153  }
154 }
std::vector< GiNaC::symbol * > gEps
Definition: ginaccltp.h:51
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
Definition: matvec3.h:98
std::vector< GiNaC::ex > gExpr
Definition: ginaccltp.h:53
Definition: matvec6.h:37
virtual void Update(const T &Eps, const T &=0.)
Definition: ginaccltp.h:209
std::vector< std::vector< GiNaC::ex > > gExprDEps
Definition: ginaccltp.h:54

Here is the call graph for this function:

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

Definition at line 157 of file ginaccltp.h.

158 {
159  for (unsigned row = 0; row < dim; row++) {
160  delete gEps[row];
161  }
162 };
std::vector< GiNaC::symbol * > gEps
Definition: ginaccltp.h:51

Member Function Documentation

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

Implements ConstitutiveLaw< T, Tder >.

Definition at line 165 of file ginaccltp.h.

References SAFENEWWITHCONSTRUCTOR.

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

166 {
167  ConstitutiveLaw<T, Tder>* pCL = 0;
168 
169  std::vector<std::string> epsilon(dim);
170  std::vector<std::string> expression(dim);
171 
172  for (unsigned row = 0; row < dim; row++) {
173  std::ostringstream eps;
174  std::ostringstream expr;
175 
176  eps << *gEps[row];
177  expr << gExpr[row];
178 
179  epsilon[row] = eps.str();
180  expression[row] = expr.str();
181  }
182 
185  cl,
188  epsilon, expression));
189 
190  return pCL;
191 }
std::vector< GiNaC::symbol * > gEps
Definition: ginaccltp.h:51
std::vector< GiNaC::ex > gExpr
Definition: ginaccltp.h:53
virtual ConstitutiveLaw< T, Tder > * pCopy(void) const
Definition: ginaccltp.h:165
#define SAFENEWWITHCONSTRUCTOR(pnt, item, constructor)
Definition: mynewmem.h:698
template<class T , class Tder >
std::ostream & GiNaCElasticConstitutiveLaw< T, Tder >::Restart ( std::ostream &  out) const
virtual

Reimplemented from ConstitutiveLaw< T, Tder >.

Definition at line 194 of file ginaccltp.h.

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

195 {
196  out << "symbolic elastic, epsilon";
197  for (unsigned row = 0; row < dim; row++) {
198  out << ", \"" << *gEps[row] << "\"";
199  }
200  out << "\", expression";
201  for (unsigned row = 0; row < dim; row++) {
202  out << ", \"" << gExpr[row] << "\"";
203  }
204 
206 }
std::vector< GiNaC::symbol * > gEps
Definition: ginaccltp.h:51
std::vector< GiNaC::ex > gExpr
Definition: ginaccltp.h:53
virtual std::ostream & Restart_int(std::ostream &out) const

Here is the call graph for this function:

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

Implements ConstitutiveLaw< T, Tder >.

Definition at line 209 of file ginaccltp.h.

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

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

211 {
212  GiNaC::lst l;
213 
215 
217 
218  for (unsigned row = 0; row < dim; row++) {
219  l.append(*gEps[row] == e(row + 1));
220  }
221 
223 
224  for (unsigned row = 0; row < dim; row++) {
225  GiNaC::ex f_expr = gExpr[row].subs(l);
226 
228  += GiNaC::ex_to<GiNaC::numeric>(f_expr).to_double();
229 
230  for (unsigned col = 0; col < dim; col++) {
231  GiNaC::ex f_derEps = gExprDEps[row][col].subs(l);
232 
233  ConstitutiveLaw<T, Tder>::FDE(row + 1, col + 1)
234  = GiNaC::ex_to<GiNaC::numeric>(f_derEps).to_double();
235  }
236  }
237 }
std::vector< GiNaC::symbol * > gEps
Definition: ginaccltp.h:51
std::vector< GiNaC::ex > gExpr
Definition: ginaccltp.h:53
T Get(void) const
Definition: tpldrive.h:113
std::vector< std::vector< GiNaC::ex > > gExprDEps
Definition: ginaccltp.h:54

Here is the call graph for this function:

Member Data Documentation

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

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