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

Go to the source code of this file.

Classes

class  BasicScalarFunction
 
class  DifferentiableScalarFunction
 
struct  ScalarFunctionRead
 

Functions

const BasicScalarFunction *const ParseScalarFunction (MBDynParser &HP, DataManager *const pDM)
 
void SetScalarFunctionDriveCallerData (void)
 
bool SetSF (const std::string &s, const ScalarFunctionRead *rf)
 
void InitSF (void)
 
void DestroySF (void)
 

Function Documentation

void DestroySF ( void  )

Definition at line 1527 of file ScalarFunctionsImpl.cc.

References done, MBDYN_EXCEPT_ARGS, and SFRead.

Referenced by MBDynParser::~MBDynParser().

1528 {
1529  if (::done == 0) {
1530  silent_cerr("DestroySF() called once too many" << std::endl);
1532  }
1533 
1534  if (--done > 0) {
1535  return;
1536  }
1537 
1538  for (SFReadType::iterator i = SFRead.begin(); i != SFRead.end(); ++i) {
1539  delete i->second;
1540  }
1541  SFRead.clear();
1542 }
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
static SFReadType SFRead
static unsigned done
void InitSF ( void  )

Definition at line 1409 of file ScalarFunctionsImpl.cc.

References ASSERT, done, MBDYN_EXCEPT_ARGS, SetCL1D(), SetCL3D(), SetCL6D(), SetDriveCallerData(), and SetSF().

Referenced by MBDynParser::MBDynParser().

1410 {
1411  if (::done++ > 0) {
1412  return;
1413  }
1414 
1415  bool b;
1416 
1417  b = SetSF("const", new ConstSFR);
1418  ASSERT(b);
1419  b = SetSF("linear", new LinearSFR);
1420  ASSERT(b);
1421  b = SetSF("pow", new PowSFR);
1422  ASSERT(b);
1423  b = SetSF("log", new LogSFR);
1424  ASSERT(b);
1425  b = SetSF("exp", new ExpSFR);
1426  ASSERT(b);
1427  b = SetSF("sum", new SumSFR);
1428  ASSERT(b);
1429  b = SetSF("sub", new SubSFR);
1430  ASSERT(b);
1431  b = SetSF("mul", new MulSFR);
1432  ASSERT(b);
1433  b = SetSF("div", new DivSFR);
1434  ASSERT(b);
1435  b = SetSF("cubic" "spline", new CubicSplineSFR);
1436  ASSERT(b);
1437  b = SetSF("multilinear", new MultiLinearSFR);
1438  ASSERT(b);
1439  b = SetSF("chebychev", new ChebychevSFR);
1440  ASSERT(b);
1441 
1442  /* this is about initializing the scalar function drive */
1444  if (!SetDriveCallerData("scalar" "function", rf)) {
1445  delete rf;
1446 
1447  silent_cerr("unable to register scalar function drive caller"
1448  << std::endl);
1449 
1451  }
1452 
1453  /* this is about initializing the scalar function constitutive law(s) */
1456  if (!SetCL1D("scalar" "function" "elastic" "isotropic", rf1D)) {
1457  delete rf1D;
1458 
1459  silent_cerr("unable to register scalar function isotropic 1D constitutive law"
1460  << std::endl);
1461 
1463  }
1464 
1466  if (!SetCL1D("scalar" "function" "elastic" "orthotropic", rf1D)) {
1467  delete rf1D;
1468 
1469  silent_cerr("unable to register scalar function orthotropic 1D constitutive law"
1470  << std::endl);
1471 
1473  }
1474 
1476  if (!SetCL1D("scalar" "function" "elastic", rf1D)) {
1477  delete rf1D;
1478 
1479  silent_cerr("unable to register scalar function 1D constitutive law"
1480  << std::endl);
1481 
1483  }
1484 
1486  if (!SetCL3D("scalar" "function" "elastic" "isotropic", rf3D)) {
1487  delete rf3D;
1488 
1489  silent_cerr("unable to register scalar function isotropic 3D constitutive law"
1490  << std::endl);
1491 
1493  }
1494 
1496  if (!SetCL3D("scalar" "function" "elastic" "orthotropic", rf3D)) {
1497  delete rf3D;
1498 
1499  silent_cerr("unable to register scalar function orthotropic 3D constitutive law"
1500  << std::endl);
1501 
1503  }
1504 
1506  if (!SetCL6D("scalar" "function" "elastic" "isotropic", rf6D)) {
1507  delete rf6D;
1508 
1509  silent_cerr("unable to register scalar function isotropic 6D constitutive law"
1510  << std::endl);
1511 
1513  }
1514 
1516  if (!SetCL6D("scalar" "function" "elastic" "orthotropic", rf6D)) {
1517  delete rf6D;
1518 
1519  silent_cerr("unable to register scalar function orthotropic 6D constitutive law"
1520  << std::endl);
1521 
1523  }
1524 }
bool SetSF(const std::string &s, const ScalarFunctionRead *rf)
bool SetDriveCallerData(const char *name, DriveCallerRead *rf)
Definition: drive_.cc:1324
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
static unsigned done
bool SetCL3D(const char *name, ConstitutiveLawRead< Vec3, Mat3x3 > *rf)
#define ASSERT(expression)
Definition: colamd.c:977
bool SetCL1D(const char *name, ConstitutiveLawRead< doublereal, doublereal > *rf)
bool SetCL6D(const char *name, ConstitutiveLawRead< Vec6, Mat6x6 > *rf)

Here is the call graph for this function:

const BasicScalarFunction* const ParseScalarFunction ( MBDynParser HP,
DataManager *const  pDM 
)

Definition at line 1011 of file ScalarFunctionsImpl.cc.

References func(), IncludeParser::GetLineData(), MBDynParser::GetScalarFunction(), HighParser::GetStringWithDelims(), HighParser::IsWord(), MBDYN_EXCEPT_ARGS, MBDynParser::SetScalarFunction(), and SFRead.

Referenced by MBDynParser::GetScalarFunction(), ParseFriction(), ScalarFuncGR::Read(), NLSFViscoElasticCLR< T, Tder, Typ >::Read(), NLPViscoElasticCLR< T, Tder, Typ >::Read(), SumSFR::Read(), SubSFR::Read(), MulSFR::Read(), DivSFR::Read(), ScalarFunctionDCR::Read(), ScalarFunctionIsotropicCLR< T, Tder >::Read(), ScalarFunctionOrthotropicCLR< T, Tder >::Read(), and MBDynParser::ScalarFunction_int().

1012 {
1013  std::string func_name(HP.GetStringWithDelims());
1014 
1015  const BasicScalarFunction *sf = HP.GetScalarFunction(func_name);
1016  if (sf == 0) {
1017  const char *s = HP.IsWord(SFWordSet);
1018  if (s == 0) {
1019  s = "const";
1020  }
1021 
1022  SFReadType::iterator func = SFRead.find(std::string(s));
1023  if (func == SFRead.end()) {
1024  silent_cerr("unknown scalar function type \"" << s << "\" "
1025  "for function \"" << func_name << "\" "
1026  "at line " << HP.GetLineData() << std::endl);
1028  }
1029 
1030  try {
1031  sf = func->second->Read(pDM, HP);
1032  } catch (...) {
1033  silent_cerr("Unable to parse "
1034  "ScalarFunction(\"" << func_name << "\") "
1035  "at line " << HP.GetLineData() << std::endl);
1036  throw;
1037  }
1038  if (!HP.SetScalarFunction(func_name, sf)) {
1039  silent_cerr("scalar function \"" << func_name << "\" "
1040  "already defined at line " << HP.GetLineData() << std::endl);
1042  }
1043 
1044  } else if (HP.IsWord(SFWordSet)) {
1045  silent_cerr("Error: redefinition of "
1046  "\"" << func_name << "\" scalar function "
1047  "at line " << HP.GetLineData() << std::endl);
1049  }
1050 
1051  return sf;
1052 }
const BasicScalarFunction * GetScalarFunction(void)
Definition: mbpar.cc:2158
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
virtual const char * IsWord(const HighParser::WordSet &ws)
Definition: parser.cc:977
bool SetScalarFunction(const std::string &s, const BasicScalarFunction *sf)
Definition: mbpar.cc:2179
void func(const T &u, const T &v, const T &w, doublereal e, T &f)
static SFReadType SFRead
static SFWordSetType SFWordSet
virtual const char * GetStringWithDelims(enum Delims Del=DEFAULTDELIM, bool escape=true)
Definition: parser.cc:1228
virtual HighParser::ErrOut GetLineData(void) const
Definition: parsinc.cc:697

Here is the call graph for this function:

void SetScalarFunctionDriveCallerData ( void  )
bool SetSF ( const std::string &  s,
const ScalarFunctionRead rf 
)

Definition at line 1399 of file ScalarFunctionsImpl.cc.

References SFRead.

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

1400 {
1401  pedantic_cout("registering scalar function \"" << s << "\""
1402  << std::endl );
1403  return SFRead.insert(SFReadType::value_type(s, rf)).second;
1404 }
static SFReadType SFRead