2561 G4cout <<
"ERROR: No current scene. Please create one." <<
G4endl;
2567 G4int copyNo, requestedDepthOfDescent;
2568 G4double param1, param2, param3, param4, param5, param6;
2569 std::istringstream is (newValue);
2570 is >> name >> copyNo >> requestedDepthOfDescent
2571 >> clipVolumeType >> parameterUnit
2572 >> param1 >> param2 >> param3 >> param4 >> param5 >> param6;
2575 if (clipVolumeType[
size_t(0)] ==
'-') {
2576 clipVolumeType = clipVolumeType.substr(1);
2577 }
else if (clipVolumeType[
size_t(0)] ==
'*') {
2579 clipVolumeType = clipVolumeType.substr(1);
2582 param1 *= unit; param2 *= unit; param3 *= unit;
2583 param4 *= unit; param5 *= unit; param6 *= unit;
2588 size_t nWorlds = transportationManager->
GetNoWorlds();
2591 static G4bool warned =
false;
2592 if (!warned && name !=
"worlds") {
2594 "WARNING: Parallel worlds in operation. To visualise, specify"
2595 "\n \"worlds\" or the parallel world volume or sub-volume name"
2596 "\n and control visibility with /vis/geometry."
2598 std::vector<G4VPhysicalVolume*>::iterator iterWorld =
2600 for (
size_t i = 0; i < nWorlds; ++i, ++iterWorld) {
2601 G4cout <<
" World " << i <<
": " << (*iterWorld)->GetName()
2614 "ERROR: G4VisCommandSceneAddVolume::SetNewValue:"
2615 "\n No world. Maybe the geometry has not yet been defined."
2616 "\n Try \"/run/initialize\""
2622 const std::vector<G4Scene::Model>& rdModelList = pScene -> GetRunDurationModelList();
2623 std::vector<G4Scene::Model>::const_iterator it;
2624 for (it = rdModelList.begin(); it != rdModelList.end(); ++it) {
2625 if (it->fpModel->GetGlobalDescription().find(
"G4PhysicalVolumeModel")
2626 != std::string::npos) {
2630 if (it != rdModelList.end()) {
2632 G4cout <<
"WARNING: There is already a volume, \""
2633 << it -> fpModel -> GetGlobalDescription()
2634 <<
"\",\n in the run-duration model list of scene \""
2635 << pScene -> GetName()
2636 <<
"\".\n To get a clean scene:"
2637 <<
"\n /vis/drawVolume " << name
2639 <<
"\n /vis/scene/create"
2640 <<
"\n /vis/scene/add/volume " << name
2641 <<
"\n /vis/sceneHandler/attach"
2642 <<
"\n (and also, if necessary, /vis/viewer/flush)"
2648 std::vector<G4PhysicalVolumeModel*> models;
2649 std::vector<G4VPhysicalVolume*> foundVolumes;
2652 typedef std::vector<PVNodeID>
PVPath;
2653 PVPath foundFullPVPath;
2654 std::vector<G4int> foundDepths;
2655 std::vector<G4Transform3D> transformations;
2657 if (name ==
"world") {
2661 foundVolumes.push_back(world);
2662 foundDepths.push_back(0);
2665 }
else if (name ==
"worlds") {
2670 "WARNING: G4VisCommandSceneAddVolume::SetNewValue:"
2671 "\n Parallel worlds requested but none exist."
2672 "\n Just adding material world."
2676 std::vector<G4VPhysicalVolume*>::iterator iterWorld =
2678 for (
size_t i = 0; i < nWorlds; ++i, ++iterWorld) {
2681 foundVolumes.push_back(*iterWorld);
2682 foundDepths.push_back(0);
2688 std::vector<G4VPhysicalVolume*>::iterator iterWorld =
2690 for (
size_t i = 0; i < nWorlds; ++i, ++iterWorld) {
2693 searchModel.SetModelingParameters (&mp);
2695 searchModel.DescribeYourselfTo (searchScene);
2698 foundWorld = *iterWorld;
2699 foundVolumes.push_back(foundVolume);
2700 foundFullPVPath = searchScene.GetFoundFullPVPath();
2701 foundDepths.push_back(searchScene.GetFoundDepth());
2702 transformations.push_back(searchScene.GetFoundTransformation());
2707 if (foundVolumes.size()) {
2708 for (
size_t i = 0; i < foundVolumes.size(); ++i) {
2710 (foundVolumes[i], requestedDepthOfDescent, transformations[i]);
2711 foundFullPVPath.pop_back();
2713 models.push_back(foundPVModel);
2717 G4cout <<
"ERROR: Volume \"" << name <<
"\"";
2719 G4cout <<
", copy no. " << copyNo <<
",";
2727 if (clipVolumeType ==
"box") {
2728 const G4double dX = (param2 - param1) / 2.;
2729 const G4double dY = (param4 - param3) / 2.;
2730 const G4double dZ = (param6 - param5) / 2.;
2731 const G4double x0 = (param2 + param1) / 2.;
2732 const G4double y0 = (param4 + param3) / 2.;
2736 (
"_displaced_clipping_box",
2737 new G4Box(
"_clipping_box",dX,dY,dZ),
2739 for (
size_t i = 0; i < foundVolumes.size(); ++i) {
2740 models[i]->SetClippingSolid(clippingSolid);
2741 models[i]->SetClippingMode(clippingMode);
2745 const G4String& currentSceneName = pScene -> GetName ();
2747 for (
size_t i = 0; i < foundVolumes.size(); ++i) {
2748 G4bool successful = pScene -> AddRunDurationModel (models[i], warn);
2752 G4cout <<
"First occurrence of \""
2753 << foundVolumes[i] -> GetName ()
2756 G4cout <<
", copy no. " << copyNo <<
",";
2761 G4cout <<
"at depth " << foundDepths[i]
2762 <<
",\n with a requested depth of further descent of ";
2763 if (requestedDepthOfDescent < 0) {
2764 G4cout <<
"<0 (unlimited)";
2767 G4cout << requestedDepthOfDescent;
2769 G4cout <<
",\n has been added to scene \"" << currentSceneName <<
"\"."
2776 G4VisCommandsSceneAddUnsuccessful(verbosity);
std::vector< G4VPhysicalVolume * >::iterator GetWorldsIterator()
void UpdateVisManagerScene(const G4String &sceneName="")
G4GLOB_DLL std::ostream G4cout
const G4String & GetName() const
G4PhysicalVolumeModel::G4PhysicalVolumeNodeID PVNodeID
std::vector< PVNodeID > PVPath
void SetBaseFullPVPath(const std::vector< G4PhysicalVolumeNodeID > &baseFullPVPath)
static G4TransportationManager * GetTransportationManager()
static G4double ValueOf(const char *unitName)
static Verbosity GetVerbosity()
size_t GetNoWorlds() const
G4Scene * GetCurrentScene() const
static G4VisManager * fpVisManager