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

#include <G4VisCommandsSet.hh>

+ Inheritance diagram for G4VisCommandSetTouchable:

Public Member Functions

 G4VisCommandSetTouchable ()
 
virtual ~G4VisCommandSetTouchable ()
 
G4String GetCurrentValue (G4UIcommand *command)
 
void SetNewValue (G4UIcommand *command, G4String newValue)
 
- Public Member Functions inherited from G4VVisCommand
 G4VVisCommand ()
 
virtual ~G4VVisCommand ()
 
- Public Member Functions inherited from G4UImessenger
 G4UImessenger ()
 
 G4UImessenger (const G4String &path, const G4String &dsc, G4bool commandsToBeBroadcasted=true)
 
virtual ~G4UImessenger ()
 
virtual G4String GetCurrentValue (G4UIcommand *command)
 
virtual void SetNewValue (G4UIcommand *command, G4String newValue)
 
G4bool operator== (const G4UImessenger &messenger) const
 
G4bool operator!= (const G4UImessenger &messenger) const
 
G4bool CommandsShouldBeInMaster () const
 

Additional Inherited Members

- Static Public Member Functions inherited from G4VVisCommand
static void SetVisManager (G4VisManager *pVisManager)
 
static const G4ColourGetCurrentTextColour ()
 
- Protected Member Functions inherited from G4VVisCommand
void SetViewParameters (G4VViewer *viewer, const G4ViewParameters &viewParams)
 
void RefreshIfRequired (G4VViewer *viewer)
 
void InterpolateViews (G4VViewer *currentViewer, std::vector< G4ViewParameters > viewVector, const G4int nInterpolationPoints=50, const G4int waitTimePerPointmilliseconds=20, const G4String exportString="")
 
void InterpolateToNewView (G4VViewer *currentViewer, const G4ViewParameters &oldVP, const G4ViewParameters &newVP, const G4int nInterpolationPoints=50, const G4int waitTimePerPointmilliseconds=20, const G4String exportString="")
 
const G4StringConvertToColourGuidance ()
 
void ConvertToColour (G4Colour &colour, const G4String &redOrString, G4double green, G4double blue, G4double opacity)
 
G4bool ProvideValueOfUnit (const G4String &where, const G4String &unit, const G4String &category, G4double &value)
 
void CheckSceneAndNotifyHandlers (G4Scene *=nullptr)
 
G4bool CheckView ()
 
void G4VisCommandsSceneAddUnsuccessful (G4VisManager::Verbosity verbosity)
 
void CopyGuidanceFrom (const G4UIcommand *fromCmd, G4UIcommand *toCmd, G4int startLine=0)
 
void CopyParametersFrom (const G4UIcommand *fromCmd, G4UIcommand *toCmd)
 
void DrawExtent (const G4VisExtent &)
 
- Protected Member Functions inherited from G4UImessenger
G4String ItoS (G4int i)
 
G4String DtoS (G4double a)
 
G4String BtoS (G4bool b)
 
G4int StoI (G4String s)
 
G4long StoL (G4String s)
 
G4double StoD (G4String s)
 
G4bool StoB (G4String s)
 
void AddUIcommand (G4UIcommand *newCommand)
 
void CreateDirectory (const G4String &path, const G4String &dsc, G4bool commandsToBeBroadcasted=true)
 
template<typename T >
T * CreateCommand (const G4String &cname, const G4String &dsc)
 
- Static Protected Member Functions inherited from G4VVisCommand
static G4String ConvertToString (G4double x, G4double y, const char *unitName)
 
static G4bool ConvertToDoublePair (const G4String &paramString, G4double &xval, G4double &yval)
 
- Protected Attributes inherited from G4UImessenger
G4UIdirectorybaseDir = nullptr
 
G4String baseDirName = ""
 
G4bool commandsShouldBeInMaster = false
 
- Static Protected Attributes inherited from G4VVisCommand
static G4VisManagerfpVisManager = 0
 
static G4int fCurrentArrow3DLineSegmentsPerCircle = 6
 
static G4Colour fCurrentColour = G4Colour::White()
 
static G4double fCurrentLineWidth = 1.
 
static G4Colour fCurrentTextColour = G4Colour::Blue()
 
static G4Text::Layout fCurrentTextLayout = G4Text::left
 
static G4double fCurrentTextSize = 12.
 
static G4PhysicalVolumeModel::TouchableProperties fCurrentTouchableProperties
 
static G4VisExtent fCurrentExtentForField
 
static std::vector< G4PhysicalVolumesSearchScene::FindingsfCurrrentPVFindingsForField
 

Detailed Description

Definition at line 125 of file G4VisCommandsSet.hh.

Constructor & Destructor Documentation

◆ G4VisCommandSetTouchable()

G4VisCommandSetTouchable::G4VisCommandSetTouchable ( )

Definition at line 393 of file G4VisCommandsSet.cc.

394{
395 G4bool omitable;
396 G4UIparameter* parameter;
397 fpCommand = new G4UIcommand("/vis/set/touchable", this);
398 fpCommand->SetGuidance
399 ("Defines touchable for future \"/vis/touchable/set/\" commands.");
400 fpCommand->SetGuidance
401 ("Please provide a list of space-separated physical volume names and"
402 "\ncopy number pairs starting at the world volume, e.g:"
403 "\n /vis/set/touchable World 0 Envelope 0 Shape1 0"
404 "\n(To get list of touchables, use \"/vis/drawTree\")"
405 "\n(To save, use \"/vis/viewer/save\")");
406 parameter = new G4UIparameter ("list", 's', omitable = true);
407 parameter->SetGuidance
408 ("List of physical volume names and copy number pairs");
409 fpCommand->SetParameter (parameter);
410}
bool G4bool
Definition: G4Types.hh:86
void SetParameter(G4UIparameter *const newParameter)
Definition: G4UIcommand.hh:146
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:156
void SetGuidance(const char *theGuidance)

◆ ~G4VisCommandSetTouchable()

G4VisCommandSetTouchable::~G4VisCommandSetTouchable ( )
virtual

Definition at line 412 of file G4VisCommandsSet.cc.

413{
414 delete fpCommand;
415}

Member Function Documentation

◆ GetCurrentValue()

G4String G4VisCommandSetTouchable::GetCurrentValue ( G4UIcommand command)
virtual

Reimplemented from G4UImessenger.

Definition at line 417 of file G4VisCommandsSet.cc.

418{
419 return G4String();
420}

◆ SetNewValue()

void G4VisCommandSetTouchable::SetNewValue ( G4UIcommand command,
G4String  newValue 
)
virtual

Reimplemented from G4UImessenger.

Definition at line 422 of file G4VisCommandsSet.cc.

423{
425
426 if (newValue.isNull()) {
428 if (verbosity >= G4VisManager::confirmations) {
429 G4cout <<
430 "Current touchable reset to: " << fCurrentTouchableProperties.fTouchablePath
431 << G4endl;
432 }
433 return;
434 }
435
436 G4ModelingParameters::PVNameCopyNoPath currentTouchablePath;
437
438 // Algorithm from Josuttis p.476.
439 G4String::size_type iBegin, iEnd;
440 iBegin = newValue.find_first_not_of(' ');
441 while (iBegin != G4String::npos) {
442 iEnd = newValue.find_first_of(' ',iBegin);
443 if (iEnd == G4String::npos) {
444 iEnd = newValue.length();
445 }
446 G4String name(newValue.substr(iBegin,iEnd-iBegin));
447 iBegin = newValue.find_first_not_of(' ',iEnd);
448 if (iBegin == G4String::npos) {
449 if (verbosity >= G4VisManager::warnings) {
450 G4cout <<
451 "WARNING: G4VisCommandSetTouchable::SetNewValue"
452 "\n A pair not found. (Did you have an even number of parameters?)"
453 "\n Command ignored."
454 << G4endl;
455 return;
456 }
457 }
458 iEnd = newValue.find_first_of(' ',iBegin);
459 if (iEnd == G4String::npos) {
460 iEnd = newValue.length();
461 }
462 G4int copyNo;
463 std::istringstream iss(newValue.substr(iBegin,iEnd-iBegin));
464 if (!(iss >> copyNo)) {
465 if (verbosity >= G4VisManager::warnings) {
466 G4cout <<
467 "WARNING: G4VisCommandSetTouchable::SetNewValue"
468 "\n Error reading copy number - it was not numeric?"
469 "\n Command ignored."
470 << G4endl;
471 return;
472 }
473 }
474 currentTouchablePath.push_back
476 iBegin = newValue.find_first_not_of(' ',iEnd);
477 }
478
479 // Check validity
480 G4bool successful = false;
481 G4TransportationManager* transportationManager =
483 size_t nWorlds = transportationManager->GetNoWorlds();
484 std::vector<G4VPhysicalVolume*>::iterator iterWorld =
485 transportationManager->GetWorldsIterator();
486 for (size_t i = 0; i < nWorlds; ++i, ++iterWorld) {
487 G4PhysicalVolumeModel pvModel (*iterWorld); // Unlimited depth.
488 G4ModelingParameters mp; // Default - no culling.
489 pvModel.SetModelingParameters (&mp);
490 G4TouchablePropertiesScene scene (&pvModel,currentTouchablePath);
491 pvModel.DescribeYourselfTo (scene); // Initiate geometry tree traversal.
492 if (scene.GetFoundTouchableProperties().fpTouchablePV) {
493 successful = true;
494 fCurrentTouchableProperties = scene.GetFoundTouchableProperties();
495 break; // Found, so no need to scan more worlds.
496 }
497 }
498
499 if (successful) {
500 if (verbosity >= G4VisManager::confirmations) {
501 G4cout <<
502 "Current touchable: " << fCurrentTouchableProperties.fTouchablePath
503 << G4endl;
504 return;
505 }
506 } else {
507 if (verbosity >= G4VisManager::warnings) {
508 G4cout <<
509 "WARNING: G4VisCommandSetTouchable::SetNewValue"
510 "\n Touchable not found."
511 << G4endl;
512 return;
513 }
514 }
515}
int G4int
Definition: G4Types.hh:85
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
std::vector< PVNameCopyNo > PVNameCopyNoPath
G4bool isNull() const
static G4TransportationManager * GetTransportationManager()
std::vector< G4VPhysicalVolume * >::iterator GetWorldsIterator()
size_t GetNoWorlds() const
static G4VisManager * fpVisManager
static G4PhysicalVolumeModel::TouchableProperties fCurrentTouchableProperties
static Verbosity GetVerbosity()
const char * name(G4int ptype)
G4ModelingParameters::PVNameCopyNoPath fTouchablePath

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