BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
Loading...
Searching...
No Matches
BDSGDMLPreprocessor.hh
1/*
2Beam Delivery Simulation (BDSIM) Copyright (C) BDSIM Collaboration, 2001 - 2026.
3
4This file is part of BDSIM.
5
6BDSIM is free software: you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published
8by the Free Software Foundation version 3 of the License.
9
10BDSIM is distributed in the hope that it will be useful, but
11WITHOUT ANY WARRANTY; without even the implied warranty of
12MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13GNU General Public License for more details.
14
15You should have received a copy of the GNU General Public License
16along with BDSIM. If not, see <http://www.gnu.org/licenses/>.
17*/
18#ifdef USE_GDML
19
20#ifndef BDSGDMLPREPROCESSOR_H
21#define BDSGDMLPREPROCESSOR_H
22
23#include "G4String.hh"
24
25#include <vector>
26#include <map>
27
28#include "xercesc/dom/DOM.hpp"
29#include "xercesc/dom/DOMNodeList.hpp"
30
31namespace BDS
32{
33 G4String PreprocessGDML(const G4String& file,
34 const G4String& prefix,
35 G4bool preprocessSchema = true);
36
37 G4String PreprocessGDMLSchemaOnly(const G4String& file);
38
40 G4String GDMLSchemaLocation();
41}
42
54{
55public:
58
59 G4String PreprocessFile(const G4String& file,
60 const G4String& prefix,
61 G4bool preprocessSchema = true);
62
65 static G4String ProcessedNodeName(const G4String& nodeName,
66 const G4String& prefix);
67private:
68
69 void ReadDoc(xercesc::DOMNodeIterator* docIterator, G4bool processSchema);
70 void ReadNode(xercesc::DOMNode* node, G4bool processSchema);
71 void ProcessGDMLNode(xercesc::DOMNamedNodeMap* attributeMap);
72 void ReadAttributes(xercesc::DOMNamedNodeMap* attributeMap);
73 void ProcessDoc(xercesc::DOMNodeIterator* dotIterator, const G4String& prefix);
74 void ProcessNode(xercesc::DOMNode* node, const G4String& prefix);
75 void ProcessAttributes(xercesc::DOMNamedNodeMap* attributeMap, const G4String& prefix, bool property = false);
76
77 G4String parentDir;
78 std::vector<std::string> ignoreNodes;
79 std::vector<std::string> ignoreAttrs;
80 std::vector<std::string> names;
81 std::map<std::string, int> count;
82
83};
84
85#endif
86
87#endif
Process a GDML file to allow multiple file loading.
static G4String ProcessedNodeName(const G4String &nodeName, const G4String &prefix)
std::vector< std::string > ignoreNodes
Nodes to ignore.
G4String PreprocessFile(const G4String &file, const G4String &prefix, G4bool preprocessSchema=true)
std::vector< std::string > names
Names to replace.
std::map< std::string, int > count
Debugging.
std::vector< std::string > ignoreAttrs
Attributes to ignore.
G4String parentDir
Directory of main gdml file.
Return either G4Tubs or G4CutTubs depending on flat face.
G4String GDMLSchemaLocation()
Get GDML Schema location included with BDSIM.