Import Geant4 10.5.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2018-06-29 10:58:11 +02:00
parent fe81a77428
commit 6aa23be517
1581 changed files with 124288 additions and 83758 deletions
+4 -1
View File
@@ -1,4 +1,4 @@
$Id: History 104015 2017-05-08 07:28:08Z gcosmo $
$Id: History 110513 2018-05-28 07:37:38Z gcosmo $
-------------------------------------------------------------------
=========================================================
@@ -20,6 +20,9 @@ committal in the CVS repository !
History file for visualization/FukuiRenderer sub-category
---------------------------------------------------------
26th May 2018 John Allison (DAWN-V10-04-00)
- G4DAWNFILESceneHandler.cc: Fix gcc-8 warnings.
7th May 2017 John Allison (DAWN-V10-03-00)
- G4DAWNFILESceneHandler.cc:
o In g4_<N>.prim, expand to 4 digits, e.g., g4_0000.prim, g4_0001.prim,...
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4DAWNFILESceneHandler.cc 104015 2017-05-08 07:28:08Z gcosmo $
// $Id: G4DAWNFILESceneHandler.cc 110513 2018-05-28 07:37:38Z gcosmo $
//
// Satoshi TANAKA
// DAWNFILE scene.
@@ -174,7 +174,8 @@ void G4DAWNFILESceneHandler::SetG4PrimFileName()
std::ostringstream filename; filename
<< fG4PrimDestDir << G4PRIM_FILE_HEADER
<< std::setw(4) << std::setfill('0') << i << ".prim";
strncpy(fG4PrimFileName,filename.str().c_str(),sizeof(fG4PrimFileName));
strncpy(fG4PrimFileName,filename.str().c_str(),sizeof(fG4PrimFileName)-1);
fG4PrimFileName[sizeof(fG4PrimFileName)-1] = '\0';
// check validity of the file name
std::ifstream fin ;
+158 -4
View File
@@ -1,4 +1,4 @@
$Id: History 107329 2017-11-08 16:41:26Z gcosmo $
$Id: History 110653 2018-06-05 11:49:58Z gcosmo $
-------------------------------------------------------------------
=========================================================
@@ -24,6 +24,159 @@ committal in the CVS repository !
History file for visualization category
---------------------------------------
05 June 2018 John Allison (vis-V10-04-07)
- openinventor-V10-04-02: Fix compilation error.
- raytracer-V10-04-01: Update "thread-local-static-var" model.
- visexternals-V10-04-01: Corrected GNUmakefile.
26 May 2018 John Allison (vis-V10-04-06)
- visexternals-V10-04-00, visexternalgl2ps-V10-04-00,
VRML-V10-04-00, gMocren-V10-04-00, DAWN-V10-04-00:
o Fix gcc-8 warnings.
25 May 2018 John Allison
- visman-V10-04-11: Introduce /vis/drawLogicalVolume:
o Synonymous with /vis/specify.
o Both commands create a new scene and invoke /vis/scene/add/logicalVolume.
24 May 2018 John Allison (vis-V10-04-05)
- modeling-V10-04-05:
o G4LogicalVolumeModel: Add overlap checking,
o Fix gcc-8 warnings.
- visman-V10-04-10:
o /vis/specify, /vis/scene/add/logicalVolume: Include overlap checking.
- opengl-V10-04-06:
o Fix gcc-8 warnings.
08 May 2018 Ben Morgan
- visman-V10-04-09: Explicitly #include G4Types header.
26 April 2018 John Allison
- openinventor-V10-04-01: Fix compilation errors.
25 April 2018 John Allison (vis-V10-04-04)
- visXXX-V10-04-00, openinventor-V10-04-00, opengl-V10-04-05:
o Implement kernel visit for "colour by density".
- visman-V10-04-08:
o Complete development for /vis/viewer/colourByDensity:
. Copy colour-by-density parameters from view parameters to
modeling parameters.
. Colour volumes according to density if the user has not specified
vis attributes. Useful for drawing geometry from GDML.
24 April 2018 John Allison
- modeling-V10-04-04: Small bug fix.
- modeling-V10-04-03: Implement /vis/viewer/colourByDensity.
- visman-V10-04-07: Small bug fix.
- visman-V10-04-06, opengl-V10-04-04:
o Migrate to greps-V10-04-04.
23 April 2018 John Allison
- visman-V10-04-05:
o Migrate to greps-V10-04-03.
o Complete implementation of /vis/viewer/colourByDensity.
22 April 2018 John Allison
- visman-V10-04-04: Several small cosmetic improvements.
28th March 2018 John Allison (vis-V10-04-03)
- visman-V10-04-03: Improve some vis commands.
20th March 2018 Makoto Asai
- raytracer-V10-04-00:
o Use HyperStep of G4ParallelWorldProcess to draw volumes
defined in a parallel world.
11th March 2018 John Allison (vis-V10-04-02)
- modeling-V10-04-02: Fix bug calculating mass of parallel world.
- visman-V10-04-02: Improve comments.
- vistree-V10-04-00:
o Fix bug in suppressed writing of repeated parameterised volumes.
13 February 2018 Jonathan Madsen
- opengl-V10-04-03:
o Replaced explicit usage of G4Mutex locking/unlocking with
G4AutoLock pointers initialized with std::defer_lock as this
enables one to avoid any deadlock or non-locked condition_variable
waits by using G4AutoLock::owns_mutex()
12 February 2018 Jonathan Madsen
- opengl-V10-04-02:
o Updated G4CONDITIONWAIT(...) to new C++11 requirements
o Found probable bug in G4OpenGLQtViewer with condition wait -- not locked
prior to entering condition, which is an undefined behavior. Adapted
G4AutoLock to accept std::defer_lock_t (doesn't lock upon construction)
to prevent deadlock that occurs when the mutex is locked
31st January 2017 John Allison (vis-V10-04-01)
- Tidy History files.
8th January 2017 John Allison (vis-V10-04-00)
- Merged timemovebranch: visman-V10-04-01, opengl-V10-04-01:
o Moved time window parameters from G4OpenGLStoredViewer to
G4ViewParameters. Now one can interpolate time window parameters (using
/vis/viewer/interpolate) and make a movie of particles moving through time.
o To do this, see guidance on /vis/viewer/set/timeWindow/ commands. Briefly:
/vis/scene/add/trajectories rich
/vis/modeling/trajectories/drawByCharge-0/default/setTimeSliceInterval 0.01 ns
then typically
/vis/viewer/set/timeWindow/displayLightFront true 0 0 -50 cm -0.5 ns
/vis/viewer/set/timeWindow/displayHeadTime true
/vis/viewer/set/timeWindow/fadeFactor 1
/run/beamOn # or several until you get a good event or events
/vis/viewer/set/timeWindow/startTime 0 ns 1 ns
/vis/viewer/save
/vis/viewer/set/timeWindow/startTime 1 ns 1 ns
then zoom, pan etc to a view of interest and
/vis/viewer/save
then repeat with next start time, another view and a save, then try
/vis/viewer/interpolate
3rd January 2017 John Allison (timemovebranch-09)
- G4ViewParameters:: TimeWindowCommands: Fix for /vis/viewer/save.
2nd January 2017 John Allison (timemovebranch-08)
- Moved time window commands to /vis/viewer/set/timeWindow/.
- DEPRECATED the equivalent /vis/ogl/set/ commands.
2nd January 2017 John Allison (timemovebranch-07)
- Copied /vis/ogl/set time window commands to /vis/viewer/set.
1st January 2017 John Allison (timemovebranch-06)
- G4ViewParameters: Completed PrintDifferences, operator<< and operator!= for
time window parameters.
31st December 2017 John Allison (timemovebranch-05)
- G4ViewParameters: Provide proper Get and Set functions for time parameters.
31st December 2017 John Allison (timemovebranch-04)
- Implement G4OpenGLStoredViewer::AddPrimitiveForASingleFrame.
19th December 2017 Gabriele Cosmo
- modeling-V10-04-01:
o Fixed self-consistency in G4AttValueFilterT header (missing #include).
Thanks to Raphael Isemann for reporting this.
14th December 2017 John Allison (timemovebranch-03)
- Merged changes from trunk up to -r107990.
14th December 2017 John Allison (timemovebranch-02)
- Time move: Tested light front drawing. Some small changes required.
14th December 2017 John Allison (timemovebranch-01)
- Time move: First working version. Much tidying to do.
14th December 2017 John Allison
- opengl-V10-04-00: Fix display list memory being exceeded.
13th December 2017 John Allison (timemovebranch-00)
- Move start time etc. from G4OpenGLViewer to G4Viewparameters:
o First stage (data are public members of G4Viewparameters).
12th December 2017 John Allison
- visman-V10-04-00: Minor cosmetic.
- modeling-V10-04-00: Improve an informational message.
7th November 2017 John Allison (vis-V10-03-10)
- opengl-V10-03-04: Refine content of output of picking.
@@ -1031,7 +1184,7 @@ G4OpenGLWtViewer
9th November 2013 Joseph Perl (vis-V09-06-36)
- visman-V09-06-25 Command parameter updates
- DAWN-V09-06-05 Replaced deprecated calls to solids accessor methods
- VRML-V09-06-04 Replaced deprecated calls to solids accessor methods
- VRML-V09-06-04 Replaced deprecated calls to solids accessor methods
7th November 2013 Laurent Garnier
- opengl-V09-06-09:
@@ -2178,9 +2331,10 @@ Rolling openinventor back to: openinventor-V09-05-14
4th June 2010 Joseph Perl (vis-V09-03-07)
- vis-HepRep-V09-03-02
o Added command renderCylAsPolygon
o Added command renderCylAsPolygon
- opengl-V09-03-07
o G4OpenGLImmediate/StoredQtViewer : Add protection against multiple
o G4OpenGLImmediate/StoredQtViewer : Add protection against multiple
repaint call. Add protection against resizeGl with bad values
3rd June 2010 John Allison
- opengl-V09-03-06:
+35 -2
View File
@@ -1,4 +1,4 @@
$Id: History 108544 2018-02-16 09:47:30Z gcosmo $
$Id: History 110480 2018-05-25 07:25:18Z gcosmo $
-------------------------------------------------------------------
=========================================================
@@ -17,7 +17,40 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
14th December 2017 John Allison (opengl-V10-03-05)
24 May 2015 John Allison (opengl-V10-04-06)
- G4OpenGLStoredQtSceneHandler.cc, G4OpenGLQtViewer.cc:
o Fix gcc-8 warnings.
- G4OpenGLStoredSceneHandler.cc: Cosmetic.
25 April 2015 John Allison (opengl-V10-04-05)
- G4OpenGLStoredViewer::CompareForKernelVisit,
G4OpenGLStoredQtViewer::CompareForKernelVisit:
o Implement comparison for "colour by density".
24 April 2017 John Allison (opengl-V10-04-04)
- Migrate to greps-V10-04-04.
13 February 2018 Jonathan Madsen (opengl-V10-04-03)
- Replaced explicit usage of G4Mutex locking/unlocking with
G4AutoLock pointers initialized with std::defer_lock as this
enables one to avoid any deadlock or non-locked condition_variable
waits by using G4AutoLock::owns_mutex()
12 February 2018 Jonathan Madsen (opengl-V10-04-02)
- Updated G4CONDITIONWAIT(...) to new C++11 requirements
- Found probable bug in G4OpenGLQtViewer with condition wait -- not locked
prior to entering condition, which is an undefined behavior. Adapted
G4AutoLock to accept std::defer_lock_t (doesn't lock upon construction)
to prevent deadlock that occurs when the mutex is locked
8th January 2017 John Allison (opengl-V10-04-01)
- Merged timemovebranch:
o Moved time window parameters from G4OpenGLStoredViewer to
G4ViewParameters. Now one can interpolate time window parameters (using
/vis/viewer/interpolate) and make a movie of particles moving through time.
o See vis-V10-04-00 History for more details.
14th December 2017 John Allison (opengl-V10-04-00)
- G4OpenGLStoredSceneHandler::AddPrimitivePreambleInternal:
o Remove glDrawBuffer(GL_FRONT), which seems to cause problems
for the case of display list memory being exceeded.
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4OpenGLQtViewer.hh 101105 2016-11-07 08:09:26Z gcosmo $
// $Id: G4OpenGLQtViewer.hh 108601 2018-02-26 10:03:17Z gcosmo $
//
//
// G4OpenGLQtViewer : Class to provide WindowsNT specific
@@ -41,6 +41,7 @@
#include "G4OpenGLViewer.hh"
#include "G4PhysicalVolumeModel.hh"
#include "G4AutoLock.hh"
#include <qobject.h>
#include <qpoint.h>
@@ -381,7 +382,11 @@ private:
QThread* fQGLContextVisSubThread;
QThread* fQGLContextMainThread;
#endif
// safe to use in serial mode
G4AutoLock* lWaitForVisSubThreadQtOpenGLContextInitialized;
G4AutoLock* lWaitForVisSubThreadQtOpenGLContextMoved;
public Q_SLOTS :
void startPauseVideo();
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4OpenGLStoredViewer.hh 91268 2015-06-29 07:04:24Z gcosmo $
// $Id: G4OpenGLStoredViewer.hh 108131 2018-01-09 13:23:26Z gcosmo $
//
//
// Andrew Walkden 7th February 1997
@@ -41,6 +41,8 @@
class G4OpenGLStoredSceneHandler;
class G4Colour;
class G4Text;
class G4Circle;
class G4OpenGLStoredViewer: virtual public G4OpenGLViewer {
@@ -51,10 +53,17 @@ public:
protected:
void KernelVisitDecision ();
virtual G4bool CompareForKernelVisit(G4ViewParameters&);
void DrawDisplayLists ();
virtual void DisplayTimePOColourModification
(G4Colour&, size_t /*currentPOListIndex*/) {}
void AddPrimitiveForASingleFrame(const G4Text& text);
void AddPrimitiveForASingleFrame(const G4Circle& circle);
G4OpenGLStoredSceneHandler& fG4OpenGLStoredSceneHandler;
G4ViewParameters fLastVP; // Memory for making kernel visit decisions.
// Two virtual functions to return sub-class selection.
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4OpenGLViewer.hh 103926 2017-05-03 13:43:27Z gcosmo $
// $Id: G4OpenGLViewer.hh 108131 2018-01-09 13:23:26Z gcosmo $
//
//
// Andrew Walkden 27th March 1996
@@ -209,16 +209,6 @@ protected:
transparency_enabled, //is alpha blending enabled?
antialiasing_enabled, //is antialiasing enabled?
haloing_enabled; //is haloing enabled for wireframe?
G4double fStartTime, fEndTime; // Time range (e.g., for trajectory steps).
G4double fFadeFactor; // 0: no fade; 1: maximum fade with time within range.
G4bool fDisplayHeadTime; // Display head time (fEndTime) in 2D text.
G4double fDisplayHeadTimeX, fDisplayHeadTimeY; // 2D screen coords.
G4double fDisplayHeadTimeSize; // Screen size.
G4double fDisplayHeadTimeRed, fDisplayHeadTimeGreen, fDisplayHeadTimeBlue;
G4bool fDisplayLightFront;// Display light front at head time originating at
G4double fDisplayLightFrontX, fDisplayLightFrontY, fDisplayLightFrontZ,
fDisplayLightFrontT;
G4double fDisplayLightFrontRed, fDisplayLightFrontGreen, fDisplayLightFrontBlue;
G4OpenGL2PSAction* fGL2PSAction;
G4double fRot_sens; // Rotation sensibility in degrees
@@ -0,0 +1,101 @@
/****************************************************************************
** Meta object code from reading C++ file 'G4OpenGLQtExportDialog.hh'
**
** Created: Tue Jun 5 13:55:33 2018
** by: The Qt Meta Object Compiler version 63 (Qt 4.8.4)
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/
#include "../include/G4OpenGLQtExportDialog.hh"
#if !defined(Q_MOC_OUTPUT_REVISION)
#error "The header file 'G4OpenGLQtExportDialog.hh' doesn't include <QObject>."
#elif Q_MOC_OUTPUT_REVISION != 63
#error "This file was generated using the moc from 4.8.4. It"
#error "cannot be used with the include files from this version of Qt."
#error "(The moc has changed too much.)"
#endif
QT_BEGIN_MOC_NAMESPACE
static const uint qt_meta_data_G4OpenGLQtExportDialog[] = {
// content:
6, // revision
0, // classname
0, 0, // classinfo
4, 14, // methods
0, 0, // properties
0, 0, // enums/sets
0, 0, // constructors
0, // flags
0, // signalCount
// slots: signature, parameters, type, tag, flags
24, 23, 23, 23, 0x0a,
40, 23, 23, 23, 0x0a,
58, 23, 23, 23, 0x0a,
84, 23, 23, 23, 0x0a,
0 // eod
};
static const char qt_meta_stringdata_G4OpenGLQtExportDialog[] = {
"G4OpenGLQtExportDialog\0\0changeSizeBox()\0"
"changeVectorEPS()\0textWidthChanged(QString)\0"
"textHeightChanged(QString)\0"
};
void G4OpenGLQtExportDialog::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
if (_c == QMetaObject::InvokeMetaMethod) {
Q_ASSERT(staticMetaObject.cast(_o));
G4OpenGLQtExportDialog *_t = static_cast<G4OpenGLQtExportDialog *>(_o);
switch (_id) {
case 0: _t->changeSizeBox(); break;
case 1: _t->changeVectorEPS(); break;
case 2: _t->textWidthChanged((*reinterpret_cast< const QString(*)>(_a[1]))); break;
case 3: _t->textHeightChanged((*reinterpret_cast< const QString(*)>(_a[1]))); break;
default: ;
}
}
}
const QMetaObjectExtraData G4OpenGLQtExportDialog::staticMetaObjectExtraData = {
0, qt_static_metacall
};
const QMetaObject G4OpenGLQtExportDialog::staticMetaObject = {
{ &QDialog::staticMetaObject, qt_meta_stringdata_G4OpenGLQtExportDialog,
qt_meta_data_G4OpenGLQtExportDialog, &staticMetaObjectExtraData }
};
#ifdef Q_NO_DATA_RELOCATION
const QMetaObject &G4OpenGLQtExportDialog::getStaticMetaObject() { return staticMetaObject; }
#endif //Q_NO_DATA_RELOCATION
const QMetaObject *G4OpenGLQtExportDialog::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->metaObject : &staticMetaObject;
}
void *G4OpenGLQtExportDialog::qt_metacast(const char *_clname)
{
if (!_clname) return 0;
if (!strcmp(_clname, qt_meta_stringdata_G4OpenGLQtExportDialog))
return static_cast<void*>(const_cast< G4OpenGLQtExportDialog*>(this));
return QDialog::qt_metacast(_clname);
}
int G4OpenGLQtExportDialog::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QDialog::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
if (_c == QMetaObject::InvokeMetaMethod) {
if (_id < 4)
qt_static_metacall(this, _c, _id, _a);
_id -= 4;
}
return _id;
}
QT_END_MOC_NAMESPACE
@@ -0,0 +1,121 @@
/****************************************************************************
** Meta object code from reading C++ file 'G4OpenGLQtMovieDialog.hh'
**
** Created: Tue Jun 5 13:55:33 2018
** by: The Qt Meta Object Compiler version 63 (Qt 4.8.4)
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/
#include "../include/G4OpenGLQtMovieDialog.hh"
#if !defined(Q_MOC_OUTPUT_REVISION)
#error "The header file 'G4OpenGLQtMovieDialog.hh' doesn't include <QObject>."
#elif Q_MOC_OUTPUT_REVISION != 63
#error "This file was generated using the moc from 4.8.4. It"
#error "cannot be used with the include files from this version of Qt."
#error "(The moc has changed too much.)"
#endif
QT_BEGIN_MOC_NAMESPACE
static const uint qt_meta_data_G4OpenGLQtMovieDialog[] = {
// content:
6, // revision
0, // classname
0, 0, // classinfo
10, 14, // methods
0, 0, // properties
0, 0, // enums/sets
0, 0, // constructors
0, // flags
0, // signalCount
// slots: signature, parameters, type, tag, flags
23, 22, 22, 22, 0x0a,
41, 22, 22, 22, 0x0a,
53, 22, 48, 22, 0x0a,
80, 22, 48, 22, 0x0a,
110, 22, 48, 22, 0x0a,
138, 22, 22, 22, 0x08,
164, 22, 22, 22, 0x08,
187, 22, 22, 22, 0x08,
214, 22, 22, 22, 0x08,
231, 22, 22, 22, 0x08,
0 // eod
};
static const char qt_meta_stringdata_G4OpenGLQtMovieDialog[] = {
"G4OpenGLQtMovieDialog\0\0stopFinishClose()\0"
"save()\0bool\0checkEncoderSwParameters()\0"
"checkSaveFileNameParameters()\0"
"checkTempFolderParameters()\0"
"selectEncoderPathAction()\0"
"selectTempPathAction()\0"
"selectSaveFileNameAction()\0resetRecording()\0"
"enabledApplyButton()\0"
};
void G4OpenGLQtMovieDialog::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
if (_c == QMetaObject::InvokeMetaMethod) {
Q_ASSERT(staticMetaObject.cast(_o));
G4OpenGLQtMovieDialog *_t = static_cast<G4OpenGLQtMovieDialog *>(_o);
switch (_id) {
case 0: _t->stopFinishClose(); break;
case 1: _t->save(); break;
case 2: { bool _r = _t->checkEncoderSwParameters();
if (_a[0]) *reinterpret_cast< bool*>(_a[0]) = _r; } break;
case 3: { bool _r = _t->checkSaveFileNameParameters();
if (_a[0]) *reinterpret_cast< bool*>(_a[0]) = _r; } break;
case 4: { bool _r = _t->checkTempFolderParameters();
if (_a[0]) *reinterpret_cast< bool*>(_a[0]) = _r; } break;
case 5: _t->selectEncoderPathAction(); break;
case 6: _t->selectTempPathAction(); break;
case 7: _t->selectSaveFileNameAction(); break;
case 8: _t->resetRecording(); break;
case 9: _t->enabledApplyButton(); break;
default: ;
}
}
}
const QMetaObjectExtraData G4OpenGLQtMovieDialog::staticMetaObjectExtraData = {
0, qt_static_metacall
};
const QMetaObject G4OpenGLQtMovieDialog::staticMetaObject = {
{ &QDialog::staticMetaObject, qt_meta_stringdata_G4OpenGLQtMovieDialog,
qt_meta_data_G4OpenGLQtMovieDialog, &staticMetaObjectExtraData }
};
#ifdef Q_NO_DATA_RELOCATION
const QMetaObject &G4OpenGLQtMovieDialog::getStaticMetaObject() { return staticMetaObject; }
#endif //Q_NO_DATA_RELOCATION
const QMetaObject *G4OpenGLQtMovieDialog::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->metaObject : &staticMetaObject;
}
void *G4OpenGLQtMovieDialog::qt_metacast(const char *_clname)
{
if (!_clname) return 0;
if (!strcmp(_clname, qt_meta_stringdata_G4OpenGLQtMovieDialog))
return static_cast<void*>(const_cast< G4OpenGLQtMovieDialog*>(this));
return QDialog::qt_metacast(_clname);
}
int G4OpenGLQtMovieDialog::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QDialog::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
if (_c == QMetaObject::InvokeMetaMethod) {
if (_id < 10)
qt_static_metacall(this, _c, _id, _a);
_id -= 10;
}
return _id;
}
QT_END_MOC_NAMESPACE
@@ -0,0 +1,170 @@
/****************************************************************************
** Meta object code from reading C++ file 'G4OpenGLQtViewer.hh'
**
** Created: Tue Jun 5 13:55:33 2018
** by: The Qt Meta Object Compiler version 63 (Qt 4.8.4)
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/
#include "../include/G4OpenGLQtViewer.hh"
#if !defined(Q_MOC_OUTPUT_REVISION)
#error "The header file 'G4OpenGLQtViewer.hh' doesn't include <QObject>."
#elif Q_MOC_OUTPUT_REVISION != 63
#error "This file was generated using the moc from 4.8.4. It"
#error "cannot be used with the include files from this version of Qt."
#error "(The moc has changed too much.)"
#endif
QT_BEGIN_MOC_NAMESPACE
static const uint qt_meta_data_G4OpenGLQtViewer[] = {
// content:
6, // revision
0, // classname
0, 0, // classinfo
29, 14, // methods
0, 0, // properties
0, 0, // enums/sets
0, 0, // constructors
0, // flags
0, // signalCount
// slots: signature, parameters, type, tag, flags
18, 17, 17, 17, 0x0a,
36, 17, 17, 17, 0x09,
71, 17, 17, 17, 0x08,
89, 17, 17, 17, 0x08,
119, 17, 17, 17, 0x08,
143, 17, 17, 17, 0x08,
170, 17, 17, 17, 0x08,
194, 17, 17, 17, 0x08,
210, 17, 17, 17, 0x08,
233, 17, 17, 17, 0x08,
258, 17, 17, 17, 0x08,
281, 17, 17, 17, 0x08,
306, 17, 17, 17, 0x08,
331, 17, 17, 17, 0x08,
351, 17, 17, 17, 0x08,
367, 17, 17, 17, 0x08,
393, 17, 17, 17, 0x08,
416, 17, 17, 17, 0x08,
440, 17, 17, 17, 0x08,
465, 17, 17, 17, 0x08,
495, 487, 17, 17, 0x08,
547, 17, 17, 17, 0x08,
588, 17, 17, 17, 0x08,
604, 17, 17, 17, 0x08,
629, 17, 17, 17, 0x08,
658, 17, 17, 17, 0x08,
686, 17, 17, 17, 0x08,
719, 710, 17, 17, 0x08,
768, 17, 17, 17, 0x08,
0 // eod
};
static const char qt_meta_stringdata_G4OpenGLQtViewer[] = {
"G4OpenGLQtViewer\0\0startPauseVideo()\0"
"updateToolbarAndMouseContextMenu()\0"
"actionSaveImage()\0actionChangeBackgroundColor()\0"
"actionChangeTextColor()\0"
"actionChangeDefaultColor()\0"
"actionMovieParameters()\0showShortcuts()\0"
"toggleMouseAction(int)\0toggleSurfaceAction(int)\0"
"toggleProjection(bool)\0toggleTransparency(bool)\0"
"toggleAntialiasing(bool)\0toggleHaloing(bool)\0"
"toggleAux(bool)\0toggleHiddenMarkers(bool)\0"
"toggleFullScreen(bool)\0processEncodeFinished()\0"
"processLookForFinished()\0processEncodeStdout()\0"
"item,id\0sceneTreeComponentItemChanged(QTreeWidgetItem*,int)\0"
"toggleSceneTreeComponentPickingCout(int)\0"
"togglePicking()\0currentTabActivated(int)\0"
"sceneTreeComponentSelected()\0"
"changeDepthInSceneTree(int)\0"
"changeSearchSelection()\0item,val\0"
"changeColorAndTransparency(QTreeWidgetItem*,int)\0"
"tableWidgetViewerSetItemChanged(QTableWidgetItem*)\0"
};
void G4OpenGLQtViewer::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
if (_c == QMetaObject::InvokeMetaMethod) {
Q_ASSERT(staticMetaObject.cast(_o));
G4OpenGLQtViewer *_t = static_cast<G4OpenGLQtViewer *>(_o);
switch (_id) {
case 0: _t->startPauseVideo(); break;
case 1: _t->updateToolbarAndMouseContextMenu(); break;
case 2: _t->actionSaveImage(); break;
case 3: _t->actionChangeBackgroundColor(); break;
case 4: _t->actionChangeTextColor(); break;
case 5: _t->actionChangeDefaultColor(); break;
case 6: _t->actionMovieParameters(); break;
case 7: _t->showShortcuts(); break;
case 8: _t->toggleMouseAction((*reinterpret_cast< int(*)>(_a[1]))); break;
case 9: _t->toggleSurfaceAction((*reinterpret_cast< int(*)>(_a[1]))); break;
case 10: _t->toggleProjection((*reinterpret_cast< bool(*)>(_a[1]))); break;
case 11: _t->toggleTransparency((*reinterpret_cast< bool(*)>(_a[1]))); break;
case 12: _t->toggleAntialiasing((*reinterpret_cast< bool(*)>(_a[1]))); break;
case 13: _t->toggleHaloing((*reinterpret_cast< bool(*)>(_a[1]))); break;
case 14: _t->toggleAux((*reinterpret_cast< bool(*)>(_a[1]))); break;
case 15: _t->toggleHiddenMarkers((*reinterpret_cast< bool(*)>(_a[1]))); break;
case 16: _t->toggleFullScreen((*reinterpret_cast< bool(*)>(_a[1]))); break;
case 17: _t->processEncodeFinished(); break;
case 18: _t->processLookForFinished(); break;
case 19: _t->processEncodeStdout(); break;
case 20: _t->sceneTreeComponentItemChanged((*reinterpret_cast< QTreeWidgetItem*(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break;
case 21: _t->toggleSceneTreeComponentPickingCout((*reinterpret_cast< int(*)>(_a[1]))); break;
case 22: _t->togglePicking(); break;
case 23: _t->currentTabActivated((*reinterpret_cast< int(*)>(_a[1]))); break;
case 24: _t->sceneTreeComponentSelected(); break;
case 25: _t->changeDepthInSceneTree((*reinterpret_cast< int(*)>(_a[1]))); break;
case 26: _t->changeSearchSelection(); break;
case 27: _t->changeColorAndTransparency((*reinterpret_cast< QTreeWidgetItem*(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break;
case 28: _t->tableWidgetViewerSetItemChanged((*reinterpret_cast< QTableWidgetItem*(*)>(_a[1]))); break;
default: ;
}
}
}
const QMetaObjectExtraData G4OpenGLQtViewer::staticMetaObjectExtraData = {
0, qt_static_metacall
};
const QMetaObject G4OpenGLQtViewer::staticMetaObject = {
{ &QObject::staticMetaObject, qt_meta_stringdata_G4OpenGLQtViewer,
qt_meta_data_G4OpenGLQtViewer, &staticMetaObjectExtraData }
};
#ifdef Q_NO_DATA_RELOCATION
const QMetaObject &G4OpenGLQtViewer::getStaticMetaObject() { return staticMetaObject; }
#endif //Q_NO_DATA_RELOCATION
const QMetaObject *G4OpenGLQtViewer::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->metaObject : &staticMetaObject;
}
void *G4OpenGLQtViewer::qt_metacast(const char *_clname)
{
if (!_clname) return 0;
if (!strcmp(_clname, qt_meta_stringdata_G4OpenGLQtViewer))
return static_cast<void*>(const_cast< G4OpenGLQtViewer*>(this));
if (!strcmp(_clname, "G4OpenGLViewer"))
return static_cast< G4OpenGLViewer*>(const_cast< G4OpenGLQtViewer*>(this));
return QObject::qt_metacast(_clname);
}
int G4OpenGLQtViewer::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QObject::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
if (_c == QMetaObject::InvokeMetaMethod) {
if (_id < 29)
qt_static_metacall(this, _c, _id, _a);
_id -= 29;
}
return _id;
}
QT_END_MOC_NAMESPACE
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4OpenGLQtViewer.cc 107329 2017-11-08 16:41:26Z gcosmo $
// $Id: G4OpenGLQtViewer.cc 110480 2018-05-25 07:25:18Z gcosmo $
//
//
// G4OpenGLQtViewer : Class to provide Qt specific
@@ -57,6 +57,7 @@
#include <CLHEP/Units/SystemOfUnits.h>
#include <typeinfo>
#include <mutex>
#include <qlayout.h>
#include <qlabel.h>
@@ -94,19 +95,18 @@
#include <qcursor.h>
#include <qthread.h>
#ifdef G4MULTITHREADED
#include "G4Threading.hh"
#endif
#ifdef G4MULTITHREADED
namespace
{
G4Mutex mWaitForVisSubThreadQtOpenGLContextMoved = G4MUTEX_INITIALIZER;
G4Mutex mWaitForVisSubThreadQtOpenGLContextInitialized = G4MUTEX_INITIALIZER;
// avoid unused variable warning
#ifdef G4MULTITHREADED
G4Condition c1_VisSubThreadQtOpenGLContextInitialized = G4CONDITION_INITIALIZER;
G4Condition c2_VisSubThreadQtOpenGLContextMoved = G4CONDITION_INITIALIZER;
}
#endif
}
//////////////////////////////////////////////////////////////////////////////
void G4OpenGLQtViewer::CreateMainWindow (
@@ -270,6 +270,12 @@ G4OpenGLQtViewer::G4OpenGLQtViewer (
,fLastHighlightName(0)
,fIsDeleting(false)
{
lWaitForVisSubThreadQtOpenGLContextInitialized
= new G4AutoLock(mWaitForVisSubThreadQtOpenGLContextInitialized,
std::defer_lock);
lWaitForVisSubThreadQtOpenGLContextMoved
= new G4AutoLock(mWaitForVisSubThreadQtOpenGLContextMoved,
std::defer_lock);
// launch Qt if not
if (QCoreApplication::instance () == NULL) {
@@ -511,6 +517,10 @@ G4OpenGLQtViewer::~G4OpenGLQtViewer (
delete fTreeIconClosed;
G4cout <<removeTempFolder().toStdString().c_str() <<G4endl;
delete lWaitForVisSubThreadQtOpenGLContextInitialized;
delete lWaitForVisSubThreadQtOpenGLContextMoved;
}
@@ -3283,7 +3293,7 @@ void G4OpenGLQtViewer::addNonPVSceneTreeElement(
const G4Text& g4Text = dynamic_cast<const G4Text&>(visible);
color = fSceneHandler.GetTextColour(g4Text);
}
catch (std::bad_cast) {
catch (const std::bad_cast&) {
color = fSceneHandler.GetColour();
}
if (modelShortName == "") {
@@ -4708,7 +4718,9 @@ void G4OpenGLQtViewer::DoneWithMasterThread()
// Called by Main Thread !
// Useful to avoid two vis thread at the same time
G4MUTEXLOCK(&mWaitForVisSubThreadQtOpenGLContextInitialized);
//G4MUTEXLOCK(&mWaitForVisSubThreadQtOpenGLContextInitialized);
if(!lWaitForVisSubThreadQtOpenGLContextInitialized->owns_lock())
lWaitForVisSubThreadQtOpenGLContextInitialized->lock();
}
void G4OpenGLQtViewer::SwitchToVisSubThread()
@@ -4725,9 +4737,14 @@ void G4OpenGLQtViewer::SwitchToVisSubThread()
// - Wait for the vis thread to set its QThread
G4CONDITIONBROADCAST(&c1_VisSubThreadQtOpenGLContextInitialized);
// a condition without a locked mutex is an undefined behavior.
// we check if the mutex owns the lock, and if not, we lock it
if(!lWaitForVisSubThreadQtOpenGLContextMoved->owns_lock())
lWaitForVisSubThreadQtOpenGLContextMoved->lock();
// Unlock the vis thread if it is Qt Viewer
G4CONDITIONWAIT(&c2_VisSubThreadQtOpenGLContextMoved, &mWaitForVisSubThreadQtOpenGLContextMoved);
G4CONDITIONWAIT(&c2_VisSubThreadQtOpenGLContextMoved,
lWaitForVisSubThreadQtOpenGLContextMoved);
// make context current
qGLW->makeCurrent();
@@ -4760,7 +4777,10 @@ void G4OpenGLQtViewer::SwitchToMasterThread()
}
// Useful to avoid two vis thread at the same time
G4MUTEXUNLOCK(&mWaitForVisSubThreadQtOpenGLContextInitialized);
//G4MUTEXUNLOCK(&mWaitForVisSubThreadQtOpenGLContextInitialized);
if(lWaitForVisSubThreadQtOpenGLContextInitialized->owns_lock())
lWaitForVisSubThreadQtOpenGLContextInitialized->unlock();
qGLW->makeCurrent();
}
@@ -4773,9 +4793,14 @@ void G4OpenGLQtViewer::MovingToVisSubThread(){
return;
}
// - Wait for the vis sub thread to set its QThread
G4CONDITIONWAIT( &c1_VisSubThreadQtOpenGLContextInitialized, &mWaitForVisSubThreadQtOpenGLContextInitialized);
// a condition without a locked mutex is an undefined behavior.
// we check if the mutex owns the lock, and if not, we lock it
if(!lWaitForVisSubThreadQtOpenGLContextInitialized->owns_lock())
lWaitForVisSubThreadQtOpenGLContextInitialized->lock();
// - Wait for the vis sub thread to set its QThread
G4CONDITIONWAIT(&c1_VisSubThreadQtOpenGLContextInitialized,
lWaitForVisSubThreadQtOpenGLContextInitialized);
// Set current QThread for the way back
SetQGLContextMainThread(QThread::currentThread());
@@ -62,7 +62,7 @@ G4bool G4OpenGLStoredQtSceneHandler::ExtraPOProcessing
fPOList[currentPOListIndex].fpG4TextPlus = pG4TextPlus;
usesGLCommands = false;
}
catch (std::bad_cast) {} // No special action if not text. Just carry on.
catch (const std::bad_cast&) {} // No special action if not text. Just carry on.
G4PhysicalVolumeModel* pPVModel =
dynamic_cast<G4PhysicalVolumeModel*>(fpModel);
@@ -128,7 +128,7 @@ G4bool G4OpenGLStoredQtSceneHandler::ExtraTOProcessing
fTOList[currentTOListIndex].fpG4TextPlus = pG4TextPlus;
usesGLCommands = false;
}
catch (std::bad_cast) {} // Do nothing if not text.
catch (const std::bad_cast&) {} // Do nothing if not text.
return usesGLCommands;
}
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4OpenGLStoredQtViewer.cc 103926 2017-05-03 13:43:27Z gcosmo $
// $Id: G4OpenGLStoredQtViewer.cc 109510 2018-04-26 07:15:57Z gcosmo $
//
//
// Class G4OpenGLStoredQtViewer : a class derived from G4OpenGLQtViewer and
@@ -119,6 +119,8 @@ G4bool G4OpenGLStoredQtViewer::CompareForKernelVisit(G4ViewParameters& lastVP)
(lastVP.IsCullingInvisible () != fVP.IsCullingInvisible ()) ||
(lastVP.IsDensityCulling () != fVP.IsDensityCulling ()) ||
(lastVP.IsCullingCovered () != fVP.IsCullingCovered ()) ||
(lastVP.GetCBDAlgorithmNumber() !=
fVP.GetCBDAlgorithmNumber()) ||
(lastVP.IsSection () != fVP.IsSection ()) ||
// Section (DCUT) implemented locally. But still need to visit
// kernel if status changes so that back plane culling can be
@@ -172,6 +174,11 @@ G4bool G4OpenGLStoredQtViewer::CompareForKernelVisit(G4ViewParameters& lastVP)
}
***************************************************************/
if (lastVP.GetCBDAlgorithmNumber() > 0) {
if (lastVP.GetCBDParameters().size() != fVP.GetCBDParameters().size()) return true;
else if (lastVP.GetCBDParameters() != fVP.GetCBDParameters()) return true;
}
if (lastVP.IsExplode () &&
(lastVP.GetExplodeFactor () != fVP.GetExplodeFactor ()))
return true;
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4OpenGLStoredSceneHandler.cc 108544 2018-02-16 09:47:30Z gcosmo $
// $Id: G4OpenGLStoredSceneHandler.cc 110480 2018-05-25 07:25:18Z gcosmo $
//
//
// Andrew Walkden 10th February 1997
@@ -102,8 +102,8 @@ G4OpenGLStoredSceneHandler::PO& G4OpenGLStoredSceneHandler::PO::operator=
G4OpenGLStoredSceneHandler::TO::TO():
fDisplayListId(0),
fPickName(0),
fStartTime(-DBL_MAX),
fEndTime(DBL_MAX),
fStartTime(-G4VisAttributes::fVeryLongTime),
fEndTime(G4VisAttributes::fVeryLongTime),
fpG4TextPlus(0),
fMarkerOrPolyline(false)
{}
@@ -123,8 +123,8 @@ G4OpenGLStoredSceneHandler::TO::TO(G4int id, const G4Transform3D& tr):
fDisplayListId(id),
fTransform(tr),
fPickName(0),
fStartTime(-DBL_MAX),
fEndTime(DBL_MAX),
fStartTime(-G4VisAttributes::fVeryLongTime),
fEndTime(G4VisAttributes::fVeryLongTime),
fpG4TextPlus(0),
fMarkerOrPolyline(false)
{}
@@ -203,7 +203,8 @@ G4bool G4OpenGLStoredSceneHandler::AddPrimitivePreamble(const G4Polyhedron& visi
return AddPrimitivePreambleInternal(visible, false, false);
}
G4bool G4OpenGLStoredSceneHandler::AddPrimitivePreambleInternal(const G4Visible& visible, bool isMarker, bool isPolyline)
G4bool G4OpenGLStoredSceneHandler::AddPrimitivePreambleInternal
(const G4Visible& visible, bool isMarker, bool isPolyline)
{
// Get applicable vis attributes for all primitives.
fpVisAttribs = fpViewer->GetApplicableVisAttributes(visible.GetVisAttributes());
@@ -212,10 +213,10 @@ G4bool G4OpenGLStoredSceneHandler::AddPrimitivePreambleInternal(const G4Visible&
G4bool transparency_enabled = true;
G4bool isMarkerNotHidden = true;
G4OpenGLViewer* pViewer = dynamic_cast<G4OpenGLViewer*>(fpViewer);
if (pViewer) {
transparency_enabled = pViewer->transparency_enabled;
isMarkerNotHidden = pViewer->fVP.IsMarkerNotHidden();
G4OpenGLViewer* pOGLViewer = dynamic_cast<G4OpenGLViewer*>(fpViewer);
if (pOGLViewer) {
transparency_enabled = pOGLViewer->transparency_enabled;
isMarkerNotHidden = pOGLViewer->fVP.IsMarkerNotHidden();
}
G4bool isTransparent = opacity < 1.;
@@ -260,7 +261,6 @@ G4bool G4OpenGLStoredSceneHandler::AddPrimitivePreambleInternal(const G4Visible&
if (fThirdPassForNonHiddenMarkers) {
if (!treatAsNotHidden) {
return false; // No further processing.
}
}
} // fThreePassCapable
@@ -432,8 +432,8 @@ end_of_display_list_reuse_test:
glMatrixMode (GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
if (pViewer) {
pViewer->g4GlOrtho (-1., 1., -1., 1., -G4OPENGL_FLT_BIG, G4OPENGL_FLT_BIG);
if (pOGLViewer) {
pOGLViewer->g4GlOrtho (-1., 1., -1., 1., -G4OPENGL_FLT_BIG, G4OPENGL_FLT_BIG);
}
glMatrixMode (GL_MODELVIEW);
glPushMatrix();
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4OpenGLStoredViewer.cc 101714 2016-11-22 08:53:13Z gcosmo $
// $Id: G4OpenGLStoredViewer.cc 109510 2018-04-26 07:15:57Z gcosmo $
//
//
// Andrew Walkden 7th February 1997
@@ -78,6 +78,8 @@ G4bool G4OpenGLStoredViewer::CompareForKernelVisit(G4ViewParameters& lastVP) {
(lastVP.IsCullingInvisible () != fVP.IsCullingInvisible ()) ||
(lastVP.IsDensityCulling () != fVP.IsDensityCulling ()) ||
(lastVP.IsCullingCovered () != fVP.IsCullingCovered ()) ||
(lastVP.GetCBDAlgorithmNumber() !=
fVP.GetCBDAlgorithmNumber()) ||
(lastVP.IsSection () != fVP.IsSection ()) ||
// Section (DCUT) implemented locally. But still need to visit
// kernel if status changes so that back plane culling can be
@@ -122,15 +124,46 @@ G4bool G4OpenGLStoredViewer::CompareForKernelVisit(G4ViewParameters& lastVP) {
}
***************************************************************/
if (lastVP.GetCBDAlgorithmNumber() > 0) {
if (lastVP.GetCBDParameters().size() != fVP.GetCBDParameters().size()) return true;
else if (lastVP.GetCBDParameters() != fVP.GetCBDParameters()) return true;
}
if (lastVP.IsExplode () &&
(lastVP.GetExplodeFactor () != fVP.GetExplodeFactor ()))
return true;
// Time window parameters operate on the existing database so no need
// to rebuild even if they change.
return false;
}
void G4OpenGLStoredViewer::DrawDisplayLists () {
// We moved these from G4OpenGLViewer to G4ViewParamaters. To avoid
// editing many lines below we introduce these convenient aliases.
#define CONVENIENT_DOUBLE_ALIAS(q) const G4double& f##q = fVP.Get##q();
#define CONVENIENT_BOOL_ALIAS(q) const G4bool& f##q = fVP.Is##q();
CONVENIENT_DOUBLE_ALIAS(StartTime)
CONVENIENT_DOUBLE_ALIAS(EndTime)
CONVENIENT_DOUBLE_ALIAS(FadeFactor)
CONVENIENT_BOOL_ALIAS(DisplayHeadTime)
CONVENIENT_DOUBLE_ALIAS(DisplayHeadTimeX)
CONVENIENT_DOUBLE_ALIAS(DisplayHeadTimeY)
CONVENIENT_DOUBLE_ALIAS(DisplayHeadTimeSize)
CONVENIENT_DOUBLE_ALIAS(DisplayHeadTimeRed)
CONVENIENT_DOUBLE_ALIAS(DisplayHeadTimeGreen)
CONVENIENT_DOUBLE_ALIAS(DisplayHeadTimeBlue)
CONVENIENT_BOOL_ALIAS(DisplayLightFront)
CONVENIENT_DOUBLE_ALIAS(DisplayLightFrontX)
CONVENIENT_DOUBLE_ALIAS(DisplayLightFrontY)
CONVENIENT_DOUBLE_ALIAS(DisplayLightFrontZ)
CONVENIENT_DOUBLE_ALIAS(DisplayLightFrontT)
CONVENIENT_DOUBLE_ALIAS(DisplayLightFrontRed)
CONVENIENT_DOUBLE_ALIAS(DisplayLightFrontGreen)
CONVENIENT_DOUBLE_ALIAS(DisplayLightFrontBlue)
const G4Planes& cutaways = fVP.GetCutawayPlanes();
G4bool cutawayUnion = fVP.IsCutaway() &&
fVP.GetCutawayMode() == G4ViewParameters::cutawayUnion;
@@ -209,14 +242,14 @@ void G4OpenGLStoredViewer::DrawDisplayLists () {
glLoadIdentity();
G4OpenGLTransform3D oglt (po.fTransform);
glMultMatrixd (oglt.GetGLMatrix ());
fOpenGLSceneHandler.G4OpenGLSceneHandler::AddPrimitive
(po.fpG4TextPlus->fG4Text);
// This text is from a PODL. We don't want to create a new PODL.
AddPrimitiveForASingleFrame(po.fpG4TextPlus->fG4Text);
} else {
glPushMatrix();
G4OpenGLTransform3D oglt (po.fTransform);
glMultMatrixd (oglt.GetGLMatrix ());
fOpenGLSceneHandler.G4OpenGLSceneHandler::AddPrimitive
(po.fpG4TextPlus->fG4Text);
// This text is from a PODL. We don't want to create a new PODL.
AddPrimitiveForASingleFrame(po.fpG4TextPlus->fG4Text);
glPopMatrix();
}
@@ -238,7 +271,7 @@ void G4OpenGLStoredViewer::DrawDisplayLists () {
G4Transform3D lastMatrixTransform;
G4bool first = true;
for (size_t iTO = 0;
iTO < fG4OpenGLStoredSceneHandler.fTOList.size(); ++iTO) {
if (TOSelected(iTO)) {
@@ -294,8 +327,8 @@ void G4OpenGLStoredViewer::DrawDisplayLists () {
} else {
glColor3d(c.GetRed(),c.GetGreen(),c.GetBlue());
}
fOpenGLSceneHandler.G4OpenGLSceneHandler::AddPrimitive
(to.fpG4TextPlus->fG4Text);
// This text is from a TODL. We don't want to create a new TODL.
AddPrimitiveForASingleFrame(to.fpG4TextPlus->fG4Text);
if (to.fpG4TextPlus->fProcessing2D) {
glMatrixMode (GL_PROJECTION);
glPopMatrix();
@@ -362,7 +395,7 @@ void G4OpenGLStoredViewer::DrawDisplayLists () {
} while (true);
// Display time at "head" of time range, which is fEndTime...
if (fDisplayHeadTime && fEndTime < DBL_MAX) {
if (fDisplayHeadTime && fEndTime < G4VisAttributes::fVeryLongTime) {
glMatrixMode (GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
@@ -378,7 +411,7 @@ void G4OpenGLStoredViewer::DrawDisplayLists () {
fDisplayHeadTimeGreen,
fDisplayHeadTimeBlue));
headTimeText.SetVisAttributes(&visAtts);
fOpenGLSceneHandler.G4OpenGLSceneHandler::AddPrimitive(headTimeText);
AddPrimitiveForASingleFrame(headTimeText);
glMatrixMode (GL_PROJECTION);
glPopMatrix();
glMatrixMode (GL_MODELVIEW);
@@ -386,7 +419,7 @@ void G4OpenGLStoredViewer::DrawDisplayLists () {
}
// Display light front...
if (fDisplayLightFront && fEndTime < DBL_MAX) {
if (fDisplayLightFront && fEndTime < G4VisAttributes::fVeryLongTime) {
G4double lightFrontRadius = (fEndTime - fDisplayLightFrontT) * c_light;
if (lightFrontRadius > 0.) {
G4Point3D lightFrontCentre(fDisplayLightFrontX, fDisplayLightFrontY, fDisplayLightFrontZ);
@@ -431,10 +464,30 @@ void G4OpenGLStoredViewer::DrawDisplayLists () {
glColor3d(fDisplayLightFrontRed,
fDisplayLightFrontGreen,
fDisplayLightFrontBlue);
fOpenGLSceneHandler.G4OpenGLSceneHandler::AddPrimitive(lightFront);
AddPrimitiveForASingleFrame(lightFront);
}
}
}
}
void G4OpenGLStoredViewer::AddPrimitiveForASingleFrame(const G4Text& text)
{
// We don't want this to get into a display list or a TODL or a PODL so
// use the fMemoryForDisplayLists flag.
G4bool memoryForDisplayListsKeep = fG4OpenGLStoredSceneHandler.fMemoryForDisplayLists;
fG4OpenGLStoredSceneHandler.fMemoryForDisplayLists = false;
fG4OpenGLStoredSceneHandler.G4OpenGLStoredSceneHandler::AddPrimitive(text);
fG4OpenGLStoredSceneHandler.fMemoryForDisplayLists = memoryForDisplayListsKeep;
}
void G4OpenGLStoredViewer::AddPrimitiveForASingleFrame(const G4Circle& circle)
{
// We don't want this to get into a display list or a TODL or a PODL so
// use the fMemoryForDisplayLists flag.
G4bool memoryForDisplayListsKeep = fG4OpenGLStoredSceneHandler.fMemoryForDisplayLists;
fG4OpenGLStoredSceneHandler.fMemoryForDisplayLists = false;
fG4OpenGLStoredSceneHandler.G4OpenGLStoredSceneHandler::AddPrimitive(circle);
fG4OpenGLStoredSceneHandler.fMemoryForDisplayLists = memoryForDisplayListsKeep;
}
#endif
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4OpenGLViewer.cc 107329 2017-11-08 16:41:26Z gcosmo $
// $Id: G4OpenGLViewer.cc 108131 2018-01-09 13:23:26Z gcosmo $
//
//
// Andrew Walkden 27th March 1996
@@ -74,24 +74,6 @@ background (G4Colour(0.,0.,0.)),
transparency_enabled (true),
antialiasing_enabled (false),
haloing_enabled (false),
fStartTime(-DBL_MAX),
fEndTime(DBL_MAX),
fFadeFactor(0.),
fDisplayHeadTime(false),
fDisplayHeadTimeX(-0.9),
fDisplayHeadTimeY(-0.9),
fDisplayHeadTimeSize(24.),
fDisplayHeadTimeRed(0.),
fDisplayHeadTimeGreen(1.),
fDisplayHeadTimeBlue(1.),
fDisplayLightFront(false),
fDisplayLightFrontX(0.),
fDisplayLightFrontY(0.),
fDisplayLightFrontZ(0.),
fDisplayLightFrontT(0.),
fDisplayLightFrontRed(0.),
fDisplayLightFrontGreen(1.),
fDisplayLightFrontBlue(0.),
fRot_sens(1.),
fPan_sens(0.01),
fWinSize_x(0),
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4OpenGLViewerMessenger.cc 101105 2016-11-07 08:09:26Z gcosmo $
// $Id: G4OpenGLViewerMessenger.cc 109510 2018-04-26 07:15:57Z gcosmo $
#ifdef G4VIS_BUILD_OPENGL_DRIVER
@@ -122,7 +122,8 @@ G4OpenGLViewerMessenger::G4OpenGLViewerMessenger()
fpCommandDisplayHeadTime =
new G4UIcommand("/vis/ogl/set/displayHeadTime", this);
fpCommandDisplayHeadTime->SetGuidance
("Display head time of range in 2D text.");
("DEPRECATED. Use /vis/viewer/set/timeWindow/displayHeadTime."
"\n Display head time of range in 2D text.");
parameter = new G4UIparameter ("displayHeadTime", 'b', omitable = false);
parameter->SetDefaultValue(false);
fpCommandDisplayHeadTime->SetParameter(parameter);
@@ -155,7 +156,8 @@ G4OpenGLViewerMessenger::G4OpenGLViewerMessenger()
fpCommandDisplayLightFront =
new G4UIcommand("/vis/ogl/set/displayLightFront", this);
fpCommandDisplayLightFront->SetGuidance
("Display the light front at head time.");
("DEPRECATED. Use /vis/viewer/set/timeWindow/displayLightFront."
"\n Display the light front at head time.");
fpCommandDisplayLightFront->SetGuidance
("Tip: The trajectories can appear of jump ahead of the light front"
"\nbecause their time range overlaps the viewer's time range. To"
@@ -209,9 +211,11 @@ G4OpenGLViewerMessenger::G4OpenGLViewerMessenger()
fpCommandEndTime =
new G4UIcommand("/vis/ogl/set/endTime", this);
fpCommandEndTime->SetGuidance("Set end and range of track time.");
fpCommandEndTime->SetGuidance
("DEPRECATED. Use /vis/viewer/set/timeWindow/endTime."
"\n Set end and range of time window.");
parameter = new G4UIparameter ("end-time", 'd', omitable = false);
parameter->SetDefaultValue(DBL_MAX);
parameter->SetDefaultValue(G4VisAttributes::fVeryLongTime);
fpCommandEndTime->SetParameter(parameter);
parameter = new G4UIparameter ("end-time-unit", 's', omitable = false);
parameter->SetDefaultValue("ns");
@@ -234,7 +238,8 @@ G4OpenGLViewerMessenger::G4OpenGLViewerMessenger()
fpCommandFade = new G4UIcmdWithADouble("/vis/ogl/set/fade", this);
fpCommandFade->SetGuidance
("0: no fade; 1: maximum fade with time within range.");
("DEPRECATED. Use /vis/viewer/set/timeWindow/fadeFactor."
"\n 0: no fade; 1: maximum fade with time within range.");
fpCommandFade->SetParameterName("fadefactor", omitable = false);
fpCommandFade->SetRange("fadefactor>=0.&&fadefactor<=1.");
fpCommandFade->SetDefaultValue(0.);
@@ -284,9 +289,11 @@ G4OpenGLViewerMessenger::G4OpenGLViewerMessenger()
fpCommandStartTime =
new G4UIcommand("/vis/ogl/set/startTime", this);
fpCommandStartTime->SetGuidance("Set start and range of track time.");
fpCommandStartTime->SetGuidance
("DEPRECATED. Use /vis/viewer/set/timeWindow/startTime."
"\n Set start and range of time window.");
parameter = new G4UIparameter ("start-time", 'd', omitable = false);
parameter->SetDefaultValue(-DBL_MAX);
parameter->SetDefaultValue(-G4VisAttributes::fVeryLongTime);
fpCommandStartTime->SetParameter(parameter);
parameter = new G4UIparameter ("start-time-unit", 's', omitable = false);
parameter->SetDefaultValue("ns");
@@ -500,13 +507,16 @@ void G4OpenGLViewerMessenger::SetNewValue
std::istringstream iss(newValue);
iss >> display >> screenX >> screenY
>> screenSize >> red >> green >> blue;
pOGLSViewer->fDisplayHeadTime = command->ConvertToBool(display);
pOGLSViewer->fDisplayHeadTimeX = screenX;
pOGLSViewer->fDisplayHeadTimeY = screenY;
pOGLSViewer->fDisplayHeadTimeSize = screenSize;
pOGLSViewer->fDisplayHeadTimeRed = red;
pOGLSViewer->fDisplayHeadTimeGreen = green;
pOGLSViewer->fDisplayHeadTimeBlue = blue;
pOGLSViewer->fVP.SetDisplayHeadTime(command->ConvertToBool(display));
pOGLSViewer->fVP.SetDisplayHeadTimeX(screenX);
pOGLSViewer->fVP.SetDisplayHeadTimeY(screenY);
pOGLSViewer->fVP.SetDisplayHeadTimeSize(screenSize);
pOGLSViewer->fVP.SetDisplayHeadTimeRed(red);
pOGLSViewer->fVP.SetDisplayHeadTimeGreen(green);
pOGLSViewer->fVP.SetDisplayHeadTimeBlue(blue);
G4cout
<< "DEPRECATED. Use /vis/viewer/set/timeWindow/displayHeadTime."
<< G4endl;
return;
}
@@ -519,18 +529,21 @@ void G4OpenGLViewerMessenger::SetNewValue
>> originX >> originY >> originZ >> unitS
>> originT >> unitT
>> red >> green >> blue;
pOGLSViewer->fDisplayLightFront = command->ConvertToBool(display);
pOGLSViewer->fDisplayLightFrontX =
command->ConvertToDimensionedDouble(G4String(originX + ' ' + unitS));
pOGLSViewer->fDisplayLightFrontY =
command->ConvertToDimensionedDouble(G4String(originY + ' ' + unitS));
pOGLSViewer->fDisplayLightFrontZ =
command->ConvertToDimensionedDouble(G4String(originZ + ' ' + unitS));
pOGLSViewer->fDisplayLightFrontT =
command->ConvertToDimensionedDouble(G4String(originT + ' ' + unitT));
pOGLSViewer->fDisplayLightFrontRed = red;
pOGLSViewer->fDisplayLightFrontGreen = green;
pOGLSViewer->fDisplayLightFrontBlue = blue;
pOGLSViewer->fVP.SetDisplayLightFront(command->ConvertToBool(display));
pOGLSViewer->fVP.SetDisplayLightFrontX
(command->ConvertToDimensionedDouble(G4String(originX + ' ' + unitS)));
pOGLSViewer->fVP.SetDisplayLightFrontY
(command->ConvertToDimensionedDouble(G4String(originY + ' ' + unitS)));
pOGLSViewer->fVP.SetDisplayLightFrontZ
(command->ConvertToDimensionedDouble(G4String(originZ + ' ' + unitS)));
pOGLSViewer->fVP.SetDisplayLightFrontT
(command->ConvertToDimensionedDouble(G4String(originT + ' ' + unitT)));
pOGLSViewer->fVP.SetDisplayLightFrontRed(red);
pOGLSViewer->fVP.SetDisplayLightFrontGreen(green);
pOGLSViewer->fVP.SetDisplayLightFrontBlue(blue);
G4cout
<< "DEPRECATED. Use /vis/viewer/set/timeWindow/displayLightFront."
<< G4endl;
return;
}
@@ -541,23 +554,31 @@ void G4OpenGLViewerMessenger::SetNewValue
std::istringstream iss(newValue);
iss >> end_time_string >> end_time_unit
>> time_range_string >> time_range_unit;
pOGLSViewer->fEndTime = command->ConvertToDimensionedDouble
(G4String(end_time_string + ' ' + end_time_unit));
pOGLSViewer->fVP.SetEndTime
(command->ConvertToDimensionedDouble
(G4String(end_time_string + ' ' + end_time_unit)));
G4double timeRange = command->ConvertToDimensionedDouble
(G4String(time_range_string + ' ' + time_range_unit));
if (timeRange > 0.) {
pOGLSViewer->fStartTime = pOGLSViewer->fEndTime - timeRange;
pOGLSViewer->fVP.SetStartTime
(pOGLSViewer->fVP.GetEndTime() - timeRange);
}
if (pOGLSViewer->fVP.IsAutoRefresh())
G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/refresh");
G4cout
<< "DEPRECATED. Use /vis/viewer/set/timeWindow/endTime."
<< G4endl;
return;
}
if (command == fpCommandFade)
{
pOGLSViewer->fFadeFactor = command->ConvertToDouble(newValue);
pOGLSViewer->fVP.SetFadeFactor(command->ConvertToDouble(newValue));
if (pOGLSViewer->fVP.IsAutoRefresh())
G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/refresh");
G4cout
<< "DEPRECATED. Use /vis/viewer/set/timeWindow/fadeFactor."
<< G4endl;
return;
}
@@ -568,15 +589,20 @@ void G4OpenGLViewerMessenger::SetNewValue
std::istringstream iss(newValue);
iss >> start_time_string >> start_time_unit
>> time_range_string >> time_range_unit;
pOGLSViewer->fStartTime = command->ConvertToDimensionedDouble
(G4String(start_time_string + ' ' + start_time_unit));
pOGLSViewer->fVP.SetStartTime
(command->ConvertToDimensionedDouble
(G4String(start_time_string + ' ' + start_time_unit)));
G4double timeRange = command->ConvertToDimensionedDouble
(G4String(time_range_string + ' ' + time_range_unit));
if (timeRange > 0.) {
pOGLSViewer->fEndTime = pOGLSViewer->fStartTime + timeRange;
pOGLSViewer->fVP.SetEndTime
(pOGLSViewer->fVP.GetStartTime() + timeRange);
}
if (pOGLSViewer->fVP.IsAutoRefresh())
G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/refresh");
G4cout
<< "DEPRECATED. Use /vis/viewer/set/timeWindow/startTime."
<< G4endl;
return;
}
+15 -1
View File
@@ -1,4 +1,4 @@
$Id: History 103926 2017-05-03 13:43:27Z gcosmo $
$Id: History 110811 2018-06-15 07:09:36Z gcosmo $
-------------------------------------------------------------------
=========================================================
@@ -20,6 +20,20 @@ committal in the CVS repository !
History file for visualization/OpenInventor
-------------------------------------------
15 June 2018 Fred Jones (openinventor-V10-04-03)
- Fixed compilation warnings for casts on gcc-8.1.
28 May 2018 Gabriele Cosmo (openinventor-V10-04-02)
- Fixed compilation error in SoGL2PSAction, induced after last changes in
visualization.
26 April 2018 John Allison (openinventor-V10-04-01)
- Fix compilation errors.
25 April 2018 John Allison (openinventor-V10-04-00)
- G4OpenInventorViewer::CompareForKernelVisit:
o Implement comparison for "colour by density".
13 January 2017 Frederick Jones
- G4OpenInventorXtExaminerViewer:
In lookAtSceneElementCB disabled default height setting for
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4OpenInventorViewer.cc 102233 2017-01-13 15:59:06Z gcosmo $
// $Id: G4OpenInventorViewer.cc 109520 2018-04-26 16:01:14Z gcosmo $
#ifdef G4VIS_BUILD_OI_DRIVER
@@ -164,6 +164,8 @@ G4bool G4OpenInventorViewer::CompareForKernelVisit(G4ViewParameters& vp) {
(vp.IsCullingInvisible () != fVP.IsCullingInvisible ()) ||
(vp.IsDensityCulling () != fVP.IsDensityCulling ()) ||
(vp.IsCullingCovered () != fVP.IsCullingCovered ()) ||
(vp.GetCBDAlgorithmNumber() !=
fVP.GetCBDAlgorithmNumber()) ||
(vp.IsSection () != fVP.IsSection ()) ||
(vp.IsCutaway () != fVP.IsCutaway ()) ||
// This assumes use of generic clipping (sectioning, slicing,
@@ -196,6 +198,11 @@ G4bool G4OpenInventorViewer::CompareForKernelVisit(G4ViewParameters& vp) {
(vp.GetVisibleDensity () != fVP.GetVisibleDensity ()))
return true;
if (vp.GetCBDAlgorithmNumber() > 0) {
if (vp.GetCBDParameters().size() != fVP.GetCBDParameters().size()) return true;
else if (vp.GetCBDParameters() != fVP.GetCBDParameters()) return true;
}
if (vp.IsSection () &&
(vp.GetSectionPlane () != fVP.GetSectionPlane ()))
return true;
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4OpenInventorXt.cc 66373 2012-12-18 09:41:34Z gcosmo $
// $Id: G4OpenInventorXt.cc 110811 2018-06-15 07:09:36Z gcosmo $
//
//
// Jeff Kallenbach 01 Aug 1996
@@ -41,6 +41,11 @@
#include "G4OpenInventorSceneHandler.hh"
#include "G4OpenInventorXtViewer.hh"
// Work around for gcc8 Coverity cast warning
inline bool soxt_dispatch_event(void* a_event) {
return SoXt::dispatchEvent((XEvent*)a_event);
}
G4OpenInventorXt::G4OpenInventorXt ()
:G4OpenInventor("OpenInventorXt","OIX",G4VGraphicsSystem::threeD)
,fInited(false)
@@ -53,9 +58,13 @@ void G4OpenInventorXt::Initialize()
SetInteractorManager (G4Xt::getInstance ());
GetInteractorManager () ->
RemoveDispatcher((G4DispatchFunction)XtDispatchEvent);
RemoveDispatcher(G4Xt::xt_dispatch_event);
// Coverity gcc8 cast warning
// RemoveDispatcher((G4DispatchFunction)XtDispatchEvent);
GetInteractorManager () ->
AddDispatcher ((G4DispatchFunction)SoXt::dispatchEvent);
AddDispatcher(soxt_dispatch_event);
// Coverity gcc8 cast warning
// AddDispatcher ((G4DispatchFunction)SoXt::dispatchEvent);
Widget top = (Widget)GetInteractorManager()->GetMainInteractor();
@@ -45,11 +45,16 @@
#include "G4OpenInventorXtExtendedViewer.hh"
#include "G4OpenInventorXtExaminerViewerMessenger.hh"
// Work around for gcc8 Coverity cast warning
inline bool soxt_dispatch_event(void* a_event) {
return SoXt::dispatchEvent((XEvent*)a_event);
}
G4OpenInventorXtExtended::G4OpenInventorXtExtended ()
:G4OpenInventor("OpenInventorXtExtended","OIXE",G4VGraphicsSystem::threeD)
,fInited(false)
{
G4OpenInventorXtExaminerViewerMessenger(getInstance());
G4OpenInventorXtExaminerViewerMessenger::GetInstance();
}
void G4OpenInventorXtExtended::Initialize()
@@ -59,9 +64,13 @@ void G4OpenInventorXtExtended::Initialize()
SetInteractorManager (G4Xt::getInstance ());
GetInteractorManager () ->
RemoveDispatcher((G4DispatchFunction)XtDispatchEvent);
RemoveDispatcher(G4Xt::xt_dispatch_event);
// Coverity gcc8 cast warning
// RemoveDispatcher((G4DispatchFunction)XtDispatchEvent);
GetInteractorManager () ->
AddDispatcher ((G4DispatchFunction)SoXt::dispatchEvent);
AddDispatcher(soxt_dispatch_event);
// Coverity gcc8 cast warning
// AddDispatcher ((G4DispatchFunction)SoXt::dispatchEvent);
Widget top = (Widget)GetInteractorManager()->GetMainInteractor();
G4cout << "TOP LEVEL WIDGET FOR SoXt::init() = " << top << G4endl;
@@ -73,7 +73,7 @@ bool SoGL2PSAction::enableFileWriting(
fFile = ::fopen(fFileName,"w");
if(!fFile) {
SoDebugError::post("SoGL2PSAction::enableFileWriting",
"Cannot open file %s",fFileName);
"Cannot open file %s",fFileName.c_str());
return false;
}
#ifdef __COIN__
@@ -54,7 +54,8 @@ extern "C" {
/* */
/*******************************************************************/
static void mouseScroll(Widget, XtPointer client_data, XEvent *event)
static void mouseScroll(Widget, XtPointer client_data, XEvent* event, Boolean*)
//static void mouseScroll(Widget, XtPointer client_data, XEvent *event)
{
Widget sb = (Widget)client_data;
int value_return = 0;
+3 -1
View File
@@ -1,4 +1,4 @@
# $Id: GNUmakefile 74059 2013-09-20 10:01:33Z gcosmo $
# $Id: GNUmakefile 109040 2018-03-22 11:23:25Z gcosmo $
name := G4RayTracer
@@ -36,6 +36,7 @@ CPPFLAGS += -I$(G4BASE)/global/HEPRandom/include
CPPFLAGS += -I$(G4BASE)/geometry/management/include
CPPFLAGS += -I$(G4BASE)/geometry/navigation/include
CPPFLAGS += -I$(G4BASE)/geometry/volumes/include
CPPFLAGS += -I$(G4BASE)/geometry/magneticfield/include
CPPFLAGS += -I$(G4BASE)/digits_hits/detector/include
CPPFLAGS += -I$(G4BASE)/digits_hits/digits/include
CPPFLAGS += -I$(G4BASE)/intercoms/include
@@ -48,6 +49,7 @@ CPPFLAGS += -I$(G4BASE)/particles/bosons/include
CPPFLAGS += -I$(G4BASE)/particles/management/include
CPPFLAGS += -I$(G4BASE)/processes/management/include
CPPFLAGS += -I$(G4BASE)/processes/cuts/include
CPPFLAGS += -I$(G4BASE)/processes/scoring/include
CPPFLAGS += -I$(G4BASE)/materials/include
include $(G4INSTALL)/config/common.gmk
+12 -1
View File
@@ -1,4 +1,4 @@
$Id: History 104015 2017-05-08 07:28:08Z gcosmo $
$Id: History 110261 2018-05-17 14:24:23Z gcosmo $
-------------------------------------------------------------------
=========================================================
@@ -24,6 +24,17 @@ committal in the CVS repository !
History file for Ray Tracer category
---------------------------------------
17th May 2018 Jonathan Madsen (raytracer-V10-04-01)
- updated "thread-local-static-var" model to
"function-returning-thread-local-static-reference" model
which fixes Windows DLL + MT
20th March 2018 Makoto Asai (raytracer-V10-04-00)
- G4RayTrajectory.cc
o Use HyperStep of G4ParallelWorldProcess to draw volumes
defined in a parallel world.
o sources.cmake and GNUmakefile are modified accordingly.
7th May 2017 John Allison (raytracer-V10-03-04)
- G4RayTracerViewer.cc:
o Expanded filename numbering to 4 digits, zero filled, e.g.,
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4RayTrajectory.hh 71495 2013-06-17 09:13:30Z gcosmo $
// $Id: G4RayTrajectory.hh 110261 2018-05-17 14:24:23Z gcosmo $
//
//
@@ -96,21 +96,21 @@ class G4RayTrajectory : public G4VTrajectory
};
#if defined G4VIS_ALLOC_EXPORT
extern G4DLLEXPORT G4ThreadLocal G4Allocator<G4RayTrajectory>* rayTrajectoryAllocator;
extern G4DLLEXPORT G4Allocator<G4RayTrajectory>*& rayTrajectoryAllocator();
#else
extern G4DLLIMPORT G4ThreadLocal G4Allocator<G4RayTrajectory>* rayTrajectoryAllocator;
extern G4DLLIMPORT G4Allocator<G4RayTrajectory>*& rayTrajectoryAllocator();
#endif
inline void* G4RayTrajectory::operator new(size_t)
{
if(!rayTrajectoryAllocator)
{ rayTrajectoryAllocator = new G4Allocator<G4RayTrajectory>; }
return (void*)rayTrajectoryAllocator->MallocSingle();
if(!rayTrajectoryAllocator())
{ rayTrajectoryAllocator() = new G4Allocator<G4RayTrajectory>; }
return (void*)rayTrajectoryAllocator()->MallocSingle();
}
inline void G4RayTrajectory::operator delete(void* aTrajectory)
{
rayTrajectoryAllocator->FreeSingle((G4RayTrajectory*)aTrajectory);
rayTrajectoryAllocator()->FreeSingle((G4RayTrajectory*)aTrajectory);
}
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4RayTrajectoryPoint.hh 77479 2013-11-25 10:01:22Z gcosmo $
// $Id: G4RayTrajectoryPoint.hh 110261 2018-05-17 14:24:23Z gcosmo $
//
//
@@ -80,21 +80,21 @@ class G4RayTrajectoryPoint :public G4VTrajectoryPoint
};
#if defined G4VIS_ALLOC_EXPORT
extern G4DLLEXPORT G4ThreadLocal G4Allocator<G4RayTrajectoryPoint>* rayTrajectoryPointAllocator;
extern G4DLLEXPORT G4Allocator<G4RayTrajectoryPoint>*& rayTrajectoryPointAllocator();
#else
extern G4DLLIMPORT G4ThreadLocal G4Allocator<G4RayTrajectoryPoint>* rayTrajectoryPointAllocator;
extern G4DLLIMPORT G4Allocator<G4RayTrajectoryPoint>*& rayTrajectoryPointAllocator();
#endif
inline void* G4RayTrajectoryPoint::operator new(size_t)
{
if(!rayTrajectoryPointAllocator)
{ rayTrajectoryPointAllocator = new G4Allocator<G4RayTrajectoryPoint>; }
return (void *) rayTrajectoryPointAllocator->MallocSingle();
if(!rayTrajectoryPointAllocator())
{ rayTrajectoryPointAllocator() = new G4Allocator<G4RayTrajectoryPoint>; }
return (void *) rayTrajectoryPointAllocator()->MallocSingle();
}
inline void G4RayTrajectoryPoint::operator delete(void *aTrajectoryPoint)
{
rayTrajectoryPointAllocator->FreeSingle((G4RayTrajectoryPoint *) aTrajectoryPoint);
rayTrajectoryPointAllocator()->FreeSingle((G4RayTrajectoryPoint *) aTrajectoryPoint);
}
#endif
+3 -1
View File
@@ -11,7 +11,7 @@
#
# Generated on : 24/9/2010
#
# $Id: sources.cmake 88190 2015-02-02 17:24:54Z gcosmo $
# $Id: sources.cmake 109040 2018-03-22 11:23:25Z gcosmo $
#
#------------------------------------------------------------------------------
@@ -27,6 +27,7 @@ include_directories(${CMAKE_SOURCE_DIR}/source/event/include)
include_directories(${CMAKE_SOURCE_DIR}/source/geometry/management/include)
include_directories(${CMAKE_SOURCE_DIR}/source/geometry/navigation/include)
include_directories(${CMAKE_SOURCE_DIR}/source/geometry/volumes/include)
include_directories(${CMAKE_SOURCE_DIR}/source/geometry/magneticfield/include)
include_directories(${CMAKE_SOURCE_DIR}/source/global/HEPGeometry/include)
include_directories(${CMAKE_SOURCE_DIR}/source/global/HEPRandom/include)
include_directories(${CMAKE_SOURCE_DIR}/source/global/management/include)
@@ -37,6 +38,7 @@ include_directories(${CMAKE_SOURCE_DIR}/source/particles/bosons/include)
include_directories(${CMAKE_SOURCE_DIR}/source/particles/management/include)
include_directories(${CMAKE_SOURCE_DIR}/source/processes/cuts/include)
include_directories(${CMAKE_SOURCE_DIR}/source/processes/management/include)
include_directories(${CMAKE_SOURCE_DIR}/source/processes/scoring/include)
include_directories(${CMAKE_SOURCE_DIR}/source/run/include)
include_directories(${CMAKE_SOURCE_DIR}/source/track/include)
include_directories(${CMAKE_SOURCE_DIR}/source/tracking/include)
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4RayTrajectory.cc 104015 2017-05-08 07:28:08Z gcosmo $
// $Id: G4RayTrajectory.cc 110261 2018-05-17 14:24:23Z gcosmo $
//
//
//
@@ -43,8 +43,13 @@
#include "G4Colour.hh"
#include "G4TransportationManager.hh"
#include "G4ios.hh"
#include "G4ParallelWorldProcess.hh"
G4ThreadLocal G4Allocator<G4RayTrajectory>* rayTrajectoryAllocator = 0;
G4Allocator<G4RayTrajectory>*& rayTrajectoryAllocator()
{
G4ThreadLocalStatic G4Allocator<G4RayTrajectory>* _instance = nullptr;
return _instance;
}
G4RayTrajectory :: G4RayTrajectory()
{
@@ -72,14 +77,28 @@ G4RayTrajectory :: ~G4RayTrajectory()
delete positionRecord;
}
void G4RayTrajectory::AppendStep(const G4Step* aStep)
void G4RayTrajectory::AppendStep(const G4Step* theStep)
{
G4RayTrajectoryPoint* trajectoryPoint = new G4RayTrajectoryPoint();
trajectoryPoint->SetStepLength(aStep->GetStepLength());
const G4Step* aStep = theStep;
G4Navigator* theNavigator
= G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking();
// Take care of parallel world(s)
if(G4ParallelWorldProcess::GetHyperStep())
{
aStep = G4ParallelWorldProcess::GetHyperStep();
G4int navID = G4ParallelWorldProcess::GetHypNavigatorID();
std::vector<G4Navigator*>::iterator iNav =
G4TransportationManager::GetTransportationManager()->
GetActiveNavigatorsIterator();
theNavigator = iNav[navID];
}
trajectoryPoint->SetStepLength(aStep->GetStepLength());
// Surface normal
G4bool valid;
G4ThreeVector theLocalNormal = theNavigator->GetLocalExitNormal(&valid);
if(valid) { theLocalNormal = -theLocalNormal; }
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4RayTrajectoryPoint.cc 71495 2013-06-17 09:13:30Z gcosmo $
// $Id: G4RayTrajectoryPoint.cc 110261 2018-05-17 14:24:23Z gcosmo $
//
//
//
@@ -35,7 +35,11 @@
#include"G4RayTrajectoryPoint.hh"
G4ThreadLocal G4Allocator<G4RayTrajectoryPoint>* rayTrajectoryPointAllocator = 0;
G4Allocator<G4RayTrajectoryPoint>*& rayTrajectoryPointAllocator()
{
G4ThreadLocalStatic G4Allocator<G4RayTrajectoryPoint>* _instance = nullptr;
return _instance;
}
G4RayTrajectoryPoint :: G4RayTrajectoryPoint()
:preStepAtt(0)
+2 -2
View File
@@ -1,5 +1,5 @@
$Id: History 110130 2018-05-16 06:43:10Z gcosmo $
$Id: History 108859 2018-03-12 07:44:53Z gcosmo $
-------------------------------------------------------------------
=========================================================
@@ -25,7 +25,7 @@ committal in the CVS repository !
History file for visualization/Tree sub-category
------------------------------------------------
11th March 2018 John Allison (vistree-V10-03-00)
11th March 2018 John Allison (vistree-V10-04-00)
- G4ASCIITreeSceneHandler.cc:
o Fix bug in suppressed writing of repeated parameterised volumes.
- G4ASCIITreeMessenger.cc:
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4ASCIITreeMessenger.cc 110130 2018-05-16 06:43:10Z gcosmo $
// $Id: G4ASCIITreeMessenger.cc 108859 2018-03-12 07:44:53Z gcosmo $
//
//
// John Allison 5th April 2001
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4ASCIITreeSceneHandler.cc 110130 2018-05-16 06:43:10Z gcosmo $
// $Id: G4ASCIITreeSceneHandler.cc 108859 2018-03-12 07:44:53Z gcosmo $
//
//
// John Allison 5th April 2001
+4 -1
View File
@@ -1,4 +1,4 @@
$Id: History 104289 2017-05-23 13:24:09Z gcosmo $
$Id: History 110513 2018-05-28 07:37:38Z gcosmo $
-------------------------------------------------------------------
=========================================================
@@ -20,6 +20,9 @@ committal in the CVS repository !
History file for visualization/VRML sub-category
------------------------------------------------
26 May 2018 John Allison (VRML-V10-04-00)
- G4VRML2FileSceneHandler.cc: Fix gcc-8 warnings.
23rd May 2017 John Allison (VRML-V10-03-01)
- Fixes for gcc-7.1 warnings.
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4VRML1FileSceneHandler.cc 104289 2017-05-23 13:24:09Z gcosmo $
// $Id: G4VRML1FileSceneHandler.cc 110513 2018-05-28 07:37:38Z gcosmo $
//
// G4VRML1FileSceneHandler.cc
// Satoshi Tanaka & Yasuhide Sawada
@@ -152,7 +152,8 @@ void G4VRML1FileSceneHandler::connectPort()
filename
<< fVRMLFileDestDir << WRL_FILE_HEADER
<< std::setw(2) << std::setfill('0') << i << ".wrl";
strncpy(fVRMLFileName,filename.str().c_str(),sizeof(fVRMLFileName));
strncpy(fVRMLFileName,filename.str().c_str(),sizeof(fVRMLFileName)-1);
fVRMLFileName[sizeof(fVRMLFileName)-1] = '\0';
// check validity of the file name
std::ifstream fin ;
@@ -210,7 +211,8 @@ void G4VRML1FileSceneHandler::closePort()
} else {
std::ostringstream ossCommand;
ossCommand << viewer << ' ' << fVRMLFileName;
strncpy(command,ossCommand.str().c_str(),sizeof(command));
strncpy(command,ossCommand.str().c_str(),sizeof(command)-1);
command[sizeof(command)-1] = '\0';
(void) system( command );
}
}
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4VRML2FileSceneHandler.cc 104289 2017-05-23 13:24:09Z gcosmo $
// $Id: G4VRML2FileSceneHandler.cc 110513 2018-05-28 07:37:38Z gcosmo $
//
// G4VRML2FileSceneHandler.cc
// Satoshi Tanaka & Yasuhide Sawada
@@ -167,7 +167,8 @@ void G4VRML2FileSceneHandler::connectPort()
filename
<< fVRMLFileDestDir << WRL_FILE_HEADER
<< std::setw(2) << std::setfill('0') << i << ".wrl";
strncpy(fVRMLFileName,filename.str().c_str(),sizeof(fVRMLFileName));
strncpy(fVRMLFileName,filename.str().c_str(),sizeof(fVRMLFileName)-1);
fVRMLFileName[sizeof(fVRMLFileName)-1] = '\0';
// check validity of the file name
std::ifstream fin ;
@@ -224,7 +225,8 @@ void G4VRML2FileSceneHandler::closePort()
} else {
std::ostringstream ossCommand;
ossCommand << viewer << ' ' << fVRMLFileName;
strncpy(command,ossCommand.str().c_str(),sizeof(command));
strncpy(command,ossCommand.str().c_str(),sizeof(command)-1);
command[sizeof(command)-1] = '\0';
(void) system( command );
}
}
+5 -1
View File
@@ -1,4 +1,4 @@
$Id: History 99076 2016-09-01 12:40:47Z gcosmo $
$Id: History 109510 2018-04-26 07:15:57Z gcosmo $
-------------------------------------------------------------------
=========================================================
@@ -20,6 +20,10 @@ committal in the CVS repository !
History file for visualization/XXX sub-category (a template graphics system)
---------------------------------------------------------------------------
25 April 2015 John Allison (visXXX-V10-04-00)
- G4XXXStoredViewer::CompareForKernelVisit, G4XXXSGViewer::CompareForKernelVisit
o Implement comparison for "colour by density".
31st August 2016 John Allison (visXXX-V10-02-01)
- Fix G4Orb and G4Ellipsoid hiding warnings.
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4XXXSGViewer.cc 95225 2016-02-01 09:15:32Z gcosmo $
// $Id: G4XXXSGViewer.cc 109510 2018-04-26 07:15:57Z gcosmo $
//
//
// John Allison 10th March 2006
@@ -122,6 +122,8 @@ G4bool G4XXXSGViewer::CompareForKernelVisit(G4ViewParameters& lastVP)
(lastVP.IsCullingInvisible () != fVP.IsCullingInvisible ()) ||
(lastVP.IsDensityCulling () != fVP.IsDensityCulling ()) ||
(lastVP.IsCullingCovered () != fVP.IsCullingCovered ()) ||
(lastVP.GetCBDAlgorithmNumber() !=
fVP.GetCBDAlgorithmNumber()) ||
// No need to visit kernel if section plane changes.
// No need to visit kernel if cutaway planes change.
(lastVP.IsExplode () != fVP.IsExplode ()) ||
@@ -142,6 +144,11 @@ G4bool G4XXXSGViewer::CompareForKernelVisit(G4ViewParameters& lastVP)
(lastVP.GetVisibleDensity () != fVP.GetVisibleDensity ()))
return true;
if (lastVP.GetCBDAlgorithmNumber() > 0) {
if (lastVP.GetCBDParameters().size() != fVP.GetCBDParameters().size()) return true;
else if (lastVP.GetCBDParameters() != fVP.GetCBDParameters()) return true;
}
if (lastVP.IsExplode () &&
(lastVP.GetExplodeFactor () != fVP.GetExplodeFactor ()))
return true;
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4XXXStoredViewer.cc 95225 2016-02-01 09:15:32Z gcosmo $
// $Id: G4XXXStoredViewer.cc 109510 2018-04-26 07:15:57Z gcosmo $
//
//
// John Allison 7th March 2006
@@ -120,6 +120,8 @@ G4bool G4XXXStoredViewer::CompareForKernelVisit(G4ViewParameters& lastVP)
(lastVP.IsCullingInvisible () != fVP.IsCullingInvisible ()) ||
(lastVP.IsDensityCulling () != fVP.IsDensityCulling ()) ||
(lastVP.IsCullingCovered () != fVP.IsCullingCovered ()) ||
(lastVP.GetCBDAlgorithmNumber() !=
fVP.GetCBDAlgorithmNumber()) ||
// No need to visit kernel if section plane changes.
// No need to visit kernel if cutaway planes change.
(lastVP.IsExplode () != fVP.IsExplode ()) ||
@@ -140,6 +142,11 @@ G4bool G4XXXStoredViewer::CompareForKernelVisit(G4ViewParameters& lastVP)
(lastVP.GetVisibleDensity () != fVP.GetVisibleDensity ()))
return true;
if (lastVP.GetCBDAlgorithmNumber() > 0) {
if (lastVP.GetCBDParameters().size() != fVP.GetCBDParameters().size()) return true;
else if (lastVP.GetCBDParameters() != fVP.GetCBDParameters()) return true;
}
if (lastVP.IsExplode () &&
(lastVP.GetExplodeFactor () != fVP.GetExplodeFactor ()))
return true;
+26
View File
@@ -0,0 +1,26 @@
$Id: History 110493 2018-05-25 20:44:11Z allison $
-------------------------------------------------------------------
=========================================================
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
=========================================================
Category History file
---------------------
This file should be used by G4 developers and category coordinators
to briefly summarize all major modifications introduced in the code
and keep track of all category-tags.
It DOES NOT substitute the CVS log-message one should put at every
committal in the CVS repository !
----------------------------------------------------------
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
28 May 2018 Gabriele Cosmo (visexternals-V10-04-01)
- visexternalgl2ps-V10-04-01: Corrected GNUmakefile, now requiring dependency
on global module.
26 May 2018 John Allison (visexternals-V10-04-00)
- visexternalgl2ps-V10-04-00: Fix gcc-8 warnings.
+2 -1
View File
@@ -1,4 +1,4 @@
# $Id: GNUmakefile 68732 2013-04-05 09:44:10Z gcosmo $
# $Id: GNUmakefile 110519 2018-05-28 07:53:49Z gcosmo $
# -------------------------------------------------------------
# GNUmakefile for gl2ps. Laurent Garnier, 6/2/09.
@@ -22,6 +22,7 @@ QTFLAGS =
QTLIBS =
GLQTLIBS =
CPPFLAGS += -I$(G4BASE)/global/management/include
ifdef G4LIB_BUILD_ZLIB
CPPFLAGS += -I$(G4BASE)/externals/zlib/include
endif
+7 -1
View File
@@ -1,4 +1,4 @@
$Id: History 104287 2017-05-23 13:22:34Z gcosmo $
$Id: History 110519 2018-05-28 07:53:49Z gcosmo $
-------------------------------------------------------------------
=========================================================
@@ -17,6 +17,12 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
28 May 2018 Gabriele Cosmo (visexternalgl2ps-V10-04-01)
- Corrected GNUmakefile, now requiring dependency on global module.
26 May 2018 John Allison (visexternalgl2ps-V10-04-00)
- Fix gcc-8 warnings.
23rd May 2017 John Allison (visexternal-V10-03-00)
- Fix gcc-7.1 warning.
@@ -23,14 +23,13 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4OpenGL2PSAction.hh 88190 2015-02-02 17:24:54Z gcosmo $
// $Id: G4OpenGL2PSAction.hh 110513 2018-05-28 07:37:38Z gcosmo $
//
#ifndef G4OpenGL2PSAction_h
#define G4OpenGL2PSAction_h
#include <string>
#include "globals.hh"
#include "Geant4_gl2ps.h"
class G4OpenGL2PSAction {
@@ -56,7 +55,7 @@ public:
protected:
bool G4gl2psBegin();
const char * fFileName;
G4String fFileName;
FILE* fFile;
GLint fViewport[4];
GLint fBufferSize;
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4OpenGL2PSAction.cc 88206 2015-02-03 13:01:27Z gcosmo $
// $Id: G4OpenGL2PSAction.cc 110513 2018-05-28 07:37:38Z gcosmo $
//
//
@@ -48,7 +48,6 @@ G4OpenGL2PSAction::G4OpenGL2PSAction(
//////////////////////////////////////////////////////////////////////////////
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
{
fFileName = "";
fFile = 0;
fViewport[0] = 0;
fViewport[1] = 0;
@@ -112,7 +111,7 @@ void G4OpenGL2PSAction::setFileName(
//////////////////////////////////////////////////////////////////////////////
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
{
fFileName = (strncpy((char*)malloc((unsigned)strlen(aFileName) + 1), aFileName, (unsigned)strlen(aFileName) + 1));
fFileName = aFileName;
}
//////////////////////////////////////////////////////////////////////////////
bool G4OpenGL2PSAction::enableFileWriting(
@@ -192,7 +191,7 @@ bool G4OpenGL2PSAction::G4gl2psBegin(
options,
GL_RGBA,0, NULL,0,0,0,
fBufferSize,
fFile,fFileName);
fFile,fFileName.c_str());
if (res == GL2PS_ERROR) {
return false;
}
+4 -1
View File
@@ -1,4 +1,4 @@
$Id: History 104291 2017-05-23 13:25:51Z gcosmo $
$Id: History 110513 2018-05-28 07:37:38Z gcosmo $
-------------------------------------------------------------------
=========================================================
@@ -20,6 +20,9 @@ committal in the CVS repository !
History file for visualization/gMocren sub-category
---------------------------------------------------
26 May 2018 John Allison (gMocren-V10-04-00)
- Fix gcc-8 warnings.
23rd May 2017 John Allison (gMocren-V10-03-00)
- Fixes for gcc-7.1 warnings.
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4GMocrenFileSceneHandler.cc 104291 2017-05-23 13:25:51Z gcosmo $
// $Id: G4GMocrenFileSceneHandler.cc 110513 2018-05-28 07:37:38Z gcosmo $
//
//
// Created: Mar. 31, 2009 Akinori Kimura
@@ -158,7 +158,8 @@ G4GMocrenFileSceneHandler::G4GMocrenFileSceneHandler(G4GMocrenFile& system,
if ( std::getenv( "G4GMocrenFile_MAX_FILE_NUM" ) != NULL ) {
char * pcFileNum = getenv("G4GMocrenFile_MAX_FILE_NUM");
char c10FileNum[10];
std::strncpy(c10FileNum, pcFileNum, 10);
std::strncpy(c10FileNum, pcFileNum, 9);
c10FileNum[9] = '\0';
kMaxFileNum = std::atoi(c10FileNum);
} else {
@@ -208,10 +209,12 @@ void G4GMocrenFileSceneHandler::SetGddFileName()
const G4int MAX_FILE_INDEX = kMaxFileNum - 1 ;
// dest directory (null if no environmental variables is set)
std::strncpy(kGddFileName, kGddDestDir, std::strlen(kGddDestDir)+1);
std::strncpy(kGddFileName, kGddDestDir, sizeof(kGddFileName)-1);
kGddFileName[sizeof(kGddFileName)-1] = '\0';
// create full path name (default)
std::strncat ( kGddFileName, DEFAULT_GDD_FILE_NAME, std::strlen(DEFAULT_GDD_FILE_NAME));
std::strncat ( kGddFileName, DEFAULT_GDD_FILE_NAME,
sizeof(kGddFileName) - std::strlen(kGddFileName) - 1);
// Automatic updation of file names
static G4int currentNumber = 0;
@@ -236,7 +239,8 @@ void G4GMocrenFileSceneHandler::SetGddFileName()
filename
<< kGddDestDir << GDD_FILE_HEADER
<< std::setw(2) << std::setfill('0') << i << ".wrl";
strncpy(kGddFileName,filename.str().c_str(),sizeof(kGddFileName));
strncpy(kGddFileName,filename.str().c_str(),sizeof(kGddFileName)-1);
kGddFileName[sizeof(kGddFileName)-1] = '\0';
// check validity of the file name
std::ifstream fin(kGddFileName);
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4GMocrenFileViewer.cc 87360 2014-12-01 16:07:16Z gcosmo $
// $Id: G4GMocrenFileViewer.cc 110513 2018-05-28 07:37:38Z gcosmo $
//
//
// Created: Mar. 31, 2009 Akinori Kimura
@@ -74,7 +74,8 @@ G4GMocrenFileViewer::G4GMocrenFileViewer (G4GMocrenFileSceneHandler& sceneHandle
"gMocren1000", FatalException,
"Invalid length of string set in G4GMocrenFile_VIEWER");
}
std::strncpy( kG4GddViewer, env, len);
std::strncpy( kG4GddViewer, env, sizeof(kG4GddViewer) - 1);
kG4GddViewer[sizeof(kG4GddViewer) - 1] = '\0';
//std::strcpy( kG4GddViewer, getenv( "G4GMocrenFile_VIEWER" ) ) ;
}
@@ -85,8 +86,11 @@ G4GMocrenFileViewer::G4GMocrenFileViewer (G4GMocrenFileSceneHandler& sceneHandle
kG4GddViewerInvocation[0] = '\0';
} else {
std::strncpy( kG4GddViewerInvocation, kG4GddViewer, std::strlen(kG4GddViewer));
std::strncat( kG4GddViewerInvocation, " ", 1);
std::strncpy( kG4GddViewerInvocation, kG4GddViewer,
sizeof(kG4GddViewerInvocation) - 1);
kG4GddViewerInvocation[sizeof(kG4GddViewerInvocation) - 1] = '\0';
std::strncat( kG4GddViewerInvocation, " ",
sizeof(kG4GddViewerInvocation) - std::strlen(kG4GddViewerInvocation) - 1);
const char * gddfname = kSceneHandler.GetGddFileName();
int len = std::strlen(gddfname);
if(len >= 64) {
@@ -94,7 +98,8 @@ G4GMocrenFileViewer::G4GMocrenFileViewer (G4GMocrenFileSceneHandler& sceneHandle
"gMocren1001", FatalException,
"Invalid length of the GDD file name");
}
std::strncat( kG4GddViewerInvocation, gddfname, len );
std::strncat( kG4GddViewerInvocation, gddfname,
sizeof(kG4GddViewerInvocation) - std::strlen(kG4GddViewerInvocation) - 1);
}
}
@@ -177,8 +182,11 @@ void G4GMocrenFileViewer::ShowView( void )
//std::strcpy( kG4GddViewerInvocation, "" );
} else {
std::strncpy( kG4GddViewerInvocation, kG4GddViewer, std::strlen(kG4GddViewer));
std::strncat( kG4GddViewerInvocation, " ", 1);
std::strncpy( kG4GddViewerInvocation, kG4GddViewer,
sizeof(kG4GddViewerInvocation) - 1);
kG4GddViewerInvocation[sizeof(kG4GddViewerInvocation) - 1] = '\0';
std::strncat( kG4GddViewerInvocation, " ",
sizeof(kG4GddViewerInvocation) - std::strlen(kG4GddViewerInvocation) - 1);
const char * gddfname = kSceneHandler.GetGddFileName();
int len = std::strlen(gddfname);
if(len >= 64) {
@@ -186,7 +194,8 @@ void G4GMocrenFileViewer::ShowView( void )
"gMocren1002", FatalException,
"Invalid length of the GDD file name");
}
std::strncat( kG4GddViewerInvocation, gddfname, len);
std::strncat( kG4GddViewerInvocation, gddfname,
sizeof(kG4GddViewerInvocation) - std::strlen(kG4GddViewerInvocation) - 1);
}
}
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4GMocrenIO.cc 75179 2013-10-29 10:09:31Z gcosmo $
// $Id: G4GMocrenIO.cc 110513 2018-05-28 07:37:38Z gcosmo $
//
//
// File I/O manager class for writing or reading calcuated dose
@@ -506,13 +506,9 @@ bool G4GMocrenIO::storeData4() {
// comment
char cmt[1025];
for(int i = 0; i < 1025; i++) cmt[i] = '\0';
//std::strncpy(cmt, kComment.c_str(), 1024);
const char * cmnt = kComment.c_str();
size_t lcm = std::strlen(cmnt);
if(lcm > 1024) lcm = 1024;
std::strncpy(cmt, cmnt, lcm);
ofile.write((char *)cmt, 1024);
std::strncpy(cmt, kComment.c_str(), 1024);
cmt[1024] = '\0';
ofile.write(cmt, 1024);
if(DEBUG || kVerbose > 0) {
G4cout << "Data comment : "
<< kComment << G4endl;
@@ -737,12 +733,9 @@ bool G4GMocrenIO::storeData4() {
// dose distribution unit
char cdunit[13];
for(int i = 0; i < 13; i++) cdunit[i] = '\0';
const char * cu = kDoseUnit.c_str();
size_t lcu = std::strlen(cu);
if(lcu > 12) lcu = 12;
std::strncpy(cdunit, cu, lcu);
ofile.write((char *)cdunit, 12);
std::strncpy(cdunit, kDoseUnit.c_str(), 12);
cdunit[12] = '\0';
ofile.write(cdunit, 12);
if(DEBUG || kVerbose > 0) {
G4cout << "Dose dist. unit : " << kDoseUnit << G4endl;
}
+70 -1
View File
@@ -1,4 +1,4 @@
$Id: History 106957 2017-10-31 08:32:27Z gcosmo $
$Id: History 110513 2018-05-28 07:37:38Z gcosmo $
-------------------------------------------------------------------
@@ -26,6 +26,75 @@ committal in the CVS repository !
History file for visualization management sub-category
------------------------------------------------------
25 May 2018 John Allison (visman-V10-04-11)
- Introduce /vis/drawLogicalVolume:
o Synonymous with /vis/specify.
o Both commands create a new scene and invoke /vis/scene/add/logicalVolume.
24 May 2018 John Allison (visman-V10-04-10)
- /vis/specify, /vis/scene/add/logicalVolume:
o Include overlap checking.
08 May 2018 Ben Morgan (visman-V10-04-09)
- G4VisCommandsMultithreading.cc:
- Explicitly #include G4Types header before use
of G4MULTITHREADED symbol. This prepares visman
for migration from -D flags to explicit header-set
#defines. It is backward compatible with old system.
25 April 2018 John Allison (visman-V10-04-08)
- G4VSceneHandler::CreateModelingParameters:
o Copy colour-by-density to modeling parameters.
24 April 2018 John Allison (visman-V10-04-07)
- G4ViewParameters.cc: Small bug fix.
24 April 2018 John Allison (visman-V10-04-06)
- Co-works greps-V10-04-04.
23 April 2018 John Allison (visman-V10-04-05)
- Co-works greps-V10-04-03.
- G4VisCommandsViewerSet.cc: /vis/viewer/set/timeWindow/ commands:
o Migrate to greps-V10-04-03.
- G4VisCommandsViewer.cc: Fix small error in guidance.
- G4ViewParameters.cc:
o Complete implementation of /vis/viewer/colourByDensity, e.g.,
operator<<, etc.
o Migrate to greps-V10-04-03.
22 April 2018 John Allison
- G4VisCommandsViewer, G4ViewParameters:
o Add /vis/viewer/colourByDensity.
22 April 2018 John Allison (visman-V10-04-04)
- G4VSceneHandler.cc: Reduced repetitive error messages.
31st March 2018 John Allison
- /vis/viewer/set/culling density: further cosmetic improvement.
30th March 2018 John Allison
- /vis/viewer/set/culling density: cosmetic improvement.
28th March 2018 John Allison (visman-V10-04-03)
- Introduce G4VVisCommand::ProvideValueOfUnit.
- /vis/viewer/set/culling density:
o Use G4VVisCommand::ProvideValueOfUnit.
o Fix bug and improve parsing.
- /vis/drawTree: Improve guidance.
11th March 2018 John Allison (visman-V10-04-02)
- G4VViewer.hh: Improve comments about switching threads.
8th January 2018 John Allison (visman-V10-04-01)
- Merged timemovebranch:
o Moved time window parameters from G4OpenGLStoredViewer to
G4ViewParameters. Now one can interpolate time window parameters (using
/vis/viewer/interpolate) and make a movie of particles moving through time.
o See vis-V10-04-00 History for more details.
12th December 2017 John Allison (visman-V10-04-00)
- G4ViewParameters.cc: Minor cosmetic.
29th October 2017 John Allison (visman-V10-03-16)
- G4VisManager.cc: Protect /vis/enable issued before run established.
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4VViewer.hh 99668 2016-09-30 08:02:13Z gcosmo $
// $Id: G4VViewer.hh 108859 2018-03-12 07:44:53Z gcosmo $
//
//
// John Allison 27th March 1996
@@ -102,17 +102,32 @@ public: // With description
std::vector<G4ThreeVector> ComputeFlyThrough(G4Vector3D*);
#ifdef G4MULTITHREADED
// In MT mode these functions are called in the following order for each run:
// Note: the order of calling of MovingToVisSubThread and SwitchToVisSubThread
// is undefined, so you may need to implement mutexes to ensure your preferred
// order - see, e.g., G4OpenGLQtViewer. To summarise, the order of calling is
// as follows - see G4VisManager.cc.
// DoneWithMasterThread
// MovingToVisSubThread ) or ( SwitchToVisSubThread
// SwitchToVisSubThread ) ( MovingToVisSubThread
// DoneWithVisSubThread
// MovingToMasterThread
// SwitchToMasterThread
// Called on the master thread before starting the vis sub-thread.
virtual void DoneWithMasterThread ();
// Called on the master thread after starting the vis sub-thread.
virtual void MovingToVisSubThread ();
// Called on the vis sub-thread when waiting for events.
// Called on the vis sub-thread at start of vis sub-thread.
virtual void SwitchToVisSubThread ();
// Called on the vis sub-thread when all events have been processed.
virtual void DoneWithVisSubThread ();
// Called on the vis sub-thread when all events have been processed.
virtual void MovingToMasterThread ();
// Called on the master thread after the vis sub-thread has terminated.
virtual void SwitchToMasterThread ();
#endif
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4VVisCommand.hh 105349 2017-07-21 12:23:24Z gcosmo $
// $Id: G4VVisCommand.hh 109186 2018-04-03 07:22:18Z gcosmo $
// Base class for visualization commands - John Allison 9th August 1998
// It is really a messenger - we have one command per messenger.
@@ -87,6 +87,13 @@ protected:
// third and fourth arguments are ignored), or
// (1.,0.,0.,0.5): this also will be red with opacity 0.5.
G4bool ProvideValueOfUnit
(const G4String& where,
const G4String& unit,
const G4String& category,
G4double& value);
// Return false if there's a problem
// Other utilities.
void UpdateVisManagerScene (const G4String& sceneName = "");
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4ViewParameters.hh 99418 2016-09-21 09:18:42Z gcosmo $
// $Id: G4ViewParameters.hh 109510 2018-04-26 07:15:57Z gcosmo $
//
//
// John Allison 19th July 1996
@@ -129,6 +129,8 @@ public: // With description
G4bool IsDensityCulling () const;
G4double GetVisibleDensity () const;
G4bool IsCullingCovered () const;
G4int GetCBDAlgorithmNumber () const;
const std::vector<G4double>& GetCBDParameters () const;
G4bool IsSection () const;
const G4Plane3D& GetSectionPlane () const;
G4bool IsCutaway () const;
@@ -179,7 +181,25 @@ public: // With description
RotationStyle GetRotationStyle () const;
const std::vector<G4ModelingParameters::VisAttributesModifier>&
GetVisAttributesModifiers () const;
G4double GetStartTime () const;
G4double GetEndTime () const;
G4double GetFadeFactor () const;
G4bool IsDisplayHeadTime () const;
G4double GetDisplayHeadTimeX () const;
G4double GetDisplayHeadTimeY () const;
G4double GetDisplayHeadTimeSize () const;
G4double GetDisplayHeadTimeRed () const;
G4double GetDisplayHeadTimeGreen () const;
G4double GetDisplayHeadTimeBlue () const;
G4bool IsDisplayLightFront () const;
G4double GetDisplayLightFrontX () const;
G4double GetDisplayLightFrontY () const;
G4double GetDisplayLightFrontZ () const;
G4double GetDisplayLightFrontT () const;
G4double GetDisplayLightFrontRed () const;
G4double GetDisplayLightFrontGreen () const;
G4double GetDisplayLightFrontBlue () const;
// Here Follow functions to evaluate useful quantities as a
// function of the radius of the Bounding Sphere of the object being
// viewed. Call them in the order given - for efficiency, later
@@ -200,6 +220,8 @@ public: // With description
void SetDensityCulling (G4bool);
void SetVisibleDensity (G4double visibleDensity);
void SetCullingCovered (G4bool);
void SetCBDAlgorithmNumber (G4int);
void SetCBDParameters (const std::vector<G4double>&);
void SetSectionPlane (const G4Plane3D& sectionPlane);
void UnsetSectionPlane ();
void SetCutawayMode (CutawayMode);
@@ -250,6 +272,24 @@ public: // With description
void SetRotationStyle (RotationStyle);
void ClearVisAttributesModifiers ();
void AddVisAttributesModifier(const G4ModelingParameters::VisAttributesModifier&);
void SetStartTime (G4double);
void SetEndTime (G4double);
void SetFadeFactor (G4double);
void SetDisplayHeadTime (G4bool);
void SetDisplayHeadTimeX (G4double);
void SetDisplayHeadTimeY (G4double);
void SetDisplayHeadTimeSize (G4double);
void SetDisplayHeadTimeRed (G4double);
void SetDisplayHeadTimeGreen (G4double);
void SetDisplayHeadTimeBlue (G4double);
void SetDisplayLightFront (G4bool);
void SetDisplayLightFrontX (G4double);
void SetDisplayLightFrontY (G4double);
void SetDisplayLightFrontZ (G4double);
void SetDisplayLightFrontT (G4double);
void SetDisplayLightFrontRed (G4double);
void SetDisplayLightFrontGreen (G4double);
void SetDisplayLightFrontBlue (G4double);
// Command dumping functions.
// For camera commands we need to provide the standard target point from
@@ -258,7 +298,8 @@ public: // With description
G4String DrawingStyleCommands () const;
G4String SceneModifyingCommands() const;
G4String TouchableCommands () const;
G4String TimeWindowCommands () const;
// Other functions.
void PrintDifferences (const G4ViewParameters& v) const;
@@ -287,6 +328,8 @@ private:
G4bool fDensityCulling; // Density culling requested. If so...
G4double fVisibleDensity; // ...density lower than this not drawn.
G4bool fCullCovered; // Cull daughters covered by opaque mothers.
G4int fCBDAlgorithmNumber; // Colour by density algorithm number.
std::vector<G4double> fCBDParameters; // Colour by density parameters.
G4bool fSection; // Section drawing requested (DCUT in GEANT3).
G4Plane3D fSectionPlane; // Cut plane for section drawing (DCUT).
CutawayMode fCutawayMode; // Cutaway mode.
@@ -329,6 +372,16 @@ private:
G4bool fPicking; // Request picking.
RotationStyle fRotationStyle; // Rotation style.
std::vector<G4ModelingParameters::VisAttributesModifier> fVisAttributesModifiers;
G4double fStartTime, fEndTime; // Time range (e.g., for trajectory steps).
G4double fFadeFactor; // 0: no fade; 1: maximum fade with time within range.
G4bool fDisplayHeadTime; // Display head time (fEndTime) in 2D text.
G4double fDisplayHeadTimeX, fDisplayHeadTimeY; // 2D screen coords.
G4double fDisplayHeadTimeSize; // Screen size.
G4double fDisplayHeadTimeRed, fDisplayHeadTimeGreen, fDisplayHeadTimeBlue;
G4bool fDisplayLightFront;// Display light front at head time originating at
G4double fDisplayLightFrontX, fDisplayLightFrontY, fDisplayLightFrontZ,
fDisplayLightFrontT;
G4double fDisplayLightFrontRed, fDisplayLightFrontGreen, fDisplayLightFrontBlue;
enum { // Constants for geometry mask in ParseGeometry and related functions.
fNoValue = 0,
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4ViewParameters.icc 99418 2016-09-21 09:18:42Z gcosmo $
// $Id: G4ViewParameters.icc 109510 2018-04-26 07:15:57Z gcosmo $
//
//
// John Allison 20th October 1996
@@ -59,6 +59,14 @@ inline G4bool G4ViewParameters::IsCullingCovered () const {
return fCullCovered;
}
inline G4int G4ViewParameters::GetCBDAlgorithmNumber () const {
return fCBDAlgorithmNumber;
}
inline const std::vector<G4double>& G4ViewParameters::GetCBDParameters () const {
return fCBDParameters;
}
inline G4bool G4ViewParameters::IsSection () const {
return fSection;
}
@@ -212,6 +220,78 @@ G4ViewParameters::GetVisAttributesModifiers() const {
return fVisAttributesModifiers;
}
inline G4double G4ViewParameters::GetStartTime () const {
return fStartTime;
}
inline G4double G4ViewParameters::GetEndTime () const {
return fEndTime;
}
inline G4double G4ViewParameters::GetFadeFactor () const {
return fFadeFactor;
}
inline G4bool G4ViewParameters::IsDisplayHeadTime () const {
return fDisplayHeadTime;
}
inline G4double G4ViewParameters::GetDisplayHeadTimeX () const {
return fDisplayHeadTimeX;
}
inline G4double G4ViewParameters::GetDisplayHeadTimeY () const {
return fDisplayHeadTimeY;
}
inline G4double G4ViewParameters::GetDisplayHeadTimeSize () const {
return fDisplayHeadTimeSize;
}
inline G4double G4ViewParameters::GetDisplayHeadTimeRed () const {
return fDisplayHeadTimeRed;
}
inline G4double G4ViewParameters::GetDisplayHeadTimeGreen () const {
return fDisplayHeadTimeGreen;
}
inline G4double G4ViewParameters::GetDisplayHeadTimeBlue () const {
return fDisplayHeadTimeBlue;
}
inline G4bool G4ViewParameters::IsDisplayLightFront () const {
return fDisplayLightFront;
}
inline G4double G4ViewParameters::GetDisplayLightFrontX () const {
return fDisplayLightFrontX;
}
inline G4double G4ViewParameters::GetDisplayLightFrontY () const {
return fDisplayLightFrontY;
}
inline G4double G4ViewParameters::GetDisplayLightFrontZ () const {
return fDisplayLightFrontZ;
}
inline G4double G4ViewParameters::GetDisplayLightFrontT () const {
return fDisplayLightFrontT;
}
inline G4double G4ViewParameters::GetDisplayLightFrontRed () const {
return fDisplayLightFrontRed;
}
inline G4double G4ViewParameters::GetDisplayLightFrontGreen () const {
return fDisplayLightFrontGreen;
}
inline G4double G4ViewParameters::GetDisplayLightFrontBlue () const {
return fDisplayLightFrontBlue;
}
inline void
G4ViewParameters::SetDrawingStyle (G4ViewParameters::DrawingStyle style) {
fDrawingStyle = style;
@@ -237,6 +317,14 @@ inline void G4ViewParameters::SetCullingCovered (G4bool value) {
fCullCovered = value;
}
inline void G4ViewParameters::SetCBDAlgorithmNumber (G4int n) {
fCBDAlgorithmNumber = n;
}
inline void G4ViewParameters::SetCBDParameters (const std::vector<G4double>& p) {
fCBDParameters = p;
}
inline void G4ViewParameters::SetSectionPlane (const G4Plane3D& sectionPlane) {
fSection = true;
fSectionPlane = sectionPlane;
@@ -391,3 +479,74 @@ inline void G4ViewParameters::ClearVisAttributesModifiers () {
fVisAttributesModifiers.clear ();
}
inline void G4ViewParameters::SetStartTime (G4double startTime) {
fStartTime = startTime;
}
inline void G4ViewParameters::SetEndTime (G4double endTime) {
fEndTime = endTime;
}
inline void G4ViewParameters::SetFadeFactor (G4double fadeFactor) {
fFadeFactor = fadeFactor;
}
inline void G4ViewParameters::SetDisplayHeadTime (G4bool displayHeadTime) {
fDisplayHeadTime = displayHeadTime;
}
inline void G4ViewParameters::SetDisplayHeadTimeX (G4double displayHeadTimeX) {
fDisplayHeadTimeX = displayHeadTimeX;
}
inline void G4ViewParameters::SetDisplayHeadTimeY (G4double displayHeadTimeY) {
fDisplayHeadTimeY = displayHeadTimeY;
}
inline void G4ViewParameters::SetDisplayHeadTimeSize (G4double displayHeadTimeSize) {
fDisplayHeadTimeSize = displayHeadTimeSize;
}
inline void G4ViewParameters::SetDisplayHeadTimeRed (G4double displayHeadTimeRed) {
fDisplayHeadTimeRed = displayHeadTimeRed;
}
inline void G4ViewParameters::SetDisplayHeadTimeGreen (G4double displayHeadTimeGreen) {
fDisplayHeadTimeGreen = displayHeadTimeGreen;
}
inline void G4ViewParameters::SetDisplayHeadTimeBlue (G4double displayHeadTimeBlue) {
fDisplayHeadTimeBlue = displayHeadTimeBlue;
}
inline void G4ViewParameters::SetDisplayLightFront (G4bool displayLightFront) {
fDisplayLightFront = displayLightFront;
}
inline void G4ViewParameters::SetDisplayLightFrontX (G4double displayLightFrontX) {
fDisplayLightFrontX = displayLightFrontX;
}
inline void G4ViewParameters::SetDisplayLightFrontY (G4double displayLightFrontY) {
fDisplayLightFrontY = displayLightFrontY;
}
inline void G4ViewParameters::SetDisplayLightFrontZ (G4double displayLightFrontZ) {
fDisplayLightFrontZ = displayLightFrontZ;
}
inline void G4ViewParameters::SetDisplayLightFrontT (G4double displayLightFrontT) {
fDisplayLightFrontT = displayLightFrontT;
}
inline void G4ViewParameters::SetDisplayLightFrontRed (G4double displayLightFrontRed) {
fDisplayLightFrontRed = displayLightFrontRed;
}
inline void G4ViewParameters::SetDisplayLightFrontGreen (G4double displayLightFrontGreen) {
fDisplayLightFrontGreen = displayLightFrontGreen;
}
inline void G4ViewParameters::SetDisplayLightFrontBlue (G4double displayLightFrontBlue) {
fDisplayLightFrontBlue = displayLightFrontBlue;
}
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4VisCommandsCompound.hh 66373 2012-12-18 09:41:34Z gcosmo $
// $Id: G4VisCommandsCompound.hh 110513 2018-05-28 07:37:38Z gcosmo $
// Compound /vis/ commands - John Allison 15th May 2000
@@ -55,7 +55,18 @@ private:
G4UIcommand* fpCommand;
};
class G4VisCommandDrawVolume: public G4VVisCommand {
class G4VisCommandDrawLogicalVolume: public G4VVisCommand {
public:
G4VisCommandDrawLogicalVolume ();
virtual ~G4VisCommandDrawLogicalVolume ();
void SetNewValue (G4UIcommand* command, G4String newValue);
private:
G4VisCommandDrawLogicalVolume (const G4VisCommandDrawLogicalVolume&);
G4VisCommandDrawLogicalVolume& operator = (const G4VisCommandDrawLogicalVolume&);
G4UIcommand* fpCommand;
};
class G4VisCommandDrawVolume: public G4VVisCommand {
public:
G4VisCommandDrawVolume ();
virtual ~G4VisCommandDrawVolume ();
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4VisCommandsViewer.hh 102234 2017-01-13 15:59:41Z gcosmo $
// $Id: G4VisCommandsViewer.hh 109510 2018-04-26 07:15:57Z gcosmo $
// /vis/viewer commands - John Allison 25th October 1998
@@ -140,6 +140,18 @@ private:
G4UIcommand* fpCommand;
};
class G4VisCommandViewerColourByDensity: public G4VVisCommandViewer {
public:
G4VisCommandViewerColourByDensity ();
virtual ~G4VisCommandViewerColourByDensity ();
G4String GetCurrentValue (G4UIcommand* command);
void SetNewValue (G4UIcommand* command, G4String newValue);
private:
G4VisCommandViewerColourByDensity (const G4VisCommandViewerColourByDensity&);
G4VisCommandViewerColourByDensity& operator = (const G4VisCommandViewerColourByDensity&);
G4UIcommand* fpCommand;
};
class G4VisCommandViewerCopyViewFrom: public G4VVisCommandViewer {
public:
G4VisCommandViewerCopyViewFrom ();
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4VisCommandsViewerSet.hh 66373 2012-12-18 09:41:34Z gcosmo $
// $Id: G4VisCommandsViewerSet.hh 108131 2018-01-09 13:23:26Z gcosmo $
// /vis/viewer/set commands - John Allison 16th May 2000
@@ -35,6 +35,7 @@
#include <vector>
class G4UIdirectory;
class G4UIcommand;
class G4UIcmdWithAString;
class G4UIcmdWithABool;
@@ -82,6 +83,12 @@ private:
G4UIcommand* fpCommandViewpointThetaPhi;
G4UIcommand* fpCommandViewpointVector;
G4ThreeVector fViewpointVector;
G4UIdirectory* fpTimeWindowDirectory;
G4UIcommand* fpCommandTimeWindowDisplayHeadTime;
G4UIcommand* fpCommandTimeWindowDisplayLightFront;
G4UIcommand* fpCommandTimeWindowEndTime;
G4UIcmdWithADouble* fpCommandTimeWindowFadeFactor;
G4UIcommand* fpCommandTimeWindowStartTime;
};
#endif
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4VSceneHandler.cc 102802 2017-02-22 15:19:00Z gcosmo $
// $Id: G4VSceneHandler.cc 109510 2018-04-26 07:15:57Z gcosmo $
//
//
// John Allison 19th July 1996
@@ -594,12 +594,16 @@ void G4VSceneHandler::RequestPrimitives (const G4VSolid& solid) {
if (pPVModel) {
G4cerr << pPVModel->GetFullPVPath();
}
G4cerr <<
"\n This means it cannot be visualized on most systems (try RayTracer)."
"\n 1) The solid may not have implemented the CreatePolyhedron method."
"\n 2) For Boolean solids, the BooleanProcessor, which attempts to create"
"\n the resultant polyhedron, may have failed."
<< G4endl;
static G4bool explanation = false;
if (!explanation) {
explanation = true;
G4cerr <<
"\n This means it cannot be visualized on most systems (try RayTracer)."
"\n 1) The solid may not have implemented the CreatePolyhedron method."
"\n 2) For Boolean solids, the BooleanProcessor, which attempts to create"
"\n the resultant polyhedron, may have failed.";
}
G4cerr << G4endl;
}
}
}
@@ -819,6 +823,9 @@ G4ModelingParameters* G4VSceneHandler::CreateModelingParameters ()
pModelingParams->SetWarning
(G4VisManager::GetVerbosity() >= G4VisManager::warnings);
pModelingParams->SetCBDAlgorithmNumber(vp.GetCBDAlgorithmNumber());
pModelingParams->SetCBDParameters(vp.GetCBDParameters());
pModelingParams->SetExplodeFactor(vp.GetExplodeFactor());
pModelingParams->SetExplodeCentre(vp.GetExplodeCentre());
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4VVisCommand.cc 105349 2017-07-21 12:23:24Z gcosmo $
// $Id: G4VVisCommand.cc 109510 2018-04-26 07:15:57Z gcosmo $
// Base class for visualization commands - John Allison 9th August 1998
// It is really a messenger - we have one command per messenger.
@@ -156,6 +156,38 @@ void G4VVisCommand::ConvertToColour
}
}
G4bool G4VVisCommand::ProvideValueOfUnit
(const G4String& where,
const G4String& unit,
const G4String& category,
G4double& value)
{
// Return false if there's a problem
G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
G4bool success = true;
if (!G4UnitDefinition::IsUnitDefined(unit)) {
if (verbosity >= G4VisManager::warnings) {
G4cerr << where
<< "\n Unit \"" << unit << "\" not defined"
<< G4endl;
}
success = false;
} else if (G4UnitDefinition::GetCategory(unit) != category) {
if (verbosity >= G4VisManager::warnings) {
G4cerr << where
<< "\n Unit \"" << unit << "\" not a unit of " << category;
if (category == "Volumic Mass") G4cerr << " (density)";
G4cerr << G4endl;
}
success = false;
} else {
value = G4UnitDefinition::GetValueOf(unit);
}
return success;
}
void G4VVisCommand::UpdateVisManagerScene
(const G4String& sceneName) {
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4ViewParameters.cc 106122 2017-09-13 12:51:53Z gcosmo $
// $Id: G4ViewParameters.cc 109510 2018-04-26 07:15:57Z gcosmo $
//
//
// John Allison 19th July 1996
@@ -48,6 +48,7 @@ G4ViewParameters::G4ViewParameters ():
fDensityCulling (false),
fVisibleDensity (0.01 * g / cm3),
fCullCovered (false),
fCBDAlgorithmNumber (0),
fSection (false),
fSectionPlane (),
fCutawayMode (cutawayUnion),
@@ -80,7 +81,25 @@ G4ViewParameters::G4ViewParameters ():
fAutoRefresh (false),
fBackgroundColour (G4Colour(0.,0.,0.)), // Black
fPicking (false),
fRotationStyle (constrainUpDirection)
fRotationStyle (constrainUpDirection),
fStartTime(-G4VisAttributes::fVeryLongTime),
fEndTime(G4VisAttributes::fVeryLongTime),
fFadeFactor(0.),
fDisplayHeadTime(false),
fDisplayHeadTimeX(-0.9),
fDisplayHeadTimeY(-0.9),
fDisplayHeadTimeSize(24.),
fDisplayHeadTimeRed(0.),
fDisplayHeadTimeGreen(1.),
fDisplayHeadTimeBlue(1.),
fDisplayLightFront(false),
fDisplayLightFrontX(0.),
fDisplayLightFrontY(0.),
fDisplayLightFrontZ(0.),
fDisplayLightFrontT(0.),
fDisplayLightFrontRed(0.),
fDisplayLightFrontGreen(1.),
fDisplayLightFrontBlue(0.)
{
fDefaultMarker.SetScreenSize (5.);
// Markers are 5 pixels "overall" size, i.e., diameter.
@@ -437,7 +456,13 @@ G4String G4ViewParameters::SceneModifyingCommands() const
} else {
oss << "false";
}
oss << "\n/vis/viewer/colourByDensity "
<< fCBDAlgorithmNumber << " g/cm3";
for (auto p: fCBDParameters) {
oss << ' ' << p/(g/cm3);
}
oss << "\n/vis/viewer/set/sectionPlane ";
if (fSection) {
oss << "on "
@@ -485,19 +510,22 @@ G4String G4ViewParameters::TouchableCommands() const
{
std::ostringstream oss;
oss
<< "#\n# Touchable commands"
<< "\n/vis/viewer/clearVisAttributesModifiers";
oss << "#\n# Touchable commands";
const std::vector<G4ModelingParameters::VisAttributesModifier>& vams =
fVisAttributesModifiers;
if (vams.empty()) {
oss << "\n# None";
oss
<< "\n# None"
<< "\n/vis/viewer/clearVisAttributesModifiers";
oss << std::endl;
return oss.str();
}
oss
<< "\n/vis/viewer/clearVisAttributesModifiers";
G4ModelingParameters::PVNameCopyNoPath lastPath;
std::vector<G4ModelingParameters::VisAttributesModifier>::const_iterator
iModifier;
@@ -607,6 +635,61 @@ G4String G4ViewParameters::TouchableCommands() const
return oss.str();
}
G4String G4ViewParameters::TimeWindowCommands() const
{
std::ostringstream oss;
oss << "#\n# Time window commands";
oss
<< "\n/vis/viewer/set/timeWindow/startTime "
<< fStartTime/ns << " ns ";
oss
<< "\n/vis/viewer/set/timeWindow/endTime "
<< fEndTime/ns << " ns ";
oss << "\n/vis/viewer/set/timeWindow/fadeFactor "
<< fFadeFactor;
oss
<< "\n/vis/viewer/set/timeWindow/displayHeadTime ";
if (!fDisplayHeadTime) {
oss << "false";
} else {
oss
<< "true"
<< ' ' << fDisplayHeadTimeX
<< ' ' << fDisplayHeadTimeY
<< ' ' << fDisplayHeadTimeSize
<< ' ' << fDisplayHeadTimeRed
<< ' ' << fDisplayHeadTimeGreen
<< ' ' << fDisplayHeadTimeBlue;
}
oss
<< "\n/vis/viewer/set/timeWindow/displayLightFront ";
if (!fDisplayLightFront) {
oss << "false";
} else {
oss
<< "true"
<< ' ' << fDisplayLightFrontX/mm
<< ' ' << fDisplayLightFrontY/mm
<< ' ' << fDisplayLightFrontZ/mm
<< " mm"
<< ' ' << fDisplayLightFrontT/ns
<< " ns"
<< ' ' << fDisplayLightFrontRed
<< ' ' << fDisplayLightFrontGreen
<< ' ' << fDisplayLightFrontBlue;
}
oss << std::endl;
return oss.str();
}
void G4ViewParameters::PrintDifferences (const G4ViewParameters& v) const {
// Put performance-sensitive parameters first.
@@ -622,6 +705,7 @@ void G4ViewParameters::PrintDifferences (const G4ViewParameters& v) const {
(fDensityCulling != v.fDensityCulling) ||
(fVisibleDensity != v.fVisibleDensity) ||
(fCullCovered != v.fCullCovered) ||
(fCBDAlgorithmNumber != v.fCBDAlgorithmNumber) ||
(fSection != v.fSection) ||
(fNoOfSides != v.fNoOfSides) ||
(fUpVector != v.fUpVector) ||
@@ -649,6 +733,14 @@ void G4ViewParameters::PrintDifferences (const G4ViewParameters& v) const {
)
G4cout << "Difference in 1st batch." << G4endl;
if (fCBDAlgorithmNumber > 0) {
if (fCBDParameters.size() != v.fCBDParameters.size()) {
G4cout << "Difference in number of colour by density parameters." << G4endl;
} else if (fCBDParameters != v.fCBDParameters) {
G4cout << "Difference in values of colour by density parameters." << G4endl;
}
}
if (fSection) {
if (!(fSectionPlane == v.fSectionPlane))
G4cout << "Difference in section planes batch." << G4endl;
@@ -676,10 +768,47 @@ void G4ViewParameters::PrintDifferences (const G4ViewParameters& v) const {
if (fVisAttributesModifiers != v.fVisAttributesModifiers) {
G4cout << "Difference in vis attributes modifiers." << G4endl;
}
if (fStartTime != v.fStartTime ||
fEndTime != v.fEndTime) {
G4cout << "Difference in time window." << G4endl;
}
if (fFadeFactor != v.fFadeFactor) {
G4cout << "Difference in time window fade factor." << G4endl;
}
if (fDisplayHeadTime != v.fDisplayHeadTime) {
G4cout << "Difference in display head time flag." << G4endl;
} else {
if (fDisplayHeadTimeX != v.fDisplayHeadTimeX ||
fDisplayHeadTimeY != v.fDisplayHeadTimeY ||
fDisplayHeadTimeSize != v.fDisplayHeadTimeSize ||
fDisplayHeadTimeRed != v.fDisplayHeadTimeRed ||
fDisplayHeadTimeGreen != v.fDisplayHeadTimeGreen ||
fDisplayHeadTimeBlue != v.fDisplayHeadTimeBlue) {
G4cout << "Difference in display head time parameters." << G4endl;
}
}
if (fDisplayLightFront != v.fDisplayLightFront) {
G4cout << "Difference in display light front flag." << G4endl;
} else {
if (fDisplayLightFrontX != v.fDisplayLightFrontX ||
fDisplayLightFrontY != v.fDisplayLightFrontY ||
fDisplayLightFrontZ != v.fDisplayLightFrontZ ||
fDisplayLightFrontT != v.fDisplayLightFrontT ||
fDisplayLightFrontRed != v.fDisplayLightFrontRed ||
fDisplayLightFrontGreen != v.fDisplayLightFrontGreen ||
fDisplayLightFrontBlue != v.fDisplayLightFrontBlue) {
G4cout << "Difference in display light front parameters." << G4endl;
}
}
}
std::ostream& operator << (std::ostream& os,
const G4ViewParameters::DrawingStyle& style) {
std::ostream& operator <<
(std::ostream& os, const G4ViewParameters::DrawingStyle& style)
{
switch (style) {
case G4ViewParameters::wireframe:
os << "wireframe"; break;
@@ -733,6 +862,16 @@ std::ostream& operator << (std::ostream& os, const G4ViewParameters& v) {
if (v.fCullCovered) os << "on";
else os << "off";
os << "\n Colour by density: ";
if (v.fCBDAlgorithmNumber <= 0) {
os << "inactive";
} else {
os << "Algorithm " << v.fCBDAlgorithmNumber << ", Parameters:";
for (auto p: v.fCBDParameters) {
os << ' ' << G4BestUnit(p,"Volumic Mass");
}
}
os << "\n Section flag: ";
if (v.fSection) os << "true, section/cut plane: " << v.fSectionPlane;
else os << "false";
@@ -844,6 +983,32 @@ std::ostream& operator << (std::ostream& os, const G4ViewParameters& v) {
os << vams;
}
os << "\n Time window parameters:"
<< "\n Start time: " << v.fStartTime/ns << " ns"
<< "\n End time: " << v.fEndTime/ns << " ns"
<< "\n Fade factor: " << v.fFadeFactor;
if (!v.fDisplayHeadTime) {
os << "\n Head time display not requested.";
} else {
os
<< "\n Head time position: "
<< v.fDisplayHeadTimeX << ' ' << v.fDisplayHeadTimeY
<< "\n Head time size: " << v.fDisplayHeadTimeSize
<< "\n Head time colour: " << v.fDisplayHeadTimeRed
<< ' ' << v.fDisplayHeadTimeGreen << ' ' << v.fDisplayHeadTimeBlue;
}
if (!v.fDisplayLightFront) {
os << "\n Light front display not requested.";
} else {
os
<< "\n Light front position: "
<< v.fDisplayLightFrontX/mm << ' ' << v.fDisplayLightFrontY/mm
<< v.fDisplayLightFrontZ/mm << " mm"
<< "\n Light front time: " << v.fDisplayLightFrontT/ns << " ns"
<< "\n Light front colour: " << v.fDisplayLightFrontRed
<< ' ' << v.fDisplayLightFrontGreen << ' ' << v.fDisplayLightFrontBlue;
}
return os;
}
@@ -861,6 +1026,7 @@ G4bool G4ViewParameters::operator != (const G4ViewParameters& v) const {
(fCullInvisible != v.fCullInvisible) ||
(fDensityCulling != v.fDensityCulling) ||
(fCullCovered != v.fCullCovered) ||
(fCBDAlgorithmNumber != v.fCBDAlgorithmNumber) ||
(fSection != v.fSection) ||
(IsCutaway() != v.IsCutaway()) ||
(IsExplode() != v.IsExplode()) ||
@@ -893,6 +1059,11 @@ G4bool G4ViewParameters::operator != (const G4ViewParameters& v) const {
if (fDensityCulling &&
(fVisibleDensity != v.fVisibleDensity)) return true;
if (fCBDAlgorithmNumber > 0) {
if (fCBDParameters.size() != v.fCBDParameters.size()) return true;
else if (fCBDParameters != v.fCBDParameters) return true;
}
if (fSection &&
(!(fSectionPlane == v.fSectionPlane))) return true;
@@ -912,6 +1083,35 @@ G4bool G4ViewParameters::operator != (const G4ViewParameters& v) const {
if (fVisAttributesModifiers != v.fVisAttributesModifiers) return true;
if (fStartTime != v.fStartTime ||
fEndTime != v.fEndTime ||
fFadeFactor != v.fFadeFactor) return true;
if (fDisplayHeadTime != v.fDisplayHeadTime) return true;
if (fDisplayHeadTime) {
if (fDisplayHeadTimeX != v.fDisplayHeadTimeX ||
fDisplayHeadTimeY != v.fDisplayHeadTimeY ||
fDisplayHeadTimeSize != v.fDisplayHeadTimeSize ||
fDisplayHeadTimeRed != v.fDisplayHeadTimeRed ||
fDisplayHeadTimeGreen != v.fDisplayHeadTimeGreen ||
fDisplayHeadTimeBlue != v.fDisplayHeadTimeBlue) {
return true;
}
}
if (fDisplayLightFront != v.fDisplayLightFront) return true;
if (fDisplayLightFront) {
if (fDisplayLightFrontX != v.fDisplayLightFrontX ||
fDisplayLightFrontY != v.fDisplayLightFrontY ||
fDisplayLightFrontZ != v.fDisplayLightFrontZ ||
fDisplayLightFrontT != v.fDisplayLightFrontT ||
fDisplayLightFrontRed != v.fDisplayLightFrontRed ||
fDisplayLightFrontGreen != v.fDisplayLightFrontGreen ||
fDisplayLightFrontBlue != v.fDisplayLightFrontBlue) {
return true;
}
}
return false;
}
@@ -1233,7 +1433,7 @@ G4ViewParameters* G4ViewParameters::CatmullRomCubicSplineInterpolation
else mi = 0.5 * (v[i+1].param - v[i-1].param); \
} else { \
/* Full Catmull-Rom slopes use previous AND next waypoints */ \
mi = 0.5 * (v[i+1].param - v[i-1].param); \
mi = 0.5 * (v[i+1].param - v[i-1].param); \
mi1 = 0.5 * (v[i+2].param - v[i ].param); \
} \
real = h00 * v[i].param + h10 * mi + h01 * v[i+1].param + h11 * mi1;
@@ -1358,8 +1558,8 @@ INTERPOLATE(plane.d()); d = real;
static G4VisAttributes workingVA;
if (v[i].fVisAttributesModifiers.size()) {
CONTINUITY(fVisAttributesModifiers.size());
if (continuous) { \
for (size_t j = 0; j < v[i].fVisAttributesModifiers.size(); ++j) { \
if (continuous) {
for (size_t j = 0; j < v[i].fVisAttributesModifiers.size(); ++j) {
CONTINUITY(fVisAttributesModifiers[j].GetPVNameCopyNoPath());
if (continuous) {
CONTINUITY(fVisAttributesModifiers[j].GetVisAttributesSignifier());
@@ -1377,6 +1577,15 @@ INTERPOLATE(plane.d()); d = real;
}
}
// Time window parameters (for showing particles in flight)
// Only two parameters are interpolated. The others are usually chosen
// once and for all by the user for a given series of views - or at least,
// if not, they will be interpolated by the default "crude" method above.
INTERPOLATE(fStartTime)
holdingValues.fStartTime = real;
INTERPOLATE(fEndTime)
holdingValues.fEndTime = real;
// Increment counters
iInterpolationPoint++;
t += dt;
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4VisCommandsCompound.cc 98766 2016-08-09 14:17:17Z gcosmo $
// $Id: G4VisCommandsCompound.cc 110513 2018-05-28 07:37:38Z gcosmo $
// Compound /vis/ commands - John Allison 15th May 2000
@@ -43,9 +43,10 @@ G4VisCommandDrawTree::G4VisCommandDrawTree() {
G4bool omitable;
fpCommand = new G4UIcommand("/vis/drawTree", this);
fpCommand->SetGuidance
("(DTREE) Creates a scene consisting of this physical volume and"
"\n produces a representation of the geometry hieracrhy.");
fpCommand->SetGuidance("The scene becomes current.");
("Produces a representation of the geometry hierarchy. Further"
"\nguidance is given on running the command. Or look at the guidance"
"\nfor \"/vis/ASCIITree/verbose\".");
fpCommand->SetGuidance("The pre-existing scene and view are preserved.");
G4UIparameter* parameter;
parameter = new G4UIparameter("physical-volume-name", 's', omitable = true);
parameter -> SetDefaultValue("world");
@@ -197,6 +198,77 @@ void G4VisCommandDrawView::SetNewValue(G4UIcommand*, G4String newValue) {
UImanager->SetVerboseLevel(keepVerbose);
}
////////////// /vis/specify ///////////////////////////////////////
G4VisCommandDrawLogicalVolume::G4VisCommandDrawLogicalVolume() {
G4bool omitable;
fpCommand = new G4UIcommand("/vis/drawLogicalVolume", this);
fpCommand->SetGuidance
("Draws logical volume with Boolean components, voxels and readout geometry.");
fpCommand->SetGuidance
("Synonymous with \"/vis/specify\".");
fpCommand->SetGuidance
("Creates a scene consisting of this logical volume and asks the"
"\n current viewer to draw it to the specified depth of descent"
"\n showing boolean components (if any), voxels (if any),"
"\n readout geometry (if any), local axes and overlaps (if any),"
"\n under control of the appropriate flag.");
fpCommand->SetGuidance
("Note: voxels are not constructed until start of run - /run/beamOn."
"\n (For voxels without a run, \"/run/beamOn 0\".)");
fpCommand->SetGuidance("The scene becomes current.");
G4UIparameter* parameter;
parameter = new G4UIparameter("logical-volume-name", 's', omitable = false);
fpCommand->SetParameter(parameter);
parameter = new G4UIparameter("depth-of-descent", 'i', omitable = true);
parameter->SetDefaultValue(1);
fpCommand->SetParameter(parameter);
parameter = new G4UIparameter("booleans-flag", 'b', omitable = true);
parameter->SetDefaultValue(true);
fpCommand->SetParameter(parameter);
parameter = new G4UIparameter("voxels-flag", 'b', omitable = true);
parameter->SetDefaultValue(true);
fpCommand->SetParameter(parameter);
parameter = new G4UIparameter("readout-flag", 'b', omitable = true);
parameter->SetDefaultValue(true);
fpCommand->SetParameter(parameter);
parameter = new G4UIparameter("axes-flag", 'b', omitable = true);
parameter->SetDefaultValue(true);
parameter -> SetGuidance ("Set \"false\" to suppress axes.");
fpCommand->SetParameter(parameter);
parameter = new G4UIparameter("check-overlap-flag", 'b', omitable = true);
parameter->SetDefaultValue(true);
parameter -> SetGuidance ("Set \"false\" to suppress overlap check.");
fpCommand->SetParameter(parameter);
}
G4VisCommandDrawLogicalVolume::~G4VisCommandDrawLogicalVolume() {
delete fpCommand;
}
void G4VisCommandDrawLogicalVolume::SetNewValue(G4UIcommand*, G4String newValue) {
G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
G4UImanager* UImanager = G4UImanager::GetUIpointer();
G4int keepVerbose = UImanager->GetVerboseLevel();
G4int newVerbose(0);
if (keepVerbose >= 2 || verbosity >= G4VisManager::confirmations)
newVerbose = 2;
UImanager->SetVerboseLevel(newVerbose);
// UImanager->ApplyCommand(G4String("/geometry/print " + newValue));
UImanager->ApplyCommand("/vis/scene/create");
UImanager->ApplyCommand(G4String("/vis/scene/add/logicalVolume " + newValue));
UImanager->ApplyCommand("/vis/sceneHandler/attach");
UImanager->SetVerboseLevel(keepVerbose);
static G4bool warned = false;
if (verbosity >= G4VisManager::confirmations && !warned) {
G4cout <<
"NOTE: For systems which are not \"auto-refresh\" you will need to"
"\n issue \"/vis/viewer/refresh\" or \"/vis/viewer/flush\"."
<< G4endl;
warned = true;
}
}
////////////// /vis/drawVolume ///////////////////////////////////////
G4VisCommandDrawVolume::G4VisCommandDrawVolume() {
@@ -308,12 +380,14 @@ G4VisCommandSpecify::G4VisCommandSpecify() {
fpCommand = new G4UIcommand("/vis/specify", this);
fpCommand->SetGuidance
("Draws logical volume with Boolean components, voxels and readout geometry.");
fpCommand->SetGuidance
("Synonymous with \"/vis/drawLogicalVolume\".");
fpCommand->SetGuidance
("Creates a scene consisting of this logical volume and asks the"
"\n current viewer to draw it to the specified depth of descent"
"\n showing boolean components (if any), voxels (if any),"
"\n readout geometry (if any) and local axes, under control of the"
"\n appropriate flag.");
"\n readout geometry (if any), local axes and overlaps (if any),"
"\n under control of the appropriate flag.");
fpCommand->SetGuidance
("Note: voxels are not constructed until start of run - /run/beamOn."
"\n (For voxels without a run, \"/run/beamOn 0\".)");
@@ -337,6 +411,10 @@ G4VisCommandSpecify::G4VisCommandSpecify() {
parameter->SetDefaultValue(true);
parameter -> SetGuidance ("Set \"false\" to suppress axes.");
fpCommand->SetParameter(parameter);
parameter = new G4UIparameter("check-overlap-flag", 'b', omitable = true);
parameter->SetDefaultValue(true);
parameter -> SetGuidance ("Set \"false\" to suppress overlap check.");
fpCommand->SetParameter(parameter);
}
G4VisCommandSpecify::~G4VisCommandSpecify() {
@@ -28,6 +28,7 @@
// /vis/multithreading commands - John Allison 29th September 2015
#include "G4Types.hh"
#ifdef G4MULTITHREADED
#include "G4VisCommandsMultithreading.hh"
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4VisCommandsSceneAdd.cc 104163 2017-05-15 06:52:42Z gcosmo $
// $Id: G4VisCommandsSceneAdd.cc 110480 2018-05-25 07:25:18Z gcosmo $
// /vis/scene/add commands - John Allison 9th August 1998
#include "G4VisCommandsSceneAdd.hh"
@@ -1163,7 +1163,8 @@ G4VisCommandSceneAddLogicalVolume::G4VisCommandSceneAddLogicalVolume () {
fpCommand -> SetGuidance ("Adds a logical volume to the current scene,");
fpCommand -> SetGuidance
("Shows boolean components (if any), voxels (if any), readout geometry"
"\n (if any) and local axes, under control of the appropriate flag."
"\n (if any), local axes and overlaps (if any), under control of the"
"\n appropriate flag."
"\n Note: voxels are not constructed until start of run -"
"\n \"/run/beamOn\". (For voxels without a run, \"/run/beamOn 0\".)");
G4UIparameter* parameter;
@@ -1186,6 +1187,10 @@ G4VisCommandSceneAddLogicalVolume::G4VisCommandSceneAddLogicalVolume () {
parameter -> SetDefaultValue (true);
parameter -> SetGuidance ("Set \"false\" to suppress axes.");
fpCommand -> SetParameter (parameter);
parameter = new G4UIparameter("check-overlap-flag", 'b', omitable = true);
parameter->SetDefaultValue(true);
parameter -> SetGuidance ("Set \"false\" to suppress overlap check.");
fpCommand->SetParameter(parameter);
}
G4VisCommandSceneAddLogicalVolume::~G4VisCommandSceneAddLogicalVolume () {
@@ -1213,13 +1218,16 @@ void G4VisCommandSceneAddLogicalVolume::SetNewValue (G4UIcommand*,
G4String name;
G4int requestedDepthOfDescent;
G4String booleansString, voxelsString, readoutString, axesString;
G4String overlapString;
std::istringstream is (newValue);
is >> name >> requestedDepthOfDescent
>> booleansString >> voxelsString >> readoutString >> axesString;
>> booleansString >> voxelsString >> readoutString >> axesString
>> overlapString;
G4bool booleans = G4UIcommand::ConvertToBool(booleansString);
G4bool voxels = G4UIcommand::ConvertToBool(voxelsString);
G4bool readout = G4UIcommand::ConvertToBool(readoutString);
G4bool axes = G4UIcommand::ConvertToBool(axesString);
G4bool checkOverlaps = G4UIcommand::ConvertToBool(overlapString);
G4LogicalVolumeStore *pLVStore = G4LogicalVolumeStore::GetInstance();
int nLV = pLVStore -> size ();
@@ -1263,7 +1271,7 @@ void G4VisCommandSceneAddLogicalVolume::SetNewValue (G4UIcommand*,
}
G4LogicalVolumeModel* model = new G4LogicalVolumeModel
(pLV, requestedDepthOfDescent, booleans, voxels, readout);
(pLV, requestedDepthOfDescent, booleans, voxels, readout, checkOverlaps);
const G4String& currentSceneName = pScene -> GetName ();
G4bool successful = pScene -> AddRunDurationModel (model, warn);
@@ -1291,15 +1299,17 @@ void G4VisCommandSceneAddLogicalVolume::SetNewValue (G4UIcommand*,
if (verbosity >= G4VisManager::confirmations) {
G4cout << "Logical volume \"" << pLV -> GetName ()
<< " with requested depth of descent "
<< "\" with requested depth of descent "
<< requestedDepthOfDescent
<< ",\n with";
<< ",\n with";
if (!booleans) G4cout << "out";
G4cout << " boolean components, with";
if (!voxels) G4cout << "out";
G4cout << " voxels and with";
G4cout << " voxels,\n with";
if (!readout) G4cout << "out";
G4cout << " readout geometry,"
G4cout << " readout geometry and with";
if (!checkOverlaps) G4cout << "out";
G4cout << " overlap checking"
<< "\n has been added to scene \"" << currentSceneName << "\".";
if (axes) {
if (axesSuccessful) {
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4VisCommandsViewer.cc 104163 2017-05-15 06:52:42Z gcosmo $
// $Id: G4VisCommandsViewer.cc 109510 2018-04-26 07:15:57Z gcosmo $
// /vis/viewer commands - John Allison 25th October 1998
@@ -559,6 +559,124 @@ void G4VisCommandViewerClone::SetNewValue (G4UIcommand*, G4String newValue) {
}
}
////////////// /vis/viewer/colourByDensity ///////////////////////////////////////
G4VisCommandViewerColourByDensity::G4VisCommandViewerColourByDensity () {
G4bool omitable;
fpCommand = new G4UIcommand ("/vis/viewer/colourByDensity", this);
fpCommand -> SetGuidance
("If a volume has no vis attributes, colour it by density.");
fpCommand -> SetGuidance
("Provide algorithm number, e.g., \"1\" (or \"0\" to switch off)."
"\nThen a unit of density, e.g., \"g/cm3\"."
"\nThen parameters for the algorithm assumed to be densities in that unit.");
fpCommand -> SetGuidance
("Algorithm 1: Simple algorithm takes 3 parameters: d0, d1 and d2."
"\nVolumes with density < d0 are invisible."
"\nVolumes with d0 <= density < d1 have colour on range red->green."
"\nVolumes with d1 <= density < d2 have colour on range green->blue."
"\nVolumes with density > d2 are blue.");
G4UIparameter* parameter;
parameter = new G4UIparameter("n",'i',omitable = true);
parameter -> SetDefaultValue (0);
parameter -> SetGuidance ("Algorithm number (or \"0\" to switch off).");
fpCommand->SetParameter(parameter);
parameter = new G4UIparameter("unit",'s',omitable = true);
parameter -> SetDefaultValue ("g/cm3");
parameter -> SetGuidance ("Unit of following densities, e.g., \"g/cm3\".");
fpCommand->SetParameter(parameter);
parameter = new G4UIparameter("d0",'d',omitable = true);
parameter -> SetDefaultValue (0.);
parameter -> SetGuidance ("Density parameter 0.");
fpCommand->SetParameter(parameter);
parameter = new G4UIparameter("d1",'d',omitable = true);
parameter -> SetDefaultValue (0.);
parameter -> SetGuidance ("Density parameter 1.");
fpCommand->SetParameter(parameter);
parameter = new G4UIparameter("d2",'d',omitable = true);
parameter -> SetDefaultValue (0.);
parameter -> SetGuidance ("Density parameter 2.");
fpCommand->SetParameter(parameter);
}
G4VisCommandViewerColourByDensity::~G4VisCommandViewerColourByDensity () {
delete fpCommand;
}
G4String G4VisCommandViewerColourByDensity::GetCurrentValue (G4UIcommand*) {
return "";
}
void G4VisCommandViewerColourByDensity::SetNewValue (G4UIcommand*, G4String newValue) {
G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
G4VViewer* viewer = fpVisManager -> GetCurrentViewer ();
if (!viewer) {
if (verbosity >= G4VisManager::errors) {
G4cerr <<
"ERROR: No current viewer - \"/vis/viewer/list\" to see possibilities."
<< G4endl;
}
return;
}
G4ViewParameters vp = viewer->GetViewParameters();
G4int algorithmNumber;
G4double d0, d1, d2;
G4String unit;
std::istringstream is (newValue);
is >> algorithmNumber >> unit >> d0 >> d1 >> d2;
if (algorithmNumber < 0 || algorithmNumber > 1) {
if (verbosity >= G4VisManager::errors) {
G4cerr <<
"ERROR: Unrecognised algorithm number: " << algorithmNumber
<< G4endl;
}
return;
}
std::vector<G4double> parameters;
if (algorithmNumber > 0) {
const G4String where = "G4VisCommandViewerColourByDensity::SetNewValue";
G4double valueOfUnit;
// "Volumic Mass" is Michel's phrase for "Density"
if (ProvideValueOfUnit(where,unit,"Volumic Mass",valueOfUnit)) {
// Successful outcome of unit search
d0 *= valueOfUnit; d1 *= valueOfUnit; d2 *= valueOfUnit;
} else {
if (verbosity >= G4VisManager::errors) {
G4cerr <<
"ERROR: Unrecognised or inappropriate unit: " << unit
<< G4endl;
}
return;
}
parameters.push_back(d0);
parameters.push_back(d1);
parameters.push_back(d2);
}
vp.SetCBDAlgorithmNumber(algorithmNumber);
vp.SetCBDParameters(parameters);
if (verbosity >= G4VisManager::confirmations) {
if (vp.GetCBDAlgorithmNumber() == 0) {
G4cout << "Colour by density deactivated" << G4endl;
} else {
G4cout << "Colour by density algorithm " << vp.GetCBDAlgorithmNumber()
<< " selected for viewer \"" << viewer->GetName()
<< "\n Parameters:";
for (auto p: vp.GetCBDParameters()) {
G4cout << ' ' << G4BestUnit(p,"Volumic Mass");
}
G4cout << G4endl;
}
}
SetViewParameters(viewer, vp);
}
////////////// /vis/viewer/copyViewFrom //////////////////////////
G4VisCommandViewerCopyViewFrom::G4VisCommandViewerCopyViewFrom () {
@@ -1645,6 +1763,7 @@ namespace {
<< vp.DrawingStyleCommands()
<< vp.SceneModifyingCommands()
<< vp.TouchableCommands()
<< vp.TimeWindowCommands()
<< std::endl;
}
}
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4VisCommandsViewerSet.cc 106122 2017-09-13 12:51:53Z gcosmo $
// $Id: G4VisCommandsViewerSet.cc 109510 2018-04-26 07:15:57Z gcosmo $
// /vis/viewer/set commands - John Allison 16th May 2000
@@ -42,6 +42,7 @@
#include "G4SystemOfUnits.hh"
#include <sstream>
#include <iomanip>
G4VisCommandsViewerSet::G4VisCommandsViewerSet ():
fLightsVector (G4ThreeVector(1.,1.,1.)),
@@ -114,7 +115,7 @@ G4VisCommandsViewerSet::G4VisCommandsViewerSet ():
("\"density\": culls volumes with density lower than threshold. Useful"
"\nfor eliminating \"container volumes\" with no physical correspondence,"
"\nwhose material is usually air. If this is selected, provide threshold"
"\ndensity and unit (g/cm3 mg/cm3 or kg/m3)."
"\ndensity and unit (e.g., g/cm3, mg/cm3 or kg/m3)."
);
parameter = new G4UIparameter("culling-option",'s',omitable = false);
parameter->SetParameterCandidates
@@ -127,7 +128,8 @@ G4VisCommandsViewerSet::G4VisCommandsViewerSet ():
parameter->SetDefaultValue("0.01");
fpCommandCulling->SetParameter(parameter);
parameter = new G4UIparameter("unit",'s',omitable = true);
parameter->SetParameterCandidates ("g/cm3, mg/cm3 kg/m3");
// parameter->SetParameterCandidates ("g/cm3 mg/cm3 kg/m3");
// Instead of the above, SetNewValue accepts *any* density unit.
parameter->SetDefaultValue("g/cm3");
fpCommandCulling->SetParameter(parameter);
@@ -442,37 +444,187 @@ G4VisCommandsViewerSet::G4VisCommandsViewerSet ():
parameter = new G4UIparameter ("z", 'd', omitable = true);
parameter -> SetDefaultValue (1.);
fpCommandViewpointVector -> SetParameter (parameter);
fpTimeWindowDirectory = new G4UIdirectory ("/vis/viewer/set/timeWindow/");
fpTimeWindowDirectory -> SetGuidance ("Set time window parameters of current viewer.");
G4String timeWindowGuidance =
"For these commands use"
"\n /vis/scene/add/trajectories rich"
"\n /vis/modeling/trajectories/drawByCharge-0/default/setTimeSliceInterval 0.01 ns"
"\nthen typically"
"\n /vis/viewer/set/timeWindow/displayLightFront true 0 0 -50 cm -0.5 ns"
"\n /vis/viewer/set/timeWindow/displayHeadTime true"
"\n /vis/viewer/set/timeWindow/fadeFactor 1"
"\n /run/beamOn # or several until you get a good event or events"
"\n /vis/viewer/set/timeWindow/startTime 0 ns 1 ns"
"\n /vis/viewer/save"
"\n /vis/viewer/set/timeWindow/startTime 1 ns 1 ns"
"\nthen zoom, pan etc to a view of interest and"
"\n /vis/viewer/save"
"\nthen repeat with next start time, another view and a save, then try"
"\n /vis/viewer/interpolate";
fpCommandTimeWindowDisplayHeadTime =
new G4UIcommand("/vis/viewer/set/timeWindow/displayHeadTime", this);
fpCommandTimeWindowDisplayHeadTime->SetGuidance
("Display head time of range in 2D text.");
fpCommandTimeWindowDisplayHeadTime->SetGuidance(timeWindowGuidance);
parameter = new G4UIparameter ("displayHeadTime", 'b', omitable = false);
parameter->SetDefaultValue(false);
fpCommandTimeWindowDisplayHeadTime->SetParameter(parameter);
parameter = new G4UIparameter ("screenX", 'd', omitable = true);
parameter->SetGuidance("-1 < screenX < 1");
parameter->SetParameterRange("screenX >= -1. && screenX <= 1.");
parameter->SetDefaultValue(-0.9);
fpCommandTimeWindowDisplayHeadTime->SetParameter(parameter);
parameter = new G4UIparameter ("screenY", 'd', omitable = true);
parameter->SetGuidance("-1 < screenY < 1");
parameter->SetParameterRange("screenY >= -1. && screenY <= 1.");
parameter->SetDefaultValue(-0.9);
fpCommandTimeWindowDisplayHeadTime->SetParameter(parameter);
parameter = new G4UIparameter ("screenSize", 'd', omitable = true);
parameter->SetDefaultValue(24.);
fpCommandTimeWindowDisplayHeadTime->SetParameter(parameter);
parameter = new G4UIparameter ("red", 'd', omitable = true);
parameter->SetParameterRange("red >= 0. && red <= 1.");
parameter->SetDefaultValue(0.);
fpCommandTimeWindowDisplayHeadTime->SetParameter(parameter);
parameter = new G4UIparameter ("green", 'd', omitable = true);
parameter->SetParameterRange("green >= 0. && green <= 1.");
parameter->SetDefaultValue(1.);
fpCommandTimeWindowDisplayHeadTime->SetParameter(parameter);
parameter = new G4UIparameter ("blue", 'd', omitable = true);
parameter->SetParameterRange("blue >= 0. && blue <= 1.");
parameter->SetDefaultValue(1.);
fpCommandTimeWindowDisplayHeadTime->SetParameter(parameter);
fpCommandTimeWindowDisplayLightFront =
new G4UIcommand("/vis/viewer/set/timeWindow/displayLightFront", this);
fpCommandTimeWindowDisplayLightFront->SetGuidance
("Display the light front at head time.");
fpCommandTimeWindowDisplayLightFront->SetGuidance
("Tip: The trajectories can appear of jump ahead of the light front"
"\nbecause their time range overlaps the viewer's time range. To"
"\naverage out this discrete time effect, advance the light front by"
"\nhalf the trajectories interval. E.g., if the trajectory time slice"
"\ninterval is 0.01 ns:"
"\n /vis/viewer/set/timeWindow/displayLightFront true -90 0 0 mm -0.005 ns"
"\nTo prevent them beating the light front at all:"
"\n /vis/viewer/set/timeWindow/displayLightFront true -90 0 0 mm -0.01 ns");
fpCommandTimeWindowDisplayLightFront->SetGuidance(timeWindowGuidance);
parameter = new G4UIparameter ("displayLightFront", 'b', omitable = false);
parameter->SetDefaultValue(false);
fpCommandTimeWindowDisplayLightFront->SetParameter(parameter);
parameter = new G4UIparameter ("originX", 'd', omitable = true);
parameter->SetDefaultValue(0.);
fpCommandTimeWindowDisplayLightFront->SetParameter(parameter);
parameter = new G4UIparameter ("originY", 'd', omitable = true);
parameter->SetDefaultValue(0.);
fpCommandTimeWindowDisplayLightFront->SetParameter(parameter);
parameter = new G4UIparameter ("originZ", 'd', omitable = true);
parameter->SetDefaultValue(0.);
fpCommandTimeWindowDisplayLightFront->SetParameter(parameter);
parameter = new G4UIparameter ("space_unit", 's', omitable = true);
parameter->SetDefaultValue("m");
fpCommandTimeWindowDisplayLightFront->SetParameter(parameter);
parameter = new G4UIparameter ("originT", 'd', omitable = true);
parameter->SetDefaultValue(0.);
fpCommandTimeWindowDisplayLightFront->SetParameter(parameter);
parameter = new G4UIparameter ("time_unit", 's', omitable = true);
parameter->SetDefaultValue("s");
fpCommandTimeWindowDisplayLightFront->SetParameter(parameter);
parameter = new G4UIparameter ("red", 'd', omitable = true);
parameter->SetParameterRange("red >= 0. && red <= 1.");
parameter->SetDefaultValue(0.);
fpCommandTimeWindowDisplayLightFront->SetParameter(parameter);
parameter = new G4UIparameter ("green", 'd', omitable = true);
parameter->SetParameterRange("green >= 0. && green <= 1.");
parameter->SetDefaultValue(1.);
fpCommandTimeWindowDisplayLightFront->SetParameter(parameter);
parameter = new G4UIparameter ("blue", 'd', omitable = true);
parameter->SetParameterRange("blue >= 0. && blue <= 1.");
parameter->SetDefaultValue(0.);
fpCommandTimeWindowDisplayLightFront->SetParameter(parameter);
fpCommandTimeWindowEndTime =
new G4UIcommand("/vis/viewer/set/timeWindow/endTime", this);
fpCommandTimeWindowEndTime->SetGuidance("Set end and range of track time.");
fpCommandTimeWindowEndTime->SetGuidance(timeWindowGuidance);
parameter = new G4UIparameter ("end-time", 'd', omitable = false);
parameter->SetDefaultValue(G4VisAttributes::fVeryLongTime);
fpCommandTimeWindowEndTime->SetParameter(parameter);
parameter = new G4UIparameter ("end-time-unit", 's', omitable = false);
parameter->SetDefaultValue("ns");
fpCommandTimeWindowEndTime->SetParameter(parameter);
parameter = new G4UIparameter ("time-range", 'd', omitable = true);
parameter->SetDefaultValue(-1.);
fpCommandTimeWindowEndTime->SetParameter(parameter);
parameter = new G4UIparameter ("time-range-unit", 's', omitable = true);
parameter->SetDefaultValue("ns");
fpCommandTimeWindowEndTime->SetParameter(parameter);
fpCommandTimeWindowFadeFactor =
new G4UIcmdWithADouble("/vis/viewer/set/timeWindow/fadeFactor", this);
fpCommandTimeWindowFadeFactor->SetGuidance
("0: no fade; 1: maximum fade with time window.");
fpCommandTimeWindowFadeFactor->SetGuidance(timeWindowGuidance);
fpCommandTimeWindowFadeFactor->SetParameterName("fade_factor", omitable = false);
fpCommandTimeWindowFadeFactor->SetRange("fade_factor>=0.&&fade_factor<=1.");
fpCommandTimeWindowFadeFactor->SetDefaultValue(0.);
fpCommandTimeWindowStartTime =
new G4UIcommand("/vis/viewer/set/timeWindow/startTime", this);
fpCommandTimeWindowStartTime->SetGuidance("Set start and range of track time.");
fpCommandTimeWindowStartTime->SetGuidance(timeWindowGuidance);
parameter = new G4UIparameter ("start-time", 'd', omitable = false);
parameter->SetDefaultValue(-G4VisAttributes::fVeryLongTime);
fpCommandTimeWindowStartTime->SetParameter(parameter);
parameter = new G4UIparameter ("start-time-unit", 's', omitable = false);
parameter->SetDefaultValue("ns");
fpCommandTimeWindowStartTime->SetParameter(parameter);
parameter = new G4UIparameter ("time-range", 'd', omitable = true);
parameter->SetDefaultValue(-1.);
fpCommandTimeWindowStartTime->SetParameter(parameter);
parameter = new G4UIparameter ("time-range-unit", 's', omitable = true);
parameter->SetDefaultValue("ns");
fpCommandTimeWindowStartTime->SetParameter(parameter);
}
G4VisCommandsViewerSet::~G4VisCommandsViewerSet() {
delete fpCommandAll;
delete fpCommandTimeWindowStartTime;
delete fpCommandTimeWindowFadeFactor;
delete fpCommandTimeWindowEndTime;
delete fpCommandTimeWindowDisplayLightFront;
delete fpCommandTimeWindowDisplayHeadTime;
delete fpTimeWindowDirectory;
delete fpCommandViewpointVector;
delete fpCommandViewpointThetaPhi;
delete fpCommandUpVector;
delete fpCommandUpThetaPhi;
delete fpCommandTargetPoint;
delete fpCommandStyle;
delete fpCommandSectionPlane;
delete fpCommandRotationStyle;
delete fpCommandProjection;
delete fpCommandPicking;
delete fpCommandLineSegments;
delete fpCommandLightsVector;
delete fpCommandLightsThetaPhi;
delete fpCommandLightsMove;
delete fpCommandHiddenMarker;
delete fpCommandHiddenEdge;
delete fpCommandGlobalMarkerScale;
delete fpCommandGlobalLineWidthScale;
delete fpCommandExplodeFactor;
delete fpCommandEdge;
delete fpCommandDefaultTextColour;
delete fpCommandDefaultColour;
delete fpCommandCutawayMode;
delete fpCommandCulling;
delete fpCommandBackground;
delete fpCommandAuxEdge;
delete fpCommandAutoRefresh;
delete fpCommandBackground;
delete fpCommandCulling;
delete fpCommandCutawayMode;
delete fpCommandDefaultColour;
delete fpCommandDefaultTextColour;
delete fpCommandEdge;
delete fpCommandExplodeFactor;
delete fpCommandGlobalLineWidthScale;
delete fpCommandGlobalMarkerScale;
delete fpCommandHiddenEdge;
delete fpCommandHiddenMarker;
delete fpCommandLineSegments;
delete fpCommandLightsMove;
delete fpCommandLightsThetaPhi;
delete fpCommandLightsVector;
delete fpCommandPicking;
delete fpCommandProjection;
delete fpCommandRotationStyle;
delete fpCommandSectionPlane;
delete fpCommandStyle;
delete fpCommandTargetPoint;
delete fpCommandUpThetaPhi;
delete fpCommandUpVector;
delete fpCommandViewpointThetaPhi;
delete fpCommandViewpointVector;
delete fpCommandAll;
}
G4String G4VisCommandsViewerSet::GetCurrentValue(G4UIcommand*) {
@@ -638,22 +790,32 @@ void G4VisCommandsViewerSet::SetNewValue
}
}
else if (cullingOption == "density") {
vp.SetDensityCulling(boolFlag);
const G4String where =
"G4VisCommandsViewerSet::SetNewValue: culling: culling by density";
if (boolFlag) {
density *= G4UnitDefinition::GetValueOf(unit);
vp.SetVisibleDensity(density);
}
else {
density = vp.GetVisibleDensity();
G4double valueOfUnit;
// "Volumic Mass" is Michel's phrase for "Density"
if (ProvideValueOfUnit(where,unit,"Volumic Mass",valueOfUnit)) {
// Successful outcome of unit search
vp.SetDensityCulling(boolFlag);
density *= valueOfUnit;
vp.SetVisibleDensity(density);
} else {
// Unsuccessful outcome of unit search. Flag and density unchanged.
density = vp.GetVisibleDensity();
}
} else { // Reset flag but density unchanged.
vp.SetDensityCulling(boolFlag);
}
if (verbosity >= G4VisManager::confirmations) {
G4cout <<
"G4VisCommandsViewerSet::SetNewValue: culling: culling by density"
"\n flag set to " << G4UIcommand::ConvertToString(boolFlag) <<
". Volumes with density less than " <<
G4BestUnit(density,"Volumic Mass") <<
"\n will be culled, i.e., not drawn, if this flag is true."
<< G4endl;
G4cout
<< where
<< "\n flag set to "
<< std::boolalpha << vp.IsDensityCulling()
<< ". Volumes with density less than "
<< G4BestUnit(density,"Volumic Mass")
<< "\n will be culled, i.e., not drawn, if this flag is true."
<< G4endl;
}
}
else {
@@ -952,7 +1114,6 @@ void G4VisCommandsViewerSet::SetNewValue
G4double x, y, z, nx, ny, nz;
std::istringstream is (newValue);
is >> choice >> x >> y >> z >> unit >> nx >> ny >> nz;
G4int iSelector = -1;
if (choice.compareTo("off",G4String::ignoreCase) == 0 ||
!G4UIcommand::ConvertToBool(choice)) iSelector = 0;
@@ -970,7 +1131,6 @@ void G4VisCommandsViewerSet::SetNewValue
}
return;
}
G4double F = 1.;
// iSelector can only be 0 or 1
switch (iSelector) {
@@ -984,7 +1144,6 @@ void G4VisCommandsViewerSet::SetNewValue
vp.SetViewpointDirection(G4Normal3D(nx,ny,nz));
break;
}
if (verbosity >= G4VisManager::confirmations) {
G4cout << "Section drawing is now: ";
if (vp.IsSection ()) G4cout << "on";
@@ -1141,6 +1300,117 @@ void G4VisCommandsViewerSet::SetNewValue
}
}
else if (command == fpCommandTimeWindowDisplayHeadTime)
{
G4String display;
G4double screenX, screenY, screenSize, red, green, blue;
std::istringstream iss(newValue);
iss >> display >> screenX >> screenY
>> screenSize >> red >> green >> blue;
vp.SetDisplayHeadTime(command->ConvertToBool(display));
vp.SetDisplayHeadTimeX(screenX);
vp.SetDisplayHeadTimeY(screenY);
vp.SetDisplayHeadTimeSize(screenSize);
vp.SetDisplayHeadTimeRed(red);
vp.SetDisplayHeadTimeGreen(green);
vp.SetDisplayHeadTimeBlue(blue);
if (verbosity >= G4VisManager::confirmations) {
G4cout << "Display head time flag set: "
<< vp
<< G4endl;
}
}
else if (command == fpCommandTimeWindowDisplayLightFront)
{
G4String display, originX, originY, originZ, unitS, originT, unitT;
G4double red, green, blue;
std::istringstream iss(newValue);
iss >> display
>> originX >> originY >> originZ >> unitS
>> originT >> unitT
>> red >> green >> blue;
vp.SetDisplayLightFront(command->ConvertToBool(display));
vp.SetDisplayLightFrontX
(command->ConvertToDimensionedDouble(G4String(originX + ' ' + unitS)));
vp.SetDisplayLightFrontY
(command->ConvertToDimensionedDouble(G4String(originY + ' ' + unitS)));
vp.SetDisplayLightFrontZ
(command->ConvertToDimensionedDouble(G4String(originZ + ' ' + unitS)));
vp.SetDisplayLightFrontT
(command->ConvertToDimensionedDouble(G4String(originT + ' ' + unitT)));
vp.SetDisplayLightFrontRed(red);
vp.SetDisplayLightFrontGreen(green);
vp.SetDisplayLightFrontBlue(blue);
if (verbosity >= G4VisManager::confirmations) {
G4cout << "Display light front flag set: "
<< vp
<< G4endl;
}
}
else if (command == fpCommandTimeWindowEndTime)
{
G4String end_time_string, end_time_unit,
time_range_string, time_range_unit;
std::istringstream iss(newValue);
iss >> end_time_string >> end_time_unit
>> time_range_string >> time_range_unit;
vp.SetEndTime
(command->ConvertToDimensionedDouble
(G4String(end_time_string + ' ' + end_time_unit)));
G4double timeRange = command->ConvertToDimensionedDouble
(G4String(time_range_string + ' ' + time_range_unit));
if (timeRange > 0.) {
vp.SetStartTime
(vp.GetEndTime() - timeRange);
}
if (verbosity >= G4VisManager::confirmations) {
G4cout
<< "Time window start time: " << vp.GetStartTime()/ns << " ns"
<< ", time window end time: " << vp.GetEndTime()/ns << " ns";
if (timeRange > 0.) {
G4cout << "\n (time range: " << timeRange/ns << " ns)";
}
G4cout << G4endl;
}
}
else if (command == fpCommandTimeWindowFadeFactor) {
vp.SetFadeFactor(command->ConvertToDouble(newValue));
if (verbosity >= G4VisManager::confirmations) {
G4cout << "Time window fade factor changed to " << vp.GetFadeFactor()
<< G4endl;
}
}
else if (command == fpCommandTimeWindowStartTime)
{
G4String start_time_string, start_time_unit,
time_range_string, time_range_unit;
std::istringstream iss(newValue);
iss >> start_time_string >> start_time_unit
>> time_range_string >> time_range_unit;
vp.SetStartTime
(command->ConvertToDimensionedDouble
(G4String(start_time_string + ' ' + start_time_unit)));
G4double timeRange = command->ConvertToDimensionedDouble
(G4String(time_range_string + ' ' + time_range_unit));
if (timeRange > 0.) {
vp.SetEndTime
(vp.GetStartTime() + timeRange);
}
if (verbosity >= G4VisManager::confirmations) {
G4cout
<< "Time window start time: " << vp.GetStartTime()/ns << " ns"
<< ", time window end time: " << vp.GetEndTime()/ns << " ns";
if (timeRange > 0.) {
G4cout << "\n (time range: " << timeRange/ns << " ns)";
}
G4cout << G4endl;
}
}
else {
if (verbosity >= G4VisManager::errors) {
G4cerr <<
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VisManager.cc 106957 2017-10-31 08:32:27Z gcosmo $
// $Id: G4VisManager.cc 110513 2018-05-28 07:37:38Z gcosmo $
//
//
// GEANT4 Visualization Manager - John Allison 02/Jan/1996.
@@ -479,6 +479,7 @@ void G4VisManager::RegisterMessengers () {
// Compound commands...
RegisterMessenger(new G4VisCommandDrawTree);
RegisterMessenger(new G4VisCommandDrawView);
RegisterMessenger(new G4VisCommandDrawLogicalVolume);
RegisterMessenger(new G4VisCommandDrawVolume);
RegisterMessenger(new G4VisCommandOpen);
RegisterMessenger(new G4VisCommandSpecify);
@@ -588,6 +589,7 @@ void G4VisManager::RegisterMessengers () {
RegisterMessenger(new G4VisCommandViewerClearTransients);
RegisterMessenger(new G4VisCommandViewerClearVisAttributesModifiers);
RegisterMessenger(new G4VisCommandViewerClone);
RegisterMessenger(new G4VisCommandViewerColourByDensity);
RegisterMessenger(new G4VisCommandViewerCopyViewFrom);
RegisterMessenger(new G4VisCommandViewerCreate);
RegisterMessenger(new G4VisCommandViewerDolly);
+25 -4
View File
@@ -1,4 +1,4 @@
$Id: History 110128 2018-05-16 06:36:57Z gcosmo $
$Id: History 110743 2018-06-12 06:33:37Z gcosmo $
-------------------------------------------------------------------
=========================================================
@@ -20,14 +20,35 @@ committal in the CVS repository !
History file for visualization/modeling
---------------------------------------
11th March 2018 John Allison (modeling-V10-03-10)
11 June 2018 John Allison (modeling-V10-04-06)
- G4PhysicalVolumeModel.cc: Fix Coverity warning.
o Unnecessary check on pointer.
24 May 2018 John Allison (modeling-V10-04-05)
- G4LogicalVolumeModel:
o Add fCheckOverlaps flag. Calls CheckOverlaps for each G4PVPlacement.
o Note: G4PVParameterised not coded in this tag.
- G4TrajectoryDrawByEncounteredVolume.cc,
G4TrajectoryEncounteredVolumeFilter.cc:
o Fix gcc-8 warnings.
30 April 2018 John Allison
- G4PhysicalVolumeModel.cc: Colour by density: improved comments.
24 April 2018 John Allison (modeling-V10-04-04)
- G4ModelingParameters.cc: Small bug fix.
24 April 2018 John Allison (modeling-V10-04-03)
- Implement /vis/viewer/set/colourByDensity.
11th March 2018 John Allison (modeling-V10-04-02)
- G4PhysicalVolumeMassScene.cc: Protect case of no material in parallel world.
19th December 2017 Gabriele Cosmo (modeling-V10-03-09)
19th December 2017 Gabriele Cosmo (modeling-V10-04-01)
- Fixed self-consistency in G4AttValueFilterT header (missing #include).
Thanks to Raphael Isemann for reporting this.
12th December 2017 John Allison
12th December 2017 John Allison (modeling-V10-04-00)
- G4TrajectoryDrawerUtils.cc: Improvement to an informational message.
13th September 2017 John Allison (modeling-V10-03-08)
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4AttValueFilterT.hh 108542 2018-02-16 09:35:32Z gcosmo $
// $Id: G4AttValueFilterT.hh 108059 2017-12-19 15:13:34Z gcosmo $
//
// Templated class for G4AttValue filters.
//
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4LogicalVolumeModel.hh 66373 2012-12-18 09:41:34Z gcosmo $
// $Id: G4LogicalVolumeModel.hh 110480 2018-05-25 07:25:18Z gcosmo $
//
//
// John Allison 26th July 1999.
@@ -58,6 +58,7 @@ public: // With description
G4bool booleans = true,
G4bool voxels = true,
G4bool readout = true,
G4bool checkOverlaps = true,
const G4Transform3D& modelTransformation = G4Transform3D(),
const G4ModelingParameters* = 0);
@@ -84,6 +85,7 @@ protected:
G4bool fBooleans; // Flag for drawing boolean components.
G4bool fVoxels; // Flag for drawing voxels.
G4bool fReadout; // Flag for drawing readout geometry.
G4bool fCheckOverlaps; // Flag for checking overlaps.
};
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4ModelingParameters.hh 103627 2017-04-19 13:30:26Z gcosmo $
// $Id: G4ModelingParameters.hh 109510 2018-04-26 07:15:57Z gcosmo $
//
//
// John Allison 31st December 1997.
@@ -178,6 +178,8 @@ public: // With description
G4bool IsDensityCulling () const;
G4double GetVisibleDensity () const;
G4bool IsCullingCovered () const;
G4int GetCBDAlgorithmNumber () const;
const std::vector<G4double>& GetCBDParameters () const;
G4bool IsExplode () const;
G4double GetExplodeFactor () const;
const G4Point3D& GetExplodeCentre () const;
@@ -196,6 +198,8 @@ public: // With description
void SetDensityCulling (G4bool);
void SetVisibleDensity (G4double);
void SetCullingCovered (G4bool);
void SetCBDAlgorithmNumber (G4int);
void SetCBDParameters (const std::vector<G4double>&);
void SetExplodeFactor (G4double explodeFactor);
void SetExplodeCentre (const G4Point3D& explodeCentre);
G4int SetNoOfSides (G4int); // Returns actual number set.
@@ -228,6 +232,8 @@ private:
G4bool fDensityCulling; // Density culling requested. If so...
G4double fVisibleDensity; // ...density lower than this not drawn.
G4bool fCullCovered; // Cull daughters covered by opaque mothers.
G4int fCBDAlgorithmNumber; // Colour by density algorithm number.
std::vector<G4double> fCBDParameters; // Colour by density parameters.
G4double fExplodeFactor; // Explode along radius by this factor...
G4Point3D fExplodeCentre; // ...about this centre.
G4int fNoOfSides; // ...if polygon approximates circle.
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4ModelingParameters.icc 99418 2016-09-21 09:18:42Z gcosmo $
// $Id: G4ModelingParameters.icc 109510 2018-04-26 07:15:57Z gcosmo $
//
//
// John Allison 31st December 1997.
@@ -64,6 +64,14 @@ inline G4bool G4ModelingParameters::IsCullingCovered () const {
return fCullCovered;
}
inline G4int G4ModelingParameters::GetCBDAlgorithmNumber () const {
return fCBDAlgorithmNumber;
}
inline const std::vector<G4double>& G4ModelingParameters::GetCBDParameters () const {
return fCBDParameters;
}
inline G4bool G4ModelingParameters::IsExplode () const {
return fExplodeFactor > 1.;
}
@@ -125,6 +133,14 @@ inline void G4ModelingParameters::SetCullingCovered (G4bool value) {
fCullCovered = value;
}
inline void G4ModelingParameters::SetCBDAlgorithmNumber (G4int n) {
fCBDAlgorithmNumber = n;
}
inline void G4ModelingParameters::SetCBDParameters (const std::vector<G4double>& p) {
fCBDParameters = p;
}
inline void G4ModelingParameters::SetExplodeFactor (G4double explodeFactor) {
fExplodeFactor = explodeFactor;
}
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4LogicalVolumeModel.cc 66373 2012-12-18 09:41:34Z gcosmo $
// $Id: G4LogicalVolumeModel.cc 110480 2018-05-25 07:25:18Z gcosmo $
//
//
// John Allison 26th July 1999.
@@ -47,6 +47,7 @@ G4LogicalVolumeModel::G4LogicalVolumeModel
G4bool booleans,
G4bool voxels,
G4bool readout,
G4bool checkOverlaps,
const G4Transform3D& modelTransformation,
const G4ModelingParameters* pMP):
// Instantiate a G4PhysicalVolumeModel with a G4PVPlacement to
@@ -70,7 +71,8 @@ G4LogicalVolumeModel::G4LogicalVolumeModel
fpLV (pLV),
fBooleans (booleans),
fVoxels (voxels),
fReadout (readout)
fReadout (readout),
fCheckOverlaps(checkOverlaps)
{
fType = "G4LogicalVolumeModel";
fGlobalTag = fpLV -> GetName ();
@@ -125,6 +127,15 @@ void G4LogicalVolumeModel::DescribeYourselfTo
}
}
}
if (fCheckOverlaps) {
G4LogicalVolume* lv = fpTopPV->GetLogicalVolume();
G4int nSisters = lv->GetNoDaughters();
for (G4int iSister = 0; iSister < nSisters; ++iSister) {
G4PVPlacement* placement = dynamic_cast<G4PVPlacement*>(lv->GetDaughter(iSister));
if (placement) placement->CheckOverlaps();
}
}
}
// This called from G4PhysicalVolumeModel::DescribeAndDescend by the
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4ModelingParameters.cc 106122 2017-09-13 12:51:53Z gcosmo $
// $Id: G4ModelingParameters.cc 109510 2018-04-26 07:15:57Z gcosmo $
//
//
// John Allison 31st December 1997.
@@ -39,6 +39,7 @@
#include "G4VSolid.hh"
#include "G4VPhysicalVolume.hh"
#include "G4PhysicalVolumeModel.hh"
#include "G4UnitsTable.hh"
G4ModelingParameters::G4ModelingParameters ():
fWarning (true),
@@ -49,6 +50,7 @@ G4ModelingParameters::G4ModelingParameters ():
fDensityCulling (false),
fVisibleDensity (0.01 * g / cm3),
fCullCovered (false),
fCBDAlgorithmNumber (0),
fExplodeFactor (1.),
fNoOfSides (24),
fpSectionSolid (0),
@@ -74,6 +76,7 @@ G4ModelingParameters::G4ModelingParameters
fDensityCulling (isDensityCulling),
fVisibleDensity (visibleDensity),
fCullCovered (isCullingCovered),
fCBDAlgorithmNumber(0),
fExplodeFactor (1.),
fNoOfSides (noOfSides),
fpSectionSolid (0),
@@ -193,6 +196,16 @@ std::ostream& operator << (std::ostream& os, const G4ModelingParameters& mp)
if (mp.fCullCovered) os << "on";
else os << "off";
os << "\n Colour by density: ";
if (mp.fCBDAlgorithmNumber <= 0) {
os << "inactive";
} else {
os << "Algorithm " << mp.fCBDAlgorithmNumber << ", Parameters:";
for (auto p: mp.fCBDParameters) {
os << ' ' << G4BestUnit(p,"Volumic Mass");
}
}
os << "\n Explode factor: " << mp.fExplodeFactor
<< " about centre: " << mp.fExplodeCentre;
@@ -231,6 +244,7 @@ G4bool G4ModelingParameters::operator !=
(fCullInvisible != mp.fCullInvisible) ||
(fDensityCulling != mp.fDensityCulling) ||
(fCullCovered != mp.fCullCovered) ||
(fCBDAlgorithmNumber != mp.fCBDAlgorithmNumber) ||
(fExplodeFactor != mp.fExplodeFactor) ||
(fExplodeCentre != mp.fExplodeCentre) ||
(fNoOfSides != mp.fNoOfSides) ||
@@ -243,6 +257,11 @@ G4bool G4ModelingParameters::operator !=
if (fDensityCulling &&
(fVisibleDensity != mp.fVisibleDensity)) return true;
if (fCBDAlgorithmNumber > 0) {
if (fCBDParameters.size() != mp.fCBDParameters.size()) return true;
else if (fCBDParameters != mp.fCBDParameters) return true;
}
if (fVisAttributesModifiers != mp.fVisAttributesModifiers)
return true;
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4PhysicalVolumeMassScene.cc 110128 2018-05-16 06:36:57Z gcosmo $
// $Id: G4PhysicalVolumeMassScene.cc 108859 2018-03-12 07:44:53Z gcosmo $
//
//
// John Allison 10th August 1998.
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4PhysicalVolumeModel.cc 106122 2017-09-13 12:51:53Z gcosmo $
// $Id: G4PhysicalVolumeModel.cc 110743 2018-06-12 06:33:37Z gcosmo $
//
//
// John Allison 31st December 1997.
@@ -229,8 +229,8 @@ void G4PhysicalVolumeModel::VisitGeometryAndGetVisReps
// local variables to preserve re-entrancy.
G4LogicalVolume* pLV = pVPV -> GetLogicalVolume ();
G4VSolid* pSol;
G4Material* pMaterial;
G4VSolid* pSol = nullptr;
G4Material* pMaterial = nullptr;
if (!(pVPV -> IsReplicated ())) {
// Non-replicated physical volume.
@@ -384,12 +384,42 @@ void G4PhysicalVolumeModel::DescribeAndDescend
fpCurrentTransform = &theNewAT;
const G4VisAttributes* pVisAttribs = pLV->GetVisAttributes();
if (!pVisAttribs) pVisAttribs = fpMP->GetDefaultVisAttributes();
// Beware - pVisAttribs might still be zero - probably will, since that's
// the default for G4ModelingParameters. So create one if necessary...
// If the volume does not have any vis attributes, create it.
G4VisAttributes* tempVisAtts = nullptr;
if (!pVisAttribs) {
static G4VisAttributes defaultVisAttribs;
pVisAttribs = &defaultVisAttribs;
tempVisAtts = new G4VisAttributes; // Default value.
// The user may request /vis/viewer/set/colourByDensity.
if (fpMP->GetCBDAlgorithmNumber() == 1) {
// Algorithm 1: 3 parameters: Simple rainbow mapping.
if (fpMP->GetCBDParameters().size() != 3) {
G4Exception("G4PhysicalVolumeModelTouchable::DescribeAndDescend",
"modeling0014",
FatalErrorInArgument,
"Algorithm-parameter mismatch for Colour By Density");
} else {
const G4double d = pMaterial? pMaterial->GetDensity(): 0.;
const G4double d0 = fpMP->GetCBDParameters()[0]; // Invisible d < d0.
const G4double d1 = fpMP->GetCBDParameters()[1]; // Rainbow d0->d1->d2.
const G4double d2 = fpMP->GetCBDParameters()[2]; // Blue d > d2.
if (d < d0) { // Density < d0 is invisible.
tempVisAtts->SetVisibility(false);
} else { // Intermediate densities are on a spectrum.
G4double red, green, blue;
if (d < d1) {
red = (d1-d)/(d1-d0); green = (d-d0)/(d1-d0); blue = 0.;
} else if (d < d2) {
red = 0.; green = (d2-d)/(d2-d1); blue = (d-d1)/(d2-d1);
} else { // Density >= d2 is blue.
red = 0.; green = 0.; blue = 1.;
}
tempVisAtts->SetColour(G4Colour(red,green,blue));
}
}
} else if (fpMP->GetCBDAlgorithmNumber() == 2) {
// Algorithm 2
// ...etc.
}
pVisAttribs = tempVisAtts;
}
// From here, can assume pVisAttribs is a valid pointer. This is necessary
// because PreAddSolid needs a vis attributes object.
@@ -604,6 +634,8 @@ void G4PhysicalVolumeModel::DescribeAndDescend
}
}
delete tempVisAtts;
// Reset for normal descending of next volume at this level...
fCurtailDescent = false;
@@ -89,7 +89,7 @@ G4TrajectoryDrawByEncounteredVolume::Draw(const G4VTrajectory& traj, const G4boo
}
catch (std::bad_cast)
catch (const std::bad_cast&)
{
G4ExceptionDescription ed;
ed << "Requires G4RichTrajectory - \"/vis/scene/add/trajectories rich\"";
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4TrajectoryDrawerUtils.cc 108542 2018-02-16 09:35:32Z gcosmo $
// $Id: G4TrajectoryDrawerUtils.cc 107920 2017-12-13 08:06:00Z gcosmo $
//
// Jane Tinslay, John Allison, Joseph Perl November 2005
//
@@ -67,7 +67,7 @@ G4TrajectoryEncounteredVolumeFilter::Evaluate(const G4VTrajectory& traj) const
return false;
}
catch (std::bad_cast)
catch (const std::bad_cast&)
{
G4ExceptionDescription ed;
ed << "Requires G4RichTrajectory - \"/vis/scene/add/trajectories rich\"";