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