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

#include <G4VisCommandsSet.hh>

+ Inheritance diagram for G4VisCommandSetVolumeForField:

Public Member Functions

 G4VisCommandSetVolumeForField ()
 
virtual ~G4VisCommandSetVolumeForField ()
 
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 137 of file G4VisCommandsSet.hh.

Constructor & Destructor Documentation

◆ G4VisCommandSetVolumeForField()

G4VisCommandSetVolumeForField::G4VisCommandSetVolumeForField ( )

Definition at line 519 of file G4VisCommandsSet.cc.

520{
521 G4bool omitable;
522 G4UIparameter* parameter;
523 fpCommand = new G4UIcommand("/vis/set/volumeForField", this);
524 fpCommand->SetGuidance
525 ("Sets a volume for \"/vis/scene/add/*Field\" commands.");
526 fpCommand->SetGuidance
527 ("Takes a volume name or a /regular expression/ -- see guidance for"
528 "\n\"/vis/drawVolume\"");
529 parameter = new G4UIparameter ("physical-volume-name", 's', omitable = true);
530 parameter -> SetDefaultValue ("none");
531 fpCommand -> SetParameter (parameter);
532 parameter = new G4UIparameter ("copy-no", 'i', omitable = true);
533 parameter -> SetGuidance ("If negative, matches any copy no.");
534 parameter -> SetDefaultValue (-1);
535 fpCommand -> SetParameter (parameter);
536 parameter = new G4UIparameter ("draw", 'b', omitable = true);
537 parameter -> SetGuidance ("If true, draw extent of found volumes.");
538 parameter -> SetDefaultValue (false);
539 fpCommand -> SetParameter (parameter);
540}
bool G4bool
Definition: G4Types.hh:86
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:156

◆ ~G4VisCommandSetVolumeForField()

G4VisCommandSetVolumeForField::~G4VisCommandSetVolumeForField ( )
virtual

Definition at line 542 of file G4VisCommandsSet.cc.

543{
544 delete fpCommand;
545}

Member Function Documentation

◆ GetCurrentValue()

G4String G4VisCommandSetVolumeForField::GetCurrentValue ( G4UIcommand command)
virtual

Reimplemented from G4UImessenger.

Definition at line 547 of file G4VisCommandsSet.cc.

548{
549 return G4String();
550}

◆ SetNewValue()

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

Reimplemented from G4UImessenger.

Definition at line 552 of file G4VisCommandsSet.cc.

553{
555
556 G4String name, drawString;
557 G4int copyNo;
558 std::istringstream is (newValue);
559 is >> name >> copyNo >> drawString;
560 G4bool draw = G4UIcmdWithABool::ConvertToBool(drawString);
561
562 if (name == "none") {
565 if (verbosity >= G4VisManager::warnings) {
566 G4cout << "Volume for field cleared" << G4endl;
567 }
568 return;
569 }
570
571 G4TransportationManager* transportationManager =
573 size_t nWorlds = transportationManager->GetNoWorlds();
574 std::vector<G4VPhysicalVolume*>::iterator iterWorld =
575 transportationManager->GetWorldsIterator();
577 G4BoundingExtentScene extentScene;
578 for (size_t i = 0; i < nWorlds; ++i, ++iterWorld) {
579 G4PhysicalVolumeModel searchModel (*iterWorld); // Unlimited depth.
580 G4ModelingParameters mp; // Default - no culling.
581 searchModel.SetModelingParameters (&mp);
582 G4PhysicalVolumesSearchScene searchScene (&searchModel, name, copyNo);
583 searchModel.DescribeYourselfTo (searchScene); // Initiate search.
584 for (const auto& findings: searchScene.GetFindings()) {
585 fCurrrentPVFindingsForField.push_back(findings);
586 G4VisExtent extent = findings.fpFoundPV->GetLogicalVolume()->GetSolid()->GetExtent();
587 extent.Transform(findings.fFoundObjectTransformation);
588 extentScene.AccrueBoundingExtent(extent);
589 }
590 }
591
592 if (fCurrrentPVFindingsForField.empty()) {
593 if (verbosity >= G4VisManager::errors) {
594 G4cerr << "ERROR: Volume \"" << name << "\"";
595 if (copyNo >= 0) {
596 G4cerr << ", copy no. " << copyNo << ",";
597 }
598 G4cerr << " not found." << G4endl;
599 }
600 return;
601 }
602
603 fCurrentExtentForField = extentScene.GetExtent();
604
606
607 if (verbosity >= G4VisManager::confirmations) {
608 for (const auto& findings: fCurrrentPVFindingsForField) {
609 G4cout
610 << "\"" << findings.fpFoundPV->GetName()
611 << "\", copy no. " << findings.fFoundPVCopyNo
612 << ", found\nin searched volume \""
613 << findings.fpSearchPV->GetName()
614 << "\" at depth " << findings.fFoundDepth
615 << ",\nbase path: \"" << findings.fFoundBasePVPath
616 << "\",\nand has been set as volume for field."
617 << G4endl;
618 }
619 }
620}
int G4int
Definition: G4Types.hh:85
G4GLOB_DLL std::ostream G4cerr
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
void AccrueBoundingExtent(const G4VisExtent &)
const G4VisExtent & GetExtent() const
static G4TransportationManager * GetTransportationManager()
std::vector< G4VPhysicalVolume * >::iterator GetWorldsIterator()
size_t GetNoWorlds() const
static G4bool ConvertToBool(const char *st)
Definition: G4UIcommand.cc:530
static std::vector< G4PhysicalVolumesSearchScene::Findings > fCurrrentPVFindingsForField
static G4VisManager * fpVisManager
static G4VisExtent fCurrentExtentForField
void DrawExtent(const G4VisExtent &)
G4VisExtent & Transform(const G4Transform3D &)
Definition: G4VisExtent.cc:102
static Verbosity GetVerbosity()
const char * name(G4int ptype)

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