#include <Parser.h>
|
virtual std::string | eval (hit::Field *n, const std::list< std::string > &args, hit::BraceExpander &exp) |
|
Definition at line 41 of file Parser.h.
◆ eval()
std::string UnitsConversionEvaler::eval |
( |
hit::Field * |
n, |
|
|
const std::list< std::string > & |
args, |
|
|
hit::BraceExpander & |
exp |
|
) |
| |
|
virtual |
Definition at line 88 of file Parser.C.
92 std::vector<std::string> argv;
93 argv.insert(argv.begin(), args.begin(), args.end());
98 n->setVal(n->val(), hit::Field::Kind::Float);
103 if (argv.size() != 4 || (argv.size() >= 3 && argv[2] !=
"->"))
105 exp.errors.push_back(
107 "units error: Expected 4 arguments ${units number from_unit -> to_unit} or " 108 "2 arguments ${units number unit}"));
115 if (!from_unit.conformsTo(to_unit))
117 exp.errors.push_back(hit::errormsg(n,
122 ") does not convert to ",
131 Real num = MooseUtils::convert<Real>(argv[0]);
134 std::stringstream ss;
135 ss << std::setprecision(17) << to_unit.convert(num, from_unit);
150 n->setVal(n->val(), hit::Field::Kind::Float);
void mooseInfoRepeated(Args &&... args)
Emit an informational message with the given stringified, concatenated args.
std::string stringify(const T &t)
conversion to string
Physical unit management class with runtime unit string parsing, unit checking, unit conversion...
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
The documentation for this class was generated from the following files: