MBDyn-1.7.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
tpldrive_impl.cc File Reference
#include "mbconfig.h"
#include "myassert.h"
#include "mynewmem.h"
#include "dataman.h"
#include "tpldrive_impl.h"
#include "reffrm.h"
Include dependency graph for tpldrive_impl.cc:

Go to the source code of this file.

Classes

class  NullTDCR< T >
 
class  ZeroTDCR< T >
 
class  SingleTDCR< T >
 
class  CompTplDriveCaller< T >
 
class  CompTplDriveCaller< Mat3x3 >
 
class  CompTplDriveCaller< Mat6x6 >
 
class  CompTDCR< T >
 
struct  DrivesArray< T >
 
class  ArrayTplDriveCaller< T >
 
class  ArrayTplDriveCaller< doublereal >
 
class  ArrayTDCR< T >
 
struct  DC1DWordSetType
 
struct  DC3DWordSetType
 
struct  DC6DWordSetType
 
struct  DC3x3DWordSetType
 
struct  DC6x6DWordSetType
 

Typedefs

typedef std::map< std::string,
TplDriveCallerRead< doublereal >
*, ltstrcase
DC1DFuncMapType
 
typedef std::map< std::string,
TplDriveCallerRead< Vec3 >
*, ltstrcase
DC3DFuncMapType
 
typedef std::map< std::string,
TplDriveCallerRead< Vec6 >
*, ltstrcase
DC6DFuncMapType
 
typedef std::map< std::string,
TplDriveCallerRead< Mat3x3 >
*, ltstrcase
DC3x3DFuncMapType
 
typedef std::map< std::string,
TplDriveCallerRead< Mat6x6 >
*, ltstrcase
DC6x6DFuncMapType
 

Functions

doublereal GetT (MBDynParser &HP, const doublereal &t)
 
template<class T >
GetT (MBDynParser &HP, const T &t)
 
bool SetDC1D (const char *name, TplDriveCallerRead< doublereal > *rf)
 
bool SetDC3D (const char *name, TplDriveCallerRead< Vec3 > *rf)
 
bool SetDC6D (const char *name, TplDriveCallerRead< Vec6 > *rf)
 
bool SetDC3x3D (const char *name, TplDriveCallerRead< Mat3x3 > *rf)
 
bool SetDC6x6D (const char *name, TplDriveCallerRead< Mat6x6 > *rf)
 
TplDriveCaller< doublereal > * ReadDC1D (const DataManager *pDM, MBDynParser &HP)
 
TplDriveCaller< Vec3 > * ReadDC3D (const DataManager *pDM, MBDynParser &HP)
 
TplDriveCaller< Vec6 > * ReadDC6D (const DataManager *pDM, MBDynParser &HP)
 
TplDriveCaller< Mat3x3 > * ReadDC3x3D (const DataManager *pDM, MBDynParser &HP)
 
TplDriveCaller< Mat6x6 > * ReadDC6x6D (const DataManager *pDM, MBDynParser &HP)
 
template<class VM >
static TplDriveCaller< Vec3 > * ReadDCVec (const DataManager *pDM, MBDynParser &HP, const ReferenceFrame &rf)
 
TplDriveCaller< Vec3 > * ReadDCVecRel (const DataManager *pDM, MBDynParser &HP, const ReferenceFrame &rf)
 
TplDriveCaller< Vec3 > * ReadDCVecAbs (const DataManager *pDM, MBDynParser &HP, const ReferenceFrame &rf)
 
void InitTplDC (void)
 
void DestroyTplDC (void)
 

Variables

static DC1DFuncMapType DC1DFuncMap
 
static DC3DFuncMapType DC3DFuncMap
 
static DC6DFuncMapType DC6DFuncMap
 
static DC3x3DFuncMapType DC3x3DFuncMap
 
static DC6x6DFuncMapType DC6x6DFuncMap
 
static DC1DWordSetType DC1DWordSet
 
static DC3DWordSetType DC3DWordSet
 
static DC6DWordSetType DC6DWordSet
 
static DC3x3DWordSetType DC3x3DWordSet
 
static DC6x6DWordSetType DC6x6DWordSet
 
static unsigned done
 

Typedef Documentation

typedef std::map<std::string, TplDriveCallerRead<doublereal> *, ltstrcase> DC1DFuncMapType

Definition at line 718 of file tpldrive_impl.cc.

typedef std::map<std::string, TplDriveCallerRead<Vec3> *, ltstrcase> DC3DFuncMapType

Definition at line 719 of file tpldrive_impl.cc.

typedef std::map<std::string, TplDriveCallerRead<Mat3x3> *, ltstrcase> DC3x3DFuncMapType

Definition at line 722 of file tpldrive_impl.cc.

typedef std::map<std::string, TplDriveCallerRead<Vec6> *, ltstrcase> DC6DFuncMapType

Definition at line 720 of file tpldrive_impl.cc.

typedef std::map<std::string, TplDriveCallerRead<Mat6x6> *, ltstrcase> DC6x6DFuncMapType

Definition at line 723 of file tpldrive_impl.cc.

Function Documentation

void DestroyTplDC ( void  )

Definition at line 980 of file tpldrive_impl.cc.

References DC1DFuncMap, DC3DFuncMap, DC3x3DFuncMap, DC6DFuncMap, DC6x6DFuncMap, done, and MBDYN_EXCEPT_ARGS.

Referenced by MBDynParser::~MBDynParser().

981 {
982  if (::done == 0) {
983  silent_cerr("DestroyTplDC() called once too many" << std::endl);
985  }
986 
987  if (--::done > 0) {
988  return;
989  }
990 
991  /* free stuff */
992  for (DC1DFuncMapType::iterator i = DC1DFuncMap.begin(); i != DC1DFuncMap.end(); ++i) {
993  delete i->second;
994  }
995  DC1DFuncMap.clear();
996 
997  for (DC3DFuncMapType::iterator i = DC3DFuncMap.begin(); i != DC3DFuncMap.end(); ++i) {
998  delete i->second;
999  }
1000  DC3DFuncMap.clear();
1001 
1002  for (DC6DFuncMapType::iterator i = DC6DFuncMap.begin(); i != DC6DFuncMap.end(); ++i) {
1003  delete i->second;
1004  }
1005  DC6DFuncMap.clear();
1006 
1007  for (DC3x3DFuncMapType::iterator i = DC3x3DFuncMap.begin(); i != DC3x3DFuncMap.end(); ++i) {
1008  delete i->second;
1009  }
1010  DC3x3DFuncMap.clear();
1011 
1012  for (DC6x6DFuncMapType::iterator i = DC6x6DFuncMap.begin(); i != DC6x6DFuncMap.end(); ++i) {
1013  delete i->second;
1014  }
1015  DC6x6DFuncMap.clear();
1016 }
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
static DC6x6DFuncMapType DC6x6DFuncMap
static DC3x3DFuncMapType DC3x3DFuncMap
static unsigned done
static DC6DFuncMapType DC6DFuncMap
static DC1DFuncMapType DC1DFuncMap
static DC3DFuncMapType DC3DFuncMap
doublereal GetT ( MBDynParser HP,
const doublereal t 
)

Definition at line 37 of file tpldrive.cc.

Referenced by SingleTDCR< T >::Read(), and ArrayTDCR< T >::Read().

38 {
39  return 0.;
40 }
template<class T >
T GetT ( MBDynParser HP,
const T &  t 
)

Definition at line 712 of file tpldrive_impl.cc.

References MBDynParser::Get().

713 {
714  return HP.Get(t);
715 }
virtual doublereal Get(const doublereal &d)
Definition: mbpar.cc:2213

Here is the call graph for this function:

void InitTplDC ( void  )

Definition at line 931 of file tpldrive_impl.cc.

References done, SetDC1D(), SetDC3D(), SetDC3x3D(), SetDC6D(), and SetDC6x6D().

Referenced by MBDynParser::MBDynParser().

932 {
933  if (::done++ > 0) {
934  return;
935  }
936 
937  /* null */
938  SetDC1D("null", new NullTDCR<doublereal>);
939  SetDC3D("null", new NullTDCR<Vec3>);
940  SetDC6D("null", new NullTDCR<Vec6>);
941 
942  SetDC3x3D("null", new NullTDCR<Mat3x3>);
943  SetDC6x6D("null", new NullTDCR<Mat6x6>);
944 
945  /* zero (deprecated) */
946  SetDC1D("zero", new ZeroTDCR<doublereal>);
947  SetDC3D("zero", new ZeroTDCR<Vec3>);
948  SetDC6D("zero", new ZeroTDCR<Vec6>);
949 
950  SetDC3x3D("zero", new ZeroTDCR<Mat3x3>);
951  SetDC6x6D("zero", new ZeroTDCR<Mat6x6>);
952 
953  /* single */
954  SetDC1D("single", new SingleTDCR<doublereal>);
955  SetDC3D("single", new SingleTDCR<Vec3>);
956  SetDC6D("single", new SingleTDCR<Vec6>);
957 
958  SetDC3x3D("single", new SingleTDCR<Mat3x3>);
959  SetDC6x6D("single", new SingleTDCR<Mat6x6>);
960 
961  /* component */
962  /* in the scalar case, "single" and "component" are identical */
963  SetDC1D("component", new SingleTDCR<doublereal>);
964  SetDC3D("component", new CompTDCR<Vec3>);
965  SetDC6D("component", new CompTDCR<Vec6>);
966 
967  SetDC3x3D("component", new CompTDCR<Mat3x3>);
968  SetDC6x6D("component", new CompTDCR<Mat6x6>);
969 
970  /* array */
971  SetDC1D("array", new ArrayTDCR<doublereal>);
972  SetDC3D("array", new ArrayTDCR<Vec3>);
973  SetDC6D("array", new ArrayTDCR<Vec6>);
974 
975  SetDC3x3D("array", new ArrayTDCR<Mat3x3>);
976  SetDC6x6D("array", new ArrayTDCR<Mat6x6>);
977 }
bool SetDC3D(const char *name, TplDriveCallerRead< Vec3 > *rf)
static unsigned done
bool SetDC3x3D(const char *name, TplDriveCallerRead< Mat3x3 > *rf)
bool SetDC1D(const char *name, TplDriveCallerRead< doublereal > *rf)
bool SetDC6D(const char *name, TplDriveCallerRead< Vec6 > *rf)
bool SetDC6x6D(const char *name, TplDriveCallerRead< Mat6x6 > *rf)

Here is the call graph for this function:

TplDriveCaller<doublereal>* ReadDC1D ( const DataManager pDM,
MBDynParser HP 
)

Definition at line 812 of file tpldrive_impl.cc.

References DC1DFuncMap, func(), IncludeParser::GetLineData(), HighParser::IsWord(), and MBDYN_EXCEPT_ARGS.

Referenced by MBDynParser::GetTplDriveCaller().

813 {
814  const char *s = HP.IsWord(DC1DWordSet);
815  if (s == 0) {
816  s = "single";
817  }
818 
819  DC1DFuncMapType::iterator func = DC1DFuncMap.find(std::string(s));
820  if (func == DC1DFuncMap.end()) {
821  silent_cerr("unknown template drive caller 1D type \"" << s << "\" "
822  "at line " << HP.GetLineData() << std::endl);
824  }
825 
826  return func->second->Read(pDM, HP);
827 }
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
virtual const char * IsWord(const HighParser::WordSet &ws)
Definition: parser.cc:977
void func(const T &u, const T &v, const T &w, doublereal e, T &f)
static DC1DFuncMapType DC1DFuncMap
virtual HighParser::ErrOut GetLineData(void) const
Definition: parsinc.cc:697
static DC1DWordSetType DC1DWordSet

Here is the call graph for this function:

TplDriveCaller<Vec3>* ReadDC3D ( const DataManager pDM,
MBDynParser HP 
)

Definition at line 830 of file tpldrive_impl.cc.

References DC3DFuncMap, func(), IncludeParser::GetLineData(), HighParser::IsWord(), and MBDYN_EXCEPT_ARGS.

Referenced by MBDynParser::GetTplDriveCaller(), ReadAirstreamData(), DataManager::ReadControl(), ReadForce(), and ReadGravity().

831 {
832  const char *s = HP.IsWord(DC3DWordSet);
833  if (s == 0) {
834  s = "single";
835  }
836 
837  DC3DFuncMapType::iterator func = DC3DFuncMap.find(std::string(s));
838  if (func == DC3DFuncMap.end()) {
839  silent_cerr("unknown template drive caller 3D type \"" << s << "\" "
840  "at line " << HP.GetLineData() << std::endl);
842  }
843 
844  return func->second->Read(pDM, HP);
845 }
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
virtual const char * IsWord(const HighParser::WordSet &ws)
Definition: parser.cc:977
void func(const T &u, const T &v, const T &w, doublereal e, T &f)
static DC3DWordSetType DC3DWordSet
static DC3DFuncMapType DC3DFuncMap
virtual HighParser::ErrOut GetLineData(void) const
Definition: parsinc.cc:697

Here is the call graph for this function:

TplDriveCaller<Mat3x3>* ReadDC3x3D ( const DataManager pDM,
MBDynParser HP 
)

Definition at line 866 of file tpldrive_impl.cc.

References DC3x3DFuncMap, func(), IncludeParser::GetLineData(), HighParser::IsWord(), and MBDYN_EXCEPT_ARGS.

Referenced by MBDynParser::GetTplDriveCaller().

867 {
868  const char *s = HP.IsWord(DC3x3DWordSet);
869  if (s == 0) {
870  s = "single";
871  }
872 
873  DC3x3DFuncMapType::iterator func = DC3x3DFuncMap.find(std::string(s));
874  if (func == DC3x3DFuncMap.end()) {
875  silent_cerr("unknown template drive caller 3x3D type \"" << s << "\" "
876  "at line " << HP.GetLineData() << std::endl);
878  }
879 
880  return func->second->Read(pDM, HP);
881 }
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
static DC3x3DWordSetType DC3x3DWordSet
virtual const char * IsWord(const HighParser::WordSet &ws)
Definition: parser.cc:977
static DC3x3DFuncMapType DC3x3DFuncMap
void func(const T &u, const T &v, const T &w, doublereal e, T &f)
virtual HighParser::ErrOut GetLineData(void) const
Definition: parsinc.cc:697

Here is the call graph for this function:

TplDriveCaller<Vec6>* ReadDC6D ( const DataManager pDM,
MBDynParser HP 
)

Definition at line 848 of file tpldrive_impl.cc.

References DC6DFuncMap, func(), IncludeParser::GetLineData(), HighParser::IsWord(), and MBDYN_EXCEPT_ARGS.

Referenced by MBDynParser::GetTplDriveCaller().

849 {
850  const char *s = HP.IsWord(DC6DWordSet);
851  if (s == 0) {
852  s = "single";
853  }
854 
855  DC6DFuncMapType::iterator func = DC6DFuncMap.find(std::string(s));
856  if (func == DC6DFuncMap.end()) {
857  silent_cerr("unknown template drive caller 6D type \"" << s << "\" "
858  "at line " << HP.GetLineData() << std::endl);
860  }
861 
862  return func->second->Read(pDM, HP);
863 }
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
virtual const char * IsWord(const HighParser::WordSet &ws)
Definition: parser.cc:977
static DC6DWordSetType DC6DWordSet
void func(const T &u, const T &v, const T &w, doublereal e, T &f)
static DC6DFuncMapType DC6DFuncMap
virtual HighParser::ErrOut GetLineData(void) const
Definition: parsinc.cc:697

Here is the call graph for this function:

TplDriveCaller<Mat6x6>* ReadDC6x6D ( const DataManager pDM,
MBDynParser HP 
)

Definition at line 884 of file tpldrive_impl.cc.

References DC6x6DFuncMap, func(), IncludeParser::GetLineData(), HighParser::IsWord(), and MBDYN_EXCEPT_ARGS.

Referenced by MBDynParser::GetTplDriveCaller().

885 {
886  const char *s = HP.IsWord(DC6x6DWordSet);
887  if (s == 0) {
888  s = "single";
889  }
890 
891  DC6x6DFuncMapType::iterator func = DC6x6DFuncMap.find(std::string(s));
892  if (func == DC6x6DFuncMap.end()) {
893  silent_cerr("unknown template drive caller 6x6D type \"" << s << "\" "
894  "at line " << HP.GetLineData() << std::endl);
896  }
897 
898  return func->second->Read(pDM, HP);
899 }
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
virtual const char * IsWord(const HighParser::WordSet &ws)
Definition: parser.cc:977
static DC6x6DFuncMapType DC6x6DFuncMap
void func(const T &u, const T &v, const T &w, doublereal e, T &f)
static DC6x6DWordSetType DC6x6DWordSet
virtual HighParser::ErrOut GetLineData(void) const
Definition: parsinc.cc:697

Here is the call graph for this function:

template<class VM >
static TplDriveCaller<Vec3>* ReadDCVec ( const DataManager pDM,
MBDynParser HP,
const ReferenceFrame rf 
)
static

Definition at line 903 of file tpldrive_impl.cc.

References MBDynParser::GetManip(), MBDynParser::GetTplDriveCaller(), MBDynParser::PopManip(), and MBDynParser::PushManip().

904 {
905  VM manip(HP, rf);
906 
907  HP.PushManip(&manip);
909  if (HP.GetManip() == &manip) {
910  HP.PopManip();
911  }
912 
913  return pDC;
914 }
void PushManip(const Manip *)
Definition: mbpar.cc:2191
TplDriveCaller< T > * GetTplDriveCaller(void)
Definition: mbpar.cc:2112
Definition: matvec3.h:98
const Manip * GetManip(void) const
Definition: mbpar.cc:2197
void PopManip(void)
Definition: mbpar.cc:2185

Here is the call graph for this function:

TplDriveCaller<Vec3>* ReadDCVecAbs ( const DataManager pDM,
MBDynParser HP,
const ReferenceFrame rf 
)

Definition at line 923 of file tpldrive_impl.cc.

Referenced by ReadStructuralForce().

924 {
925  return ReadDCVec<MBDynParser::VecAbsManip>(pDM, HP, rf);
926 }
TplDriveCaller<Vec3>* ReadDCVecRel ( const DataManager pDM,
MBDynParser HP,
const ReferenceFrame rf 
)

Definition at line 917 of file tpldrive_impl.cc.

Referenced by ModuleIMUConstraint::ModuleIMUConstraint(), DataManager::ReadControl(), and ReadStructuralForce().

918 {
919  return ReadDCVec<MBDynParser::VecRelManip>(pDM, HP, rf);
920 }
bool SetDC1D ( const char *  name,
TplDriveCallerRead< doublereal > *  rf 
)

Definition at line 771 of file tpldrive_impl.cc.

References DC1DFuncMap.

Referenced by InitTplDC(), and mbdyn_octave_set().

772 {
773  pedantic_cout("registering template drive caller 1D \"" << name << "\""
774  << std::endl );
775  return DC1DFuncMap.insert(DC1DFuncMapType::value_type(name, rf)).second;
776 }
static DC1DFuncMapType DC1DFuncMap
bool SetDC3D ( const char *  name,
TplDriveCallerRead< Vec3 > *  rf 
)

Definition at line 779 of file tpldrive_impl.cc.

References DC3DFuncMap.

Referenced by InitTplDC(), mbdyn_octave_set(), and module_init().

780 {
781  pedantic_cout("registering template drive caller 3D \"" << name << "\""
782  << std::endl );
783  return DC3DFuncMap.insert(DC3DFuncMapType::value_type(name, rf)).second;
784 }
static DC3DFuncMapType DC3DFuncMap
bool SetDC3x3D ( const char *  name,
TplDriveCallerRead< Mat3x3 > *  rf 
)

Definition at line 795 of file tpldrive_impl.cc.

References DC3x3DFuncMap.

Referenced by InitTplDC(), and mbdyn_octave_set().

796 {
797  pedantic_cout("registering template drive caller 3x3D \"" << name << "\""
798  << std::endl );
799  return DC3x3DFuncMap.insert(DC3x3DFuncMapType::value_type(name, rf)).second;
800 }
static DC3x3DFuncMapType DC3x3DFuncMap
bool SetDC6D ( const char *  name,
TplDriveCallerRead< Vec6 > *  rf 
)

Definition at line 787 of file tpldrive_impl.cc.

References DC6DFuncMap.

Referenced by InitTplDC(), and mbdyn_octave_set().

788 {
789  pedantic_cout("registering template drive caller 6D \"" << name << "\""
790  << std::endl );
791  return DC6DFuncMap.insert(DC6DFuncMapType::value_type(name, rf)).second;
792 }
static DC6DFuncMapType DC6DFuncMap
bool SetDC6x6D ( const char *  name,
TplDriveCallerRead< Mat6x6 > *  rf 
)

Definition at line 803 of file tpldrive_impl.cc.

References DC6x6DFuncMap.

Referenced by InitTplDC(), and mbdyn_octave_set().

804 {
805  pedantic_cout("registering template drive caller 6x6D \"" << name << "\""
806  << std::endl );
807  return DC6x6DFuncMap.insert(DC6x6DFuncMapType::value_type(name, rf)).second;
808 }
static DC6x6DFuncMapType DC6x6DFuncMap

Variable Documentation

DC1DFuncMapType DC1DFuncMap
static

Definition at line 725 of file tpldrive_impl.cc.

Referenced by DestroyTplDC(), DC1DWordSetType::IsWord(), ReadDC1D(), and SetDC1D().

DC1DWordSetType DC1DWordSet
static

Definition at line 762 of file tpldrive_impl.cc.

DC3DFuncMapType DC3DFuncMap
static

Definition at line 726 of file tpldrive_impl.cc.

Referenced by DestroyTplDC(), DC3DWordSetType::IsWord(), ReadDC3D(), and SetDC3D().

DC3DWordSetType DC3DWordSet
static

Definition at line 763 of file tpldrive_impl.cc.

DC3x3DFuncMapType DC3x3DFuncMap
static

Definition at line 729 of file tpldrive_impl.cc.

Referenced by DestroyTplDC(), DC3x3DWordSetType::IsWord(), ReadDC3x3D(), and SetDC3x3D().

DC3x3DWordSetType DC3x3DWordSet
static

Definition at line 766 of file tpldrive_impl.cc.

DC6DFuncMapType DC6DFuncMap
static

Definition at line 727 of file tpldrive_impl.cc.

Referenced by DestroyTplDC(), DC6DWordSetType::IsWord(), ReadDC6D(), and SetDC6D().

DC6DWordSetType DC6DWordSet
static

Definition at line 764 of file tpldrive_impl.cc.

DC6x6DFuncMapType DC6x6DFuncMap
static

Definition at line 730 of file tpldrive_impl.cc.

Referenced by DestroyTplDC(), DC6x6DWordSetType::IsWord(), ReadDC6x6D(), and SetDC6x6D().

DC6x6DWordSetType DC6x6DWordSet
static

Definition at line 767 of file tpldrive_impl.cc.

unsigned done
static

Definition at line 928 of file tpldrive_impl.cc.

Referenced by DestroyTplDC(), and InitTplDC().