Import Geant4 10.7.0 source tree
This commit is contained in:
@@ -16,6 +16,18 @@ commit in the repository !
|
||||
* Reverse chronological order (last date on top), please *
|
||||
----------------------------------------------------------
|
||||
|
||||
October 11th, 2020 E.Tcherniaev - geomvol-V10-06-03
|
||||
- G4PVPlacement::CheckOverlaps(): Added keeping of bounding box from
|
||||
previous solid and complementory comparison of bounding spheres.
|
||||
|
||||
October 7th, 2020 G.Cosmo - geomvol-V10-06-02
|
||||
- Minor update to G4LogicalBorderSurface.
|
||||
|
||||
October 6th, 2020 G.Cosmo - geomvol-V10-06-01
|
||||
- Use std::map instead of std::vector to define G4LogicalBorderSurfaceTable,
|
||||
to speedup search of surfaces in large tables.
|
||||
Based on GitHub PR #6 by J.Brodsky.
|
||||
|
||||
December 10th, 2019 B.Morgan - geomvol-V10-06-00
|
||||
- Cleanup CMake build, removing obsolete granular library options and
|
||||
explicit include_directories.
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
// Class description:
|
||||
//
|
||||
// G4AssemblyVolume is a helper class to make the build process of geometry
|
||||
// easier. It allows to combine several volumes together in an arbitrary way
|
||||
// easier. It allows one to combine several volumes together in an arbitrary way
|
||||
// in 3D space and then work with the result as with a single logical volume
|
||||
// for placement.
|
||||
// The resulting objects are independent copies of each of the assembled
|
||||
|
||||
@@ -31,12 +31,11 @@
|
||||
// of two physical volumes.
|
||||
|
||||
// Author: John Apostolakis (John.Apostolakis@cern.ch), 17-06-1997
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
#ifndef G4LogicalBorderSurface_h
|
||||
#define G4LogicalBorderSurface_h 1
|
||||
#ifndef G4LogicalBorderSurface_hh
|
||||
#define G4LogicalBorderSurface_hh 1
|
||||
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
#include "G4LogicalSurface.hh"
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
@@ -44,7 +43,9 @@
|
||||
class G4VPhysicalVolume;
|
||||
class G4LogicalBorderSurface;
|
||||
|
||||
using G4LogicalBorderSurfaceTable = std::vector<G4LogicalBorderSurface*>;
|
||||
using G4LogicalBorderSurfaceTable
|
||||
= std::map<std::pair<const G4VPhysicalVolume*,
|
||||
const G4VPhysicalVolume*>, G4LogicalBorderSurface*>;
|
||||
|
||||
class G4LogicalBorderSurface : public G4LogicalSurface
|
||||
{
|
||||
@@ -99,5 +100,5 @@ class G4LogicalBorderSurface : public G4LogicalSurface
|
||||
|
||||
#include "G4LogicalBorderSurface.icc"
|
||||
|
||||
#endif /* G4LogicalBorderSurface_h */
|
||||
#endif
|
||||
|
||||
|
||||
@@ -31,10 +31,9 @@
|
||||
// volume.
|
||||
|
||||
// Author: John Apostolakis (John.Apostolakis@cern.ch), 16-06-1997
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
#ifndef G4LogicalSkinSurface_h
|
||||
#define G4LogicalSkinSurface_h 1
|
||||
// --------------------------------------------------------------------
|
||||
#ifndef G4LogicalSkinSurface_hh
|
||||
#define G4LogicalSkinSurface_hh 1
|
||||
|
||||
#include <vector>
|
||||
|
||||
@@ -48,7 +47,7 @@ using G4LogicalSkinSurfaceTable = std::vector<G4LogicalSkinSurface*>;
|
||||
class G4LogicalSkinSurface : public G4LogicalSurface
|
||||
{
|
||||
|
||||
public: // with description
|
||||
public:
|
||||
|
||||
G4LogicalSkinSurface( const G4String& name,
|
||||
G4LogicalVolume* vol,
|
||||
@@ -71,7 +70,7 @@ class G4LogicalSkinSurface : public G4LogicalSurface
|
||||
|
||||
static void CleanSurfaceTable();
|
||||
static const G4LogicalSkinSurfaceTable* GetSurfaceTable();
|
||||
static size_t GetNumberOfSkinSurfaces();
|
||||
static std::size_t GetNumberOfSkinSurfaces();
|
||||
static void DumpInfo(); // const
|
||||
// To handle with the table of surfaces.
|
||||
|
||||
@@ -91,5 +90,5 @@ class G4LogicalSkinSurface : public G4LogicalSurface
|
||||
|
||||
#include "G4LogicalSkinSurface.icc"
|
||||
|
||||
#endif /* G4LogicalSkinSurface_h */
|
||||
#endif
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
// of two physical volumes.
|
||||
//
|
||||
// Author: John Apostolakis (John.Apostolakis@cern.ch), 26-06-1997
|
||||
// ----------------------------------------------------------------------
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#include "G4LogicalBorderSurface.hh"
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
@@ -49,14 +49,14 @@ G4LogicalBorderSurface(const G4String& name,
|
||||
: G4LogicalSurface(name, surfaceProperty),
|
||||
Volume1(vol1), Volume2(vol2)
|
||||
{
|
||||
if (!theBorderSurfaceTable)
|
||||
if (theBorderSurfaceTable == nullptr)
|
||||
{
|
||||
theBorderSurfaceTable = new G4LogicalBorderSurfaceTable;
|
||||
}
|
||||
|
||||
// Store in the table of Surfaces
|
||||
//
|
||||
theBorderSurfaceTable->push_back(this);
|
||||
theBorderSurfaceTable->insert(std::make_pair(std::make_pair(vol1,vol2),this));
|
||||
}
|
||||
|
||||
G4LogicalBorderSurface::~G4LogicalBorderSurface()
|
||||
@@ -92,7 +92,7 @@ const G4LogicalBorderSurfaceTable* G4LogicalBorderSurface::GetSurfaceTable()
|
||||
return theBorderSurfaceTable;
|
||||
}
|
||||
|
||||
size_t G4LogicalBorderSurface::GetNumberOfBorderSurfaces()
|
||||
std::size_t G4LogicalBorderSurface::GetNumberOfBorderSurfaces()
|
||||
{
|
||||
if (theBorderSurfaceTable != nullptr)
|
||||
{
|
||||
@@ -107,14 +107,10 @@ G4LogicalBorderSurface::GetSurface(const G4VPhysicalVolume* vol1,
|
||||
{
|
||||
if (theBorderSurfaceTable != nullptr)
|
||||
{
|
||||
for(auto pos = theBorderSurfaceTable->cbegin();
|
||||
pos != theBorderSurfaceTable->cend(); ++pos)
|
||||
{
|
||||
if( (*pos)->GetVolume1() == vol1 && (*pos)->GetVolume2() == vol2 )
|
||||
{ return *pos; }
|
||||
}
|
||||
auto pos = theBorderSurfaceTable->find(std::make_pair(vol1,vol2));
|
||||
if(pos != theBorderSurfaceTable->cend()) return pos->second;
|
||||
}
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Dump info for known surfaces
|
||||
@@ -129,11 +125,11 @@ void G4LogicalBorderSurface::DumpInfo()
|
||||
for(auto pos = theBorderSurfaceTable->cbegin();
|
||||
pos != theBorderSurfaceTable->cend(); ++pos)
|
||||
{
|
||||
G4cout << (*pos)->GetName() << " : " << G4endl
|
||||
G4LogicalBorderSurface* pSurf = pos->second;
|
||||
G4cout << pSurf->GetName() << " : " << G4endl
|
||||
<< " Border of volumes "
|
||||
<< (*pos)->GetVolume1()->GetName() << " and "
|
||||
<< (*pos)->GetVolume2()->GetName()
|
||||
<< G4endl;
|
||||
<< pSurf->GetVolume1()->GetName() << " and "
|
||||
<< pSurf->GetVolume2()->GetName() << G4endl;
|
||||
}
|
||||
}
|
||||
G4cout << G4endl;
|
||||
@@ -146,7 +142,7 @@ void G4LogicalBorderSurface::CleanSurfaceTable()
|
||||
for(auto pos = theBorderSurfaceTable->cbegin();
|
||||
pos != theBorderSurfaceTable->cend(); ++pos)
|
||||
{
|
||||
if (*pos) { delete *pos; }
|
||||
if (pos->second) { delete pos->second; }
|
||||
}
|
||||
theBorderSurfaceTable->clear();
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
// logical volume.
|
||||
//
|
||||
// Author: John Apostolakis (John.Apostolakis@cern.ch), 26-06-1997
|
||||
// ----------------------------------------------------------------------
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#include "G4LogicalSkinSurface.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// class G4PVPlacement Implementation
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
@@ -163,7 +163,7 @@ G4PVPlacement::~G4PVPlacement()
|
||||
//
|
||||
G4bool G4PVPlacement::IsMany() const
|
||||
{
|
||||
return fmany;
|
||||
return fmany;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
@@ -215,7 +215,7 @@ GetReplicationData( EAxis&, G4int&, G4double&, G4double&, G4bool& ) const
|
||||
G4bool G4PVPlacement::IsRegularStructure() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// IsRegularRepeatedStructure
|
||||
@@ -224,8 +224,8 @@ G4bool G4PVPlacement::IsRegularStructure() const
|
||||
//
|
||||
G4int G4PVPlacement::GetRegularStructureId() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// VolumeType
|
||||
@@ -294,6 +294,8 @@ G4bool G4PVPlacement::CheckOverlaps(G4int res, G4double tol,
|
||||
ymax = std::max(ymax, points[i].y());
|
||||
zmax = std::max(zmax, points[i].z());
|
||||
}
|
||||
G4ThreeVector scenter(0.5*(xmax+xmin), 0.5*(ymax+ymin), 0.5*(zmax+zmin));
|
||||
G4double sradius = 0.5*G4ThreeVector(xmax-xmin, ymax-ymin, zmax-zmin).mag();
|
||||
|
||||
// Check overlap with the mother volume
|
||||
//
|
||||
@@ -332,21 +334,27 @@ G4bool G4PVPlacement::CheckOverlaps(G4int res, G4double tol,
|
||||
|
||||
// Checking overlaps with each 'sister' volume
|
||||
//
|
||||
G4VSolid* previous = nullptr;
|
||||
G4ThreeVector pmin_local(0.,0.,0.), pmax_local(0.,0.,0.);
|
||||
|
||||
for (size_t k = 0; k < motherLog->GetNoDaughters(); ++k)
|
||||
{
|
||||
G4VPhysicalVolume* daughter = motherLog->GetDaughter(k);
|
||||
if (daughter == this) continue;
|
||||
G4VSolid* daughterSolid = daughter->GetLogicalVolume()->GetSolid();
|
||||
G4AffineTransform Td(daughter->GetRotation(), daughter->GetTranslation());
|
||||
|
||||
G4AffineTransform Td(daughter->GetRotation(), daughter->GetTranslation());
|
||||
G4VSolid* daughterSolid = daughter->GetLogicalVolume()->GetSolid();
|
||||
if (previous != daughterSolid)
|
||||
{
|
||||
daughterSolid->BoundingLimits(pmin_local, pmax_local);
|
||||
previous = daughterSolid;
|
||||
}
|
||||
G4double distout = -kInfinity;
|
||||
G4ThreeVector plocal;
|
||||
if (!Td.IsRotated()) {
|
||||
G4ThreeVector offset = Td.NetTranslation();
|
||||
G4ThreeVector pmin, pmax;
|
||||
daughterSolid->BoundingLimits(pmin, pmax);
|
||||
pmin += offset;
|
||||
pmax += offset;
|
||||
G4ThreeVector pmin(pmin_local + offset);
|
||||
G4ThreeVector pmax(pmax_local + offset);
|
||||
if (pmin.x() >= xmax) continue;
|
||||
if (pmin.y() >= ymax) continue;
|
||||
if (pmin.z() >= zmax) continue;
|
||||
@@ -364,7 +372,7 @@ G4bool G4PVPlacement::CheckOverlaps(G4int res, G4double tol,
|
||||
if (p.z() >= pmax.z()) continue;
|
||||
G4ThreeVector md = p - offset;
|
||||
if (daughterSolid->Inside(md) == kInside)
|
||||
{
|
||||
{
|
||||
G4double dtmp = daughterSolid->DistanceToOut(md);
|
||||
if (dtmp <= tol) continue;
|
||||
distout = dtmp;
|
||||
@@ -372,9 +380,20 @@ G4bool G4PVPlacement::CheckOverlaps(G4int res, G4double tol,
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
G4ThreeVector pmin, pmax;
|
||||
daughterSolid->BoundingLimits(pmin, pmax);
|
||||
}
|
||||
else
|
||||
{
|
||||
G4ThreeVector pmin(pmin_local), pmax(pmax_local);
|
||||
G4ThreeVector dcenter = Td.TransformPoint(0.5*(pmin + pmax));
|
||||
G4double dradius = 0.5*((pmax - pmin).mag());
|
||||
if ((scenter - dcenter).mag2() >= (sradius + dradius)*(sradius + dradius)) continue;
|
||||
if (dcenter.x() - dradius >= xmax) continue;
|
||||
if (dcenter.y() - dradius >= ymax) continue;
|
||||
if (dcenter.z() - dradius >= zmax) continue;
|
||||
if (dcenter.x() + dradius <= xmin) continue;
|
||||
if (dcenter.y() + dradius <= ymin) continue;
|
||||
if (dcenter.z() + dradius <= zmin) continue;
|
||||
|
||||
G4ThreeVector pbox[8] = {
|
||||
G4ThreeVector(pmin.x(), pmin.y(), pmin.z()),
|
||||
G4ThreeVector(pmax.x(), pmin.y(), pmin.z()),
|
||||
@@ -414,13 +433,13 @@ G4bool G4PVPlacement::CheckOverlaps(G4int res, G4double tol,
|
||||
if (p.z() <= dzmin) continue;
|
||||
G4ThreeVector md = Td.InverseTransformPoint(p);
|
||||
if (daughterSolid->Inside(md) == kInside)
|
||||
{
|
||||
{
|
||||
G4double dtmp = daughterSolid->DistanceToOut(md);
|
||||
if (dtmp <= tol) continue;
|
||||
distout = dtmp;
|
||||
plocal = md;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -503,12 +522,12 @@ G4bool G4PVPlacement::CheckOverlaps(G4int res, G4double tol,
|
||||
// argument into it.
|
||||
//
|
||||
// NOTE: Ownership of the returned pointer is left to the caller !
|
||||
// No entity is currently responsible to delete this memory.
|
||||
// No entity is currently responsible to delete this memory.
|
||||
//
|
||||
G4RotationMatrix*
|
||||
G4PVPlacement::NewPtrRotMatrix(const G4RotationMatrix &RotMat)
|
||||
{
|
||||
G4RotationMatrix* pRotMatrix;
|
||||
G4RotationMatrix* pRotMatrix;
|
||||
if ( RotMat.isIdentity() )
|
||||
{
|
||||
pRotMatrix = nullptr;
|
||||
@@ -516,6 +535,6 @@ G4PVPlacement::NewPtrRotMatrix(const G4RotationMatrix &RotMat)
|
||||
else
|
||||
{
|
||||
pRotMatrix = new G4RotationMatrix(RotMat);
|
||||
}
|
||||
}
|
||||
return pRotMatrix;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user