48 fpDefaultVisAttributes (0),
50 fNumberOfCloudPoints (10000),
52 fCullInvisible (false),
53 fDensityCulling (false),
54 fVisibleDensity (0.01 * g / cm3),
56 fCBDAlgorithmNumber (0),
62 fSpecialMeshRendering (false)
76 fpDefaultVisAttributes (pDefaultVisAttributes),
77 fDrawingStyle (drawingStyle),
78 fNumberOfCloudPoints (10000),
80 fCullInvisible (isCullingInvisible),
81 fDensityCulling (isDensityCulling),
82 fVisibleDensity (visibleDensity),
83 fCullCovered (isCullingCovered),
84 fCBDAlgorithmNumber (0),
86 fNoOfSides (noOfSides),
90 fSpecialMeshRendering (false)
95 delete fpSectionSolid;
96 delete fpCutawaySolid;
120 const G4double reasonableMaximum = 10.0 * g / cm3;
121 if (visibleDensity < 0 && fWarning) {
122 G4warn <<
"G4ModelingParameters::SetVisibleDensity: attempt to set negative "
123 "density - ignored." <<
G4endl;
126 if (fVisibleDensity > reasonableMaximum && fWarning) {
127 G4warn <<
"G4ModelingParameters::SetVisibleDensity: density > "
129 <<
" g / cm3 - did you mean this?"
132 fVisibleDensity = visibleDensity;
138 if (nSides < nSidesMin) {
141 G4warn <<
"G4ModelingParameters::SetNoOfSides: attempt to set the"
142 "\nnumber of sides per circle < " << nSidesMin
143 <<
"; forced to" << nSides <<
G4endl;
151 delete fpSectionSolid;
152 fpSectionSolid = pSectionSolid;
157 delete fpCutawaySolid;
158 fpCutawaySolid = pCutawaySolid;
163 os <<
"Modeling parameters (warning ";
164 if (mp.fWarning) os <<
"true";
169 os <<
"\n Default vis. attributes: ";
173 os <<
"\n Current requested drawing style: ";
174 switch (mp.fDrawingStyle) {
176 os <<
"wireframe";
break;
178 os <<
"hidden line removal (hlr)";
break;
180 os <<
"surface (hsr)";
break;
182 os <<
"surface and edges (hlhsr)";
break;
184 os <<
"cloud";
break;
185 default: os <<
"unrecognised";
break;
188 os <<
"\n Number of cloud points: " << mp.fNumberOfCloudPoints;
190 os <<
"\n Culling: ";
191 if (mp.fCulling) os <<
"on";
194 os <<
"\n Culling invisible objects: ";
195 if (mp.fCullInvisible) os <<
"on";
198 os <<
"\n Density culling: ";
199 if (mp.fDensityCulling) {
200 os <<
"on - invisible if density less than "
201 << mp.fVisibleDensity / (1. * g / cm3) <<
" g cm^-3";
205 os <<
"\n Culling daughters covered by opaque mothers: ";
206 if (mp.fCullCovered) os <<
"on";
209 os <<
"\n Colour by density: ";
210 if (mp.fCBDAlgorithmNumber <= 0) {
213 os <<
"Algorithm " << mp.fCBDAlgorithmNumber <<
", Parameters:";
214 for (
auto p: mp.fCBDParameters) {
219 os <<
"\n Explode factor: " << mp.fExplodeFactor
220 <<
" about centre: " << mp.fExplodeCentre;
222 os <<
"\n No. of sides used in circle polygon approximation: "
225 os <<
"\n Section (DCUT) shape (G4DisplacedSolid) pointer: ";
226 if (!mp.fpSectionSolid) os <<
"non-";
229 os <<
"\n Cutaway (DCUT) shape (G4DisplacedSolid) pointer: ";
230 if (!mp.fpCutawaySolid) os <<
"non-";
233 os <<
"\n Event pointer: " << mp.fpEvent;
235 os <<
"\n Vis attributes modifiers: ";
236 const std::vector<G4ModelingParameters::VisAttributesModifier>& vams =
237 mp.fVisAttributesModifiers;
244 os <<
"\n Special Mesh Rendering: ";
245 if (mp.fSpecialMeshRendering) {
247 if (mp.fSpecialMeshVolumes.empty()) {
250 os <<
"selected meshes";
251 for (
const auto& vol: mp.fSpecialMeshVolumes) {
252 os <<
"\n " << vol.GetName() <<
':' << vol.GetCopyNo();
264 (fWarning != mp.fWarning) ||
265 (*fpDefaultVisAttributes != *mp.fpDefaultVisAttributes) ||
266 (fDrawingStyle != mp.fDrawingStyle) ||
267 (fNumberOfCloudPoints != mp.fNumberOfCloudPoints) ||
268 (fCulling != mp.fCulling) ||
269 (fCullInvisible != mp.fCullInvisible) ||
270 (fDensityCulling != mp.fDensityCulling) ||
271 (fCullCovered != mp.fCullCovered) ||
272 (fCBDAlgorithmNumber != mp.fCBDAlgorithmNumber) ||
273 (fExplodeFactor != mp.fExplodeFactor) ||
274 (fExplodeCentre != mp.fExplodeCentre) ||
275 (fNoOfSides != mp.fNoOfSides) ||
276 (fpSectionSolid != mp.fpSectionSolid) ||
277 (fpCutawaySolid != mp.fpCutawaySolid) ||
278 (fpEvent != mp.fpEvent) ||
279 (fSpecialMeshRendering != mp.fSpecialMeshRendering)
283 if (fDensityCulling &&
284 (fVisibleDensity != mp.fVisibleDensity))
return true;
286 if (fCBDAlgorithmNumber > 0) {
287 if (fCBDParameters.size() != mp.fCBDParameters.size())
return true;
288 else if (fCBDParameters != mp.fCBDParameters)
return true;
291 if (fVisAttributesModifiers != mp.fVisAttributesModifiers)
294 if (fSpecialMeshRendering) {
295 if (fSpecialMeshVolumes != mp.fSpecialMeshVolumes)
302G4bool G4ModelingParameters::VisAttributesModifier::operator!=
305 if (fSignifier != rhs.fSignifier)
return true;
306 if (fPVNameCopyNoPath != rhs.fPVNameCopyNoPath)
return true;
307 switch (fSignifier) {
309 if (fVisAtts.IsVisible() != rhs.fVisAtts.IsVisible())
313 if (fVisAtts.IsDaughtersInvisible() !=
314 rhs.fVisAtts.IsDaughtersInvisible())
318 if (fVisAtts.GetColour() != rhs.fVisAtts.GetColour())
322 if (fVisAtts.GetLineStyle() != rhs.fVisAtts.GetLineStyle())
326 if (fVisAtts.GetLineWidth() != rhs.fVisAtts.GetLineWidth())
332 if (fVisAtts.GetForcedDrawingStyle() !=
333 rhs.fVisAtts.GetForcedDrawingStyle())
337 if (fVisAtts.GetForcedNumberOfCloudPoints() !=
338 rhs.fVisAtts.GetForcedNumberOfCloudPoints())
342 if (fVisAtts.IsForceAuxEdgeVisible() !=
343 rhs.fVisAtts.IsForceAuxEdgeVisible() ||
344 fVisAtts.IsForcedAuxEdgeVisible() !=
345 rhs.fVisAtts.IsForcedAuxEdgeVisible())
349 if (fVisAtts.GetForcedLineSegmentsPerCircle() !=
350 rhs.fVisAtts.GetForcedLineSegmentsPerCircle())
357G4bool G4ModelingParameters::PVNameCopyNo::operator!=
360 if (fName != rhs.fName)
return true;
361 if (fCopyNo != rhs.fCopyNo)
return true;
365std::ostream&
operator <<
368 os <<
"Touchable path: ";
372 os <<
"physical-volume-name:copy-number pairs:\n ";
374 for (i = path.begin(); i != path.end(); ++i) {
375 if (i != path.begin()) {
378 os << i->GetName() <<
':' << i->GetCopyNo();
389G4bool G4ModelingParameters::PVPointerCopyNo::operator!=
392 if (fpPV != rhs.fpPV)
return true;
393 if (fCopyNo != rhs.fCopyNo)
return true;
397std::ostream&
operator <<
400 os <<
"Touchable path: physical-volume-pointer:copy-number pairs:\n ";
402 for (i = path.begin(); i != path.end(); ++i) {
403 if (i != path.begin()) {
406 os <<
'(' << (
void*)(i->GetPVPointer()) <<
')' << i->GetName() <<
':' << i->GetCopyNo();
411std::ostream&
operator <<
413 const std::vector<G4ModelingParameters::VisAttributesModifier>& vams)
415 std::vector<G4ModelingParameters::VisAttributesModifier>::const_iterator
417 for (iModifier = vams.begin();
418 iModifier != vams.end();
421 iModifier->GetPVNameCopyNoPath();
422 os <<
'\n' << vamPath;
425 switch (iModifier->GetVisAttributesSignifier()) {
427 os <<
" visibility ";
435 os <<
" daughtersInvisible ";
443 os <<
" colour " << c;
464 os <<
" forceWireframe ";
474 os <<
" forceSolid ";
484 os <<
" forceCloud ";
493 os <<
" numberOfCloudPoints "
497 os <<
" forceAuxEdgeVisible: ";
512 os <<
" lineSegmentsPerCircle "
std::ostream & operator<<(std::ostream &os, const G4ModelingParameters &mp)
const G4String & GetName() const
G4int SetNoOfSides(G4int)
PVNameCopyNoPath::const_iterator PVNameCopyNoPathConstIterator
PVPointerCopyNoPath::const_iterator PVPointerCopyNoPathConstIterator
std::vector< PVNameCopyNo > PVNameCopyNoPath
std::vector< PVPointerCopyNo > PVPointerCopyNoPath
@ VASForceNumberOfCloudPoints
@ VASForceLineSegmentsPerCircle
void SetCutawaySolid(G4DisplacedSolid *pCutawaySolid)
void SetSectionSolid(G4DisplacedSolid *pSectionSolid)
void SetVisibleDensity(G4double)
const G4String & GetName() const
G4int GetForcedNumberOfCloudPoints() const
G4double GetLineWidth() const
G4bool IsDaughtersInvisible() const
G4int GetForcedLineSegmentsPerCircle() const
LineStyle GetLineStyle() const
const G4Colour & GetColour() const
G4bool IsForceAuxEdgeVisible() const
G4bool IsForcedAuxEdgeVisible() const
ForcedDrawingStyle GetForcedDrawingStyle() const
static G4int GetMinLineSegmentsPerCircle()
G4bool IsForceDrawingStyle() const