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

#include <constltp_ann.h>

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

Public Member Functions

 AnnElasticConstitutiveLaw (const std::string &f, bool b=false)
 
virtual ~AnnElasticConstitutiveLaw (void)
 
virtual ConstLawType::Type GetConstLawType (void) const
 
virtual void AfterConvergence (const T &Eps, const T &EpsPrime=0.)
 
virtual ConstitutiveLaw< T,
Tder > * 
pCopy (void) const
 
virtual std::ostream & Restart (std::ostream &out) const
 
virtual void Update (const T &Eps, const T &EpsPrime=0.)
 
- Public Member Functions inherited from ConstitutiveLaw< T, Tder >
 ConstitutiveLaw (void)
 
virtual ~ConstitutiveLaw (void)
 
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 SetValue (DataManager *pDM, VectorHandler &X, VectorHandler &XP, SimulationEntity::Hints *h=0)
 
virtual HintParseHint (DataManager *pDM, const char *s) 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)
 

Protected Member Functions

void AnnInit (void)
 
virtual void AnnSanity (void)
 
virtual void Update (const T &Eps, const T &EpsPrime, int feedback)
 

Protected Attributes

bool bUnit
 
unsigned dim
 
ANNnet
 
std::string fname
 
- 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
 

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
 

Detailed Description

template<class T, class Tder>
class AnnElasticConstitutiveLaw< T, Tder >

Definition at line 40 of file constltp_ann.h.

Constructor & Destructor Documentation

template<class T , class Tder >
AnnElasticConstitutiveLaw< T, Tder >::AnnElasticConstitutiveLaw ( const std::string &  f,
bool  b = false 
)
inline

Definition at line 100 of file constltp_ann.h.

References AnnElasticConstitutiveLaw< T, Tder >::AnnInit(), and AnnElasticConstitutiveLaw< T, Tder >::AnnSanity().

101  : bUnit(b), fname(f)
102  {
103  AnnInit();
104  AnnSanity();
105  }
virtual void AnnSanity(void)
Definition: constltp_ann.h:67

Here is the call graph for this function:

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

Definition at line 107 of file constltp_ann.h.

References ANN_destroy(), and AnnElasticConstitutiveLaw< T, Tder >::net.

107  {
108  if (net != 0) {
109  (void)ANN_destroy(net);
110  delete net;
111  }
112  };
ann_res_t ANN_destroy(ANN *net)
Definition: ann.c:218

Here is the call graph for this function:

Member Function Documentation

template<class T , class Tder >
virtual void AnnElasticConstitutiveLaw< T, Tder >::AfterConvergence ( const T &  Eps,
const T &  EpsPrime = 0. 
)
inlinevirtual

Reimplemented from ConstitutiveLaw< T, Tder >.

Definition at line 119 of file constltp_ann.h.

References ANN_FEEDBACK_UPDATE, and AnnElasticConstitutiveLaw< T, Tder >::Update().

120  {
121  Update(Eps, EpsPrime, ANN_FEEDBACK_UPDATE);
122  };
virtual void Update(const T &Eps, const T &EpsPrime, int feedback)
Definition: constltp_ann.h:73
#define ANN_FEEDBACK_UPDATE
Definition: ann.h:52

Here is the call graph for this function:

template<class T , class Tder >
void AnnElasticConstitutiveLaw< T, Tder >::AnnInit ( void  )
inlineprotected

Definition at line 48 of file constltp_ann.h.

References ANN_init(), AnnElasticConstitutiveLaw< T, Tder >::dim, AnnElasticConstitutiveLaw< T, Tder >::fname, MBDYN_EXCEPT_ARGS, and AnnElasticConstitutiveLaw< T, Tder >::net.

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

49  {
50  if (typeid(T) == typeid(Vec3)) {
51  dim = 3;
52 
53  } else if (typeid(T) == typeid(Vec6)) {
54  dim = 6;
55 
56  } else {
58  }
59 
60  net = new ANN;
61  if (ANN_init(net, fname.c_str()) != 0) {
63  }
64  }
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
Definition: matvec3.h:98
ann_res_t ANN_init(ANN *net, const char *FileName)
Definition: ann.c:48
Definition: matvec6.h:37
struct ANN ANN

Here is the call graph for this function:

template<class T , class Tder >
virtual void AnnElasticConstitutiveLaw< T, Tder >::AnnSanity ( void  )
inlineprotectedvirtual

Reimplemented in AnnViscoElasticConstitutiveLaw< T, Tder >.

Definition at line 67 of file constltp_ann.h.

References NO_OP.

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

68  {
69  /* add sanity checks */
70  NO_OP;
71  }
#define NO_OP
Definition: myassert.h:74
template<class T , class Tder >
virtual ConstLawType::Type AnnElasticConstitutiveLaw< T, Tder >::GetConstLawType ( void  ) const
inlinevirtual

Implements ConstitutiveLaw< T, Tder >.

Reimplemented in AnnViscoElasticConstitutiveLaw< T, Tder >.

Definition at line 114 of file constltp_ann.h.

References ConstLawType::ELASTIC.

114  {
115  return ConstLawType::ELASTIC;
116  };
template<class T , class Tder >
virtual ConstitutiveLaw<T, Tder>* AnnElasticConstitutiveLaw< T, Tder >::pCopy ( void  ) const
inlinevirtual

Implements ConstitutiveLaw< T, Tder >.

Reimplemented in AnnViscoElasticConstitutiveLaw< T, Tder >.

Definition at line 124 of file constltp_ann.h.

References AnnElasticConstitutiveLaw< T, Tder >::fname, and SAFENEWWITHCONSTRUCTOR.

124  {
125  ConstitutiveLaw<T, Tder>* pCL = NULL;
126 
128  SAFENEWWITHCONSTRUCTOR(pCL, cl, cl(fname));
129  return pCL;
130  };
#define SAFENEWWITHCONSTRUCTOR(pnt, item, constructor)
Definition: mynewmem.h:698
template<class T , class Tder >
virtual std::ostream& AnnElasticConstitutiveLaw< T, Tder >::Restart ( std::ostream &  out) const
inlinevirtual

Reimplemented from ConstitutiveLaw< T, Tder >.

Definition at line 132 of file constltp_ann.h.

References AnnElasticConstitutiveLaw< T, Tder >::fname.

132  {
133  return out << " ann elastic, \"" << fname << "\",";
134  };
template<class T , class Tder >
virtual void AnnElasticConstitutiveLaw< T, Tder >::Update ( const T &  Eps,
const T &  EpsPrime,
int  feedback 
)
inlineprotectedvirtual

Reimplemented in AnnViscoElasticConstitutiveLaw< T, Tder >.

Definition at line 73 of file constltp_ann.h.

References ANN_jacobian_matrix(), ANN_sim(), c, AnnElasticConstitutiveLaw< T, Tder >::dim, ConstitutiveLaw< T, Tder >::F, ConstitutiveLaw< T, Tder >::FDE, ANN::input, ANN::jacobian, matrix::mat, MBDYN_EXCEPT_ARGS, AnnElasticConstitutiveLaw< T, Tder >::net, ANN::output, and vector::vec.

Referenced by AnnElasticConstitutiveLaw< T, Tder >::AfterConvergence(), AnnElasticConstitutiveLaw< doublereal, doublereal >::AfterConvergence(), AnnElasticConstitutiveLaw< T, Tder >::Update(), and AnnElasticConstitutiveLaw< doublereal, doublereal >::Update().

73  {
74 
76 
78 
81 
82  for (unsigned r = 0; r < dim; r++) {
83  net->input.vec[r] = E(r + 1);
84  }
85  if (ANN_sim(net, &net->input, &net->output, feedback)) {
87  }
89 
90  for (unsigned r = 0; r < dim; r++) {
92  for (unsigned c = 0; c < dim; c++) {
93  ConstitutiveLaw<T, Tder>::FDE(r + 1, c + 1) = -net->jacobian.mat[r][c];
94  }
95  }
96  };
ann_res_t ANN_sim(ANN *net, vector *input, vector *output, unsigned flags)
Definition: ann.c:425
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
vector input
Definition: ann.h:116
vector output
Definition: ann.h:116
matrix jacobian
Definition: ann.h:98
static std::stack< cleanup * > c
Definition: cleanup.cc:59
double ** mat
Definition: matrix.h:62
double * vec
Definition: matrix.h:69
ann_res_t ANN_jacobian_matrix(ANN *net, matrix *jacobian)
Definition: ann.c:921

Here is the call graph for this function:

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

Implements ConstitutiveLaw< T, Tder >.

Definition at line 136 of file constltp_ann.h.

References ANN_FEEDBACK_NONE, and AnnElasticConstitutiveLaw< T, Tder >::Update().

136  {
137  Update(Eps, EpsPrime, ANN_FEEDBACK_NONE);
138  };
#define ANN_FEEDBACK_NONE
Definition: ann.h:51
virtual void Update(const T &Eps, const T &EpsPrime, int feedback)
Definition: constltp_ann.h:73

Here is the call graph for this function:

Member Data Documentation

template<class T , class Tder >
bool AnnElasticConstitutiveLaw< T, Tder >::bUnit
protected
template<class T , class Tder >
unsigned AnnElasticConstitutiveLaw< T, Tder >::dim
protected

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