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

Go to the source code of this file.

Classes

struct  UDEWordSetType
 

Typedefs

typedef std::map< std::string,
UserDefinedElemRead
*, ltstrcase
UDEMapType
 

Functions

UserDefinedElemParseUserDefinedElem (unsigned uLabel, DofOwner *pDO, DataManager *const pDM, MBDynParser &HP)
 
ElemReadLoadable (DataManager *pDM, MBDynParser &HP, const DofOwner *pDO, unsigned int uLabel)
 
bool SetUDE (const std::string &s, UserDefinedElemRead *rude)
 
void InitUDE (void)
 
void DestroyUDE (void)
 

Variables

static UDEMapType UDEMap
 
static UDEWordSetType UDEWordSet
 
static unsigned done = 0
 

Typedef Documentation

typedef std::map<std::string, UserDefinedElemRead *, ltstrcase> UDEMapType

Definition at line 50 of file userelem.cc.

Function Documentation

void DestroyUDE ( void  )

Definition at line 134 of file userelem.cc.

References done, MBDYN_EXCEPT_ARGS, and UDEMap.

Referenced by DataManager::~DataManager().

135 {
136  if (::done == 0) {
137  silent_cerr("DestroyUDE() called once too many" << std::endl);
139  }
140 
141  if (--done > 0) {
142  return;
143  }
144 
145  for (UDEMapType::iterator i = UDEMap.begin(); i != UDEMap.end(); ++i) {
146  delete i->second;
147  }
148  UDEMap.clear();
149 }
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
static UDEMapType UDEMap
Definition: userelem.cc:51
static unsigned done
Definition: userelem.cc:104
void InitUDE ( void  )

Definition at line 107 of file userelem.cc.

References ASSERT, asynchronous_machine_set(), done, inline_friction_set(), mbdyn_cyclocopter_set(), SetUDE(), and wheel2_set().

Referenced by DataManager::DataManager().

108 {
109  if (::done++ > 0) {
110  return;
111  }
112 
113  bool b;
114 
115  b = SetUDE("loadable", new LoadableElemRead);
116  ASSERT(b != false);
117 #ifdef STATIC_MODULES
118  b = wheel2_set();
119  ASSERT(b != false);
121  ASSERT(b != false);
122  b = inline_friction_set();
123  ASSERT(b != false);
124  b = mbdyn_cyclocopter_set();
125  ASSERT(b != false);
126 #ifdef HAVE_CHARM
127  b = mbcharm_set();
128  ASSERT(b != false);
129 #endif // HAVE_CHARM
130 #endif // STATIC_MODULES
131 }
bool inline_friction_set(void)
bool asynchronous_machine_set(void)
bool wheel2_set(void)
#define ASSERT(expression)
Definition: colamd.c:977
bool SetUDE(const std::string &s, UserDefinedElemRead *rude)
Definition: userelem.cc:97
bool mbdyn_cyclocopter_set(void)
static unsigned done
Definition: userelem.cc:104

Here is the call graph for this function:

UserDefinedElem* ParseUserDefinedElem ( unsigned  uLabel,
DofOwner pDO,
DataManager *const  pDM,
MBDynParser HP 
)

Definition at line 61 of file userelem.cc.

References DEBUGCOUTFNAME, IncludeParser::GetLineData(), HighParser::IsWord(), MBDYN_EXCEPT_ARGS, and UDEMap.

Referenced by DataManager::ReadOneElem().

63 {
64  DEBUGCOUTFNAME("ParseUserDefinedElem(" << uLabel << ")");
65 
66  const char *s = HP.IsWord(::UDEWordSet);
67  if (s == 0) {
68  silent_cerr("ParseUserDefinedElem(" << uLabel << "): "
69  "unknown user-defined element type "
70  "at line " << HP.GetLineData() << std::endl);
72  }
73 
74  UDEMapType::iterator i = ::UDEMap.find(std::string(s));
75  if (i == ::UDEMap.end()) {
76  silent_cerr("ParseUserDefinedElem(" << uLabel << "): "
77  "unknown user-defined element type \"" << s << "\" "
78  "at line " << HP.GetLineData() << std::endl);
80  }
81 
82  return i->second->Read(uLabel, pDO, pDM, HP);
83 }
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
#define DEBUGCOUTFNAME(fname)
Definition: myassert.h:256
virtual const char * IsWord(const HighParser::WordSet &ws)
Definition: parser.cc:977
static UDEMapType UDEMap
Definition: userelem.cc:51
static UDEWordSetType UDEWordSet
Definition: userelem.cc:58
virtual HighParser::ErrOut GetLineData(void) const
Definition: parsinc.cc:697

Here is the call graph for this function:

Elem* ReadLoadable ( DataManager pDM,
MBDynParser HP,
const DofOwner pDO,
unsigned int  uLabel 
)

Definition at line 87 of file userelem.cc.

References ASSERT, and UDEMap.

Referenced by DataManager::ReadOneElem().

89 {
90  UDEMapType::iterator i = UDEMap.find("loadable");
91  ASSERT(i != UDEMap.end());
92 
93  return i->second->Read(uLabel, pDO, pDM, HP);
94 }
static UDEMapType UDEMap
Definition: userelem.cc:51
#define ASSERT(expression)
Definition: colamd.c:977
bool SetUDE ( const std::string &  s,
UserDefinedElemRead rude 
)

Definition at line 97 of file userelem.cc.

References UDEMap.

Referenced by asynchronous_machine_set(), autodiff_test_set(), ballbearing_contact_set(), hydrodynamic_plain_bearing_set(), InitUDE(), inline_friction_set(), journal_bearing_set(), mbdyn_cyclocopter_set(), mbdyn_octave_set(), module_init(), uni_in_plane_set(), and wheel2_set().

98 {
99  pedantic_cout("registering user-defined element \"" << s << "\""
100  << std::endl );
101  return UDEMap.insert(UDEMapType::value_type(s, rude)).second;
102 }
static UDEMapType UDEMap
Definition: userelem.cc:51

Variable Documentation

unsigned done = 0
static

Definition at line 104 of file userelem.cc.

Referenced by DestroyUDE(), and InitUDE().

UDEMapType UDEMap
static
UDEWordSetType UDEWordSet
static

Definition at line 58 of file userelem.cc.