1098 {
1099
1102
1104 if (!pScene) {
1106 G4cout <<
"ERROR: No current scene. Please create one." <<
G4endl;
1107 }
1108 return;
1109 }
1110
1112 G4int requestedDepthOfDescent;
1113 G4String booleansString, voxelsString, readoutString;
1114 std::istringstream is (newValue);
1115 is >> name >> requestedDepthOfDescent
1116 >> booleansString >> voxelsString >> readoutString;
1120
1122 int nLV = pLVStore -> size ();
1123 int iLV;
1125 for (iLV = 0; iLV < nLV; iLV++ ) {
1126 pLV = (*pLVStore) [iLV];
1127 if (pLV -> GetName () == name) break;
1128 }
1129 if (iLV == nLV) {
1131 G4cout <<
"ERROR: Logical volume " << name
1132 <<
" not found in logical volume store." <<
G4endl;
1133 }
1134 return;
1135 }
1136
1137 const std::vector<G4Scene::Model>& rdModelList = pScene -> GetRunDurationModelList();
1138 std::vector<G4Scene::Model>::const_iterator i;
1139 for (i = rdModelList.begin(); i != rdModelList.end(); ++i) {
1140 if (i->fpModel->GetGlobalDescription().find("Volume") != std::string::npos) break;
1141 }
1142 if (i != rdModelList.end()) {
1144 G4cout <<
"There is already a volume, \""
1145 << i->fpModel->GetGlobalDescription()
1146 << "\",\n in the run-duration model list of scene \""
1147 << pScene -> GetName()
1148 << "\".\n Your logical volume must be the only volume in the scene."
1149 << "\n Create a new scene and try again:"
1150 << "\n /vis/specify " << name
1151 << "\n or"
1152 << "\n /vis/scene/create"
1153 << "\n /vis/scene/add/logicalVolume " << name
1154 << "\n /vis/sceneHandler/attach"
1155 << "\n (and also, if necessary, /vis/viewer/flush)"
1157 }
1158 }
1159
1161 (pLV, requestedDepthOfDescent, booleans, voxels, readout);
1162 const G4String& currentSceneName = pScene -> GetName ();
1163 G4bool successful = pScene -> AddRunDurationModel (model, warn);
1164 if (successful) {
1166 G4cout <<
"Logical volume \"" << pLV -> GetName ()
1167 << " with requested depth of descent "
1168 << requestedDepthOfDescent
1169 << ",\n with";
1170 if (!booleans)
G4cout <<
"out";
1171 G4cout <<
" boolean components, with";
1172 if (!voxels)
G4cout <<
"out";
1173 G4cout <<
" voxels and with";
1174 if (!readout)
G4cout <<
"out";
1175 G4cout <<
" readout geometry,"
1176 << "\n has been added to scene \"" << currentSceneName << "\"."
1178 }
1179 }
1180 else {
1181 G4VisCommandsSceneAddUnsuccessful(verbosity);
1182 return;
1183 }
1184
1186}
G4DLLIMPORT std::ostream G4cout
static G4LogicalVolumeStore * GetInstance()
static G4bool ConvertToBool(const char *st)
static G4VisManager * fpVisManager
void UpdateVisManagerScene(const G4String &sceneName="")
G4Scene * GetCurrentScene() const
static Verbosity GetVerbosity()