Geant4 11.1.1
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4ModelingParameters Class Reference

#include <G4ModelingParameters.hh>

Classes

class  PVNameCopyNo
 
class  PVPointerCopyNo
 
class  VisAttributesModifier
 

Public Types

enum  DrawingStyle {
  wf , hlr , hsr , hlhsr ,
  cloud
}
 
enum  VisAttributesSignifier {
  VASVisibility , VASDaughtersInvisible , VASColour , VASLineStyle ,
  VASLineWidth , VASForceWireframe , VASForceSolid , VASForceCloud ,
  VASForceNumberOfCloudPoints , VASForceAuxEdgeVisible , VASForceLineSegmentsPerCircle
}
 
typedef std::vector< PVNameCopyNoPVNameCopyNoPath
 
typedef PVNameCopyNoPath::const_iterator PVNameCopyNoPathConstIterator
 
typedef std::vector< PVPointerCopyNoPVPointerCopyNoPath
 
typedef PVPointerCopyNoPath::const_iterator PVPointerCopyNoPathConstIterator
 

Public Member Functions

 G4ModelingParameters ()
 
 G4ModelingParameters (const G4VisAttributes *pDefaultVisAttributes, DrawingStyle drawingStyle, G4bool isCulling, G4bool isCullingInvisible, G4bool isDensityCulling, G4double visibleDensity, G4bool isCullingCovered, G4int noOfSides)
 
 ~G4ModelingParameters ()
 
G4bool operator!= (const G4ModelingParameters &) const
 
G4bool IsWarning () const
 
const G4VisAttributesGetDefaultVisAttributes () const
 
DrawingStyle GetDrawingStyle () const
 
G4int GetNumberOfCloudPoints () const
 
G4bool IsCulling () const
 
G4bool IsCullingInvisible () const
 
G4bool IsDensityCulling () const
 
G4double GetVisibleDensity () const
 
G4bool IsCullingCovered () const
 
G4int GetCBDAlgorithmNumber () const
 
const std::vector< G4double > & GetCBDParameters () const
 
G4bool IsExplode () const
 
G4double GetExplodeFactor () const
 
const G4Point3DGetExplodeCentre () const
 
G4int GetNoOfSides () const
 
G4DisplacedSolidGetSectionSolid () const
 
G4DisplacedSolidGetCutawaySolid () const
 
const G4EventGetEvent () const
 
const std::vector< VisAttributesModifier > & GetVisAttributesModifiers () const
 
G4bool IsSpecialMeshRendering () const
 
const std::vector< PVNameCopyNo > & GetSpecialMeshVolumes () const
 
void SetWarning (G4bool)
 
void SetDefaultVisAttributes (const G4VisAttributes *pDefaultVisAttributes)
 
void SetDrawingStyle (DrawingStyle)
 
void SetNumberOfCloudPoints (G4int)
 
void SetCulling (G4bool)
 
void SetCullingInvisible (G4bool)
 
void SetDensityCulling (G4bool)
 
void SetVisibleDensity (G4double)
 
void SetCullingCovered (G4bool)
 
void SetCBDAlgorithmNumber (G4int)
 
void SetCBDParameters (const std::vector< G4double > &)
 
void SetExplodeFactor (G4double explodeFactor)
 
void SetExplodeCentre (const G4Point3D &explodeCentre)
 
G4int SetNoOfSides (G4int)
 
void SetSectionSolid (G4DisplacedSolid *pSectionSolid)
 
void SetCutawaySolid (G4DisplacedSolid *pCutawaySolid)
 
void SetEvent (const G4Event *pEvent)
 
void SetVisAttributesModifiers (const std::vector< VisAttributesModifier > &)
 
void SetSpecialMeshRendering (G4bool)
 
void SetSpecialMeshVolumes (const std::vector< PVNameCopyNo > &)
 

Friends

std::ostream & operator<< (std::ostream &os, const G4ModelingParameters &)
 
std::ostream & operator<< (std::ostream &os, const PVNameCopyNoPath &)
 
std::ostream & operator<< (std::ostream &os, const PVPointerCopyNoPath &)
 
std::ostream & operator<< (std::ostream &os, const std::vector< VisAttributesModifier > &)
 

Detailed Description

Definition at line 52 of file G4ModelingParameters.hh.

Member Typedef Documentation

◆ PVNameCopyNoPath

Definition at line 94 of file G4ModelingParameters.hh.

◆ PVNameCopyNoPathConstIterator

typedef PVNameCopyNoPath::const_iterator G4ModelingParameters::PVNameCopyNoPathConstIterator

Definition at line 95 of file G4ModelingParameters.hh.

◆ PVPointerCopyNoPath

◆ PVPointerCopyNoPathConstIterator

typedef PVPointerCopyNoPath::const_iterator G4ModelingParameters::PVPointerCopyNoPathConstIterator

Definition at line 112 of file G4ModelingParameters.hh.

Member Enumeration Documentation

◆ DrawingStyle

Enumerator
wf 
hlr 
hsr 
hlhsr 
cloud 

Definition at line 57 of file G4ModelingParameters.hh.

57 {
58 wf, // Draw edges - no hidden line removal (wireframe).
59 hlr, // Draw edges - hidden lines removed.
60 hsr, // Draw surfaces - hidden surfaces removed.
61 hlhsr, // Draw surfaces and edges - hidden removed.
62 cloud // Draw as a cloud of points
63 };

◆ VisAttributesSignifier

Enumerator
VASVisibility 
VASDaughtersInvisible 
VASColour 
VASLineStyle 
VASLineWidth 
VASForceWireframe 
VASForceSolid 
VASForceCloud 
VASForceNumberOfCloudPoints 
VASForceAuxEdgeVisible 
VASForceLineSegmentsPerCircle 

Definition at line 67 of file G4ModelingParameters.hh.

Constructor & Destructor Documentation

◆ G4ModelingParameters() [1/2]

G4ModelingParameters::G4ModelingParameters ( )

Definition at line 46 of file G4ModelingParameters.cc.

46 :
47 fWarning (true),
48 fpDefaultVisAttributes (0),
49 fDrawingStyle (wf),
50 fNumberOfCloudPoints (10000),
51 fCulling (false),
52 fCullInvisible (false),
53 fDensityCulling (false),
54 fVisibleDensity (0.01 * g / cm3),
55 fCullCovered (false),
56 fCBDAlgorithmNumber (0),
57 fExplodeFactor (1.),
58 fNoOfSides (24),
59 fpSectionSolid (0),
60 fpCutawaySolid (0),
61 fpEvent (0),
62 fSpecialMeshRendering (false)
63{}

◆ G4ModelingParameters() [2/2]

G4ModelingParameters::G4ModelingParameters ( const G4VisAttributes pDefaultVisAttributes,
G4ModelingParameters::DrawingStyle  drawingStyle,
G4bool  isCulling,
G4bool  isCullingInvisible,
G4bool  isDensityCulling,
G4double  visibleDensity,
G4bool  isCullingCovered,
G4int  noOfSides 
)

Definition at line 65 of file G4ModelingParameters.cc.

74 :
75 fWarning (true),
76 fpDefaultVisAttributes (pDefaultVisAttributes),
77 fDrawingStyle (drawingStyle),
78 fNumberOfCloudPoints (10000),
79 fCulling (isCulling),
80 fCullInvisible (isCullingInvisible),
81 fDensityCulling (isDensityCulling),
82 fVisibleDensity (visibleDensity),
83 fCullCovered (isCullingCovered),
84 fCBDAlgorithmNumber (0),
85 fExplodeFactor (1.),
86 fNoOfSides (noOfSides),
87 fpSectionSolid (0),
88 fpCutawaySolid (0),
89 fpEvent (0),
90 fSpecialMeshRendering (false)
91{}

◆ ~G4ModelingParameters()

G4ModelingParameters::~G4ModelingParameters ( )

Definition at line 93 of file G4ModelingParameters.cc.

94{
95 delete fpSectionSolid;
96 delete fpCutawaySolid;
97}

Member Function Documentation

◆ GetCBDAlgorithmNumber()

G4int G4ModelingParameters::GetCBDAlgorithmNumber ( ) const

◆ GetCBDParameters()

const std::vector< G4double > & G4ModelingParameters::GetCBDParameters ( ) const

◆ GetCutawaySolid()

G4DisplacedSolid * G4ModelingParameters::GetCutawaySolid ( ) const

◆ GetDefaultVisAttributes()

const G4VisAttributes * G4ModelingParameters::GetDefaultVisAttributes ( ) const

◆ GetDrawingStyle()

DrawingStyle G4ModelingParameters::GetDrawingStyle ( ) const

◆ GetEvent()

◆ GetExplodeCentre()

const G4Point3D & G4ModelingParameters::GetExplodeCentre ( ) const

◆ GetExplodeFactor()

G4double G4ModelingParameters::GetExplodeFactor ( ) const

◆ GetNoOfSides()

G4int G4ModelingParameters::GetNoOfSides ( ) const

◆ GetNumberOfCloudPoints()

G4int G4ModelingParameters::GetNumberOfCloudPoints ( ) const

◆ GetSectionSolid()

G4DisplacedSolid * G4ModelingParameters::GetSectionSolid ( ) const

◆ GetSpecialMeshVolumes()

const std::vector< PVNameCopyNo > & G4ModelingParameters::GetSpecialMeshVolumes ( ) const

◆ GetVisAttributesModifiers()

const std::vector< VisAttributesModifier > & G4ModelingParameters::GetVisAttributesModifiers ( ) const

◆ GetVisibleDensity()

G4double G4ModelingParameters::GetVisibleDensity ( ) const

◆ IsCulling()

G4bool G4ModelingParameters::IsCulling ( ) const

◆ IsCullingCovered()

G4bool G4ModelingParameters::IsCullingCovered ( ) const

◆ IsCullingInvisible()

G4bool G4ModelingParameters::IsCullingInvisible ( ) const

◆ IsDensityCulling()

G4bool G4ModelingParameters::IsDensityCulling ( ) const

◆ IsExplode()

G4bool G4ModelingParameters::IsExplode ( ) const

◆ IsSpecialMeshRendering()

G4bool G4ModelingParameters::IsSpecialMeshRendering ( ) const

◆ IsWarning()

G4bool G4ModelingParameters::IsWarning ( ) const

◆ operator!=()

G4bool G4ModelingParameters::operator!= ( const G4ModelingParameters mp) const

Definition at line 260 of file G4ModelingParameters.cc.

261 {
262
263 if (
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)
280 )
281 return true;
282
283 if (fDensityCulling &&
284 (fVisibleDensity != mp.fVisibleDensity)) return true;
285
286 if (fCBDAlgorithmNumber > 0) {
287 if (fCBDParameters.size() != mp.fCBDParameters.size()) return true;
288 else if (fCBDParameters != mp.fCBDParameters) return true;
289 }
290
291 if (fVisAttributesModifiers != mp.fVisAttributesModifiers)
292 return true;
293
294 if (fSpecialMeshRendering) {
295 if (fSpecialMeshVolumes != mp.fSpecialMeshVolumes)
296 return true;;
297 }
298
299 return false;
300}

◆ SetCBDAlgorithmNumber()

void G4ModelingParameters::SetCBDAlgorithmNumber ( G4int  )

◆ SetCBDParameters()

void G4ModelingParameters::SetCBDParameters ( const std::vector< G4double > &  )

◆ SetCulling()

◆ SetCullingCovered()

void G4ModelingParameters::SetCullingCovered ( G4bool  )

◆ SetCullingInvisible()

◆ SetCutawaySolid()

void G4ModelingParameters::SetCutawaySolid ( G4DisplacedSolid pCutawaySolid)

Definition at line 155 of file G4ModelingParameters.cc.

156 {
157 delete fpCutawaySolid;
158 fpCutawaySolid = pCutawaySolid;
159}

Referenced by G4VSceneHandler::CreateModelingParameters().

◆ SetDefaultVisAttributes()

void G4ModelingParameters::SetDefaultVisAttributes ( const G4VisAttributes pDefaultVisAttributes)

◆ SetDensityCulling()

void G4ModelingParameters::SetDensityCulling ( G4bool  )

◆ SetDrawingStyle()

void G4ModelingParameters::SetDrawingStyle ( DrawingStyle  )

◆ SetEvent()

void G4ModelingParameters::SetEvent ( const G4Event pEvent)

◆ SetExplodeCentre()

void G4ModelingParameters::SetExplodeCentre ( const G4Point3D explodeCentre)

◆ SetExplodeFactor()

void G4ModelingParameters::SetExplodeFactor ( G4double  explodeFactor)

◆ SetNoOfSides()

G4int G4ModelingParameters::SetNoOfSides ( G4int  nSides)

Definition at line 136 of file G4ModelingParameters.cc.

136 {
137 const G4int nSidesMin = fpDefaultVisAttributes->GetMinLineSegmentsPerCircle();
138 if (nSides < nSidesMin) {
139 nSides = nSidesMin;
140 if (fWarning)
141 G4warn << "G4ModelingParameters::SetNoOfSides: attempt to set the"
142 "\nnumber of sides per circle < " << nSidesMin
143 << "; forced to" << nSides << G4endl;
144 }
145 fNoOfSides = nSides;
146 return fNoOfSides;
147}
#define G4warn
Definition: G4Scene.cc:41
int G4int
Definition: G4Types.hh:85
#define G4endl
Definition: G4ios.hh:57
static G4int GetMinLineSegmentsPerCircle()

◆ SetNumberOfCloudPoints()

void G4ModelingParameters::SetNumberOfCloudPoints ( G4int  )

◆ SetSectionSolid()

void G4ModelingParameters::SetSectionSolid ( G4DisplacedSolid pSectionSolid)

Definition at line 149 of file G4ModelingParameters.cc.

150 {
151 delete fpSectionSolid;
152 fpSectionSolid = pSectionSolid;
153}

Referenced by G4VSceneHandler::CreateModelingParameters().

◆ SetSpecialMeshRendering()

void G4ModelingParameters::SetSpecialMeshRendering ( G4bool  )

◆ SetSpecialMeshVolumes()

void G4ModelingParameters::SetSpecialMeshVolumes ( const std::vector< PVNameCopyNo > &  )

◆ SetVisAttributesModifiers()

void G4ModelingParameters::SetVisAttributesModifiers ( const std::vector< VisAttributesModifier > &  )

◆ SetVisibleDensity()

void G4ModelingParameters::SetVisibleDensity ( G4double  visibleDensity)

Definition at line 119 of file G4ModelingParameters.cc.

119 {
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;
124 }
125 else {
126 if (fVisibleDensity > reasonableMaximum && fWarning) {
127 G4warn << "G4ModelingParameters::SetVisibleDensity: density > "
128 << reasonableMaximum
129 << " g / cm3 - did you mean this?"
130 << G4endl;
131 }
132 fVisibleDensity = visibleDensity;
133 }
134}
double G4double
Definition: G4Types.hh:83

◆ SetWarning()

void G4ModelingParameters::SetWarning ( G4bool  )

Friends And Related Function Documentation

◆ operator<< [1/4]

std::ostream & operator<< ( std::ostream &  os,
const G4ModelingParameters mp 
)
friend

Definition at line 161 of file G4ModelingParameters.cc.

162{
163 os << "Modeling parameters (warning ";
164 if (mp.fWarning) os << "true";
165 else os << "false";
166 os << "):";
167
168 const G4VisAttributes* va = mp.fpDefaultVisAttributes;
169 os << "\n Default vis. attributes: ";
170 if (va) os << *va;
171 else os << "none";
172
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;
186 }
187
188 os << "\n Number of cloud points: " << mp.fNumberOfCloudPoints;
189
190 os << "\n Culling: ";
191 if (mp.fCulling) os << "on";
192 else os << "off";
193
194 os << "\n Culling invisible objects: ";
195 if (mp.fCullInvisible) os << "on";
196 else os << "off";
197
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";
202 }
203 else os << "off";
204
205 os << "\n Culling daughters covered by opaque mothers: ";
206 if (mp.fCullCovered) os << "on";
207 else os << "off";
208
209 os << "\n Colour by density: ";
210 if (mp.fCBDAlgorithmNumber <= 0) {
211 os << "inactive";
212 } else {
213 os << "Algorithm " << mp.fCBDAlgorithmNumber << ", Parameters:";
214 for (auto p: mp.fCBDParameters) {
215 os << ' ' << G4BestUnit(p,"Volumic Mass");
216 }
217 }
218
219 os << "\n Explode factor: " << mp.fExplodeFactor
220 << " about centre: " << mp.fExplodeCentre;
221
222 os << "\n No. of sides used in circle polygon approximation: "
223 << mp.fNoOfSides;
224
225 os << "\n Section (DCUT) shape (G4DisplacedSolid) pointer: ";
226 if (!mp.fpSectionSolid) os << "non-";
227 os << "null";
228
229 os << "\n Cutaway (DCUT) shape (G4DisplacedSolid) pointer: ";
230 if (!mp.fpCutawaySolid) os << "non-";
231 os << "null";
232
233 os << "\n Event pointer: " << mp.fpEvent;
234
235 os << "\n Vis attributes modifiers: ";
236 const std::vector<G4ModelingParameters::VisAttributesModifier>& vams =
237 mp.fVisAttributesModifiers;
238 if (vams.empty()) {
239 os << "None";
240 } else {
241 os << vams;
242 }
243
244 os << "\n Special Mesh Rendering: ";
245 if (mp.fSpecialMeshRendering) {
246 os << "on: ";
247 if (mp.fSpecialMeshVolumes.empty()) {
248 os << "all meshes";
249 } else {
250 os << "selected meshes";
251 for (const auto& vol: mp.fSpecialMeshVolumes) {
252 os << "\n " << vol.GetName() << ':' << vol.GetCopyNo();
253 }
254 }
255 } else os << "off";
256
257 return os;
258}
#define G4BestUnit(a, b)

◆ operator<< [2/4]

std::ostream & operator<< ( std::ostream &  os,
const PVNameCopyNoPath path 
)
friend

Definition at line 365 of file G4ModelingParameters.cc.

367{
368 os << "Touchable path: ";
369 if (path.empty()) {
370 os << "empty";
371 } else {
372 os << "physical-volume-name:copy-number pairs:\n ";
374 for (i = path.begin(); i != path.end(); ++i) {
375 if (i != path.begin()) {
376 os << ',';
377 }
378 os << i->GetName() << ':' << i->GetCopyNo();
379 }
380 }
381 return os;
382}
PVNameCopyNoPath::const_iterator PVNameCopyNoPathConstIterator

◆ operator<< [3/4]

std::ostream & operator<< ( std::ostream &  os,
const PVPointerCopyNoPath path 
)
friend

Definition at line 397 of file G4ModelingParameters.cc.

399{
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()) {
404 os << ',';
405 }
406 os << '(' << (void*)(i->GetPVPointer()) << ')' << i->GetName() << ':' << i->GetCopyNo();
407 }
408 return os;
409}
PVPointerCopyNoPath::const_iterator PVPointerCopyNoPathConstIterator

◆ operator<< [4/4]

std::ostream & operator<< ( std::ostream &  os,
const std::vector< VisAttributesModifier > &  vams 
)
friend

Definition at line 411 of file G4ModelingParameters.cc.

414{
415 std::vector<G4ModelingParameters::VisAttributesModifier>::const_iterator
416 iModifier;
417 for (iModifier = vams.begin();
418 iModifier != vams.end();
419 ++iModifier) {
421 iModifier->GetPVNameCopyNoPath();
422 os << '\n' << vamPath;
423 const G4VisAttributes& vamVisAtts = iModifier->GetVisAttributes();
424 const G4Colour& c = vamVisAtts.GetColour();
425 switch (iModifier->GetVisAttributesSignifier()) {
427 os << " visibility ";
428 if (vamVisAtts.IsVisible()) {
429 os << "true";
430 } else {
431 os << "false";
432 }
433 break;
435 os << " daughtersInvisible ";
436 if (vamVisAtts.IsDaughtersInvisible()) {
437 os << "true";
438 } else {
439 os << "false";
440 }
441 break;
443 os << " colour " << c;
444 break;
446 os << " lineStyle ";
447 switch (vamVisAtts.GetLineStyle()) {
449 os << "unbroken";
450 break;
452 os << "dashed";
453 break;
455 os << "dotted";
456 }
457 break;
459 os << " lineWidth "
460 << vamVisAtts.GetLineWidth();
461 break;
464 os << " forceWireframe ";
465 if (vamVisAtts.IsForceDrawingStyle()) {
466 os << "true";
467 } else {
468 os << "false";
469 }
470 }
471 break;
473 if (vamVisAtts.GetForcedDrawingStyle() == G4VisAttributes::solid) {
474 os << " forceSolid ";
475 if (vamVisAtts.IsForceDrawingStyle()) {
476 os << "true";
477 } else {
478 os << "false";
479 }
480 }
481 break;
483 if (vamVisAtts.GetForcedDrawingStyle() == G4VisAttributes::cloud) {
484 os << " forceCloud ";
485 if (vamVisAtts.IsForceDrawingStyle()) {
486 os << "true";
487 } else {
488 os << "false";
489 }
490 }
491 break;
493 os << " numberOfCloudPoints "
494 << vamVisAtts.GetForcedNumberOfCloudPoints();
495 break;
497 os << " forceAuxEdgeVisible: ";
498 if (!vamVisAtts.IsForceDrawingStyle()) {
499 os << "not ";
500 }
501 os << " forced";
502 if (vamVisAtts.IsForceAuxEdgeVisible()) {
503 os << ": ";
504 if (vamVisAtts.IsForcedAuxEdgeVisible()) {
505 os << "true";
506 } else {
507 os << "false";
508 }
509 }
510 break;
512 os << " lineSegmentsPerCircle "
513 << vamVisAtts.GetForcedLineSegmentsPerCircle();
514 break;
515 }
516 }
517
518 return os;
519}
std::vector< PVNameCopyNo > PVNameCopyNoPath
G4int GetForcedNumberOfCloudPoints() const
G4double GetLineWidth() const
G4bool IsDaughtersInvisible() const
G4int GetForcedLineSegmentsPerCircle() const
LineStyle GetLineStyle() const
const G4Colour & GetColour() const
G4bool IsVisible() const
G4bool IsForceAuxEdgeVisible() const
G4bool IsForcedAuxEdgeVisible() const
ForcedDrawingStyle GetForcedDrawingStyle() const
G4bool IsForceDrawingStyle() const

The documentation for this class was generated from the following files: