Geant4 11.2.2
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 ()=default
 
 G4UImessenger (const G4String &path, const G4String &dsc, G4bool commandsToBeBroadcasted=true)
 
virtual ~G4UImessenger ()
 
G4bool CommandsShouldBeInMaster () const
 

Additional Inherited Members

- Static Public Member Functions inherited from G4VVisCommand
static G4VisManagerGetVisManager ()
 
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="")
 
void Twinkle (G4VViewer *currentViewer, const G4ViewParameters &baseVP, const std::vector< std::vector< G4PhysicalVolumeModel::G4PhysicalVolumeNodeID > > &paths)
 
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 CopyCameraParameters (G4ViewParameters &target, const G4ViewParameters &from)
 
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 LtoS (G4long l)
 
G4String DtoS (G4double a)
 
G4String BtoS (G4bool b)
 
G4int StoI (const G4String &s)
 
G4long StoL (const G4String &s)
 
G4double StoD (const 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 = nullptr
 
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
 
static G4bool fThereWasAViewer = false
 
static G4ViewParameters fExistingVP
 
static G4SceneTreeItem fExistingSceneTree
 

Detailed Description

Definition at line 125 of file G4VisCommandsSet.hh.

Constructor & Destructor Documentation

◆ G4VisCommandSetTouchable()

G4VisCommandSetTouchable::G4VisCommandSetTouchable ( )

Definition at line 390 of file G4VisCommandsSet.cc.

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

◆ ~G4VisCommandSetTouchable()

G4VisCommandSetTouchable::~G4VisCommandSetTouchable ( )
virtual

Definition at line 409 of file G4VisCommandsSet.cc.

410{
411 delete fpCommand;
412}

Member Function Documentation

◆ GetCurrentValue()

G4String G4VisCommandSetTouchable::GetCurrentValue ( G4UIcommand * command)
virtual

Reimplemented from G4UImessenger.

Definition at line 414 of file G4VisCommandsSet.cc.

415{
416 return G4String();
417}

◆ SetNewValue()

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

Reimplemented from G4UImessenger.

Definition at line 419 of file G4VisCommandsSet.cc.

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