1420 {
1421
1424
1426 if (!pScene) {
1428 G4warn <<
"ERROR: No current scene. Please create one." <<
G4endl;
1429 }
1430 return;
1431 }
1432
1434 G4int requestedDepthOfDescent;
1435 G4String booleansString, voxelsString, readoutString, axesString;
1437 std::istringstream is (newValue);
1438 is >>
name >> requestedDepthOfDescent
1439 >> booleansString >> voxelsString >> readoutString >> axesString
1440 >> overlapString;
1446
1450 if (pLV == nullptr) return;
1451
1452 const std::vector<G4Scene::Model>& rdModelList =
1453 pScene -> GetRunDurationModelList();
1454 std::vector<G4Scene::Model>::const_iterator i;
1455 for (i = rdModelList.begin(); i != rdModelList.end(); ++i) {
1456 if (i->fpModel->GetGlobalDescription().find("Volume") != std::string::npos) break;
1457 }
1458 if (i != rdModelList.end()) {
1460 G4warn <<
"There is already a volume, \""
1461 << i->fpModel->GetGlobalDescription()
1462 << "\",\n in the run-duration model list of scene \""
1463 << pScene -> GetName()
1464 << "\".\n Your logical volume must be the only volume in the scene."
1465 << "\n Create a new scene and try again:"
1466 <<
"\n /vis/specify " <<
name
1467 << "\n or"
1468 << "\n /vis/scene/create"
1469 <<
"\n /vis/scene/add/logicalVolume " <<
name
1470 << "\n /vis/sceneHandler/attach"
1471 << "\n (and also, if necessary, /vis/viewer/flush)"
1473 }
1474 return;
1475 }
1476
1478 (pLV, requestedDepthOfDescent, booleans, voxels, readout, checkOverlaps);
1479 const G4String& currentSceneName = pScene -> GetName ();
1480 G4bool successful = pScene -> AddRunDurationModel (model, warn);
1481
1482 if (successful) {
1483
1484 G4bool axesSuccessful =
false;
1485 if (axes) {
1487 const G4double axisLengthMax = radius / 2.;
1488 const G4double intLog10Length = std::floor(std::log10(axisLengthMax));
1489 G4double axisLength = std::pow(10,intLog10Length);
1490 if (5.*axisLength < axisLengthMax) axisLength *= 5.;
1491 else if (2.*axisLength < axisLengthMax) axisLength *= 2.;
1492 const G4double axisWidth = axisLength / 20.;
1494 axesSuccessful = pScene -> AddRunDurationModel (axesModel, warn);
1495 }
1496
1497
1498
1499
1500
1501
1502
1503
1505 G4cout <<
"Logical volume \"" << pLV -> GetName ()
1506 << "\" with requested depth of descent "
1507 << requestedDepthOfDescent
1508 << ",\n with";
1509 if (!booleans)
G4cout <<
"out";
1510 G4cout <<
" boolean components, with";
1511 if (!voxels)
G4cout <<
"out";
1512 G4cout <<
" voxels,\n with";
1513 if (!readout)
G4cout <<
"out";
1514 G4cout <<
" readout geometry and with";
1515 if (!checkOverlaps)
G4cout <<
"out";
1516 G4cout <<
" overlap checking"
1517 << "\n has been added to scene \"" << currentSceneName << "\".";
1518 if (axes) {
1519 if (axesSuccessful) {
1521 "\n Axes have also been added at the origin of local cooordinates.";
1522 } else {
1524 "\n Axes have not been added for some reason possibly stated above.";
1525 }
1526 }
1528 }
1529 }
1530 else {
1532 return;
1533 }
1534
1536}
G4GLOB_DLL std::ostream G4cout
G4LogicalVolume * GetVolume(const G4String &name, G4bool verbose=true, G4bool reverseSearch=false) const
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)