#include <G4GDMLEvaluator.hh>
Definition at line 47 of file G4GDMLEvaluator.hh.
◆ G4GDMLEvaluator()
G4GDMLEvaluator::G4GDMLEvaluator |
( |
| ) |
|
Definition at line 41 of file G4GDMLEvaluator.cc.
static const double candela
static const double meter
static const double second
static const double kelvin
static const double kilogram
static const double ampere
◆ Clear()
void G4GDMLEvaluator::Clear |
( |
| ) |
|
Definition at line 48 of file G4GDMLEvaluator.cc.
static const double candela
std::vector< G4String > variableList
static const double meter
static const double second
static const double kelvin
static const double kilogram
static const double ampere
◆ ConvertToString() [1/2]
◆ ConvertToString() [2/2]
◆ DefineConstant()
Definition at line 57 of file G4GDMLEvaluator.cc.
61 G4String error_msg =
"Redefinition of constant or variable: "+
name;
62 G4Exception(
"G4GDMLEvaluator::DefineConstant()",
"InvalidExpression",
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
◆ DefineMatrix()
void G4GDMLEvaluator::DefineMatrix |
( |
const G4String & |
name, |
|
|
G4int |
coldim, |
|
|
std::vector< G4double > |
valueList |
|
) |
| |
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)
◆ DefineVariable()
Definition at line 68 of file G4GDMLEvaluator.cc.
72 G4String error_msg =
"Redefinition of constant or variable: "+
name;
73 G4Exception(
"G4GDMLEvaluator::DefineVariable()",
"InvalidExpression",
std::vector< G4String > variableList
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
◆ Evaluate()
Definition at line 213 of file G4GDMLEvaluator.cc.
219 if (!expression.empty())
226 G4String error_msg =
"Error in expression: " + expression;
227 G4Exception(
"G4GDMLEvaluator::Evaluate()",
"InvalidExpression",
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
G4String SolveBrackets(const G4String &)
◆ EvaluateInteger()
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",
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
G4double Evaluate(const G4String &)
◆ GetConstant()
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",
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
G4bool IsVariable(const G4String &) const
G4double Evaluate(const G4String &)
◆ GetVariable()
Definition at line 274 of file G4GDMLEvaluator.cc.
278 G4String error_msg =
"Variable '" + name +
"' is not a defined!";
279 G4Exception(
"G4GDMLEvaluator::GetVariable()",
"InvalidSetup",
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
G4bool IsVariable(const G4String &) const
G4double Evaluate(const G4String &)
◆ IsVariable()
Definition at line 146 of file G4GDMLEvaluator.cc.
150 for (
size_t i=0;i<variableCount;i++)
std::vector< G4String > variableList
◆ SetVariable()
Definition at line 135 of file G4GDMLEvaluator.cc.
139 G4String error_msg =
"Variable '" + name +
"' is not defined!";
140 G4Exception(
"G4GDMLEvaluator::SetVariable()",
"InvalidSetup",
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
G4bool IsVariable(const G4String &) const
◆ SolveBrackets()
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;
178 out.append(in,0,open);
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 &)
◆ eval
◆ variableList
std::vector<G4String> G4GDMLEvaluator::variableList |
|
private |
The documentation for this class was generated from the following files: