57  char* char_str = xercesc::XMLString::transcode(toTranscode);
 
   59  xercesc::XMLString::release(&char_str);
 
   94    std::stringstream stream;
 
   96    nameOut = stream.str();
 
  114  auto idx = 
name.find(
"0x");
 
  115  if(idx != G4String::npos)
 
  133  G4cout << 
"Stripping off GDML names of materials, solids and volumes ..." 
  141  for(i = 0; i < solids->size(); ++i)
 
  152  for(i = 0; i < lvols->size(); ++i)
 
  163  for(i = 0; i < pvols->size(); ++i)
 
  174  for(i = 0; i < materials->size(); ++i)
 
  184  for(i = 0; i < elements->size(); ++i)
 
  195  void (
G4GDMLRead::*func)(
const xercesc::DOMElement* 
const))
 
  202  const xercesc::DOMNamedNodeMap* 
const attributes = element->getAttributes();
 
  203  XMLSize_t attributeCount                         = attributes->getLength();
 
  205  for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
 
  208    xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
 
  210    if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
 
  215    const xercesc::DOMAttr* 
const attribute =
 
  216      dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
 
  220                  "No attribute found!");
 
  226    if(attribute_name == 
"for")
 
  228      var = attribute_value;
 
  230    else if(attribute_name == 
"from")
 
  232      from = attribute_value;
 
  234    else if(attribute_name == 
"to")
 
  236      to = attribute_value;
 
  238    else if(attribute_name == 
"step")
 
  240      step = attribute_value;
 
  247                "No variable is determined for loop!");
 
  253                "Variable is not defined in loop!");
 
  266  if((_from < _to) && (_step <= 0))
 
  271  if((_from > _to) && (_step >= 0))
 
  282    (this->*func)(element);
 
  296  const xercesc::DOMElement* 
const auxiliaryElement)
 
  301  const xercesc::DOMNamedNodeMap* 
const attributes =
 
  302    auxiliaryElement->getAttributes();
 
  303  XMLSize_t attributeCount = attributes->getLength();
 
  305  for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
 
  308    xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
 
  310    if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
 
  315    const xercesc::DOMAttr* 
const attribute =
 
  316      dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
 
  320                  "No attribute found!");
 
  326    if(attName == 
"auxtype")
 
  328      auxstruct.
type = attValue;
 
  330    else if(attName == 
"auxvalue")
 
  332      auxstruct.
value = attValue;
 
  334    else if(attName == 
"auxunit")
 
  336      auxstruct.
unit = attValue;
 
  340  for(xercesc::DOMNode* iter = auxiliaryElement->getFirstChild();
 
  341                        iter != 
nullptr; iter = iter->getNextSibling())
 
  343    if(iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE)
 
  348    const xercesc::DOMElement* 
const child =
 
  349      dynamic_cast<xercesc::DOMElement*
>(iter);
 
  358    if(
tag == 
"auxiliary")
 
  382  for(xercesc::DOMNode* iter = userinfoElement->getFirstChild();
 
  383                        iter != 
nullptr; iter = iter->getNextSibling())
 
  385    if(iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE)
 
  390    const xercesc::DOMElement* 
const child =
 
  391      dynamic_cast<xercesc::DOMElement*
>(iter);
 
  400    if(
tag == 
"auxiliary")
 
  406      G4String error_msg = 
"Unknown tag in structure: " + 
tag;
 
  416  G4String error_msg = 
"No handle to user-code for parsing extensions!";
 
  429    G4cout << 
"G4GDML: Reading module '" << fileName << 
"'..." << 
G4endl;
 
  433    G4cout << 
"G4GDML: Reading '" << fileName << 
"'..." << 
G4endl;
 
  440  xercesc::XercesDOMParser* 
parser = 
new xercesc::XercesDOMParser;
 
  444    parser->setValidationScheme(xercesc::XercesDOMParser::Val_Always);
 
  447  parser->setCreateEntityReferenceNodes(
false);
 
  450  parser->setDoNamespaces(
true);
 
  452  parser->setErrorHandler(handler);
 
  456    parser->parse(fileName.c_str());
 
  457  } 
catch(
const xercesc::XMLException& e)
 
  460  } 
catch(
const xercesc::DOMException& e)
 
  465  xercesc::DOMDocument* doc = 
parser->getDocument();
 
  469    G4String error_msg = 
"Unable to open document: " + fileName;
 
  473  xercesc::DOMElement* element = doc->getDocumentElement();
 
  475  if(element == 
nullptr )
 
  477    std::ostringstream message;
 
  478    message << 
"ERROR - Empty document or unable to validate schema!" << 
G4endl 
  479            << 
"        Check Internet connection is ON in case of schema" 
  481            << 
"        validation enabled and location defined as URL in" 
  482            << 
G4endl << 
"        the GDML file - " << fileName
 
  483            << 
" - being imported!" << 
G4endl 
  484            << 
"        Otherwise, verify GDML schema server is reachable!";
 
  489  for(xercesc::DOMNode* iter = element->getFirstChild(); iter != 
nullptr;
 
  490      iter                   = iter->getNextSibling())
 
  492    if(iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE)
 
  497    const xercesc::DOMElement* 
const child =
 
  498      dynamic_cast<xercesc::DOMElement*
>(iter);
 
  511    else if(
tag == 
"materials")
 
  515    else if(
tag == 
"solids")
 
  519    else if(
tag == 
"setup")
 
  523    else if(
tag == 
"structure")
 
  527    else if(
tag == 
"userinfo")
 
  531    else if(
tag == 
"extension")
 
  537      G4String error_msg = 
"Unknown tag in gdml: " + 
tag;
 
  549    G4cout << 
"G4GDML: Reading module '" << fileName << 
"' done!" << 
G4endl;
 
  554    G4cout << 
"G4GDML: Reading '" << fileName << 
"' done!" << 
G4endl;
 
std::vector< G4Element * > G4ElementTable
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::vector< G4GDMLAuxStructType > G4GDMLAuxListType
std::vector< G4Material * > G4MaterialTable
G4GLOB_DLL std::ostream G4cout
static G4ElementTable * GetElementTable()
void SetName(const G4String &name)
const G4String & GetName() const
void SetVariable(const G4String &, G4double)
G4bool IsVariable(const G4String &) const
G4int EvaluateInteger(const G4String &)
G4String SolveBrackets(const G4String &)
G4String Strip(const G4String &) const
G4GDMLAuxListType auxGlobalList
G4GDMLAuxStructType AuxiliaryRead(const xercesc::DOMElement *const auxElem)
void GeneratePhysvolName(const G4String &, G4VPhysicalVolume *)
virtual void SolidsRead(const xercesc::DOMElement *const)=0
G4String GenerateName(const G4String &name, G4bool strip=false)
const G4GDMLAuxListType * GetAuxList() const
virtual void MaterialsRead(const xercesc::DOMElement *const)=0
void LoopRead(const xercesc::DOMElement *const, void(G4GDMLRead::*)(const xercesc::DOMElement *const))
void Read(const G4String &, G4bool validation, G4bool isModule, G4bool strip=true)
virtual void UserinfoRead(const xercesc::DOMElement *const)
virtual void SetupRead(const xercesc::DOMElement *const)=0
G4String Transcode(const XMLCh *const)
void StripName(G4String &) const
virtual void ExtensionRead(const xercesc::DOMElement *const)
virtual void DefineRead(const xercesc::DOMElement *const)=0
virtual void StructureRead(const xercesc::DOMElement *const)=0
void OverlapCheck(G4bool)
static G4LogicalVolumeStore * GetInstance()
void SetName(const G4String &pName)
const G4String & GetName() const
void SetName(const G4String &name)
static G4MaterialTable * GetMaterialTable()
const G4String & GetName() const
static G4PhysicalVolumeStore * GetInstance()
static G4SolidStore * GetInstance()
static G4UnitsTable & GetUnitsTable()
G4LogicalVolume * GetLogicalVolume() const
const G4String & GetName() const
void SetName(const G4String &pName)
void SetName(const G4String &name)
const char * name(G4int ptype)
void strip(G4String &str, char c=' ')
Remove leading and trailing characters from string.
std::vector< G4GDMLAuxStructType > * auxList