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]; }
95 if (r>=rows || c>=cols)
105 if (r>=rows || c>=cols)
149 const xercesc::DOMNamedNodeMap*
const attributes
150 = constantElement->getAttributes();
151 XMLSize_t attributeCount = attributes->getLength();
153 for (XMLSize_t attribute_index=0;
154 attribute_index<attributeCount; attribute_index++)
156 xercesc::DOMNode* node = attributes->item(attribute_index);
158 if (node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE) {
continue; }
160 const xercesc::DOMAttr*
const attribute
161 =
dynamic_cast<xercesc::DOMAttr*
>(node);
164 G4Exception(
"G4GDMLRead::ConstantRead()",
"InvalidRead",
171 if (attName==
"name") { name = attValue; }
else
172 if (attName==
"value") { value =
eval.
Evaluate(attValue); }
184 const xercesc::DOMNamedNodeMap*
const attributes
185 = expElement->getAttributes();
186 XMLSize_t attributeCount = attributes->getLength();
188 for (XMLSize_t attribute_index=0;
189 attribute_index<attributeCount; attribute_index++)
191 xercesc::DOMNode* node = attributes->item(attribute_index);
193 if (node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE) {
continue; }
195 const xercesc::DOMAttr*
const attribute
196 =
dynamic_cast<xercesc::DOMAttr*
>(node);
199 G4Exception(
"G4GDMLRead::ExpressionRead()",
"InvalidRead",
206 if (attName==
"name") { name = attValue; }
221 const xercesc::DOMNamedNodeMap*
const attributes
222 = matrixElement->getAttributes();
223 XMLSize_t attributeCount = attributes->getLength();
225 for (XMLSize_t attribute_index=0;
226 attribute_index<attributeCount; attribute_index++)
228 xercesc::DOMNode* node = attributes->item(attribute_index);
230 if (node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE) {
continue; }
232 const xercesc::DOMAttr*
const attribute
233 =
dynamic_cast<xercesc::DOMAttr*
>(node);
236 G4Exception(
"G4GDMLRead::MatrixRead()",
"InvalidRead",
243 if (attName==
"name") { name =
GenerateName(attValue); }
else
245 if (attName==
"values") { values = attValue; }
248 std::stringstream MatrixValueStream(values);
249 std::vector<G4double> valueList;
251 while (!MatrixValueStream.eof())
254 MatrixValueStream >> MatrixValue;
262 for (
size_t i=0;i<valueList.size();i++)
264 matrix.
Set(i/coldim,i%coldim,valueList[i]);
277 const xercesc::DOMNamedNodeMap*
const attributes
278 = positionElement->getAttributes();
279 XMLSize_t attributeCount = attributes->getLength();
281 for (XMLSize_t attribute_index=0;
282 attribute_index<attributeCount; attribute_index++)
284 xercesc::DOMNode* node = attributes->item(attribute_index);
286 if (node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE) {
continue; }
288 const xercesc::DOMAttr*
const attribute
289 =
dynamic_cast<xercesc::DOMAttr*
>(node);
292 G4Exception(
"G4GDMLRead::PositionRead()",
"InvalidRead",
299 if (attName==
"name") { name =
GenerateName(attValue); }
else
300 if (attName==
"unit") { unit =
eval.
Evaluate(attValue); }
else
316 const xercesc::DOMNamedNodeMap*
const attributes
317 = rotationElement->getAttributes();
318 XMLSize_t attributeCount = attributes->getLength();
320 for (XMLSize_t attribute_index=0;
321 attribute_index<attributeCount; attribute_index++)
323 xercesc::DOMNode* node = attributes->item(attribute_index);
325 if (node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE) {
continue; }
327 const xercesc::DOMAttr*
const attribute
328 =
dynamic_cast<xercesc::DOMAttr*
>(node);
331 G4Exception(
"G4GDMLRead::RotationRead()",
"InvalidRead",
338 if (attName==
"name") { name =
GenerateName(attValue); }
else
339 if (attName==
"unit") { unit =
eval.
Evaluate(attValue); }
else
353 const xercesc::DOMNamedNodeMap*
const attributes
354 = scaleElement->getAttributes();
355 XMLSize_t attributeCount = attributes->getLength();
357 for (XMLSize_t attribute_index=0;
358 attribute_index<attributeCount; attribute_index++)
360 xercesc::DOMNode* node = attributes->item(attribute_index);
362 if (node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE) {
continue; }
364 const xercesc::DOMAttr*
const attribute
365 =
dynamic_cast<xercesc::DOMAttr*
>(node);
368 G4Exception(
"G4GDMLRead::ScaleRead()",
"InvalidRead",
375 if (attName==
"name") { name =
GenerateName(attValue); }
else
390 const xercesc::DOMNamedNodeMap*
const attributes
391 = variableElement->getAttributes();
392 XMLSize_t attributeCount = attributes->getLength();
394 for (XMLSize_t attribute_index=0;
395 attribute_index<attributeCount; attribute_index++)
397 xercesc::DOMNode* node = attributes->item(attribute_index);
399 if (node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE) {
continue; }
401 const xercesc::DOMAttr*
const attribute
402 =
dynamic_cast<xercesc::DOMAttr*
>(node);
405 G4Exception(
"G4GDMLRead::VariableRead()",
"InvalidRead",
412 if (attName==
"name") { name = attValue; }
else
413 if (attName==
"value") { value =
eval.
Evaluate(attValue); }
425 const xercesc::DOMNamedNodeMap*
const attributes
426 = element->getAttributes();
427 XMLSize_t attributeCount = attributes->getLength();
429 for (XMLSize_t attribute_index=0;
430 attribute_index<attributeCount; attribute_index++)
432 xercesc::DOMNode* node = attributes->item(attribute_index);
434 if (node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE) {
continue; }
436 const xercesc::DOMAttr*
const attribute
437 =
dynamic_cast<xercesc::DOMAttr*
>(node);
440 G4Exception(
"G4GDMLRead::QuantityRead()",
"InvalidRead",
447 if (attName==
"name") { name = attValue; }
else
448 if (attName==
"value") { value =
eval.
Evaluate(attValue); }
else
449 if (attName==
"unit") { unit =
eval.
Evaluate(attValue); }
461 for (xercesc::DOMNode* iter = defineElement->getFirstChild();
462 iter != 0;iter = iter->getNextSibling())
464 if (iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE) {
continue; }
466 const xercesc::DOMElement*
const child
467 =
dynamic_cast<xercesc::DOMElement*
>(iter);
470 G4Exception(
"G4GDMLRead::DefineRead()",
"InvalidRead",
477 if (tag==
"matrix") {
MatrixRead(child); }
else
480 if (tag==
"scale") {
ScaleRead(child); }
else
486 G4String error_msg =
"Unknown tag in define: "+tag;
487 G4Exception(
"G4GDMLReadDefine::defineRead()",
"ReadError",
499 const xercesc::DOMNamedNodeMap*
const attributes
500 = vectorElement->getAttributes();
501 XMLSize_t attributeCount = attributes->getLength();
503 for (XMLSize_t attribute_index=0;
504 attribute_index<attributeCount; attribute_index++)
506 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
508 if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
511 const xercesc::DOMAttr*
const attribute
512 =
dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
515 G4Exception(
"G4GDMLRead::VectorRead()",
"InvalidRead",
522 if (attName==
"unit") { unit =
eval.
Evaluate(attValue); }
else
535 const xercesc::DOMNamedNodeMap*
const attributes = element->getAttributes();
536 XMLSize_t attributeCount = attributes->getLength();
538 for (XMLSize_t attribute_index=0;
539 attribute_index<attributeCount; attribute_index++)
541 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
543 if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
546 const xercesc::DOMAttr*
const attribute
547 =
dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
557 if (attName==
"ref") { ref = attValue; }
582 G4String error_msg =
"Quantity '"+ref+
"' was not found!";
583 G4Exception(
"G4GDMLReadDefine::getQuantity()",
"ReadError",
593 G4String error_msg =
"Position '"+ref+
"' was not found!";
594 G4Exception(
"G4GDMLReadDefine::getPosition()",
"ReadError",
604 G4String error_msg =
"Rotation '"+ref+
"' was not found!";
605 G4Exception(
"G4GDMLReadDefine::getRotation()",
"ReadError",
615 G4String error_msg =
"Scale '"+ref+
"' was not found!";
616 G4Exception(
"G4GDMLReadDefine::getScale()",
"ReadError",
626 G4String error_msg =
"Matrix '"+ref+
"' was not found!";
627 G4Exception(
"G4GDMLReadDefine::getMatrix()",
"ReadError",