2787 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
2793 G4int copyNo, requestedDepthOfDescent;
2794 G4double param1, param2, param3, param4, param5, param6;
2795 std::istringstream is (newValue);
2796 is >> name >> copyNo >> requestedDepthOfDescent
2797 >> clipVolumeType >> parameterUnit
2798 >> param1 >> param2 >> param3 >> param4 >> param5 >> param6;
2801 if (clipVolumeType[
size_t(0)] ==
'-') {
2802 clipVolumeType = clipVolumeType.substr(1);
2803 }
else if (clipVolumeType[
size_t(0)] ==
'*') {
2805 clipVolumeType = clipVolumeType.substr(1);
2808 param1 *= unit; param2 *= unit; param3 *= unit;
2809 param4 *= unit; param5 *= unit; param6 *= unit;
2814 size_t nWorlds = transportationManager->
GetNoWorlds();
2817 static G4bool warned =
false;
2818 if (!warned && name !=
"worlds") {
2820 "WARNING: Parallel worlds in operation. To visualise, specify" 2821 "\n \"worlds\" or the parallel world volume or sub-volume name" 2822 "\n and control visibility with /vis/geometry." 2824 std::vector<G4VPhysicalVolume*>::iterator iterWorld =
2826 for (
size_t i = 0; i < nWorlds; ++i, ++iterWorld) {
2827 G4cout <<
" World " << i <<
": " << (*iterWorld)->GetName()
2840 "ERROR: G4VisCommandSceneAddVolume::SetNewValue:" 2841 "\n No world. Maybe the geometry has not yet been defined." 2842 "\n Try \"/run/initialize\"" 2848 const std::vector<G4Scene::Model>& rdModelList = pScene -> GetRunDurationModelList();
2849 std::vector<G4Scene::Model>::const_iterator it;
2850 for (it = rdModelList.begin(); it != rdModelList.end(); ++it) {
2851 if (it->fpModel->GetGlobalDescription().find(
"G4PhysicalVolumeModel")
2852 != std::string::npos) {
2856 if (it != rdModelList.end()) {
2858 G4cout <<
"WARNING: There is already a volume, \"" 2859 << it -> fpModel -> GetGlobalDescription()
2860 <<
"\",\n in the run-duration model list of scene \"" 2861 << pScene -> GetName()
2862 <<
"\".\n To get a clean scene:" 2863 <<
"\n /vis/drawVolume " << name
2865 <<
"\n /vis/scene/create" 2866 <<
"\n /vis/scene/add/volume " << name
2867 <<
"\n /vis/sceneHandler/attach" 2868 <<
"\n (and also, if necessary, /vis/viewer/flush)" 2874 std::vector<G4PhysicalVolumeModel*> models;
2875 std::vector<G4VPhysicalVolume*> foundVolumes;
2878 typedef std::vector<PVNodeID>
PVPath;
2879 PVPath foundFullPVPath;
2880 std::vector<G4int> foundDepths;
2881 std::vector<G4Transform3D> transformations;
2883 if (name ==
"world") {
2887 foundVolumes.push_back(world);
2888 foundDepths.push_back(0);
2891 }
else if (name ==
"worlds") {
2896 "WARNING: G4VisCommandSceneAddVolume::SetNewValue:" 2897 "\n Parallel worlds requested but none exist." 2898 "\n Just adding material world." 2902 std::vector<G4VPhysicalVolume*>::iterator iterWorld =
2904 for (
size_t i = 0; i < nWorlds; ++i, ++iterWorld) {
2907 foundVolumes.push_back(*iterWorld);
2908 foundDepths.push_back(0);
2914 std::vector<G4VPhysicalVolume*>::iterator iterWorld =
2916 for (
size_t i = 0; i < nWorlds; ++i, ++iterWorld) {
2919 searchModel.SetModelingParameters (&mp);
2921 searchModel.DescribeYourselfTo (searchScene);
2924 foundWorld = *iterWorld;
2925 foundVolumes.push_back(foundVolume);
2926 foundFullPVPath = searchScene.GetFoundFullPVPath();
2927 foundDepths.push_back(searchScene.GetFoundDepth());
2928 transformations.push_back(searchScene.GetFoundTransformation());
2933 if (foundVolumes.size()) {
2934 for (
size_t i = 0; i < foundVolumes.size(); ++i) {
2936 (foundVolumes[i], requestedDepthOfDescent, transformations[i]);
2937 foundFullPVPath.pop_back();
2939 models.push_back(foundPVModel);
2943 G4cerr <<
"ERROR: Volume \"" << name <<
"\"";
2945 G4cerr <<
", copy no. " << copyNo <<
",";
2953 if (clipVolumeType ==
"box") {
2954 const G4double dX = (param2 - param1) / 2.;
2955 const G4double dY = (param4 - param3) / 2.;
2956 const G4double dZ = (param6 - param5) / 2.;
2957 const G4double x0 = (param2 + param1) / 2.;
2958 const G4double y0 = (param4 + param3) / 2.;
2962 (
"_displaced_clipping_box",
2963 new G4Box(
"_clipping_box",dX,dY,dZ),
2965 for (
size_t i = 0; i < foundVolumes.size(); ++i) {
2966 models[i]->SetClippingSolid(clippingSolid);
2967 models[i]->SetClippingMode(clippingMode);
2971 const G4String& currentSceneName = pScene -> GetName ();
2973 for (
size_t i = 0; i < foundVolumes.size(); ++i) {
2974 G4bool successful = pScene -> AddRunDurationModel (models[i], warn);
2978 G4cout <<
"First occurrence of \"" 2979 << foundVolumes[i] -> GetName ()
2982 G4cout <<
", copy no. " << copyNo <<
",";
2987 G4cout <<
"at depth " << foundDepths[i]
2988 <<
",\n with a requested depth of further descent of ";
2989 if (requestedDepthOfDescent < 0) {
2990 G4cout <<
"<0 (unlimited)";
2993 G4cout << requestedDepthOfDescent;
2995 G4cout <<
",\n has been added to scene \"" << currentSceneName <<
"\"."
std::vector< G4VPhysicalVolume * >::iterator GetWorldsIterator()
G4Scene * GetCurrentScene() const
void UpdateVisManagerScene(const G4String &sceneName="")
size_t GetNoWorlds() const
static void G4VisCommandsSceneAddUnsuccessful(G4VisManager::Verbosity verbosity)
G4GLOB_DLL std::ostream G4cout
G4PhysicalVolumeModel::G4PhysicalVolumeNodeID PVNodeID
std::vector< PVNodeID > PVPath
void SetBaseFullPVPath(const std::vector< G4PhysicalVolumeNodeID > &baseFullPVPath)
static G4TransportationManager * GetTransportationManager()
const G4String & GetName() const
static G4double ValueOf(const char *unitName)
static Verbosity GetVerbosity()
G4GLOB_DLL std::ostream G4cerr
static G4VisManager * fpVisManager