#include <G4GDMLEvaluator.hh>
Definition at line 47 of file G4GDMLEvaluator.hh.
G4GDMLEvaluator::G4GDMLEvaluator |
( |
| ) |
|
Definition at line 41 of file G4GDMLEvaluator.cc.
static constexpr double candela
static constexpr double ampere
static constexpr double second
static constexpr double meter
static constexpr double kelvin
static constexpr double kilogram
static constexpr double mole
void G4GDMLEvaluator::Clear |
( |
| ) |
|
Definition at line 48 of file G4GDMLEvaluator.cc.
static constexpr double candela
static constexpr double ampere
static constexpr double second
static constexpr double meter
static constexpr double kelvin
static constexpr double kilogram
static constexpr double mole
Definition at line 57 of file G4GDMLEvaluator.cc.
61 G4String error_msg =
"Redefinition of constant or variable: "+
name;
62 G4Exception(
"G4GDMLEvaluator::DefineConstant()",
"InvalidExpression",
const XML_Char int const XML_Char * value
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition at line 80 of file G4GDMLEvaluator.cc.
84 const G4int size = valueList.size();
88 G4String error_msg =
"Matrix '"+name+
"' is empty!";
89 G4Exception(
"G4GDMLEvaluator::DefineMatrix()",
"InvalidSize",
103 if (size % coldim != 0)
105 G4String error_msg =
"Matrix '" + name +
"' is not filled correctly!";
106 G4Exception(
"G4GDMLEvaluator::DefineMatrix()",
"InvalidSize",
110 if ((size == coldim) || (coldim == 1))
112 for (
G4int i=0;i<size;i++)
114 std::stringstream MatrixElementNameStream;
115 MatrixElementNameStream << name <<
"_" << i;
121 const G4int rowdim = size/coldim;
123 for (
G4int i=0;i<rowdim;i++)
125 for (
G4int j=0;j<coldim;j++)
127 std::stringstream MatrixElementNameStream;
128 MatrixElementNameStream << name <<
"_" << i <<
"_" << j;
129 DefineConstant(MatrixElementNameStream.str(),valueList[coldim*i+j]);
void DefineConstant(const G4String &, G4double)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition at line 68 of file G4GDMLEvaluator.cc.
72 G4String error_msg =
"Redefinition of constant or variable: "+
name;
73 G4Exception(
"G4GDMLEvaluator::DefineVariable()",
"InvalidExpression",
77 variableList.push_back(name);
const XML_Char int const XML_Char * value
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition at line 213 of file G4GDMLEvaluator.cc.
219 if (!expression.empty())
221 value = eval.
evaluate(expression.c_str());
226 G4String error_msg =
"Error in expression: " + expression;
227 G4Exception(
"G4GDMLEvaluator::Evaluate()",
"InvalidExpression",
const XML_Char int const XML_Char * value
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
G4String SolveBrackets(const G4String &)
G4int G4GDMLEvaluator::EvaluateInteger |
( |
const G4String & |
expression | ) |
|
Definition at line 234 of file G4GDMLEvaluator.cc.
248 G4String error_msg =
"Expression '" + expression
249 +
"' is expected to have an integer value!";
250 G4Exception(
"G4GDMLEvaluator::EvaluateInteger()",
"InvalidExpression",
const XML_Char int const XML_Char * value
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
G4double Evaluate(const G4String &)
Definition at line 256 of file G4GDMLEvaluator.cc.
260 G4String error_msg =
"Constant '" + name
261 +
"' is not defined! It is a variable!";
262 G4Exception(
"G4GDMLEvaluator::GetConstant()",
"InvalidSetup",
267 G4String error_msg =
"Constant '" + name +
"' is not defined!";
268 G4Exception(
"G4GDMLEvaluator::GetConstant()",
"InvalidSetup",
G4bool IsVariable(const G4String &) const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
G4double Evaluate(const G4String &)
Definition at line 274 of file G4GDMLEvaluator.cc.
278 G4String error_msg =
"Variable '" + name +
"' is not a defined!";
279 G4Exception(
"G4GDMLEvaluator::GetVariable()",
"InvalidSetup",
G4bool IsVariable(const G4String &) const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
G4double Evaluate(const G4String &)
Definition at line 146 of file G4GDMLEvaluator.cc.
148 const size_t variableCount = variableList.size();
150 for (
size_t i=0;i<variableCount;i++)
152 if (variableList[i] == name) {
return true; }
Definition at line 135 of file G4GDMLEvaluator.cc.
139 G4String error_msg =
"Variable '" + name +
"' is not defined!";
140 G4Exception(
"G4GDMLEvaluator::SetVariable()",
"InvalidSetup",
const XML_Char int const XML_Char * value
G4bool IsVariable(const G4String &) const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition at line 158 of file G4GDMLEvaluator.cc.
160 std::string::size_type full = in.size();
161 std::string::size_type open = in.find(
"[",0);
162 std::string::size_type close = in.find(
"]",0);
164 if (open==close) {
return in; }
166 if ((open>close) || (open==std::string::npos) || (close==std::string::npos))
168 G4String error_msg =
"Bracket mismatch: " + in;
169 G4Exception(
"G4GDMLEvaluator::SolveBrackets()",
"InvalidExpression",
174 std::string::size_type begin = open;
175 std::string::size_type end = 0;
176 std::string::size_type end1 = 0;
184 end = in.find(
",",begin+1);
185 end1= in.find(
"]",begin+1);
186 if (end>end1) { end = end1; }
187 if (end==std::string::npos) { end = close;}
189 std::stringstream indexStream;
190 indexStream <<
"_" <<
EvaluateInteger(in.substr(begin+1,end-begin-1))-1;
192 out.append(indexStream.str());
198 if (full==close) {
return out; }
200 open = in.find(
"[",begin);
201 close = in.find(
"]",begin+1);
203 if (open==close) { out.
append(in.substr(end+1,full-end-1));
return out; }
204 out.
append(in.substr(end+1,open-end-1));
208 }
while (close<full);
G4int EvaluateInteger(const G4String &)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
G4String & append(const G4String &)
The documentation for this class was generated from the following files: