37 :
m(0), rows(0), cols(0)
43 if ((rows0==0) || (cols0==0))
45 G4Exception(
"G4GDMLMatrix::G4GDMLMatrix(r,c)",
"InvalidSetup",
54 :
m(0), rows(0), cols(0)
61 for (
size_t i=0; i<
rows*
cols; i++) {
m[i] = rhs.
m[i]; }
69 if (
this == &rhs) {
return *
this; }
78 for (
size_t i=0; i<
rows*
cols; i++) {
m[i] = rhs.
m[i]; }
150 const xercesc::DOMNamedNodeMap*
const attributes
151 = constantElement->getAttributes();
152 XMLSize_t attributeCount = attributes->getLength();
154 for (XMLSize_t attribute_index=0;
155 attribute_index<attributeCount; attribute_index++)
157 xercesc::DOMNode* node = attributes->item(attribute_index);
159 if (node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE) {
continue; }
161 const xercesc::DOMAttr*
const attribute
162 =
dynamic_cast<xercesc::DOMAttr*
>(node);
165 G4Exception(
"G4GDMLRead::ConstantRead()",
"InvalidRead",
172 if (attName==
"name") { name = attValue; }
else
173 if (attName==
"value") { value =
eval.
Evaluate(attValue); }
185 const xercesc::DOMNamedNodeMap*
const attributes
186 = expElement->getAttributes();
187 XMLSize_t attributeCount = attributes->getLength();
189 for (XMLSize_t attribute_index=0;
190 attribute_index<attributeCount; attribute_index++)
192 xercesc::DOMNode* node = attributes->item(attribute_index);
194 if (node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE) {
continue; }
196 const xercesc::DOMAttr*
const attribute
197 =
dynamic_cast<xercesc::DOMAttr*
>(node);
200 G4Exception(
"G4GDMLRead::ExpressionRead()",
"InvalidRead",
207 if (attName==
"name") { name = attValue; }
222 const xercesc::DOMNamedNodeMap*
const attributes
223 = matrixElement->getAttributes();
224 XMLSize_t attributeCount = attributes->getLength();
226 for (XMLSize_t attribute_index=0;
227 attribute_index<attributeCount; attribute_index++)
229 xercesc::DOMNode* node = attributes->item(attribute_index);
231 if (node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE) {
continue; }
233 const xercesc::DOMAttr*
const attribute
234 =
dynamic_cast<xercesc::DOMAttr*
>(node);
237 G4Exception(
"G4GDMLRead::MatrixRead()",
"InvalidRead",
244 if (attName==
"name") { name =
GenerateName(attValue); }
else
246 if (attName==
"values") { values = attValue; }
249 std::stringstream MatrixValueStream(values);
250 std::vector<G4double> valueList;
252 while (!MatrixValueStream.eof())
255 MatrixValueStream >> MatrixValue;
263 for (
size_t i=0;i<valueList.size();i++)
265 matrix.
Set(i/coldim,i%coldim,valueList[i]);
278 const xercesc::DOMNamedNodeMap*
const attributes
279 = positionElement->getAttributes();
280 XMLSize_t attributeCount = attributes->getLength();
282 for (XMLSize_t attribute_index=0;
283 attribute_index<attributeCount; attribute_index++)
285 xercesc::DOMNode* node = attributes->item(attribute_index);
287 if (node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE) {
continue; }
289 const xercesc::DOMAttr*
const attribute
290 =
dynamic_cast<xercesc::DOMAttr*
>(node);
293 G4Exception(
"G4GDMLRead::PositionRead()",
"InvalidRead",
300 if (attName==
"name") { name =
GenerateName(attValue); }
else
303 G4Exception(
"G4GDMLReadDefine::PositionRead()",
"InvalidRead",
321 const xercesc::DOMNamedNodeMap*
const attributes
322 = rotationElement->getAttributes();
323 XMLSize_t attributeCount = attributes->getLength();
325 for (XMLSize_t attribute_index=0;
326 attribute_index<attributeCount; attribute_index++)
328 xercesc::DOMNode* node = attributes->item(attribute_index);
330 if (node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE) {
continue; }
332 const xercesc::DOMAttr*
const attribute
333 =
dynamic_cast<xercesc::DOMAttr*
>(node);
336 G4Exception(
"G4GDMLRead::RotationRead()",
"InvalidRead",
343 if (attName==
"name") { name =
GenerateName(attValue); }
else
346 G4Exception(
"G4GDMLReadDefine::RotationRead()",
"InvalidRead",
362 const xercesc::DOMNamedNodeMap*
const attributes
363 = scaleElement->getAttributes();
364 XMLSize_t attributeCount = attributes->getLength();
366 for (XMLSize_t attribute_index=0;
367 attribute_index<attributeCount; attribute_index++)
369 xercesc::DOMNode* node = attributes->item(attribute_index);
371 if (node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE) {
continue; }
373 const xercesc::DOMAttr*
const attribute
374 =
dynamic_cast<xercesc::DOMAttr*
>(node);
377 G4Exception(
"G4GDMLRead::ScaleRead()",
"InvalidRead",
384 if (attName==
"name") { name =
GenerateName(attValue); }
else
399 const xercesc::DOMNamedNodeMap*
const attributes
400 = variableElement->getAttributes();
401 XMLSize_t attributeCount = attributes->getLength();
403 for (XMLSize_t attribute_index=0;
404 attribute_index<attributeCount; attribute_index++)
406 xercesc::DOMNode* node = attributes->item(attribute_index);
408 if (node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE) {
continue; }
410 const xercesc::DOMAttr*
const attribute
411 =
dynamic_cast<xercesc::DOMAttr*
>(node);
414 G4Exception(
"G4GDMLRead::VariableRead()",
"InvalidRead",
421 if (attName==
"name") { name = attValue; }
else
422 if (attName==
"value") { value =
eval.
Evaluate(attValue); }
434 const xercesc::DOMNamedNodeMap*
const attributes
435 = element->getAttributes();
436 XMLSize_t attributeCount = attributes->getLength();
438 for (XMLSize_t attribute_index=0;
439 attribute_index<attributeCount; attribute_index++)
441 xercesc::DOMNode* node = attributes->item(attribute_index);
443 if (node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE) {
continue; }
445 const xercesc::DOMAttr*
const attribute
446 =
dynamic_cast<xercesc::DOMAttr*
>(node);
449 G4Exception(
"G4GDMLRead::QuantityRead()",
"InvalidRead",
456 if (attName==
"name") { name = attValue; }
else
457 if (attName==
"value") { value =
eval.
Evaluate(attValue); }
else
471 for (xercesc::DOMNode* iter = defineElement->getFirstChild();
472 iter != 0;iter = iter->getNextSibling())
474 if (iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE) {
continue; }
476 const xercesc::DOMElement*
const child
477 =
dynamic_cast<xercesc::DOMElement*
>(iter);
480 G4Exception(
"G4GDMLRead::DefineRead()",
"InvalidRead",
487 if (tag==
"matrix") {
MatrixRead(child); }
else
490 if (tag==
"scale") {
ScaleRead(child); }
else
496 G4String error_msg =
"Unknown tag in define: "+tag;
497 G4Exception(
"G4GDMLReadDefine::defineRead()",
"ReadError",
509 const xercesc::DOMNamedNodeMap*
const attributes
510 = vectorElement->getAttributes();
511 XMLSize_t attributeCount = attributes->getLength();
513 for (XMLSize_t attribute_index=0;
514 attribute_index<attributeCount; attribute_index++)
516 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
518 if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
521 const xercesc::DOMAttr*
const attribute
522 =
dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
525 G4Exception(
"G4GDMLRead::VectorRead()",
"InvalidRead",
545 const xercesc::DOMNamedNodeMap*
const attributes = element->getAttributes();
546 XMLSize_t attributeCount = attributes->getLength();
548 for (XMLSize_t attribute_index=0;
549 attribute_index<attributeCount; attribute_index++)
551 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
553 if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
556 const xercesc::DOMAttr*
const attribute
557 =
dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
567 if (attName==
"ref") { ref = attValue; }
592 G4String error_msg =
"Quantity '"+ref+
"' was not found!";
593 G4Exception(
"G4GDMLReadDefine::getQuantity()",
"ReadError",
603 G4String error_msg =
"Position '"+ref+
"' was not found!";
604 G4Exception(
"G4GDMLReadDefine::getPosition()",
"ReadError",
614 G4String error_msg =
"Rotation '"+ref+
"' was not found!";
615 G4Exception(
"G4GDMLReadDefine::getRotation()",
"ReadError",
625 G4String error_msg =
"Scale '"+ref+
"' was not found!";
626 G4Exception(
"G4GDMLReadDefine::getScale()",
"ReadError",
636 G4String error_msg =
"Matrix '"+ref+
"' was not found!";
637 G4Exception(
"G4GDMLReadDefine::getMatrix()",
"ReadError",