Import Geant4 10.3.1 source tree

This commit is contained in:
Gabriele Cosmo
2017-02-28 16:16:20 +01:00
parent a3452e42ac
commit 4597adb7c4
267 changed files with 14761 additions and 24650 deletions
+4 -1
View File
@@ -1,4 +1,4 @@
$Id: History 101714 2016-11-22 08:53:13Z gcosmo $
$Id: History 102570 2017-02-09 08:40:47Z gcosmo $
-------------------------------------------------------------------
=========================================================
@@ -17,6 +17,9 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
6th January 2017 John Allison (opengl-V10-02-27)
- G4OpenGLSceneHandler.cc: Fixed bug in ScaledFlush.
21th November 2016 Laurent Garnier (opengl-V10-02-26)
- Go back on the glCheckFramebufferStatus(): comment out this command
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4OpenGLSceneHandler.cc 99503 2016-09-26 07:17:29Z gcosmo $
// $Id: G4OpenGLSceneHandler.cc 102570 2017-02-09 08:40:47Z gcosmo $
//
//
// Andrew Walkden 27th March 1996
@@ -120,17 +120,54 @@ void G4OpenGLSceneHandler::ScaledFlush()
// Drawing transients, e.g., trajectories.
if (!fpScene) {
// No scene, so probably not in event loop.
glFlush();
return;
}
// Get event from modeling parameters
if (!fpModel) {
// No model, so probably not in event loop
glFlush();
return;
}
const G4ModelingParameters* modelingParameters =
fpModel->GetModelingParameters();
if (!modelingParameters) {
// No modeling parameters, so probably not in event loop.
glFlush();
return;
}
const G4Event* thisEvent = modelingParameters->GetEvent();
if (!thisEvent) {
// No event, so probably not in event loop.
glFlush();
return;
}
G4RunManager* runMan = G4RunManager::GetRunManager();
#ifdef G4MULTITHREADED
if (G4Threading::IsMultithreadedApplication()) {
runMan = G4MTRunManager::GetMasterRunManager();
}
#endif
if (!runMan) {
glFlush();
return;
}
const G4Run* thisRun = runMan->GetCurrentRun();
if (!thisRun) {
glFlush();
return;
}
switch (fFlushAction) {
case endOfEvent:
// If "/vis/scene/endOfEventAction refresh", primitives are flushed at
// end of event anyway.
// But if "/vis/scene/endOfEventAction accumulate", ShowView is not
// called until end of run, so we have to watch for a new event.
if (fpScene->GetRefreshAtEndOfEvent()) return;
else {
// end of run anyway, so only scale if false.
if (!fpScene->GetRefreshAtEndOfEvent()) {
// But if "/vis/scene/endOfEventAction accumulate", ShowView is not
// called until end of run, so we have to watch for a new event.
// Get event from modeling parameters
const G4Event* thisEvent = fpModel->GetModelingParameters()->GetEvent();
if (!thisEvent) {glFlush(); return;}
G4int thisEventID = thisEvent->GetEventID();
static G4int lastEventID = 0;
if (thisEventID != lastEventID) {
@@ -141,20 +178,10 @@ void G4OpenGLSceneHandler::ScaledFlush()
break;
case endOfRun:
// If "/vis/scene/endOfRunAction refresh", primitives are flushed at
// end of run anyway.
// If "/vis/scene/endOfRunAction accumulate", ShowView is never called
// so we have to watch for a new run.
if (fpScene->GetRefreshAtEndOfRun()) return;
else {
G4RunManager* runMan = G4RunManager::GetRunManager();
#ifdef G4MULTITHREADED
if (G4Threading::IsMultithreadedApplication()) {
runMan = G4MTRunManager::GetMasterRunManager();
}
#endif
if (!runMan) {glFlush(); return;}
const G4Run* thisRun = runMan->GetCurrentRun();
if (!thisRun) {glFlush(); return;}
// end of run anyway, so only scale if false.
if (!fpScene->GetRefreshAtEndOfRun()) {
// If "/vis/scene/endOfRunAction accumulate", ShowView is never called
// so we have to watch for a new run.
G4int thisRunID = thisRun->GetRunID();
static G4int lastRunID = 0;
if (thisRunID != lastRunID) {
@@ -178,11 +205,8 @@ void G4OpenGLSceneHandler::ScaledFlush()
}
case NthEvent:
// If "/vis/scene/endOfEventAction refresh", primitives are flushed at
// end of event anyway.
if (fpScene->GetRefreshAtEndOfEvent()) return;
else {
// Get event from modeling parameters
const G4Event* thisEvent = fpModel->GetModelingParameters()->GetEvent();
// end of event anyway, so only scale if false.
if (!fpScene->GetRefreshAtEndOfEvent()) {
G4int thisEventID = thisEvent->GetEventID();
static G4int lastEventID = 0;
if (thisEventID != lastEventID) {
+7 -1
View File
@@ -1,4 +1,4 @@
$Id: History 97317 2016-06-01 12:14:31Z gcosmo $
$Id: History 102573 2017-02-09 08:50:23Z gcosmo $
-------------------------------------------------------------------
=========================================================
@@ -20,6 +20,12 @@ committal in the CVS repository !
History file for visualization/OpenInventor
-------------------------------------------
10 January 2017 Fred Jones (openinventor-V10-02-04)
- G4OpenInventorXtExtendedViewer:
Added viewer button for Wireframe/Solid switching.
Added workaround to prevent empty second page in
PS and PDF output (due to superimposed scene).
01 June 2016 John Allison (openinventor-V10-02-03)
- G4OpenInventorXtExtendedViewer.hh:
Removed fPDFButton - not used. Fixes Coverity warning.
@@ -65,6 +65,8 @@ class SoPointSet;
class G4OpenInventorXtExaminerViewer : public SoXtExaminerViewer {
friend class G4OpenInventorXtExaminerViewerMessenger;
// FWJ
friend class G4OpenInventorXtExtendedViewer;
private:
Widget prevViewPtButton, nextViewPtButton;
@@ -108,6 +110,8 @@ public:
bool abbrOutputFlag;
bool pickRefPathFlag;
bool viewingBeforePickRef;
// FWJ
// SoNode * superimposition;
protected:
// Same constructor as the ExaminerViewer
@@ -204,6 +208,7 @@ private:
static void saveViewPtCB(Widget, XtPointer, XtPointer);
static void abbrOutputCB(Widget, XtPointer, XtPointer);
static void pickRefPathCB(Widget, XtPointer, XtPointer);
static void switchWireFrameCB(Widget, XtPointer, XtPointer);
static void constructListsDialog(Widget, XtPointer, XtPointer);
void saveViewPt(char *name);
@@ -0,0 +1,34 @@
#ifndef COIN_PIXMAP_WIREFRAME_XPM
#define COIN_PIXMAP_WIREFRAME_XPM
/* XPM */
static const char* wireframe_xpm[]={
"24 24 2 1",
". c None",
"# c #000000",
"........................",
"........................",
"......################..",
".....##.............##..",
"....#.#............#.#..",
"...#..#...........#..#..",
"..################...#..",
"..#...#..........#...#..",
"..#...#..........#...#..",
"..#...#..........#...#..",
"..#...#..........#...#..",
"..#...#..........#...#..",
"..#...#..........#...#..",
"..#...#..........#...#..",
"..#...#..........#...#..",
"..#...#..........#...#..",
"..#...#..........#...#..",
"..#...################..",
"..#..#...........#..#...",
"..#.#............#.#....",
"..##.............##.....",
"..################......",
"........................",
"........................"};
#endif /* !COIN_PIXMAP_WIREFRAME_XPM */
@@ -11,7 +11,7 @@
#
# Generated on : 24/9/2010
#
# $Id: sources.cmake 96179 2016-03-22 15:43:57Z gcosmo $
# $Id: sources.cmake 102573 2017-02-09 08:50:23Z gcosmo $
#
#------------------------------------------------------------------------------
@@ -109,6 +109,7 @@ if(UNIX)
saveViewPt.h
pickext.h
pickref.h
wireframe.h
)
list(APPEND G4VIS_MODULE_OPENINVENTOR_SOURCES
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4OpenInventorViewer.cc 88190 2015-02-02 17:24:54Z gcosmo $
// $Id: G4OpenInventorViewer.cc 102573 2017-02-09 08:50:23Z gcosmo $
#ifdef G4VIS_BUILD_OI_DRIVER
@@ -184,6 +184,9 @@ G4bool G4OpenInventorViewer::CompareForKernelVisit(G4ViewParameters& vp) {
// needs a kernel visit. (In this respect, it differs from the
// OpenGL drivers, where it's done in SetView.)
(vp.GetScaleFactor () != fVP.GetScaleFactor ()) ||
// If G4OpenInventor ever introduces VAMs, the following might need
// changing to a complete comparison, i.e., remove ".size()". See
// G4OpenGLStoredViewer::CompareForKernelVisit.
(vp.GetVisAttributesModifiers().size() !=
fVP.GetVisAttributesModifiers().size())
)
@@ -83,6 +83,7 @@
#include "saveViewPt.h"
#include "pickext.h"
#include "pickref.h"
#include "wireframe.h"
//#include "console.h"
//#include "favorites.h"
@@ -689,6 +690,7 @@ void G4OpenInventorXtExaminerViewer::createViewerButtons(Widget parent,
int n;
Arg args[6];
Widget saveViewPtButton, abbrOutputButton, pickRefPathButton;
Widget switchWireFrameButton;
// Create original buttons
SoXtExaminerViewer::createViewerButtons(parent, buttonlist);
@@ -779,16 +781,23 @@ void G4OpenInventorXtExaminerViewer::createViewerButtons(Widget parent,
XtVaSetValues(pickRefPathButton, XmNlabelType, XmPIXMAP, XmNlabelPixmap,
pickrefxpm, XmNselectPixmap, pickrefxpm, XmNlabelInsensitivePixmap,
pickrefxpm_ins, XmNselectInsensitivePixmap, pickrefxpm_ins, NULL);
// Pixmap favoritesxpm, favoritesxpm_ins;
// favoritesxpm = SoXtInternal::createPixmapFromXpm(pickRefPathButton,
// favorites_xpm);
// favoritesxpm_ins = SoXtInternal::createPixmapFromXpm(pickRefPathButton,
// favorites_xpm, TRUE);
// XtVaSetValues(pickRefPathButton, XmNlabelType, XmPIXMAP, XmNlabelPixmap,
// favoritesxpm, XmNselectPixmap, favoritesxpm, XmNlabelInsensitivePixmap,
// favoritesxpm_ins, XmNselectInsensitivePixmap, favoritesxpm_ins, NULL);
buttonlist->append(pickRefPathButton);
// Toggle button for switching in and out of wireframe mode
switchWireFrameButton = XtVaCreateManagedWidget("Wireframe",
xmToggleButtonWidgetClass, parent, XmNindicatorOn, False, NULL);
XtAddCallback(switchWireFrameButton, XmNvalueChangedCallback,
G4OpenInventorXtExaminerViewer::switchWireFrameCB, this);
Pixmap wireframe, wireframe_ins;
wireframe = SoXtInternal::createPixmapFromXpm(switchWireFrameButton,
wireframe_xpm);
wireframe_ins = SoXtInternal::createPixmapFromXpm(switchWireFrameButton,
wireframe_xpm, TRUE);
XtVaSetValues(switchWireFrameButton, XmNlabelType, XmPIXMAP, XmNlabelPixmap,
wireframe, XmNselectPixmap, wireframe, XmNlabelInsensitivePixmap,
wireframe_ins, XmNselectInsensitivePixmap, wireframe_ins, NULL);
buttonlist->append(switchWireFrameButton);
}
@@ -3036,11 +3045,11 @@ void G4OpenInventorXtExaminerViewer::saveViewPtCB(Widget w,
XmString label = XmStringCreateLocalized((char *) "Name the viewpoint:");
XtSetArg(args[n], XmNselectionLabelString, label); n++;
XtSetArg(args[n], XmNautoUnmanage, False); n++; //prevent the dialog from closing
//automatically, in case the name
//is wrong
nameViewPtDialog = XmCreatePromptDialog(parent, (char *) "Save Viewpoint",
// Prevent the dialog from closing automatically, in case the name is wrong
XtSetArg(args[n], XmNautoUnmanage, False); n++;
// FWJ
XtSetArg(args[n], XmNtitle, "Save Bookmark"); n++;
nameViewPtDialog = XmCreatePromptDialog(parent, String("Save Bookmark"),
args, n);
XmStringFree(label);
@@ -3109,8 +3118,9 @@ void G4OpenInventorXtExaminerViewer::abbrOutputCB(Widget,
XtPointer client_data,
XtPointer)
{
G4OpenInventorXtExaminerViewer * This =
G4OpenInventorXtExaminerViewer * This =
(G4OpenInventorXtExaminerViewer *) client_data;
// G4cout << "DISARMCALLBACK abbrOutputFlag=" << This->abbrOutputFlag << G4endl;
This->abbrOutputFlag = !(This->abbrOutputFlag);
}
@@ -3130,6 +3140,24 @@ void G4OpenInventorXtExaminerViewer::pickRefPathCB(Widget,
}
void G4OpenInventorXtExaminerViewer::switchWireFrameCB(Widget w,
XtPointer client_data,
XtPointer)
{
G4OpenInventorXtExaminerViewer* This =
(G4OpenInventorXtExaminerViewer*)client_data;
// xmToggleButton theToggleButton = (xmToggleButton)w;
if (XmToggleButtonGetState(w)) {
This->setDrawStyle(SoXtViewer::STILL, SoXtViewer::VIEW_LINE);
This->setDrawStyle(SoXtViewer::INTERACTIVE, SoXtViewer::VIEW_LINE);
} else {
This->setDrawStyle(SoXtViewer::STILL, SoXtViewer::VIEW_AS_IS);
This->setDrawStyle(SoXtViewer::INTERACTIVE,
SoXtViewer::VIEW_SAME_AS_STILL);
}
}
// Examines new viewpoint name and if OK calls saveViewPt.
void G4OpenInventorXtExaminerViewer::getViewPtNameCB(Widget w,
@@ -324,12 +324,28 @@ void G4OpenInventorXtExtendedViewer::EscapeFromKeyboardCbk(void* o) {
void G4OpenInventorXtExtendedViewer::PostScriptCbk(
Widget,XtPointer aData,XtPointer) {
G4OpenInventorXtExtendedViewer* This = (G4OpenInventorXtExtendedViewer*)aData;
// FWJ Workaround: avoids empty 2nd page in file
SbBool superimpState =
This->fViewer->getSuperimpositionEnabled(This->fViewer->superimposition);
This->fViewer->setSuperimpositionEnabled(This->fViewer->superimposition,
FALSE);
This->WritePostScript();
if (superimpState)
This->fViewer->setSuperimpositionEnabled(This->fViewer->superimposition,
TRUE);
}
void G4OpenInventorXtExtendedViewer::PDFCbk(
Widget,XtPointer aData,XtPointer) {
G4OpenInventorXtExtendedViewer* This = (G4OpenInventorXtExtendedViewer*)aData;
// FWJ Workaround: avoids empty 2nd page in file
SbBool superimpState =
This->fViewer->getSuperimpositionEnabled(This->fViewer->superimposition);
This->fViewer->setSuperimpositionEnabled(This->fViewer->superimposition,
FALSE);
This->WritePDF();
if (superimpState)
This->fViewer->setSuperimpositionEnabled(This->fViewer->superimposition,
TRUE);
}
void G4OpenInventorXtExtendedViewer::PixmapPostScriptCbk(
+5 -1
View File
@@ -1,4 +1,4 @@
$Id: History 99076 2016-09-01 12:40:47Z gcosmo $
$Id: History 102778 2017-02-22 10:50:10Z gcosmo $
-------------------------------------------------------------------
=========================================================
@@ -24,6 +24,10 @@ committal in the CVS repository !
History file for Ray Tracer category
---------------------------------------
22nd February 2017 John Allison (raytracer-V10-02-02)
- G4RTXScanner.cc: Changed XA_RGB_BEST_MAP to XA_RGB_DEFAULT_MAP.
(It seems XA_RGB_BEST_MAP no longer available on Mac XQuartz 2.7.11.)
31st August 2016 John Allison (raytracer-V10-02-01)
- Fix G4Orb and G4Ellipsoid hiding warnings.
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4RTXScanner.cc 66373 2012-12-18 09:41:34Z gcosmo $
// $Id: G4RTXScanner.cc 102778 2017-02-22 10:50:10Z gcosmo $
//
//
@@ -177,16 +177,16 @@ G4bool G4RTXScanner::GetXWindow(const G4String& name, G4ViewParameters& vp)
int nMaps;
Status status = XGetRGBColormaps
(display, RootWindow(display, screen_num),
&scmap, &nMaps, XA_RGB_BEST_MAP);
&scmap, &nMaps, XA_RGB_DEFAULT_MAP);
if (!status) {
system("xstdcmap -best"); // ...and try again...
status = XGetRGBColormaps
(display, RootWindow(display, screen_num),
&scmap, &nMaps, XA_RGB_BEST_MAP);
&scmap, &nMaps, XA_RGB_DEFAULT_MAP);
if (!status) {
G4cerr <<
"G4RTXScanner::Initialize(): cannot get color map."
"\n Perhaps your system does not support RGB_BEST_MAP."
"\n Perhaps your system does not support XA_RGB_DEFAULT_MAP."
<< G4endl;
return false;
}
+4 -1
View File
@@ -1,4 +1,4 @@
$Id: History 101792 2016-11-28 16:47:50Z gcosmo $
$Id: History 102575 2017-02-09 09:07:12Z gcosmo $
-------------------------------------------------------------------
@@ -26,6 +26,9 @@ committal in the CVS repository !
History file for visualization management sub-category
------------------------------------------------------
12th December 2016 Brian Smith, Laurent Garnier (visman-V10-02-38)
- /vis/viewer/interpolate: Now works for WIN32.
27th November 2016 John Allison (visman-V10-02-37)
- G4VisManager.cc: Fix for OpenGLXm. An extra refresh should come
BEFORE ShowView. Should not affect other viewers.
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4VisCommandsViewer.hh 97316 2016-06-01 12:12:58Z gcosmo $
// $Id: G4VisCommandsViewer.hh 102575 2017-02-09 09:07:12Z gcosmo $
// /vis/viewer commands - John Allison 25th October 1998
@@ -194,7 +194,6 @@ private:
G4UIcmdWithAString* fpCommand;
};
#ifndef WIN32
class G4VisCommandViewerInterpolate: public G4VVisCommandViewer {
public:
G4VisCommandViewerInterpolate ();
@@ -206,7 +205,6 @@ private:
G4VisCommandViewerInterpolate& operator = (const G4VisCommandViewerInterpolate&);
G4UIcommand* fpCommand;
};
#endif
class G4VisCommandViewerList: public G4VVisCommandViewer {
public:
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4VisCommandsViewer.cc 99440 2016-09-22 08:34:04Z gcosmo $
// $Id: G4VisCommandsViewer.cc 102575 2017-02-09 09:07:12Z gcosmo $
// /vis/viewer commands - John Allison 25th October 1998
@@ -52,6 +52,10 @@
#include <fstream>
#include <sstream>
#include <iomanip>
#ifdef WIN32
#include <regex>
#include <filesystem>
#endif //WIN32
G4VVisCommandViewer::G4VVisCommandViewer () {}
@@ -958,10 +962,6 @@ void G4VisCommandViewerFlush::SetNewValue (G4UIcommand*, G4String newValue) {
////////////// /vis/viewer/interpolate ///////////////////////////////////////
#ifndef WIN32
// popen is not available in Windows. _popen is said to be available in
// Windows but this has not been tried.
G4VisCommandViewerInterpolate::G4VisCommandViewerInterpolate () {
G4bool omitable;
fpCommand = new G4UIcommand ("/vis/viewer/interpolate", this);
@@ -1037,11 +1037,40 @@ void G4VisCommandViewerInterpolate::SetNewValue (G4UIcommand*, G4String newValue
>> waitTimePerPointString
>> timeUnit
>> exportString;
G4String waitTimePerPointDimString(waitTimePerPointString + ' ' + timeUnit);
const G4double waitTimePerPoint =
G4UIcommand::ConvertToDimensionedDouble((waitTimePerPointString + ' ' + timeUnit).c_str());
G4UIcommand::ConvertToDimensionedDouble(waitTimePerPointDimString.c_str());
G4int waitTimePerPointmilliseconds = waitTimePerPoint/millisecond;
if (waitTimePerPointmilliseconds < 0) waitTimePerPointmilliseconds = 0;
G4UImanager* uiManager = G4UImanager::GetUIpointer();
// Save current view parameters
G4ViewParameters saveVP = currentViewer->GetViewParameters();
// Save current verbosities
G4VisManager::Verbosity keepVisVerbosity = fpVisManager->GetVerbosity();
G4int keepUIVerbosity = uiManager->GetVerboseLevel();
// Set verbosities for this operation
fpVisManager->SetVerboseLevel(G4VisManager::errors);
uiManager->SetVerboseLevel(0);
// Switch off auto-refresh while we read in the view files (it will be
// restored later). Note: the view files do not set auto-refresh.
G4ViewParameters non_auto = saveVP;
non_auto.SetAutoRefresh(false);
currentViewer->SetViewParameters(non_auto);
// View vector of way points
std::vector<G4ViewParameters> viewVector;
const G4int safety = 9999;
G4int safetyCount = 0;
G4String pathname;
#ifndef WIN32
// Execute pattern and get resulting list of filles
G4String shellCommand = "echo " + pattern;
FILE *filelist = popen(shellCommand.c_str(), "r");
@@ -1055,38 +1084,74 @@ void G4VisCommandViewerInterpolate::SetNewValue (G4UIcommand*, G4String newValue
return;
}
// Save current view parameters
G4ViewParameters saveVP = currentViewer->GetViewParameters();
// Save current verbosities
G4VisManager::Verbosity keepVisVerbosity = fpVisManager->GetVerbosity();
G4UImanager* ui = G4UImanager::GetUIpointer();
G4int keepUIVerbosity = ui->GetVerboseLevel();
// Set verbosities for this operation
fpVisManager->SetVerboseLevel(G4VisManager::errors);
ui->SetVerboseLevel(0);
// Switch off auto-refresh while we read in the view files (it will be
// restored later). Note: the view files do not set auto-refresh.
G4ViewParameters non_auto = saveVP;
non_auto.SetAutoRefresh(false);
currentViewer->SetViewParameters(non_auto);
// Build view vector of way points
std::vector<G4ViewParameters> viewVector;
const size_t BUFLENGTH = 999999;
char buf[BUFLENGTH];
fgets(buf, BUFLENGTH, filelist);
std::istringstream fileliststream(buf);
const G4int safety = 9999;
G4int safetyCount = 0;
G4String pathname;
while (fileliststream >> pathname
&& safetyCount++ < safety) { // Loop checking, 16.02.2016, J.Allison
ui->ApplyCommand("/control/execute " + pathname);
uiManager->ApplyCommand("/control/execute " + pathname);
viewVector.push_back(currentViewer->GetViewParameters());
}
pclose(filelist);
#else // WIN32 (popen is not available in Windows)
std::experimental::filesystem::v1::path filePattern(pattern);
// Default pattern : *.g4view
// Translated to a regexp : ^.*\\.g4view
// Convert pattern into a regexp
std::string regexp_pattern("^" + filePattern.filename().string());
std::string result_pattern = "";
// Replace '.' by "\\."
size_t currentPos = 0;
size_t nextPos = 0;
std::string currentReplacement = "";
size_t pos1 = regexp_pattern.find('.', nextPos);
size_t pos2 = regexp_pattern.find('*', nextPos);
size_t pos3 = regexp_pattern.find('?', nextPos);
while ((pos1 != std::string::npos) || (pos2 != std::string::npos) || (pos3 != std::string::npos)) {
nextPos = pos1;
currentReplacement = "\\.";
if (pos2 < nextPos) {
nextPos = pos2;
currentReplacement = ".*";
}
if (pos3 < nextPos) {
nextPos = pos3;
currentReplacement = "(.{1,1})";
}
result_pattern += regexp_pattern.substr(currentPos, nextPos - currentPos) + currentReplacement;
nextPos++;
currentPos = nextPos;
pos1 = regexp_pattern.find('.', currentPos);
pos2 = regexp_pattern.find('*', currentPos);
pos3 = regexp_pattern.find('?', currentPos);
}
result_pattern += regexp_pattern.substr(currentPos);
// Build view vector of way points
// Add "./" for empty paths
G4String parentPath(filePattern.parent_path().string().length() ? filePattern.parent_path().string() : std::string("./"));
// Iterate through files in directory and apply regex match to filter appropriate files
std::regex result_pattern_regex (result_pattern, std::regex_constants::basic | std::regex_constants::icase);
for (auto iter = std::experimental::filesystem::v1::directory_iterator(parentPath);
iter != std::experimental::filesystem::v1::directory_iterator() && safetyCount++ < safety;
++iter)
{
const auto& file = iter->path();
G4String filename(file.filename().string());
if (std::regex_match(filename, result_pattern_regex))
{
uiManager->ApplyCommand("/control/execute " + filename);
viewVector.push_back(currentViewer->GetViewParameters());
}
}
#endif // WIN32
if (safetyCount >= safety) {
if (verbosity >= G4VisManager::errors) {
@@ -1095,10 +1160,9 @@ void G4VisCommandViewerInterpolate::SetNewValue (G4UIcommand*, G4String newValue
"\n the number of way points exceeds the maximum currently allowed: "
<< safety << G4endl;
}
pclose(filelist);
return;
}
// Interpolate views
safetyCount = 0;
do {
@@ -1111,7 +1175,7 @@ void G4VisCommandViewerInterpolate::SetNewValue (G4UIcommand*, G4String newValue
currentViewer->RefreshView();
if (exportString == "export" &&
currentViewer->GetName().contains("OpenGL"))
ui->ApplyCommand("/vis/ogl/export");
uiManager->ApplyCommand("/vis/ogl/export");
#ifdef G4VIS_USE_STD11
if (waitTimePerPointmilliseconds > 0)
std::this_thread::sleep_for(std::chrono::milliseconds(waitTimePerPointmilliseconds));
@@ -1119,7 +1183,7 @@ void G4VisCommandViewerInterpolate::SetNewValue (G4UIcommand*, G4String newValue
} while (safetyCount++ < safety); // Loop checking, 16.02.2016, J.Allison
// Restore original verbosities
ui->SetVerboseLevel(keepUIVerbosity);
uiManager->SetVerboseLevel(keepUIVerbosity);
fpVisManager->SetVerboseLevel(keepVisVerbosity);
// Restore original view parameters
@@ -1129,12 +1193,8 @@ void G4VisCommandViewerInterpolate::SetNewValue (G4UIcommand*, G4String newValue
G4cout << "Viewer \"" << currentViewer -> GetName () << "\""
<< " restored." << G4endl;
}
pclose(filelist);
}
#endif // WIN32 - popen is not available in Windows. _popen is there but not tried.
////////////// /vis/viewer/list ///////////////////////////////////////
G4VisCommandViewerList::G4VisCommandViewerList () {
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VisManager.cc 101792 2016-11-28 16:47:50Z gcosmo $
// $Id: G4VisManager.cc 102575 2017-02-09 09:07:12Z gcosmo $
//
//
// GEANT4 Visualization Manager - John Allison 02/Jan/1996.
@@ -490,9 +490,7 @@ void G4VisManager::RegisterMessengers () {
RegisterMessenger(new G4VisCommandViewerCreate);
RegisterMessenger(new G4VisCommandViewerDolly);
RegisterMessenger(new G4VisCommandViewerFlush);
#ifndef WIN32
RegisterMessenger(new G4VisCommandViewerInterpolate);
#endif
RegisterMessenger(new G4VisCommandViewerList);
RegisterMessenger(new G4VisCommandViewerPan);
RegisterMessenger(new G4VisCommandViewerRebuild);