Import Geant4 10.4.0.beta source tree
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
# $Id: GNUmakefile 85530 2014-10-30 16:17:43Z gcosmo $
|
||||
# $Id: GNUmakefile 103464 2017-04-11 07:24:03Z gcosmo $
|
||||
# ----------------------------------------------------------------
|
||||
# GNUmakefile for geometry/CSG library. Gabriele Cosmo, 16/11/96.
|
||||
# ----------------------------------------------------------------
|
||||
@@ -17,6 +17,8 @@ CPPFLAGS += -I$(G4BASE)/intercoms/include \
|
||||
-I$(G4BASE)/global/management/include \
|
||||
-I$(G4BASE)/global/HEPRandom/include \
|
||||
-I$(G4BASE)/global/HEPGeometry/include \
|
||||
-I$(G4BASE)/geometry/solids/CSG/include \
|
||||
-I$(G4BASE)/geometry/solids/specific/include \
|
||||
-I$(G4BASE)/geometry/volumes/include \
|
||||
-I$(G4BASE)/geometry/management/include
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
$Id: History 102530 2017-02-08 13:41:59Z gcosmo $
|
||||
$Id: History 104316 2017-05-24 13:04:23Z gcosmo $
|
||||
-------------------------------------------------------------------
|
||||
|
||||
=========================================================
|
||||
@@ -20,7 +20,25 @@ committal in the CVS repository !
|
||||
* Reverse chronological order (last date on top), please *
|
||||
----------------------------------------------------------
|
||||
|
||||
February 2, 2017 G. Cosmo geom-bool-V10-02-12
|
||||
May 24, 2017 G. Cosmo geom-bool-V10-03-04
|
||||
- Renamed ambiguous name Extent() in all shapes to BoundingLimits().
|
||||
Change required in order to avoid signature conflict with VecGeom in
|
||||
G4U* wrappers. Requires tag geommng-V10-03-16.
|
||||
|
||||
May 15, 2017 G. Cosmo geom-bool-V10-03-03
|
||||
- Fixed minor Coverity defects to G4MultiUnion.
|
||||
|
||||
April 17, 2017 G. Cosmo geom-bool-V10-03-02
|
||||
- Added G4MultiUnion class, importing original implementation for a
|
||||
multiple-union structure from the USolids library.
|
||||
Removed no longer necessary wrapper G4UMultiUnion.
|
||||
Requires coworking tags in geometry solids and persistency/gdml.
|
||||
|
||||
March 16, 2017 E. Tcherniaev geom-bool-V10-03-01
|
||||
- Revised SurfaceNormal() in G4UnionSolid, to correctly return average
|
||||
normal if point is on common surface.
|
||||
|
||||
February 2, 2017 G. Cosmo geom-bool-V10-03-00
|
||||
- Return normal from solid being subtracted, in case point is located
|
||||
outside in G4SubtractionSolid::SurfaceNormal().
|
||||
- Code formatting and minor cleanup in G4IntersectionSolid.
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4DisplacedSolid.hh 101046 2016-11-04 10:44:26Z gcosmo $
|
||||
// $Id: G4DisplacedSolid.hh 104316 2017-05-24 13:04:23Z gcosmo $
|
||||
//
|
||||
//
|
||||
// class G4DisplacedSolid
|
||||
@@ -76,7 +76,7 @@ class G4DisplacedSolid : public G4VSolid
|
||||
|
||||
EInside Inside( const G4ThreeVector& p ) const ;
|
||||
|
||||
void Extent(G4ThreeVector& pMin, G4ThreeVector& pMax) const;
|
||||
void BoundingLimits(G4ThreeVector& pMin, G4ThreeVector& pMax) const;
|
||||
|
||||
G4bool CalculateExtent(const EAxis pAxis,
|
||||
const G4VoxelLimits& pVoxelLimit,
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4IntersectionSolid.hh 101046 2016-11-04 10:44:26Z gcosmo $
|
||||
// $Id: G4IntersectionSolid.hh 104316 2017-05-24 13:04:23Z gcosmo $
|
||||
//
|
||||
//
|
||||
// class G4IntersectionSolid
|
||||
@@ -86,7 +86,7 @@ class G4IntersectionSolid : public G4BooleanSolid
|
||||
G4IntersectionSolid& operator=(const G4IntersectionSolid& rhs);
|
||||
// Copy constructor and assignment operator.
|
||||
|
||||
void Extent(G4ThreeVector& pMin, G4ThreeVector& pMax) const;
|
||||
void BoundingLimits(G4ThreeVector& pMin, G4ThreeVector& pMax) const;
|
||||
|
||||
G4bool CalculateExtent( const EAxis pAxis,
|
||||
const G4VoxelLimits& pVoxelLimit,
|
||||
|
||||
@@ -34,23 +34,247 @@
|
||||
//
|
||||
// Class description:
|
||||
//
|
||||
// Typedef for UMultiUnion from USolids module.
|
||||
// An instance of "G4MultiUnion" constitutes a grouping of several solids.
|
||||
// The constituent solids are stored with their respective location in an
|
||||
// instance of "G4Node". An instance of "G4MultiUnion" is subsequently
|
||||
// composed of one or several nodes.
|
||||
|
||||
// History:
|
||||
// 13.11.13 G.Cosmo, CERN/PH
|
||||
// 06.04.17 G.Cosmo - Imported implementation in Geant4 for VecGeom migration
|
||||
// 19.10.12 M.Gayer - Original implementation from USolids module
|
||||
// --------------------------------------------------------------------
|
||||
#ifndef G4MULTIUNION_HH
|
||||
#define G4MULTIUNION_HH
|
||||
|
||||
#include "G4UMultiUnion.hh"
|
||||
#include <vector>
|
||||
|
||||
#if defined(G4GEOM_USE_USOLIDS)
|
||||
#include "G4VSolid.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
#include "G4Transform3D.hh"
|
||||
#include "G4Point3D.hh"
|
||||
#include "G4Vector3D.hh"
|
||||
#include "G4SurfBits.hh"
|
||||
#include "G4Voxelizer.hh"
|
||||
|
||||
typedef G4UMultiUnion G4MultiUnion;
|
||||
class G4Polyhedron;
|
||||
|
||||
#else
|
||||
class G4MultiUnion : public G4VSolid
|
||||
{
|
||||
friend class G4Voxelizer;
|
||||
|
||||
typedef void G4MultiUnion;
|
||||
public:
|
||||
|
||||
G4MultiUnion() : G4VSolid("") {}
|
||||
G4MultiUnion(const G4String& name);
|
||||
~G4MultiUnion();
|
||||
|
||||
// Build the multiple union by adding nodes
|
||||
void AddNode(G4VSolid& solid, G4Transform3D& trans);
|
||||
|
||||
G4MultiUnion(const G4MultiUnion& rhs);
|
||||
G4MultiUnion& operator=(const G4MultiUnion& rhs);
|
||||
|
||||
// Accessors
|
||||
inline const G4Transform3D& GetTransformation(G4int index) const;
|
||||
inline G4VSolid* GetSolid(G4int index) const;
|
||||
inline G4int GetNumberOfSolids()const;
|
||||
|
||||
// Navigation methods
|
||||
EInside Inside(const G4ThreeVector& aPoint) const;
|
||||
|
||||
EInside InsideIterator(const G4ThreeVector& aPoint) const;
|
||||
|
||||
// Safety methods
|
||||
G4double DistanceToIn(const G4ThreeVector& aPoint) const;
|
||||
G4double DistanceToOut(const G4ThreeVector& aPoint) const;
|
||||
inline void SetAccurateSafety(G4bool flag);
|
||||
|
||||
// Exact distance methods
|
||||
G4double DistanceToIn(const G4ThreeVector& aPoint,
|
||||
const G4ThreeVector& aDirection) const;
|
||||
G4double DistanceToOut(const G4ThreeVector& aPoint,
|
||||
const G4ThreeVector& aDirection,
|
||||
const G4bool calcNorm=false,
|
||||
G4bool *validNorm=0,
|
||||
G4ThreeVector *aNormalVector=0) const;
|
||||
|
||||
G4double DistanceToInNoVoxels(const G4ThreeVector& aPoint,
|
||||
const G4ThreeVector& aDirection) const;
|
||||
G4double DistanceToOutVoxels(const G4ThreeVector& aPoint,
|
||||
const G4ThreeVector& aDirection,
|
||||
G4ThreeVector* aNormalVector) const;
|
||||
G4double DistanceToOutVoxelsCore(const G4ThreeVector& aPoint,
|
||||
const G4ThreeVector& aDirection,
|
||||
G4ThreeVector* aNormalVector,
|
||||
G4bool& aConvex,
|
||||
std::vector<G4int>& candidates) const;
|
||||
G4double DistanceToOutNoVoxels(const G4ThreeVector& aPoint,
|
||||
const G4ThreeVector& aDirection,
|
||||
G4ThreeVector* aNormalVector) const;
|
||||
|
||||
G4ThreeVector SurfaceNormal(const G4ThreeVector& aPoint) const;
|
||||
|
||||
void Extent(EAxis aAxis, G4double& aMin, G4double& aMax) const;
|
||||
void BoundingLimits(G4ThreeVector& aMin, G4ThreeVector& aMax) const;
|
||||
G4bool CalculateExtent(const EAxis pAxis,
|
||||
const G4VoxelLimits& pVoxelLimit,
|
||||
const G4AffineTransform& pTransform,
|
||||
G4double& pMin, G4double& pMax) const;
|
||||
G4double GetCubicVolume();
|
||||
G4double GetSurfaceArea();
|
||||
|
||||
G4VSolid* Clone() const ;
|
||||
|
||||
G4GeometryType GetEntityType() const { return "G4MultiUnion"; }
|
||||
|
||||
void Voxelize();
|
||||
// Finalize and prepare for use. User MUST call it once before
|
||||
// navigation use.
|
||||
|
||||
EInside InsideNoVoxels(const G4ThreeVector& aPoint) const;
|
||||
inline G4Voxelizer& GetVoxels() const;
|
||||
|
||||
std::ostream& StreamInfo(std::ostream& os) const;
|
||||
|
||||
G4ThreeVector GetPointOnSurface() const;
|
||||
|
||||
void DescribeYourselfTo ( G4VGraphicsScene& scene ) const ;
|
||||
G4Polyhedron* CreatePolyhedron () const ;
|
||||
G4Polyhedron* GetPolyhedron () const;
|
||||
|
||||
G4MultiUnion(__void__&);
|
||||
// Fake default constructor for usage restricted to direct object
|
||||
// persistency for clients requiring preallocation of memory for
|
||||
// persistifiable objects.
|
||||
|
||||
private:
|
||||
|
||||
EInside InsideWithExclusion(const G4ThreeVector& aPoint,
|
||||
G4SurfBits* bits = 0) const;
|
||||
G4int SafetyFromOutsideNumberNode(const G4ThreeVector& aPoint,
|
||||
G4double& safety) const;
|
||||
G4double DistanceToInCandidates(const G4ThreeVector& aPoint,
|
||||
const G4ThreeVector& aDirection,
|
||||
std::vector<G4int>& candidates,
|
||||
G4SurfBits& bits) const;
|
||||
|
||||
// Conversion utilities
|
||||
inline G4ThreeVector GetLocalPoint(const G4Transform3D& trans,
|
||||
const G4ThreeVector& gpoint) const;
|
||||
inline G4ThreeVector GetLocalVector(const G4Transform3D& trans,
|
||||
const G4ThreeVector& gvec) const;
|
||||
inline G4ThreeVector GetGlobalPoint(const G4Transform3D& trans,
|
||||
const G4ThreeVector& lpoint) const;
|
||||
inline G4ThreeVector GetGlobalVector(const G4Transform3D& trans,
|
||||
const G4ThreeVector& lvec) const;
|
||||
void TransformLimits(G4ThreeVector& min, G4ThreeVector& max,
|
||||
const G4Transform3D& transformation) const;
|
||||
private:
|
||||
|
||||
struct G4MultiUnionSurface
|
||||
{
|
||||
G4ThreeVector point;
|
||||
G4VSolid* solid;
|
||||
};
|
||||
|
||||
std::vector<G4VSolid*> fSolids;
|
||||
std::vector<G4Transform3D> fTransformObjs;
|
||||
G4Voxelizer fVoxels; // Pointer to the vozelized solid
|
||||
G4double fCubicVolume; // Cubic Volume
|
||||
G4double fSurfaceArea; // Surface Area
|
||||
G4double kRadTolerance; // Cached radial tolerance
|
||||
mutable G4bool fAccurate; // Accurate safety (off by default)
|
||||
|
||||
mutable G4bool fRebuildPolyhedron;
|
||||
mutable G4Polyhedron* fpPolyhedron;
|
||||
};
|
||||
|
||||
//______________________________________________________________________________
|
||||
inline G4Voxelizer& G4MultiUnion::GetVoxels() const
|
||||
{
|
||||
return (G4Voxelizer&)fVoxels;
|
||||
}
|
||||
|
||||
//______________________________________________________________________________
|
||||
inline const G4Transform3D& G4MultiUnion::GetTransformation(G4int index) const
|
||||
{
|
||||
return fTransformObjs[index];
|
||||
}
|
||||
|
||||
//______________________________________________________________________________
|
||||
inline G4VSolid* G4MultiUnion::GetSolid(G4int index) const
|
||||
{
|
||||
return fSolids[index];
|
||||
}
|
||||
|
||||
//______________________________________________________________________________
|
||||
inline G4int G4MultiUnion::GetNumberOfSolids() const
|
||||
{
|
||||
return fSolids.size();
|
||||
}
|
||||
|
||||
//______________________________________________________________________________
|
||||
inline void G4MultiUnion::SetAccurateSafety(G4bool flag)
|
||||
{
|
||||
fAccurate = flag;
|
||||
}
|
||||
|
||||
//______________________________________________________________________________
|
||||
inline
|
||||
G4ThreeVector G4MultiUnion::GetLocalPoint(const G4Transform3D& trans,
|
||||
const G4ThreeVector& global) const
|
||||
{
|
||||
// Returns local point coordinates converted from the global frame defined
|
||||
// by the transformation. This is defined by multiplying the inverse
|
||||
// transformation with the global vector.
|
||||
|
||||
return trans.inverse()*G4Point3D(global);
|
||||
}
|
||||
|
||||
//______________________________________________________________________________
|
||||
inline
|
||||
G4ThreeVector G4MultiUnion::GetLocalVector(const G4Transform3D& trans,
|
||||
const G4ThreeVector& global) const
|
||||
{
|
||||
// Returns local point coordinates converted from the global frame defined
|
||||
// by the transformation. This is defined by multiplying the inverse
|
||||
// transformation with the global vector.
|
||||
|
||||
G4Rotate3D rot;
|
||||
G4Translate3D transl ;
|
||||
G4Scale3D scale;
|
||||
|
||||
trans.getDecomposition(scale,rot,transl);
|
||||
return rot.inverse()*G4Vector3D(global);
|
||||
}
|
||||
|
||||
//______________________________________________________________________________
|
||||
inline
|
||||
G4ThreeVector G4MultiUnion::GetGlobalPoint(const G4Transform3D& trans,
|
||||
const G4ThreeVector& local) const
|
||||
{
|
||||
// Returns global point coordinates converted from the local frame defined
|
||||
// by the transformation. This is defined by multiplying this transformation
|
||||
// with the local vector.
|
||||
|
||||
return trans*G4Point3D(local);
|
||||
}
|
||||
|
||||
//______________________________________________________________________________
|
||||
inline
|
||||
G4ThreeVector G4MultiUnion::GetGlobalVector(const G4Transform3D& trans,
|
||||
const G4ThreeVector& local) const
|
||||
{
|
||||
// Returns vector components converted from the local frame defined by the
|
||||
// transformation to the global one. This is defined by multiplying this
|
||||
// transformation with the local vector while ignoring the translation.
|
||||
|
||||
G4Rotate3D rot;
|
||||
G4Translate3D transl ;
|
||||
G4Scale3D scale;
|
||||
|
||||
trans.getDecomposition(scale,rot,transl);
|
||||
return rot*G4Vector3D(local);
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -61,7 +61,7 @@ class G4ScaledSolid : public G4VSolid
|
||||
|
||||
EInside Inside( const G4ThreeVector& p ) const;
|
||||
|
||||
void Extent(G4ThreeVector& pMin, G4ThreeVector& pMax) const;
|
||||
void BoundingLimits(G4ThreeVector& pMin, G4ThreeVector& pMax) const;
|
||||
|
||||
G4bool CalculateExtent(const EAxis pAxis,
|
||||
const G4VoxelLimits& pVoxelLimit,
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4SubtractionSolid.hh 101046 2016-11-04 10:44:26Z gcosmo $
|
||||
// $Id: G4SubtractionSolid.hh 104316 2017-05-24 13:04:23Z gcosmo $
|
||||
//
|
||||
//
|
||||
// class G4SubtractionSolid
|
||||
@@ -86,7 +86,7 @@ class G4SubtractionSolid : public G4BooleanSolid
|
||||
G4SubtractionSolid& operator=(const G4SubtractionSolid& rhs);
|
||||
// Copy constructor and assignment operator.
|
||||
|
||||
void Extent(G4ThreeVector& pMin, G4ThreeVector& pMax) const;
|
||||
void BoundingLimits(G4ThreeVector& pMin, G4ThreeVector& pMax) const;
|
||||
|
||||
G4bool CalculateExtent( const EAxis pAxis,
|
||||
const G4VoxelLimits& pVoxelLimit,
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4UnionSolid.hh 101046 2016-11-04 10:44:26Z gcosmo $
|
||||
// $Id: G4UnionSolid.hh 104316 2017-05-24 13:04:23Z gcosmo $
|
||||
//
|
||||
//
|
||||
// class G4UnionSolid
|
||||
@@ -85,7 +85,7 @@ class G4UnionSolid : public G4BooleanSolid
|
||||
G4UnionSolid& operator=(const G4UnionSolid& rhs);
|
||||
// Copy constructor and assignment operator.
|
||||
|
||||
void Extent(G4ThreeVector& pMin, G4ThreeVector& pMax) const;
|
||||
void BoundingLimits(G4ThreeVector& pMin, G4ThreeVector& pMax) const;
|
||||
|
||||
G4bool CalculateExtent( const EAxis pAxis,
|
||||
const G4VoxelLimits& pVoxelLimit,
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#
|
||||
# Generated on : 24/9/2010
|
||||
#
|
||||
# $Id: sources.cmake 96129 2016-03-16 22:05:08Z gcosmo $
|
||||
# $Id: sources.cmake 103464 2017-04-11 07:24:03Z gcosmo $
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
@@ -22,6 +22,8 @@ include_directories(${USOLIDS_INCLUDE_DIRS})
|
||||
# List internal includes needed.
|
||||
include_directories(${CMAKE_SOURCE_DIR}/source/geometry/management/include)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/source/geometry/volumes/include)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/source/geometry/solids/CSG/include)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/source/geometry/solids/specific/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)
|
||||
@@ -41,15 +43,14 @@ GEANT4_DEFINE_MODULE(NAME G4geomBoolean
|
||||
G4MultiUnion.hh
|
||||
G4ScaledSolid.hh
|
||||
G4SubtractionSolid.hh
|
||||
G4UMultiUnion.hh
|
||||
G4UnionSolid.hh
|
||||
SOURCES
|
||||
G4BooleanSolid.cc
|
||||
G4DisplacedSolid.cc
|
||||
G4IntersectionSolid.cc
|
||||
G4MultiUnion.cc
|
||||
G4ScaledSolid.cc
|
||||
G4SubtractionSolid.cc
|
||||
G4UMultiUnion.cc
|
||||
G4UnionSolid.cc
|
||||
GRANULAR_DEPENDENCIES
|
||||
G4geometrymng
|
||||
@@ -57,7 +58,8 @@ GEANT4_DEFINE_MODULE(NAME G4geomBoolean
|
||||
G4graphics_reps
|
||||
G4intercoms
|
||||
G4volumes
|
||||
G4GeomUSolids
|
||||
G4csg
|
||||
G4specsolids
|
||||
GLOBAL_DEPENDENCIES
|
||||
G4global
|
||||
G4graphics_reps
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4DisplacedSolid.cc 101046 2016-11-04 10:44:26Z gcosmo $
|
||||
// $Id: G4DisplacedSolid.cc 104316 2017-05-24 13:04:23Z gcosmo $
|
||||
//
|
||||
// Implementation for G4DisplacedSolid class for boolean
|
||||
// operations between other solids
|
||||
@@ -265,13 +265,14 @@ void G4DisplacedSolid::SetObjectTranslation(const G4ThreeVector& vector)
|
||||
//
|
||||
// Get bounding box
|
||||
|
||||
void G4DisplacedSolid::Extent(G4ThreeVector& pMin, G4ThreeVector& pMax) const
|
||||
void G4DisplacedSolid::BoundingLimits(G4ThreeVector& pMin,
|
||||
G4ThreeVector& pMax) const
|
||||
{
|
||||
if (!fDirectTransform->IsRotated())
|
||||
{
|
||||
// Special case of pure translation
|
||||
//
|
||||
fPtrSolid->Extent(pMin,pMax);
|
||||
fPtrSolid->BoundingLimits(pMin,pMax);
|
||||
G4ThreeVector offset = fDirectTransform->NetTranslation();
|
||||
pMin += offset;
|
||||
pMax += offset;
|
||||
@@ -298,7 +299,7 @@ void G4DisplacedSolid::Extent(G4ThreeVector& pMin, G4ThreeVector& pMax) const
|
||||
<< GetName() << " !"
|
||||
<< "\npMin = " << pMin
|
||||
<< "\npMax = " << pMax;
|
||||
G4Exception("G4DisplacedSolid::Extent()", "GeomMgt0001",
|
||||
G4Exception("G4DisplacedSolid::BoundingLimits()", "GeomMgt0001",
|
||||
JustWarning, message);
|
||||
DumpInfo();
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4IntersectionSolid.cc 102530 2017-02-08 13:41:59Z gcosmo $
|
||||
// $Id: G4IntersectionSolid.cc 104316 2017-05-24 13:04:23Z gcosmo $
|
||||
//
|
||||
// Implementation of methods for the class G4IntersectionSolid
|
||||
//
|
||||
@@ -139,11 +139,12 @@ G4IntersectionSolid::operator = (const G4IntersectionSolid& rhs)
|
||||
// Get bounding box
|
||||
|
||||
void
|
||||
G4IntersectionSolid::Extent(G4ThreeVector& pMin, G4ThreeVector& pMax) const
|
||||
G4IntersectionSolid::BoundingLimits(G4ThreeVector& pMin,
|
||||
G4ThreeVector& pMax) const
|
||||
{
|
||||
G4ThreeVector minA,maxA, minB,maxB;
|
||||
fPtrSolidA->Extent(minA,maxA);
|
||||
fPtrSolidB->Extent(minB,maxB);
|
||||
fPtrSolidA->BoundingLimits(minA,maxA);
|
||||
fPtrSolidB->BoundingLimits(minB,maxB);
|
||||
|
||||
pMin.set(std::max(minA.x(),minB.x()),
|
||||
std::max(minA.y(),minB.y()),
|
||||
@@ -162,7 +163,7 @@ G4IntersectionSolid::Extent(G4ThreeVector& pMin, G4ThreeVector& pMax) const
|
||||
<< GetName() << " !"
|
||||
<< "\npMin = " << pMin
|
||||
<< "\npMax = " << pMax;
|
||||
G4Exception("G4IntersectionSolid::Extent()", "GeomMgt0001",
|
||||
G4Exception("G4IntersectionSolid::BoundingLimits()", "GeomMgt0001",
|
||||
JustWarning, message);
|
||||
DumpInfo();
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -127,12 +127,13 @@ G4VSolid* G4ScaledSolid::GetUnscaledSolid() const
|
||||
//
|
||||
// Get bounding box
|
||||
|
||||
void G4ScaledSolid::Extent(G4ThreeVector& pMin, G4ThreeVector& pMax) const
|
||||
void G4ScaledSolid::BoundingLimits(G4ThreeVector& pMin,
|
||||
G4ThreeVector& pMax) const
|
||||
{
|
||||
G4ThreeVector bmin,bmax;
|
||||
G4ThreeVector scale = fScale->GetScale();
|
||||
|
||||
fPtrSolid->Extent(bmin,bmax);
|
||||
fPtrSolid->BoundingLimits(bmin,bmax);
|
||||
pMin.set(bmin.x()*scale.x(),bmin.y()*scale.y(),bmin.z()*scale.z());
|
||||
pMax.set(bmax.x()*scale.x(),bmax.y()*scale.y(),bmax.z()*scale.z());
|
||||
|
||||
@@ -145,7 +146,7 @@ void G4ScaledSolid::Extent(G4ThreeVector& pMin, G4ThreeVector& pMax) const
|
||||
<< GetName() << " !"
|
||||
<< "\npMin = " << pMin
|
||||
<< "\npMax = " << pMax;
|
||||
G4Exception("G4ScaledSolid::Extent()", "GeomMgt0001",
|
||||
G4Exception("G4ScaledSolid::BoundingLimits()", "GeomMgt0001",
|
||||
JustWarning, message);
|
||||
DumpInfo();
|
||||
}
|
||||
@@ -164,7 +165,7 @@ G4ScaledSolid::CalculateExtent( const EAxis pAxis,
|
||||
{
|
||||
// Find bounding box of unscaled solid
|
||||
G4ThreeVector bmin,bmax;
|
||||
fPtrSolid->Extent(bmin,bmax);
|
||||
fPtrSolid->BoundingLimits(bmin,bmax);
|
||||
|
||||
// Set combined transformation
|
||||
G4Transform3D transform3D =
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4SubtractionSolid.cc 102530 2017-02-08 13:41:59Z gcosmo $
|
||||
// $Id: G4SubtractionSolid.cc 104316 2017-05-24 13:04:23Z gcosmo $
|
||||
//
|
||||
// Implementation of methods for the class G4IntersectionSolid
|
||||
//
|
||||
@@ -139,12 +139,13 @@ G4SubtractionSolid::operator = (const G4SubtractionSolid& rhs)
|
||||
// Get bounding box
|
||||
|
||||
void
|
||||
G4SubtractionSolid::Extent(G4ThreeVector& pMin, G4ThreeVector& pMax) const
|
||||
G4SubtractionSolid::BoundingLimits(G4ThreeVector& pMin,
|
||||
G4ThreeVector& pMax) const
|
||||
{
|
||||
// Since it is unclear how the shape of the first solid will be changed
|
||||
// after subtraction, just return its original bounding box.
|
||||
//
|
||||
fPtrSolidA->Extent(pMin,pMax);
|
||||
fPtrSolidA->BoundingLimits(pMin,pMax);
|
||||
|
||||
// Check correctness of the bounding box
|
||||
//
|
||||
@@ -155,7 +156,7 @@ G4SubtractionSolid::Extent(G4ThreeVector& pMin, G4ThreeVector& pMax) const
|
||||
<< GetName() << " !"
|
||||
<< "\npMin = " << pMin
|
||||
<< "\npMax = " << pMax;
|
||||
G4Exception("G4SubtractionSolid::Extent()", "GeomMgt0001",
|
||||
G4Exception("G4SubtractionSolid::BoundingLimits()", "GeomMgt0001",
|
||||
JustWarning, message);
|
||||
DumpInfo();
|
||||
}
|
||||
|
||||
@@ -24,9 +24,9 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4UnionSolid.cc 101046 2016-11-04 10:44:26Z gcosmo $
|
||||
// $Id: G4UnionSolid.cc 104316 2017-05-24 13:04:23Z gcosmo $
|
||||
//
|
||||
// Implementation of methods for the class G4IntersectionSolid
|
||||
// Implementation of methods for the class G4UnionSolid
|
||||
//
|
||||
// History:
|
||||
//
|
||||
@@ -34,6 +34,7 @@
|
||||
// 28.11.98 V.Grichine: fix while loops in DistToIn/Out
|
||||
// 27.07.99 V.Grichine: modifications in DistToOut(p,v,...), while -> do-while
|
||||
// 16.03.01 V.Grichine: modifications in CalculateExtent()
|
||||
// 17.03.17 E.Tcherniaev: revision of SurfaceNormal()
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
@@ -136,11 +137,12 @@ G4UnionSolid& G4UnionSolid::operator = (const G4UnionSolid& rhs)
|
||||
//
|
||||
// Get bounding box
|
||||
|
||||
void G4UnionSolid::Extent(G4ThreeVector& pMin, G4ThreeVector& pMax) const
|
||||
void G4UnionSolid::BoundingLimits(G4ThreeVector& pMin,
|
||||
G4ThreeVector& pMax) const
|
||||
{
|
||||
G4ThreeVector minA,maxA, minB,maxB;
|
||||
fPtrSolidA->Extent(minA,maxA);
|
||||
fPtrSolidB->Extent(minB,maxB);
|
||||
fPtrSolidA->BoundingLimits(minA,maxA);
|
||||
fPtrSolidB->BoundingLimits(minB,maxB);
|
||||
|
||||
pMin.set(std::min(minA.x(),minB.x()),
|
||||
std::min(minA.y(),minB.y()),
|
||||
@@ -159,7 +161,8 @@ void G4UnionSolid::Extent(G4ThreeVector& pMin, G4ThreeVector& pMax) const
|
||||
<< GetName() << " !"
|
||||
<< "\npMin = " << pMin
|
||||
<< "\npMax = " << pMax;
|
||||
G4Exception("G4UnionSolid::Extent()", "GeomMgt0001", JustWarning, message);
|
||||
G4Exception("G4UnionSolid::BoundingLimits()", "GeomMgt0001",
|
||||
JustWarning, message);
|
||||
DumpInfo();
|
||||
}
|
||||
}
|
||||
@@ -230,54 +233,42 @@ EInside G4UnionSolid::Inside( const G4ThreeVector& p ) const
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
//
|
||||
//
|
||||
// Get surface normal
|
||||
|
||||
G4ThreeVector
|
||||
G4UnionSolid::SurfaceNormal( const G4ThreeVector& p ) const
|
||||
{
|
||||
G4ThreeVector normal;
|
||||
EInside positionA = fPtrSolidA->Inside(p);
|
||||
EInside positionB = fPtrSolidB->Inside(p);
|
||||
|
||||
#ifdef G4BOOLDEBUG
|
||||
if( Inside(p) == kOutside )
|
||||
{
|
||||
G4cout << "WARNING - Invalid call in "
|
||||
<< "G4UnionSolid::SurfaceNormal(p)" << G4endl
|
||||
<< " Point p is outside !" << G4endl;
|
||||
G4cout << " p = " << p << G4endl;
|
||||
G4cerr << "WARNING - Invalid call in "
|
||||
<< "G4UnionSolid::SurfaceNormal(p)" << G4endl
|
||||
<< " Point p is outside !" << G4endl;
|
||||
G4cerr << " p = " << p << G4endl;
|
||||
}
|
||||
#endif
|
||||
if (positionA == kSurface &&
|
||||
positionB == kOutside) return fPtrSolidA->SurfaceNormal(p);
|
||||
|
||||
if(fPtrSolidA->Inside(p) == kSurface && fPtrSolidB->Inside(p) != kInside)
|
||||
if (positionA == kOutside &&
|
||||
positionB == kSurface) return fPtrSolidB->SurfaceNormal(p);
|
||||
|
||||
if (positionA == kSurface &&
|
||||
positionB == kSurface)
|
||||
{
|
||||
if (Inside(p) == kSurface)
|
||||
{
|
||||
normal= fPtrSolidA->SurfaceNormal(p) ;
|
||||
G4ThreeVector normalA = fPtrSolidA->SurfaceNormal(p);
|
||||
G4ThreeVector normalB = fPtrSolidB->SurfaceNormal(p);
|
||||
return (normalA + normalB).unit();
|
||||
}
|
||||
else if(fPtrSolidB->Inside(p) == kSurface &&
|
||||
fPtrSolidA->Inside(p) != kInside)
|
||||
{
|
||||
normal= fPtrSolidB->SurfaceNormal(p) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
normal= fPtrSolidA->SurfaceNormal(p) ;
|
||||
}
|
||||
#ifdef G4BOOLDEBUG
|
||||
if(Inside(p)==kInside)
|
||||
{
|
||||
G4cout << "WARNING - Invalid call in "
|
||||
<< "G4UnionSolid::SurfaceNormal(p)" << G4endl
|
||||
<< " Point p is inside !" << G4endl;
|
||||
G4cout << " p = " << p << G4endl;
|
||||
G4cerr << "WARNING - Invalid call in "
|
||||
<< "G4UnionSolid::SurfaceNormal(p)" << G4endl
|
||||
<< " Point p is inside !" << G4endl;
|
||||
G4cerr << " p = " << p << G4endl;
|
||||
}
|
||||
G4String surf[3] = { "OUTSIDE", "SURFACE", "INSIDE" };
|
||||
std::ostringstream message;
|
||||
G4int oldprc = message.precision(16);
|
||||
message << "Invalid call of SurfaceNormal(p) for union solid: "
|
||||
<< GetName() << " !"
|
||||
<< "\nPoint p" << p << " is " << surf[Inside(p)] << " !!!";
|
||||
message.precision(oldprc);
|
||||
G4Exception("G4UnionSolid::SurfaceNormal()", "GeomMgt0001",
|
||||
JustWarning, message);
|
||||
#endif
|
||||
}
|
||||
return normal;
|
||||
return fPtrSolidA->SurfaceNormal(p);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////
|
||||
|
||||
Reference in New Issue
Block a user