Geant4-11
Functions
G4ConversionUtils Namespace Reference

Functions

template<>
G4bool Convert (const G4String &myInput, G4DimensionedDouble &min, G4DimensionedDouble &max)
 
template<>
G4bool Convert (const G4String &myInput, G4DimensionedDouble &output)
 
template<>
G4bool Convert (const G4String &myInput, G4DimensionedThreeVector &min, G4DimensionedThreeVector &max)
 
template<>
G4bool Convert (const G4String &myInput, G4DimensionedThreeVector &output)
 
template<>
G4bool Convert (const G4String &myInput, G4ThreeVector &min, G4ThreeVector &max)
 
template<>
G4bool Convert (const G4String &myInput, G4ThreeVector &output)
 
template<typename Value >
G4bool Convert (const G4String &myInput, Value &output)
 
template<typename Value >
G4bool Convert (const G4String &myInput, Value &value1, Value &value2)
 

Function Documentation

◆ Convert() [1/8]

template<>
G4bool G4ConversionUtils::Convert ( const G4String myInput,
G4DimensionedDouble min,
G4DimensionedDouble max 
)
inline

Definition at line 122 of file G4ConversionUtils.hh.

124 {
125 G4String input = G4StrUtil::strip_copy(myInput);
126
127 G4double valueMin, valueMax;
128 G4String unitsMin, unitsMax;
129
130 std::istringstream is(input);
131 char tester;
132
133 if (!(is >> valueMin >> unitsMin >> valueMax >> unitsMax) || is.get(tester)) return false;;
134
135 min = G4DimensionedDouble(valueMin, unitsMin);
136 max = G4DimensionedDouble(valueMax, unitsMax);
137
138 return true;
139 }
G4DimensionedType< G4double > G4DimensionedDouble
double G4double
Definition: G4Types.hh:83
T max(const T t1, const T t2)
brief Return the largest of the two arguments
T min(const T t1, const T t2)
brief Return the smallest of the two arguments
G4String strip_copy(G4String str, char c=' ')
Return copy of string with leading and trailing characters removed.

References G4INCL::Math::max(), G4INCL::Math::min(), and G4StrUtil::strip_copy().

◆ Convert() [2/8]

template<>
G4bool G4ConversionUtils::Convert ( const G4String myInput,
G4DimensionedDouble output 
)
inline

Definition at line 57 of file G4ConversionUtils.hh.

58 {
59 G4String input = G4StrUtil::strip_copy(myInput);
60
61 G4double value;
62 G4String unit;
63
64 std::istringstream is(input);
65 char tester;
66
67 if (!(is >> value >> unit) || is.get(tester)) return false;
68
69 output = G4DimensionedDouble(value, unit);
70
71 return true;
72 }

References G4StrUtil::strip_copy().

◆ Convert() [3/8]

template<>
G4bool G4ConversionUtils::Convert ( const G4String myInput,
G4DimensionedThreeVector min,
G4DimensionedThreeVector max 
)
inline

Definition at line 141 of file G4ConversionUtils.hh.

143 {
144 G4String input = G4StrUtil::strip_copy(myInput);
145
146 G4double valueMinX, valueMinY, valueMinZ;
147 G4double valueMaxX, valueMaxY, valueMaxZ;
148 G4String unitMin, unitMax;
149
150 std::istringstream is(input);
151 char tester;
152
153 if (!(is >> valueMinX >> valueMinY >> valueMinZ >> unitMin >> valueMaxX >> valueMaxY >> valueMaxZ >> unitMax)
154 || is.get(tester)) return false;
155
156 min = G4DimensionedThreeVector(G4ThreeVector(valueMinX, valueMinY, valueMinZ), unitMin);
157 max = G4DimensionedThreeVector(G4ThreeVector(valueMaxX, valueMaxY, valueMaxZ), unitMax);
158
159 return true;
160 }
G4DimensionedType< G4ThreeVector > G4DimensionedThreeVector
CLHEP::Hep3Vector G4ThreeVector

References G4INCL::Math::max(), G4INCL::Math::min(), and G4StrUtil::strip_copy().

◆ Convert() [4/8]

template<>
G4bool G4ConversionUtils::Convert ( const G4String myInput,
G4DimensionedThreeVector output 
)
inline

Definition at line 74 of file G4ConversionUtils.hh.

76 {
77 G4String input = G4StrUtil::strip_copy(myInput);
78
79 G4double value1, value2, value3;
80 G4String unit;
81
82 std::istringstream is(input);
83 char tester;
84
85 if (!(is >> value1 >> value2 >> value3 >>unit) || is.get(tester)) return false;
86
87 output = G4DimensionedThreeVector(G4ThreeVector(value1, value2, value3), unit);
88
89 return true;
90 }

References G4StrUtil::strip_copy().

◆ Convert() [5/8]

template<>
G4bool G4ConversionUtils::Convert ( const G4String myInput,
G4ThreeVector min,
G4ThreeVector max 
)
inline

Definition at line 162 of file G4ConversionUtils.hh.

164 {
165 G4String input = G4StrUtil::strip_copy(myInput);
166
167 G4double valueMinX, valueMinY, valueMinZ;
168 G4double valueMaxX, valueMaxY, valueMaxZ;
169
170 std::istringstream is(input);
171 char tester;
172
173 if (!(is >> valueMinX >> valueMinY >> valueMinZ >> valueMaxX >> valueMaxY >> valueMaxZ)
174 || is.get(tester)) return false;
175
176 min = G4ThreeVector(valueMinX, valueMinY, valueMinZ);
177 max = G4ThreeVector(valueMaxX, valueMaxY, valueMaxZ);
178
179 return true;
180 }

References G4INCL::Math::max(), G4INCL::Math::min(), and G4StrUtil::strip_copy().

◆ Convert() [6/8]

template<>
G4bool G4ConversionUtils::Convert ( const G4String myInput,
G4ThreeVector output 
)
inline

Definition at line 92 of file G4ConversionUtils.hh.

93 {
94 G4String input = G4StrUtil::strip_copy(myInput);
95
96 G4double value1, value2, value3;
97
98 std::istringstream is(input);
99 char tester;
100
101 if (!(is >> value1 >> value2 >> value3) || is.get(tester)) return false;
102 output = G4ThreeVector(value1, value2, value3);
103
104 return true;
105 }

References G4StrUtil::strip_copy().

◆ Convert() [7/8]

template<typename Value >
G4bool G4ConversionUtils::Convert ( const G4String myInput,
Value &  output 
)

◆ Convert() [8/8]

template<typename Value >
G4bool G4ConversionUtils::Convert ( const G4String myInput,
Value &  value1,
Value &  value2 
)

Definition at line 110 of file G4ConversionUtils.hh.

112 {
113 G4String input = G4StrUtil::strip_copy(myInput);
114
115 std::istringstream is(input);
116 char tester;
117
118 return ((is >> value1 >> value2) && (!is.get(tester)));
119 }

References G4StrUtil::strip_copy().