Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // 26 // 26 // >> 27 // $Id$ 27 // 28 // 28 // 29 // 29 // John Allison 31st December 1997. 30 // John Allison 31st December 1997. 30 // Parameters associated with the modeling of 31 // Parameters associated with the modeling of GEANT4 objects. 31 32 32 #include "G4ModelingParameters.hh" 33 #include "G4ModelingParameters.hh" 33 34 34 #include "G4ios.hh" 35 #include "G4ios.hh" 35 #include "G4VisAttributes.hh" 36 #include "G4VisAttributes.hh" 36 #include "G4ExceptionSeverity.hh" 37 #include "G4ExceptionSeverity.hh" 37 #include "G4SystemOfUnits.hh" 38 #include "G4SystemOfUnits.hh" 38 #include "G4VSolid.hh" 39 #include "G4VSolid.hh" 39 #include "G4DisplacedSolid.hh" << 40 #include "G4VPhysicalVolume.hh" 40 #include "G4VPhysicalVolume.hh" 41 #include "G4PhysicalVolumeModel.hh" 41 #include "G4PhysicalVolumeModel.hh" 42 #include "G4UnitsTable.hh" << 43 << 44 #define G4warn G4cout << 45 42 46 G4ModelingParameters::G4ModelingParameters (): 43 G4ModelingParameters::G4ModelingParameters (): 47 fWarning (true), 44 fWarning (true), 48 fpDefaultVisAttributes (0), 45 fpDefaultVisAttributes (0), 49 fDrawingStyle (wf), 46 fDrawingStyle (wf), 50 fNumberOfCloudPoints (10000), << 51 fCulling (false), 47 fCulling (false), 52 fCullInvisible (false), 48 fCullInvisible (false), 53 fDensityCulling (false), 49 fDensityCulling (false), 54 fVisibleDensity (0.01 * g / cm3), 50 fVisibleDensity (0.01 * g / cm3), 55 fCullCovered (false), 51 fCullCovered (false), 56 fCBDAlgorithmNumber (0), << 57 fExplodeFactor (1.), 52 fExplodeFactor (1.), 58 fNoOfSides (24), 53 fNoOfSides (24), 59 fpSectionSolid (0), 54 fpSectionSolid (0), 60 fCutawayMode (cutawayUnion), << 61 fpCutawaySolid (0), 55 fpCutawaySolid (0), 62 fpEvent (0), << 56 fpEvent (0) 63 fSpecialMeshRendering (false) << 64 {} 57 {} 65 58 66 G4ModelingParameters::G4ModelingParameters 59 G4ModelingParameters::G4ModelingParameters 67 (const G4VisAttributes* pDefaultVisAttributes, 60 (const G4VisAttributes* pDefaultVisAttributes, 68 G4ModelingParameters::DrawingStyle drawingSty 61 G4ModelingParameters::DrawingStyle drawingStyle, 69 G4bool isCulling, 62 G4bool isCulling, 70 G4bool isCullingInvisible, 63 G4bool isCullingInvisible, 71 G4bool isDensityCulling, 64 G4bool isDensityCulling, 72 G4double visibleDensity, 65 G4double visibleDensity, 73 G4bool isCullingCovered, 66 G4bool isCullingCovered, 74 G4int noOfSides 67 G4int noOfSides 75 ): 68 ): 76 fWarning (true), 69 fWarning (true), 77 fpDefaultVisAttributes (pDefaultVisAttribute 70 fpDefaultVisAttributes (pDefaultVisAttributes), 78 fDrawingStyle (drawingStyle), 71 fDrawingStyle (drawingStyle), 79 fNumberOfCloudPoints (10000), << 80 fCulling (isCulling), 72 fCulling (isCulling), 81 fCullInvisible (isCullingInvisible), 73 fCullInvisible (isCullingInvisible), 82 fDensityCulling (isDensityCulling), 74 fDensityCulling (isDensityCulling), 83 fVisibleDensity (visibleDensity), 75 fVisibleDensity (visibleDensity), 84 fCullCovered (isCullingCovered), 76 fCullCovered (isCullingCovered), 85 fCBDAlgorithmNumber (0), << 86 fExplodeFactor (1.), 77 fExplodeFactor (1.), 87 fNoOfSides (noOfSides), 78 fNoOfSides (noOfSides), 88 fpSectionSolid (0), 79 fpSectionSolid (0), 89 fCutawayMode (cutawayUnion), << 90 fpCutawaySolid (0), 80 fpCutawaySolid (0), 91 fpEvent (0), << 81 fpEvent (0) 92 fSpecialMeshRendering (false) << 93 {} 82 {} 94 83 95 G4ModelingParameters::~G4ModelingParameters () 84 G4ModelingParameters::~G4ModelingParameters () 96 { 85 { 97 delete fpSectionSolid; 86 delete fpSectionSolid; 98 delete fpCutawaySolid; 87 delete fpCutawaySolid; 99 } 88 } 100 89 101 //G4ModelingParameters::VisAttributesModifier: << 90 G4ModelingParameters::VisAttributesModifier::VisAttributesModifier 102 //(const G4VisAttributes& visAtts, << 91 (const G4VisAttributes& visAtts, 103 // G4ModelingParameters::VisAttributesSignifie << 92 G4ModelingParameters::VisAttributesSignifier signifier, 104 // const std::vector<G4PhysicalVolumeModel::G4 << 93 const std::vector<G4PhysicalVolumeModel::G4PhysicalVolumeNodeID>& path): 105 //fVisAtts(visAtts), fSignifier(signifier) << 94 fVisAtts(visAtts), fSignifier(signifier) 106 //{ << 95 { 107 // typedef G4PhysicalVolumeModel::G4PhysicalV << 96 typedef G4PhysicalVolumeModel::G4PhysicalVolumeNodeID PVNodeID; 108 // typedef std::vector<PVNodeID> PVPath; << 97 typedef std::vector<PVNodeID> PVPath; 109 // typedef PVPath::const_iterator PVPathConst << 98 typedef PVPath::const_iterator PVPathConstIterator; 110 // PVPathConstIterator i; << 99 PVPathConstIterator i; 111 // for (i = path.begin(); << 100 for (i = path.begin(); 112 // i != path.end(); << 101 i != path.end(); 113 // ++i) { << 102 ++i) { 114 // fPVNameCopyNoPath.push_back << 103 fPVNameCopyNoPath.push_back 115 // (PVNameCopyNo << 104 (PVNameCopyNo 116 // (i->GetPhysicalVolume()->GetName(), << 105 (i->GetPhysicalVolume()->GetName(), 117 // i->GetCopyNo())); << 106 i->GetCopyNo())); 118 // } << 107 } 119 //} << 108 } 120 109 121 void G4ModelingParameters::SetVisibleDensity ( 110 void G4ModelingParameters::SetVisibleDensity (G4double visibleDensity) { 122 const G4double reasonableMaximum = 10.0 * g 111 const G4double reasonableMaximum = 10.0 * g / cm3; 123 if (visibleDensity < 0 && fWarning) { 112 if (visibleDensity < 0 && fWarning) { 124 G4warn << "G4ModelingParameters::SetVisibl << 113 G4cout << "G4ModelingParameters::SetVisibleDensity: attempt to set negative " 125 "density - ignored." << G4endl; 114 "density - ignored." << G4endl; 126 } 115 } 127 else { 116 else { 128 if (fVisibleDensity > reasonableMaximum && 117 if (fVisibleDensity > reasonableMaximum && fWarning) { 129 G4warn << "G4ModelingParameters::SetVisi << 118 G4cout << "G4ModelingParameters::SetVisibleDensity: density > " 130 << reasonableMaximum 119 << reasonableMaximum 131 << " g / cm3 - did you mean this?" 120 << " g / cm3 - did you mean this?" 132 << G4endl; 121 << G4endl; 133 } 122 } 134 fVisibleDensity = visibleDensity; 123 fVisibleDensity = visibleDensity; 135 } 124 } 136 } 125 } 137 126 138 G4int G4ModelingParameters::SetNoOfSides (G4in 127 G4int G4ModelingParameters::SetNoOfSides (G4int nSides) { 139 const G4int nSidesMin = fpDefaultVisAttribu << 128 const G4int nSidesMin = 12; 140 if (nSides < nSidesMin) { 129 if (nSides < nSidesMin) { 141 nSides = nSidesMin; 130 nSides = nSidesMin; 142 if (fWarning) 131 if (fWarning) 143 G4warn << "G4ModelingParameters::SetNoOf << 132 G4cout << "G4ModelingParameters::SetNoOfSides: attempt to set the" 144 "\nnumber of sides per circle < " << nSidesM 133 "\nnumber of sides per circle < " << nSidesMin 145 << "; forced to" << nSides << G4endl; 134 << "; forced to" << nSides << G4endl; 146 } 135 } 147 fNoOfSides = nSides; 136 fNoOfSides = nSides; 148 return fNoOfSides; 137 return fNoOfSides; 149 } 138 } 150 139 151 void G4ModelingParameters::SetSectionSolid 140 void G4ModelingParameters::SetSectionSolid 152 (G4DisplacedSolid* pSectionSolid) { << 141 (G4VSolid* pSectionSolid) { 153 delete fpSectionSolid; 142 delete fpSectionSolid; 154 fpSectionSolid = pSectionSolid; 143 fpSectionSolid = pSectionSolid; 155 } 144 } 156 145 157 void G4ModelingParameters::SetCutawaySolid 146 void G4ModelingParameters::SetCutawaySolid 158 (G4DisplacedSolid* pCutawaySolid) { << 147 (G4VSolid* pCutawaySolid) { 159 delete fpCutawaySolid; 148 delete fpCutawaySolid; 160 fpCutawaySolid = pCutawaySolid; 149 fpCutawaySolid = pCutawaySolid; 161 } 150 } 162 151 163 std::ostream& operator << (std::ostream& os, c 152 std::ostream& operator << (std::ostream& os, const G4ModelingParameters& mp) 164 { 153 { 165 os << "Modeling parameters (warning "; 154 os << "Modeling parameters (warning "; 166 if (mp.fWarning) os << "true"; 155 if (mp.fWarning) os << "true"; 167 else os << "false"; 156 else os << "false"; 168 os << "):"; 157 os << "):"; 169 158 170 const G4VisAttributes* va = mp.fpDefaultVisA 159 const G4VisAttributes* va = mp.fpDefaultVisAttributes; 171 os << "\n Default vis. attributes: "; 160 os << "\n Default vis. attributes: "; 172 if (va) os << *va; 161 if (va) os << *va; 173 else os << "none"; 162 else os << "none"; 174 163 175 os << "\n Current requested drawing style: 164 os << "\n Current requested drawing style: "; 176 switch (mp.fDrawingStyle) { 165 switch (mp.fDrawingStyle) { 177 case G4ModelingParameters::wf: << 166 case G4ModelingParameters::wf: 178 os << "wireframe"; break; << 167 os << "wireframe"; break; 179 case G4ModelingParameters::hlr: << 168 case G4ModelingParameters::hlr: 180 os << "hidden line removal (hlr)"; break << 169 os << "hidden line removal (hlr)"; break; 181 case G4ModelingParameters::hsr: << 170 case G4ModelingParameters::hsr: 182 os << "surface (hsr)"; break; << 171 os << "surface (hsr)"; break; 183 case G4ModelingParameters::hlhsr: << 172 case G4ModelingParameters::hlhsr: 184 os << "surface and edges (hlhsr)"; break << 173 os << "surface and edges (hlhsr)"; break; 185 case G4ModelingParameters::cloud: << 174 default: os << "unrecognised"; break; 186 os << "cloud"; break; << 187 default: os << "unrecognised"; break; << 188 } 175 } 189 176 190 os << "\n Number of cloud points: " << mp.f << 191 << 192 os << "\n Culling: "; 177 os << "\n Culling: "; 193 if (mp.fCulling) os << "on"; 178 if (mp.fCulling) os << "on"; 194 else os << "off"; 179 else os << "off"; 195 180 196 os << "\n Culling invisible objects: "; 181 os << "\n Culling invisible objects: "; 197 if (mp.fCullInvisible) os << "on"; 182 if (mp.fCullInvisible) os << "on"; 198 else os << "off"; 183 else os << "off"; 199 184 200 os << "\n Density culling: "; 185 os << "\n Density culling: "; 201 if (mp.fDensityCulling) { 186 if (mp.fDensityCulling) { 202 os << "on - invisible if density less than 187 os << "on - invisible if density less than " 203 << mp.fVisibleDensity / (1. * g / cm3) 188 << mp.fVisibleDensity / (1. * g / cm3) << " g cm^-3"; 204 } 189 } 205 else os << "off"; 190 else os << "off"; 206 191 207 os << "\n Culling daughters covered by opaq 192 os << "\n Culling daughters covered by opaque mothers: "; 208 if (mp.fCullCovered) os << "on"; 193 if (mp.fCullCovered) os << "on"; 209 else os << "off"; 194 else os << "off"; 210 195 211 os << "\n Colour by density: "; << 212 if (mp.fCBDAlgorithmNumber <= 0) { << 213 os << "inactive"; << 214 } else { << 215 os << "Algorithm " << mp.fCBDAlgorithmNumb << 216 for (auto p: mp.fCBDParameters) { << 217 os << ' ' << G4BestUnit(p,"Volumic Mass" << 218 } << 219 } << 220 << 221 os << "\n Explode factor: " << mp.fExplodeF 196 os << "\n Explode factor: " << mp.fExplodeFactor 222 << " about centre: " << mp.fExplodeCentre 197 << " about centre: " << mp.fExplodeCentre; 223 198 224 os << "\n No. of sides used in circle polyg 199 os << "\n No. of sides used in circle polygon approximation: " 225 << mp.fNoOfSides; 200 << mp.fNoOfSides; 226 201 227 os << "\n Section (DCUT) shape (G4Displaced << 202 os << "\n Section (DCUT) shape (G4VSolid) pointer: "; 228 if (!mp.fpSectionSolid) os << "non-"; 203 if (!mp.fpSectionSolid) os << "non-"; 229 os << "null"; 204 os << "null"; 230 205 231 os << "\n Cutaway mode: "; << 206 os << "\n Cutaway (DCUT) shape (G4VSolid) pointer: "; 232 if (mp.GetCutawayMode() == G4ModelingParamet << 233 else if (mp.GetCutawayMode() == G4ModelingPa << 234 << 235 os << "\n Cutaway (DCUT) shape (G4Displaced << 236 if (!mp.fpCutawaySolid) os << "non-"; 207 if (!mp.fpCutawaySolid) os << "non-"; 237 os << "null"; 208 os << "null"; 238 209 239 os << "\n Event pointer: " << mp.fpEvent; 210 os << "\n Event pointer: " << mp.fpEvent; 240 211 241 os << "\n Vis attributes modifiers: "; 212 os << "\n Vis attributes modifiers: "; 242 const std::vector<G4ModelingParameters::VisA 213 const std::vector<G4ModelingParameters::VisAttributesModifier>& vams = 243 mp.fVisAttributesModifiers; << 214 mp.fVisAttributesModifiers; 244 if (vams.empty()) { 215 if (vams.empty()) { 245 os << "None"; 216 os << "None"; 246 } else { 217 } else { 247 os << vams; 218 os << vams; 248 } 219 } 249 << 220 250 os << "\n Special Mesh Rendering: "; << 251 if (mp.fSpecialMeshRendering) { << 252 os << "on: "; << 253 if (mp.fSpecialMeshVolumes.empty()) { << 254 os << "all meshes"; << 255 } else { << 256 os << "selected meshes"; << 257 for (const auto& vol: mp.fSpecialMeshVol << 258 os << "\n " << vol.GetName() << ':' << vo << 259 } << 260 } << 261 } else os << "off"; << 262 << 263 return os; 221 return os; 264 } 222 } 265 223 266 G4bool G4ModelingParameters::operator != 224 G4bool G4ModelingParameters::operator != 267 (const G4ModelingParameters& mp) const { 225 (const G4ModelingParameters& mp) const { 268 226 269 if ( 227 if ( 270 (fWarning != mp.fWarning) 228 (fWarning != mp.fWarning) || 271 (*fpDefaultVisAttributes != *mp.fpDefaul 229 (*fpDefaultVisAttributes != *mp.fpDefaultVisAttributes) || 272 (fDrawingStyle != mp.fDrawingS << 273 (fNumberOfCloudPoints != mp.fNumberOf << 274 (fCulling != mp.fCulling) 230 (fCulling != mp.fCulling) || 275 (fCullInvisible != mp.fCullInvi 231 (fCullInvisible != mp.fCullInvisible) || 276 (fDensityCulling != mp.fDensityC 232 (fDensityCulling != mp.fDensityCulling) || 277 (fCullCovered != mp.fCullCove 233 (fCullCovered != mp.fCullCovered) || 278 (fCBDAlgorithmNumber != mp.fCBDAlgor << 279 (fExplodeFactor != mp.fExplodeF 234 (fExplodeFactor != mp.fExplodeFactor) || 280 (fExplodeCentre != mp.fExplodeC 235 (fExplodeCentre != mp.fExplodeCentre) || 281 (fNoOfSides != mp.fNoOfSide 236 (fNoOfSides != mp.fNoOfSides) || 282 (fpSectionSolid != mp.fpSection << 237 (fpSectionSolid != mp.fpSectionSolid) || 283 (fCutawayMode != mp.fCutawayM << 238 (fpCutawaySolid != mp.fpCutawaySolid) || 284 (fpCutawaySolid != mp.fpCutaway << 239 (fpEvent != mp.fpEvent) 285 (fpEvent != mp.fpEvent) << 286 (fSpecialMeshRendering != mp.fSpecialM << 287 ) 240 ) 288 return true; 241 return true; 289 242 290 if (fDensityCulling && 243 if (fDensityCulling && 291 (fVisibleDensity != mp.fVisibleDensity)) 244 (fVisibleDensity != mp.fVisibleDensity)) return true; 292 245 293 if (fCBDAlgorithmNumber > 0) { << 246 if (VAMSNotEqual(fVisAttributesModifiers, mp.fVisAttributesModifiers)) 294 if (fCBDParameters.size() != mp.fCBDParame << 295 else if (fCBDParameters != mp.fCBDParamete << 296 } << 297 << 298 if (fVisAttributesModifiers != mp.fVisAttrib << 299 return true; 247 return true; 300 248 301 if (fSpecialMeshRendering) { << 302 if (fSpecialMeshVolumes != mp.fSpecialMesh << 303 return true;; << 304 } << 305 << 306 return false; 249 return false; 307 } 250 } 308 251 309 G4bool G4ModelingParameters::VisAttributesModi << 252 G4bool G4ModelingParameters::PVNameCopyNoPathNotEqual 310 (const G4ModelingParameters::VisAttributesModi << 253 (const G4ModelingParameters::PVNameCopyNoPath& path1, >> 254 const G4ModelingParameters::PVNameCopyNoPath& path2) 311 { 255 { 312 if (fSignifier != rhs.fSignifier) return tru << 256 if (path1.size() != path2.size()) return true; 313 if (fPVNameCopyNoPath != rhs.fPVNameCopyNoPa << 257 if (path1.empty()) return false; 314 switch (fSignifier) { << 258 PVNameCopyNoPathConstIterator i1, i2; 315 case G4ModelingParameters::VASVisibility: << 259 for (i1 = path1.begin(), i2 = path2.begin(); 316 if (fVisAtts.IsVisible() != rhs.fVisAtts << 260 i1 != path1.end(); 317 return true; << 261 ++i1, ++i2) { 318 break; << 262 if (i1->GetName() != i2->GetName()) return true; 319 case G4ModelingParameters::VASDaughtersInv << 263 if (i1->GetCopyNo() != i2->GetCopyNo()) return true; 320 if (fVisAtts.IsDaughtersInvisible() != << 321 rhs.fVisAtts.IsDaughtersInvisible()) << 322 return true; << 323 break; << 324 case G4ModelingParameters::VASColour: << 325 if (fVisAtts.GetColour() != rhs.fVisAtts << 326 return true; << 327 break; << 328 case G4ModelingParameters::VASLineStyle: << 329 if (fVisAtts.GetLineStyle() != rhs.fVisA << 330 return true; << 331 break; << 332 case G4ModelingParameters::VASLineWidth: << 333 if (fVisAtts.GetLineWidth() != rhs.fVisA << 334 return true; << 335 break; << 336 case G4ModelingParameters::VASForceWirefra << 337 case G4ModelingParameters::VASForceSolid: << 338 case G4ModelingParameters::VASForceCloud: << 339 if (fVisAtts.GetForcedDrawingStyle() != << 340 rhs.fVisAtts.GetForcedDrawingStyle() << 341 return true; << 342 break; << 343 case G4ModelingParameters::VASForceNumberO << 344 if (fVisAtts.GetForcedNumberOfCloudPoint << 345 rhs.fVisAtts.GetForcedNumberOfCloudP << 346 return true; << 347 break; << 348 case G4ModelingParameters::VASForceAuxEdge << 349 if (fVisAtts.IsForceAuxEdgeVisible() != << 350 rhs.fVisAtts.IsForceAuxEdgeVisible() << 351 fVisAtts.IsForcedAuxEdgeVisible() != << 352 rhs.fVisAtts.IsForcedAuxEdgeVisible( << 353 return true; << 354 break; << 355 case G4ModelingParameters::VASForceLineSeg << 356 if (fVisAtts.GetForcedLineSegmentsPerCir << 357 rhs.fVisAtts.GetForcedLineSegmentsPe << 358 return true; << 359 break; << 360 } 264 } 361 return false; 265 return false; 362 } 266 } 363 267 364 G4bool G4ModelingParameters::PVNameCopyNo::ope << 268 G4bool G4ModelingParameters::VAMSNotEqual 365 (const G4ModelingParameters::PVNameCopyNo& rhs << 269 (const std::vector<G4ModelingParameters::VisAttributesModifier>& vams1, >> 270 const std::vector<G4ModelingParameters::VisAttributesModifier>& vams2) 366 { 271 { 367 if (fName != rhs.fName) return true; << 272 if (vams1.size() != vams2.size()) return true; 368 if (fCopyNo != rhs.fCopyNo) return true; << 273 if (vams1.empty()) return false; 369 return false; << 274 std::vector<VisAttributesModifier>::const_iterator i1, i2; 370 } << 275 for (i1 = vams1.begin(), i2 = vams2.begin(); 371 << 276 i1 != vams1.end(); 372 std::ostream& operator << << 277 ++i1, ++i2) { 373 (std::ostream& os, const G4ModelingParameters: << 278 const PVNameCopyNoPath& vam1Path = i1->GetPVNameCopyNoPath(); 374 { << 279 const PVNameCopyNoPath& vam2Path = i2->GetPVNameCopyNoPath(); 375 os << "Touchable path: "; << 280 if (PVNameCopyNoPathNotEqual(vam1Path,vam2Path)) return true; 376 if (path.empty()) { << 281 if (i1->GetVisAttributesSignifier() != i2->GetVisAttributesSignifier()) 377 os << "empty"; << 282 return true; 378 } else { << 283 const G4VisAttributes& vam1VisAtts = i1->GetVisAttributes(); 379 os << "physical-volume-name:copy-number pa << 284 const G4VisAttributes& vam2VisAtts = i2->GetVisAttributes(); 380 G4ModelingParameters::PVNameCopyNoPathCons << 285 const G4Colour& c1 = vam1VisAtts.GetColour(); 381 for (i = path.begin(); i != path.end(); ++ << 286 const G4Colour& c2 = vam2VisAtts.GetColour(); 382 if (i != path.begin()) { << 287 switch (i1->GetVisAttributesSignifier()) { 383 os << ','; << 288 case G4ModelingParameters::VASVisibility: 384 } << 289 if (vam1VisAtts.IsVisible() != vam2VisAtts.IsVisible()) 385 os << i->GetName() << ':' << i->GetCopyN << 290 return true; >> 291 break; >> 292 case G4ModelingParameters::VASDaughtersInvisible: >> 293 if (vam1VisAtts.IsDaughtersInvisible() != >> 294 vam2VisAtts.IsDaughtersInvisible()) >> 295 return true; >> 296 break; >> 297 case G4ModelingParameters::VASColour: >> 298 if (c1 != c2) >> 299 return true; >> 300 break; >> 301 case G4ModelingParameters::VASLineStyle: >> 302 if (vam1VisAtts.GetLineStyle() != vam2VisAtts.GetLineStyle()) >> 303 return true; >> 304 break; >> 305 case G4ModelingParameters::VASLineWidth: >> 306 if (vam1VisAtts.GetLineWidth() != vam2VisAtts.GetLineWidth()) >> 307 return true; >> 308 break; >> 309 case G4ModelingParameters::VASForceWireframe: >> 310 if (vam1VisAtts.GetForcedDrawingStyle() != >> 311 vam2VisAtts.GetForcedDrawingStyle()) >> 312 return true; >> 313 break; >> 314 case G4ModelingParameters::VASForceSolid: >> 315 if (vam1VisAtts.GetForcedDrawingStyle() != >> 316 vam2VisAtts.GetForcedDrawingStyle()) >> 317 return true; >> 318 break; >> 319 case G4ModelingParameters::VASForceAuxEdgeVisible: >> 320 if (vam1VisAtts.IsForceAuxEdgeVisible() != >> 321 vam2VisAtts.IsForceAuxEdgeVisible()) >> 322 return true; >> 323 break; >> 324 case G4ModelingParameters::VASForceLineSegmentsPerCircle: >> 325 if (vam1VisAtts.GetForcedLineSegmentsPerCircle() != >> 326 vam2VisAtts.GetForcedLineSegmentsPerCircle()) >> 327 return true; >> 328 break; 386 } 329 } 387 } 330 } 388 return os; << 389 } << 390 << 391 const G4String& G4ModelingParameters::PVPointe << 392 { << 393 return fpPV->GetName(); << 394 } << 395 << 396 G4bool G4ModelingParameters::PVPointerCopyNo:: << 397 (const G4ModelingParameters::PVPointerCopyNo& << 398 { << 399 if (fpPV != rhs.fpPV) return true; << 400 if (fCopyNo != rhs.fCopyNo) return true; << 401 return false; 331 return false; 402 } 332 } 403 333 404 std::ostream& operator << 334 std::ostream& operator << 405 (std::ostream& os, const G4ModelingParameters: << 335 (std::ostream& os, const G4ModelingParameters::PVNameCopyNoPath& path) 406 { 336 { 407 os << "Touchable path: physical-volume-point << 337 // os << "Touchable path: physical-volume-name:copy-number pairs:\n "; 408 G4ModelingParameters::PVPointerCopyNoPathCon << 338 G4ModelingParameters::PVNameCopyNoPathConstIterator i; 409 for (i = path.begin(); i != path.end(); ++i) 339 for (i = path.begin(); i != path.end(); ++i) { 410 if (i != path.begin()) { 340 if (i != path.begin()) { 411 os << ','; << 341 os << ", "; 412 } 342 } 413 os << '(' << (void*)(i->GetPVPointer()) << << 343 os << i->GetName() << ':' << i->GetCopyNo(); 414 } 344 } 415 return os; 345 return os; 416 } 346 } 417 347 418 std::ostream& operator << 348 std::ostream& operator << 419 (std::ostream& os, 349 (std::ostream& os, 420 const std::vector<G4ModelingParameters::VisAt 350 const std::vector<G4ModelingParameters::VisAttributesModifier>& vams) 421 { 351 { 422 std::vector<G4ModelingParameters::VisAttribu 352 std::vector<G4ModelingParameters::VisAttributesModifier>::const_iterator 423 iModifier; << 353 iModifier; 424 for (iModifier = vams.begin(); 354 for (iModifier = vams.begin(); 425 iModifier != vams.end(); 355 iModifier != vams.end(); 426 ++iModifier) { 356 ++iModifier) { 427 const G4ModelingParameters::PVNameCopyNoPa 357 const G4ModelingParameters::PVNameCopyNoPath& vamPath = 428 iModifier->GetPVNameCopyNoPath(); << 358 iModifier->GetPVNameCopyNoPath(); 429 os << '\n' << vamPath; 359 os << '\n' << vamPath; 430 const G4VisAttributes& vamVisAtts = iModif 360 const G4VisAttributes& vamVisAtts = iModifier->GetVisAttributes(); 431 const G4Colour& c = vamVisAtts.GetColour() 361 const G4Colour& c = vamVisAtts.GetColour(); 432 switch (iModifier->GetVisAttributesSignifi 362 switch (iModifier->GetVisAttributesSignifier()) { 433 case G4ModelingParameters::VASVisibility 363 case G4ModelingParameters::VASVisibility: 434 os << " visibility "; 364 os << " visibility "; 435 if (vamVisAtts.IsVisible()) { 365 if (vamVisAtts.IsVisible()) { 436 os << "true"; 366 os << "true"; 437 } else { 367 } else { 438 os << "false"; 368 os << "false"; 439 } 369 } 440 break; 370 break; 441 case G4ModelingParameters::VASDaughtersI 371 case G4ModelingParameters::VASDaughtersInvisible: 442 os << " daughtersInvisible "; 372 os << " daughtersInvisible "; 443 if (vamVisAtts.IsDaughtersInvisible()) 373 if (vamVisAtts.IsDaughtersInvisible()) { 444 os << "true"; 374 os << "true"; 445 } else { 375 } else { 446 os << "false"; 376 os << "false"; 447 } 377 } 448 break; 378 break; 449 case G4ModelingParameters::VASColour: 379 case G4ModelingParameters::VASColour: 450 os << " colour " << c; 380 os << " colour " << c; 451 break; 381 break; 452 case G4ModelingParameters::VASLineStyle: 382 case G4ModelingParameters::VASLineStyle: 453 os << " lineStyle "; 383 os << " lineStyle "; 454 switch (vamVisAtts.GetLineStyle()) { 384 switch (vamVisAtts.GetLineStyle()) { 455 case G4VisAttributes::unbroken: 385 case G4VisAttributes::unbroken: 456 os << "unbroken"; 386 os << "unbroken"; 457 break; 387 break; 458 case G4VisAttributes::dashed: 388 case G4VisAttributes::dashed: 459 os << "dashed"; 389 os << "dashed"; 460 break; 390 break; 461 case G4VisAttributes::dotted: 391 case G4VisAttributes::dotted: 462 os << "dotted"; 392 os << "dotted"; 463 } 393 } 464 break; 394 break; 465 case G4ModelingParameters::VASLineWidth: 395 case G4ModelingParameters::VASLineWidth: 466 os << " lineWidth " 396 os << " lineWidth " 467 << vamVisAtts.GetLineWidth(); 397 << vamVisAtts.GetLineWidth(); 468 break; 398 break; 469 case G4ModelingParameters::VASForceWiref 399 case G4ModelingParameters::VASForceWireframe: 470 if (vamVisAtts.GetForcedDrawingStyle() 400 if (vamVisAtts.GetForcedDrawingStyle() == G4VisAttributes::wireframe) { 471 os << " forceWireframe "; 401 os << " forceWireframe "; 472 if (vamVisAtts.IsForceDrawingStyle() 402 if (vamVisAtts.IsForceDrawingStyle()) { 473 os << "true"; 403 os << "true"; 474 } else { 404 } else { 475 os << "false"; 405 os << "false"; 476 } 406 } 477 } 407 } 478 break; 408 break; 479 case G4ModelingParameters::VASForceSolid 409 case G4ModelingParameters::VASForceSolid: 480 if (vamVisAtts.GetForcedDrawingStyle() 410 if (vamVisAtts.GetForcedDrawingStyle() == G4VisAttributes::solid) { 481 os << " forceSolid "; 411 os << " forceSolid "; 482 if (vamVisAtts.IsForceDrawingStyle() 412 if (vamVisAtts.IsForceDrawingStyle()) { 483 os << "true"; 413 os << "true"; 484 } else { 414 } else { 485 os << "false"; 415 os << "false"; 486 } 416 } 487 } 417 } 488 break; 418 break; 489 case G4ModelingParameters::VASForceCloud << 490 if (vamVisAtts.GetForcedDrawingStyle() << 491 os << " forceCloud "; << 492 if (vamVisAtts.IsForceDrawingStyle() << 493 os << "true"; << 494 } else { << 495 os << "false"; << 496 } << 497 } << 498 break; << 499 case G4ModelingParameters::VASForceNumbe << 500 os << " numberOfCloudPoints " << 501 << vamVisAtts.GetForcedNumberOfCloudPo << 502 break; << 503 case G4ModelingParameters::VASForceAuxEd 419 case G4ModelingParameters::VASForceAuxEdgeVisible: 504 os << " forceAuxEdgeVisible: "; << 420 os << " forceAuxEdgeVisible "; 505 if (!vamVisAtts.IsForceDrawingStyle()) << 506 os << "not "; << 507 } << 508 os << " forced"; << 509 if (vamVisAtts.IsForceAuxEdgeVisible() 421 if (vamVisAtts.IsForceAuxEdgeVisible()) { 510 os << ": "; << 422 os << "true"; 511 if (vamVisAtts.IsForcedAuxEdgeVisibl << 423 } else { 512 os << "true"; << 424 os << "false"; 513 } else { << 514 os << "false"; << 515 } << 516 } 425 } 517 break; 426 break; 518 case G4ModelingParameters::VASForceLineS 427 case G4ModelingParameters::VASForceLineSegmentsPerCircle: 519 os << " lineSegmentsPerCircle " 428 os << " lineSegmentsPerCircle " 520 << vamVisAtts.GetForcedLineSegmentsPer 429 << vamVisAtts.GetForcedLineSegmentsPerCircle(); 521 break; 430 break; 522 } 431 } 523 } 432 } 524 433 525 return os; 434 return os; 526 } 435 } 527 436 528 437