File indexing completed on 2025-01-18 09:58:19
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035 #ifndef G4GDMLREADDEFINE_HH
0036 #define G4GDMLREADDEFINE_HH 1
0037
0038 #include <map>
0039
0040 #include "G4ThreeVector.hh"
0041 #include "G4RotationMatrix.hh"
0042
0043 #include "G4GDMLRead.hh"
0044
0045 class G4GDMLMatrix
0046 {
0047 public:
0048
0049 G4GDMLMatrix();
0050 G4GDMLMatrix(std::size_t rows0, std::size_t cols0);
0051 G4GDMLMatrix(const G4GDMLMatrix& rhs);
0052 G4GDMLMatrix& operator=(const G4GDMLMatrix& rhs);
0053 ~G4GDMLMatrix();
0054
0055 void Set(std::size_t r, std::size_t c, G4double a);
0056 G4double Get(std::size_t r, std::size_t c) const;
0057 std::size_t GetRows() const;
0058 std::size_t GetCols() const;
0059
0060 private:
0061
0062 G4double* m = nullptr;
0063 std::size_t rows = 0, cols = 0;
0064 };
0065
0066 class G4GDMLReadDefine : public G4GDMLRead
0067 {
0068 public:
0069
0070 G4bool IsValidID(const G4String&) const;
0071 G4double GetConstant(const G4String&);
0072 G4double GetVariable(const G4String&);
0073 G4double GetQuantity(const G4String&);
0074 G4ThreeVector GetPosition(const G4String&);
0075 G4ThreeVector GetRotation(const G4String&);
0076 G4ThreeVector GetScale(const G4String&);
0077 G4GDMLMatrix GetMatrix(const G4String&);
0078
0079 virtual void DefineRead(const xercesc::DOMElement* const);
0080
0081 inline void SetReverseSearch(G4bool flag)
0082 { reverseSearch = flag; }
0083
0084 protected:
0085
0086 G4GDMLReadDefine();
0087 virtual ~G4GDMLReadDefine();
0088
0089 G4RotationMatrix GetRotationMatrix(const G4ThreeVector&);
0090 void VectorRead(const xercesc::DOMElement* const, G4ThreeVector&);
0091 G4String RefRead(const xercesc::DOMElement* const);
0092
0093 void ConstantRead(const xercesc::DOMElement* const);
0094 void MatrixRead(const xercesc::DOMElement* const);
0095 void PositionRead(const xercesc::DOMElement* const);
0096 void RotationRead(const xercesc::DOMElement* const);
0097 void ScaleRead(const xercesc::DOMElement* const);
0098 void VariableRead(const xercesc::DOMElement* const);
0099 void QuantityRead(const xercesc::DOMElement* const);
0100 void ExpressionRead(const xercesc::DOMElement* const);
0101
0102 protected:
0103 G4bool reverseSearch = false;
0104 std::map<G4String, G4double> quantityMap;
0105 std::map<G4String, G4ThreeVector> positionMap;
0106 std::map<G4String, G4ThreeVector> rotationMap;
0107 std::map<G4String, G4ThreeVector> scaleMap;
0108 std::map<G4String, G4GDMLMatrix> matrixMap;
0109 };
0110
0111 #endif