Import Geant4 11.1.1 source tree
This commit is contained in:
@@ -6,6 +6,10 @@ It must **not** be used as a substitute for writing good git commit messages!
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
## 2023-01-09 Gabriele Cosmo (geommng-V11-00-10)
|
||||
- G4LogicalVolume: use std::shared_ptr for handling visualization attributes.
|
||||
Ignore calls to SetVisAttributes() from worker threads.
|
||||
|
||||
## 2022-11-16 Gabriele Cosmo (geommng-V11-00-09)
|
||||
- Fixed more compilation warnings for implicit type conversions on
|
||||
macOS/XCode 14.1 in G4SmartVoxelNode source.
|
||||
|
||||
@@ -105,6 +105,7 @@
|
||||
#define G4LOGICALVOLUME_HH 1
|
||||
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
|
||||
#include "G4Types.hh"
|
||||
#include "G4Region.hh" // Required by inline methods
|
||||
@@ -120,9 +121,9 @@ class G4VSensitiveDetector;
|
||||
class G4VSolid;
|
||||
class G4UserLimits;
|
||||
class G4SmartVoxelHeader;
|
||||
class G4VisAttributes;
|
||||
class G4FastSimulationManager;
|
||||
class G4MaterialCutsCouple;
|
||||
class G4VisAttributes;
|
||||
|
||||
class G4LVData
|
||||
{
|
||||
@@ -323,11 +324,11 @@ class G4LogicalVolume
|
||||
// Equality defined by address only.
|
||||
// Returns true if objects are at same address, else false.
|
||||
|
||||
inline const G4VisAttributes* GetVisAttributes () const;
|
||||
inline void SetVisAttributes (const G4VisAttributes* pVA);
|
||||
void SetVisAttributes (const G4VisAttributes& VA);
|
||||
// Gets and sets visualization attributes. A copy of 'VA' on the heap
|
||||
// will be made in the case the call with a const reference is used.
|
||||
const G4VisAttributes* GetVisAttributes () const;
|
||||
void SetVisAttributes (const G4VisAttributes* pVA);
|
||||
void SetVisAttributes (const G4VisAttributes& VA);
|
||||
// Gets and sets visualization attributes.
|
||||
// Arguments are converted to shared_ptr.
|
||||
|
||||
inline G4FastSimulationManager* GetFastSimulationManager () const;
|
||||
// Gets current FastSimulationManager pointer if exists, otherwise null.
|
||||
@@ -405,12 +406,12 @@ class G4LogicalVolume
|
||||
G4double fSmartless = 2.0;
|
||||
// Quality for optimisation, average number of voxels to be spent
|
||||
// per content.
|
||||
const G4VisAttributes* fVisAttributes = nullptr;
|
||||
// Pointer (possibly nullptr) to visualization attributes.
|
||||
G4Region* fRegion = nullptr;
|
||||
// Pointer to the cuts region (if any)
|
||||
// Pointer to the cuts region (if any).
|
||||
G4double fBiasWeight = 1.0;
|
||||
// Weight used in the event biasing technique.
|
||||
std::shared_ptr<const G4VisAttributes> fVisAttributes;
|
||||
// Pointer to visualization attributes.
|
||||
|
||||
// Shadow of master pointers.
|
||||
// Each worker thread can access this field from the master thread
|
||||
|
||||
@@ -322,26 +322,6 @@ G4bool G4LogicalVolume::operator == ( const G4LogicalVolume& lv) const
|
||||
return (this==&lv) ? true : false;
|
||||
}
|
||||
|
||||
// ********************************************************************
|
||||
// GetVisAttributes
|
||||
// ********************************************************************
|
||||
//
|
||||
inline
|
||||
const G4VisAttributes* G4LogicalVolume::GetVisAttributes () const
|
||||
{
|
||||
return fVisAttributes;
|
||||
}
|
||||
|
||||
// ********************************************************************
|
||||
// SetVisAttributes
|
||||
// ********************************************************************
|
||||
//
|
||||
inline
|
||||
void G4LogicalVolume::SetVisAttributes (const G4VisAttributes* pVA)
|
||||
{
|
||||
fVisAttributes = pVA;
|
||||
}
|
||||
|
||||
// ********************************************************************
|
||||
// SetBiasWeight
|
||||
// ********************************************************************
|
||||
@@ -361,3 +341,13 @@ G4double G4LogicalVolume::GetBiasWeight() const
|
||||
{
|
||||
return fBiasWeight;
|
||||
}
|
||||
|
||||
// ********************************************************************
|
||||
// GetVisAttributes
|
||||
// ********************************************************************
|
||||
//
|
||||
inline
|
||||
const G4VisAttributes* G4LogicalVolume::GetVisAttributes () const
|
||||
{
|
||||
return fVisAttributes.get();
|
||||
}
|
||||
|
||||
@@ -641,11 +641,6 @@ G4double G4LogicalVolume::GetMass(G4bool forced,
|
||||
return massSum;
|
||||
}
|
||||
|
||||
void G4LogicalVolume::SetVisAttributes (const G4VisAttributes& VA)
|
||||
{
|
||||
fVisAttributes = new G4VisAttributes(VA);
|
||||
}
|
||||
|
||||
// ********************************************************************
|
||||
// Change the daughters volume type -- checking proposed values
|
||||
//
|
||||
@@ -677,3 +672,23 @@ G4bool G4LogicalVolume::ChangeDaughtersType(EVolume aType)
|
||||
}
|
||||
return works;
|
||||
}
|
||||
|
||||
// ********************************************************************
|
||||
// SetVisAttributes - copy version
|
||||
// ********************************************************************
|
||||
//
|
||||
void G4LogicalVolume::SetVisAttributes (const G4VisAttributes& VA)
|
||||
{
|
||||
if (G4Threading::IsWorkerThread()) return;
|
||||
fVisAttributes = std::make_shared<const G4VisAttributes>(VA);
|
||||
}
|
||||
|
||||
// ********************************************************************
|
||||
// SetVisAttributes
|
||||
// ********************************************************************
|
||||
//
|
||||
void G4LogicalVolume::SetVisAttributes (const G4VisAttributes* pVA)
|
||||
{
|
||||
if (G4Threading::IsWorkerThread()) return;
|
||||
fVisAttributes = std::shared_ptr<const G4VisAttributes>(pVA,[](const G4VisAttributes*){});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user