55 bool IsFunc(
const std::string& fname)
const;
64 ASSERT(args.size() == 1 + 2 + 1);
85 rc = utScan((*arg1)().c_str(), &u_from);
92 silent_cerr(
"module-udunits: utScan could not interpret "
93 "unit \"" << (*arg1)() <<
"\" in first arg"
99 rc = utScan((*arg2)().c_str(), &u_to);
105 silent_cerr(
"module-udunits: utScan could not interpret "
106 "unit \"" << (*arg2)() <<
"\" in second arg"
111 double slope, intercept;
112 rc = utConvert(&u_from, &u_to, &slope, &intercept);
118 silent_cerr(
"module-udunits: utConvert failed (rc=" << rc <<
")" << std::endl);
123 if (intercept != 0) {
124 silent_cerr(
"module-udunits: conversion between \"" << (*arg1)() <<
"\" "
125 "and \"" << (*arg2)() <<
"\" "
126 "has non-zero intercept" << std::endl);
133 *out = (*arg3)()*slope + intercept;
142 int rc = utInit(path);
145 path =
"<unspecified>";
154 silent_cerr(
"utUnit could not find file \"" << path <<
"\""
159 silent_cerr(
"utUnit found a syntax error "
160 "in file \"" << path <<
"\"" << std::endl);
164 silent_cerr(
"utUnit found an unknown specification "
165 "in file \"" << path <<
"\"" << std::endl);
169 silent_cerr(
"utUnit hit an I/O error while reading "
170 "file \"" << path <<
"\"" << std::endl);
174 silent_cerr(
"utUnit ran out of memory while reading "
175 "file \"" << path <<
"\"" << std::endl);
181 f.
args.resize(1 + 3);
198 return (fname.compare(
f.
fname) == 0);
204 if (fname.compare(
f.
fname) == 0) {
216 return TypedValue((*dynamic_cast<MathParser::MathArgReal_t*>(f->
args[0]))());
230 const char *
path = 0;
MathArgPriv_t< Real, AT_REAL > MathArgReal_t
#define MBDYN_EXCEPT_ARGS
MathParser::MathFunc_t * GetFunc(const std::string &fname) const
int RegisterNameSpace(NameSpace *ns)
std::vector< MathArg_t * > MathArgs
virtual const char * GetFileName(enum Delims Del=DEFAULTDELIM)
TypedValue EvalFunc(MathParser::MathFunc_t *f) const
UDUnitsNameSpace(const char *path)
bool IsFunc(const std::string &fname) const
virtual MathParser & GetMathParser(void)
#define ASSERT(expression)
MathArgPriv_t< std::string, AT_STRING > MathArgString_t
virtual Table * GetTable(void)
int module_init(const char *module_name, void *pdm, void *php)
This function registers our user defined element for the math parser.
bool IsFlag(const MathParser::ArgFlag f) const
static std::stack< const HighParser * > pHP
static int unit_convert(const MathParser::MathArgs &args)