1290 {
1291
1294
1296 if (!pScene) {
1298 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
1299 }
1300 return;
1301 }
1302
1304 G4int requestedDepthOfDescent;
1305 G4String booleansString, voxelsString, readoutString, axesString;
1307 std::istringstream is (newValue);
1308 is >>
name >> requestedDepthOfDescent
1309 >> booleansString >> voxelsString >> readoutString >> axesString
1310 >> overlapString;
1316
1318 int nLV = pLVStore -> size ();
1319 int iLV;
1321 for (iLV = 0; iLV < nLV; iLV++ ) {
1322 pLV = (*pLVStore) [iLV];
1323 if (pLV -> GetName () == name) break;
1324 }
1325 if (iLV == nLV) {
1328 <<
" not found in logical volume store." <<
G4endl;
1329 }
1330 return;
1331 }
1332
1333 const std::vector<G4Scene::Model>& rdModelList =
1334 pScene -> GetRunDurationModelList();
1335 std::vector<G4Scene::Model>::const_iterator i;
1336 for (i = rdModelList.begin(); i != rdModelList.end(); ++i) {
1337 if (i->fpModel->GetGlobalDescription().find("Volume") != std::string::npos) break;
1338 }
1339 if (i != rdModelList.end()) {
1341 G4cout <<
"There is already a volume, \""
1342 << i->fpModel->GetGlobalDescription()
1343 << "\",\n in the run-duration model list of scene \""
1344 << pScene -> GetName()
1345 << "\".\n Your logical volume must be the only volume in the scene."
1346 << "\n Create a new scene and try again:"
1347 <<
"\n /vis/specify " <<
name
1348 << "\n or"
1349 << "\n /vis/scene/create"
1350 <<
"\n /vis/scene/add/logicalVolume " <<
name
1351 << "\n /vis/sceneHandler/attach"
1352 << "\n (and also, if necessary, /vis/viewer/flush)"
1354 }
1355 return;
1356 }
1357
1359 (pLV, requestedDepthOfDescent, booleans, voxels, readout, checkOverlaps);
1360 const G4String& currentSceneName = pScene -> GetName ();
1361 G4bool successful = pScene -> AddRunDurationModel (model, warn);
1362
1363 if (successful) {
1364
1365 G4bool axesSuccessful =
false;
1366 if (axes) {
1368 const G4double axisLengthMax = radius / 2.;
1369 const G4double intLog10Length = std::floor(std::log10(axisLengthMax));
1370 G4double axisLength = std::pow(10,intLog10Length);
1371 if (5.*axisLength < axisLengthMax) axisLength *= 5.;
1372 else if (2.*axisLength < axisLengthMax) axisLength *= 2.;
1373 const G4double axisWidth = axisLength / 20.;
1375 axesSuccessful = pScene -> AddRunDurationModel (axesModel, warn);
1376 }
1377
1378
1379
1380
1381
1382
1383
1384
1386 G4cout <<
"Logical volume \"" << pLV -> GetName ()
1387 << "\" with requested depth of descent "
1388 << requestedDepthOfDescent
1389 << ",\n with";
1390 if (!booleans)
G4cout <<
"out";
1391 G4cout <<
" boolean components, with";
1392 if (!voxels)
G4cout <<
"out";
1393 G4cout <<
" voxels,\n with";
1394 if (!readout)
G4cout <<
"out";
1395 G4cout <<
" readout geometry and with";
1396 if (!checkOverlaps)
G4cout <<
"out";
1397 G4cout <<
" overlap checking"
1398 << "\n has been added to scene \"" << currentSceneName << "\".";
1399 if (axes) {
1400 if (axesSuccessful) {
1402 "\n Axes have also been added at the origin of local cooordinates.";
1403 } else {
1405 "\n Axes have not been added for some reason possibly stated above.";
1406 }
1407 }
1409 }
1410 }
1411 else {
1413 return;
1414 }
1415
1417}
G4GLOB_DLL std::ostream G4cerr
G4GLOB_DLL std::ostream G4cout
static G4LogicalVolumeStore * GetInstance()
static G4bool ConvertToBool(const char *st)
const G4VisExtent & GetExtent() const
void G4VisCommandsSceneAddUnsuccessful(G4VisManager::Verbosity verbosity)
void CheckSceneAndNotifyHandlers(G4Scene *=nullptr)
static G4VisManager * fpVisManager
G4double GetExtentRadius() const
G4Scene * GetCurrentScene() const
static Verbosity GetVerbosity()
const char * name(G4int ptype)