MBDyn-1.7.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
gust.h File Reference
#include "matvec3.h"
Include dependency graph for gust.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  Gust
 
struct  GustRead
 

Functions

bool SetGustData (const char *name, GustRead *rf)
 
void InitGustData (void)
 
void DestroyGustData (void)
 
GustReadGustData (const DataManager *pDM, MBDynParser &HP)
 

Function Documentation

void DestroyGustData ( void  )

Definition at line 233 of file gust.cc.

References done, GustFuncMap, and MBDYN_EXCEPT_ARGS.

Referenced by DataManager::~DataManager().

234 {
235  if (::done == 0) {
236  silent_cerr("DestroyGustData() called once too many" << std::endl);
238  }
239 
240  if (--::done > 0) {
241  return;
242  }
243 
244  /* free stuff */
245  for (GustFuncMapType::iterator i = GustFuncMap.begin(); i != GustFuncMap.end(); ++i) {
246  delete i->second;
247  }
248  GustFuncMap.clear();
249 }
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
static GustFuncMapType GustFuncMap
Definition: gust.cc:171
static unsigned done
Definition: gust.cc:209
void InitGustData ( void  )

Definition at line 212 of file gust.cc.

References done, and SetGustData().

Referenced by DataManager::DataManager().

213 {
214  if (::done++ > 0) {
215  return;
216  }
217 
218  SetGustData("front" "1D", new Gust1DGR);
219  SetGustData("scalar" "function", new ScalarFuncGR);
220  SetGustData("power" "law", new PowerLawGR);
221  SetGustData("logarithmic", new LogarithmicGR);
222 
223  /* NOTE: add here initialization of new built-in drive callers;
224  * alternative ways to register new custom gust models are:
225  * - call SetGustData() from anywhere in the code
226  * - write a module that calls SetGustData() from inside a function
227  * called module_init(), and run-time load it using "module load"
228  * in the input file.
229  */
230 }
static unsigned done
Definition: gust.cc:209
bool SetGustData(const char *name, GustRead *rf)
Definition: gust.cc:182

Here is the call graph for this function:

Gust* ReadGustData ( const DataManager pDM,
MBDynParser HP 
)

Definition at line 190 of file gust.cc.

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

Referenced by ReadAirstreamData(), and DataManager::ReadElems().

191 {
192  DEBUGCOUTFNAME("ReadGustData()");
193 
194  const char *s = HP.IsWord(GustWordSet);
195  if (s == 0) {
196  return 0;
197  }
198 
199  GustFuncMapType::iterator func = GustFuncMap.find(std::string(s));
200  if (func == GustFuncMap.end()) {
201  silent_cerr("unknown gust type \"" << s << "\" "
202  "at line " << HP.GetLineData() << std::endl);
204  }
205 
206  return func->second->Read(pDM, HP);
207 }
#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
void func(const T &u, const T &v, const T &w, doublereal e, T &f)
static GustWordSetType GustWordSet
Definition: gust.cc:179
static GustFuncMapType GustFuncMap
Definition: gust.cc:171
virtual HighParser::ErrOut GetLineData(void) const
Definition: parsinc.cc:697

Here is the call graph for this function:

bool SetGustData ( const char *  name,
GustRead rf 
)

Definition at line 182 of file gust.cc.

References GustFuncMap.

Referenced by InitGustData().

183 {
184  pedantic_cout("registering gust \"" << name << "\"" << std::endl);
185  return GustFuncMap.insert(GustFuncMapType::value_type(name, rf)).second;
186 }
static GustFuncMapType GustFuncMap
Definition: gust.cc:171