Import Geant4 9.4.0 source tree
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
#------------------------------------------------------------------------------
|
||||
# CMakeLists.txt
|
||||
# Module : G4geomBoolean
|
||||
# Package: Geant4.src.G4geometry..G4geomBoolean
|
||||
#
|
||||
# CMakeLists.txt for building a single granular library.
|
||||
#
|
||||
# Generated on : 24/9/2010
|
||||
#
|
||||
# $Id: CMakeLists.txt,v 1.1 2010/09/29 18:42:21 bmorgan Exp $
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
if(GEANT4_BUILD_GRANULAR_LIBS)
|
||||
include(Geant4MacroLibraryTargets)
|
||||
GEANT4_GRANULAR_LIBRARY_TARGET(COMPONENT sources.cmake)
|
||||
endif()
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# $Id: GNUmakefile,v 1.6 2005/05/09 13:44:58 gcosmo Exp $
|
||||
# $Id: GNUmakefile,v 1.8 2010/10/27 07:34:32 gcosmo Exp $
|
||||
# ----------------------------------------------------------------
|
||||
# GNUmakefile for geometry/CSG library. Gabriele Cosmo, 16/11/96.
|
||||
# ----------------------------------------------------------------
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
$Id: History,v 1.62 2007/10/24 08:19:11 gcosmo Exp $
|
||||
$Id: History,v 1.67 2010/10/20 07:31:58 gcosmo Exp $
|
||||
-------------------------------------------------------------------
|
||||
|
||||
=========================================================
|
||||
@@ -20,6 +20,27 @@ committal in the CVS repository !
|
||||
* Reverse chronological order (last date on top), please *
|
||||
----------------------------------------------------------
|
||||
|
||||
October 19, 2010 G.Cosmo geom-bool-V09-03-03
|
||||
- Implemented Clone() virtual method for all solids, returning a pointer
|
||||
to a dynamically allocated copy of the solid. To be used by Geant4-MT.
|
||||
|
||||
September 22, 2010 G.Cosmo geom-bool-V09-03-02
|
||||
- Implemented copy-constructor and assignment operator for concrete
|
||||
solids classes to facilitate conversion to Geant4-MT.
|
||||
|
||||
July 7, 2010 G.Cosmo geom-bool-V09-03-01
|
||||
- Simplified logic in G4UnionSolid::Inside() to exclude obvious
|
||||
conditional cases.
|
||||
|
||||
May 11, 2010 J.Allison geom-bool-V09-03-00
|
||||
- Introduced recursive algorithm in CreatePolyhedron(): it uses
|
||||
HepPolyhedronProcessor from 'graphics_reps', which tries small shifts
|
||||
in an attempt to avoid numerical problems in the calculation of the
|
||||
polyhedron in BooleanProcessor. Recursion allows HepPolyhedronProcessor
|
||||
to try all permutations, also for Booleans of Booleans.
|
||||
Helps in reducing the number of cases of "Error in Boolean processor" for
|
||||
visualization, but still some stubborn cases are left.
|
||||
|
||||
Oct 24, 2007 V.Grichine geom-bool-V09-00-00
|
||||
- Improved response of Inside() for G4SubtractionSolid and G4UnionSolid
|
||||
according to suggestion in problem report #979.
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4BooleanSolid.hh,v 1.15 2006/10/19 15:34:49 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
// $Id: G4BooleanSolid.hh,v 1.18 2010/09/22 14:57:59 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-09-04 $
|
||||
//
|
||||
//
|
||||
// class G4BooleanSolid
|
||||
@@ -49,7 +49,7 @@
|
||||
#include "G4RotationMatrix.hh"
|
||||
#include "G4Transform3D.hh"
|
||||
|
||||
class G4VSolid;
|
||||
class HepPolyhedronProcessor;
|
||||
|
||||
class G4BooleanSolid : public G4VSolid
|
||||
{
|
||||
@@ -105,16 +105,18 @@ class G4BooleanSolid : public G4VSolid
|
||||
// persistency for clients requiring preallocation of memory for
|
||||
// persistifiable objects.
|
||||
|
||||
G4BooleanSolid(const G4BooleanSolid& rhs);
|
||||
G4BooleanSolid& operator=(const G4BooleanSolid& rhs);
|
||||
// Copy constructor and assignment operator.
|
||||
|
||||
protected:
|
||||
|
||||
G4VSolid* fPtrSolidA;
|
||||
G4VSolid* fPtrSolidB;
|
||||
|
||||
private:
|
||||
|
||||
G4BooleanSolid(const G4BooleanSolid&);
|
||||
G4BooleanSolid& operator=(const G4BooleanSolid&);
|
||||
// Private copy constructor and assignment operator.
|
||||
G4Polyhedron* StackPolyhedron(HepPolyhedronProcessor&,
|
||||
const G4VSolid*) const;
|
||||
// Stack polyhedra for processing. Return top polyhedron.
|
||||
|
||||
private:
|
||||
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4DisplacedSolid.hh,v 1.19 2006/06/29 18:43:31 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
// $Id: G4DisplacedSolid.hh,v 1.21 2010/10/20 07:31:39 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-09-04 $
|
||||
//
|
||||
//
|
||||
// class G4DisplacedSolid
|
||||
@@ -108,10 +108,11 @@ class G4DisplacedSolid : public G4VSolid
|
||||
|
||||
public: // with description
|
||||
|
||||
virtual G4GeometryType GetEntityType() const;
|
||||
G4GeometryType GetEntityType() const;
|
||||
G4VSolid* Clone() const;
|
||||
|
||||
virtual const G4DisplacedSolid* GetDisplacedSolidPtr() const ;
|
||||
virtual G4DisplacedSolid* GetDisplacedSolidPtr();
|
||||
const G4DisplacedSolid* GetDisplacedSolidPtr() const;
|
||||
G4DisplacedSolid* GetDisplacedSolidPtr();
|
||||
// If the Solid is a "G4DisplacedSolid",
|
||||
// return a self pointer else return 0.
|
||||
|
||||
@@ -147,10 +148,14 @@ class G4DisplacedSolid : public G4VSolid
|
||||
// persistency for clients requiring preallocation of memory for
|
||||
// persistifiable objects.
|
||||
|
||||
G4DisplacedSolid(const G4DisplacedSolid& rhs);
|
||||
G4DisplacedSolid& operator=(const G4DisplacedSolid& rhs);
|
||||
// Copy constructor and assignment operator.
|
||||
|
||||
void DescribeYourselfTo ( G4VGraphicsScene& scene ) const ;
|
||||
G4Polyhedron* CreatePolyhedron () const ;
|
||||
G4NURBS* CreateNURBS () const ;
|
||||
virtual G4Polyhedron* GetPolyhedron () const;
|
||||
G4Polyhedron* GetPolyhedron () const ;
|
||||
// For creating graphical representations (ie for visualisation).
|
||||
|
||||
protected:
|
||||
@@ -159,12 +164,6 @@ class G4DisplacedSolid : public G4VSolid
|
||||
G4AffineTransform* fPtrTransform ;
|
||||
G4AffineTransform* fDirectTransform ;
|
||||
mutable G4Polyhedron* fpPolyhedron;
|
||||
|
||||
private:
|
||||
|
||||
G4DisplacedSolid(const G4DisplacedSolid&);
|
||||
G4DisplacedSolid& operator=(const G4DisplacedSolid&);
|
||||
// Private copy constructor and assignment operator.
|
||||
} ;
|
||||
|
||||
#endif
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4IntersectionSolid.hh,v 1.9 2006/06/29 18:43:33 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
// $Id: G4IntersectionSolid.hh,v 1.11 2010/10/20 07:31:39 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-09-04 $
|
||||
//
|
||||
//
|
||||
// class G4IntersectionSolid
|
||||
@@ -72,7 +72,9 @@ class G4IntersectionSolid : public G4BooleanSolid
|
||||
|
||||
virtual ~G4IntersectionSolid() ;
|
||||
|
||||
virtual G4GeometryType GetEntityType() const;
|
||||
G4GeometryType GetEntityType() const;
|
||||
|
||||
G4VSolid* Clone() const;
|
||||
|
||||
public: // without description
|
||||
|
||||
@@ -81,6 +83,10 @@ class G4IntersectionSolid : public G4BooleanSolid
|
||||
// persistency for clients requiring preallocation of memory for
|
||||
// persistifiable objects.
|
||||
|
||||
G4IntersectionSolid(const G4IntersectionSolid& rhs);
|
||||
G4IntersectionSolid& operator=(const G4IntersectionSolid& rhs);
|
||||
// Copy constructor and assignment operator.
|
||||
|
||||
G4bool CalculateExtent( const EAxis pAxis,
|
||||
const G4VoxelLimits& pVoxelLimit,
|
||||
const G4AffineTransform& pTransform,
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4SubtractionSolid.hh,v 1.9 2006/06/29 18:43:35 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
// $Id: G4SubtractionSolid.hh,v 1.11 2010/10/20 07:31:39 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-09-04 $
|
||||
//
|
||||
//
|
||||
// class G4SubtractionSolid
|
||||
@@ -72,7 +72,9 @@ class G4SubtractionSolid : public G4BooleanSolid
|
||||
|
||||
virtual ~G4SubtractionSolid() ;
|
||||
|
||||
virtual G4GeometryType GetEntityType() const ;
|
||||
G4GeometryType GetEntityType() const ;
|
||||
|
||||
G4VSolid* Clone() const;
|
||||
|
||||
public: // without description
|
||||
|
||||
@@ -81,6 +83,10 @@ class G4SubtractionSolid : public G4BooleanSolid
|
||||
// persistency for clients requiring preallocation of memory for
|
||||
// persistifiable objects.
|
||||
|
||||
G4SubtractionSolid(const G4SubtractionSolid& rhs);
|
||||
G4SubtractionSolid& operator=(const G4SubtractionSolid& rhs);
|
||||
// Copy constructor and assignment operator.
|
||||
|
||||
G4bool CalculateExtent( const EAxis pAxis,
|
||||
const G4VoxelLimits& pVoxelLimit,
|
||||
const G4AffineTransform& pTransform,
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4UnionSolid.hh,v 1.10 2006/06/29 18:43:37 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
// $Id: G4UnionSolid.hh,v 1.12 2010/10/20 07:31:39 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-09-04 $
|
||||
//
|
||||
//
|
||||
// class G4UnionSolid
|
||||
@@ -71,7 +71,9 @@ class G4UnionSolid : public G4BooleanSolid
|
||||
|
||||
virtual ~G4UnionSolid() ;
|
||||
|
||||
virtual G4GeometryType GetEntityType() const ;
|
||||
G4GeometryType GetEntityType() const ;
|
||||
|
||||
G4VSolid* Clone() const;
|
||||
|
||||
public: // without description
|
||||
|
||||
@@ -80,6 +82,10 @@ class G4UnionSolid : public G4BooleanSolid
|
||||
// persistency for clients requiring preallocation of memory for
|
||||
// persistifiable objects.
|
||||
|
||||
G4UnionSolid(const G4UnionSolid& rhs);
|
||||
G4UnionSolid& operator=(const G4UnionSolid& rhs);
|
||||
// Copy constructor and assignment operator.
|
||||
|
||||
G4bool CalculateExtent( const EAxis pAxis,
|
||||
const G4VoxelLimits& pVoxelLimit,
|
||||
const G4AffineTransform& pTransform,
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
#------------------------------------------------------------------------------
|
||||
# sources.cmake
|
||||
# Module : G4geomBoolean
|
||||
# Package: Geant4.src.G4geometry..G4geomBoolean
|
||||
#
|
||||
# Sources description for a library.
|
||||
# Lists the sources and headers of the code explicitely.
|
||||
# Lists include paths needed.
|
||||
# Lists the internal granular and global dependencies of the library.
|
||||
# Source specific properties should be added at the end.
|
||||
#
|
||||
# Generated on : 24/9/2010
|
||||
#
|
||||
# $Id: sources.cmake,v 1.1 2010/09/29 18:42:29 bmorgan Exp $
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# List external includes needed.
|
||||
include_directories(${CLHEP_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/global/HEPGeometry/include)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/source/global/HEPRandom/include)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/source/global/management/include)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/source/graphics_reps/include)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/source/intercoms/include)
|
||||
|
||||
#
|
||||
# Define the Geant4 Module.
|
||||
#
|
||||
include(Geant4MacroDefineModule)
|
||||
GEANT4_DEFINE_MODULE(NAME G4geomBoolean
|
||||
HEADERS
|
||||
G4BooleanSolid.hh
|
||||
G4BooleanSolid.icc
|
||||
G4DisplacedSolid.hh
|
||||
G4IntersectionSolid.hh
|
||||
G4SubtractionSolid.hh
|
||||
G4UnionSolid.hh
|
||||
SOURCES
|
||||
G4BooleanSolid.cc
|
||||
G4DisplacedSolid.cc
|
||||
G4IntersectionSolid.cc
|
||||
G4SubtractionSolid.cc
|
||||
G4UnionSolid.cc
|
||||
GRANULAR_DEPENDENCIES
|
||||
G4geometrymng
|
||||
G4globman
|
||||
G4graphics_reps
|
||||
G4intercoms
|
||||
G4volumes
|
||||
GLOBAL_DEPENDENCIES
|
||||
G4global
|
||||
G4graphics_reps
|
||||
G4intercoms
|
||||
LINK_LIBRARIES
|
||||
)
|
||||
|
||||
# List any source specific properties here
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4BooleanSolid.cc,v 1.21 2006/10/19 15:34:49 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
// $Id: G4BooleanSolid.cc,v 1.24 2010/09/22 14:57:59 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-09-04 $
|
||||
//
|
||||
// Implementation for the abstract base class for solids created by boolean
|
||||
// operations between other solids
|
||||
@@ -39,6 +39,7 @@
|
||||
#include "G4BooleanSolid.hh"
|
||||
#include "G4VSolid.hh"
|
||||
#include "G4Polyhedron.hh"
|
||||
#include "HepPolyhedronProcessor.h"
|
||||
#include "Randomize.hh"
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
@@ -115,6 +116,44 @@ G4BooleanSolid::~G4BooleanSolid()
|
||||
delete fpPolyhedron;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copy constructor
|
||||
|
||||
G4BooleanSolid::G4BooleanSolid(const G4BooleanSolid& rhs)
|
||||
: G4VSolid (rhs), fPtrSolidA(rhs.fPtrSolidA), fPtrSolidB(rhs.fPtrSolidB),
|
||||
fStatistics(rhs.fStatistics), fCubVolEpsilon(rhs.fCubVolEpsilon),
|
||||
fAreaAccuracy(rhs.fAreaAccuracy), fCubicVolume(rhs.fCubicVolume),
|
||||
fSurfaceArea(rhs.fSurfaceArea), fpPolyhedron(0),
|
||||
createdDisplacedSolid(rhs.createdDisplacedSolid)
|
||||
{
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Assignment operator
|
||||
|
||||
G4BooleanSolid& G4BooleanSolid::operator = (const G4BooleanSolid& rhs)
|
||||
{
|
||||
// Check assignment to self
|
||||
//
|
||||
if (this == &rhs) { return *this; }
|
||||
|
||||
// Copy base class data
|
||||
//
|
||||
G4VSolid::operator=(rhs);
|
||||
|
||||
// Copy data
|
||||
//
|
||||
fPtrSolidA= rhs.fPtrSolidA; fPtrSolidB= rhs.fPtrSolidB;
|
||||
fStatistics= rhs.fStatistics; fCubVolEpsilon= rhs.fCubVolEpsilon;
|
||||
fAreaAccuracy= rhs.fAreaAccuracy; fCubicVolume= rhs.fCubicVolume;
|
||||
fSurfaceArea= rhs.fSurfaceArea; fpPolyhedron= 0;
|
||||
createdDisplacedSolid= rhs.createdDisplacedSolid;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////
|
||||
//
|
||||
// If Solid is made up from a Boolean operation of two solids,
|
||||
@@ -230,3 +269,48 @@ G4Polyhedron* G4BooleanSolid::GetPolyhedron () const
|
||||
}
|
||||
return fpPolyhedron;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Stacks polyhedra for processing. Returns top polyhedron.
|
||||
|
||||
G4Polyhedron*
|
||||
G4BooleanSolid::StackPolyhedron(HepPolyhedronProcessor& processor,
|
||||
const G4VSolid* solid) const
|
||||
{
|
||||
HepPolyhedronProcessor::Operation operation;
|
||||
const G4String& type = solid->GetEntityType();
|
||||
if (type == "G4UnionSolid")
|
||||
{ operation = HepPolyhedronProcessor::UNION; }
|
||||
else if (type == "G4IntersectionSolid")
|
||||
{ operation = HepPolyhedronProcessor::INTERSECTION; }
|
||||
else if (type == "G4SubtractionSolid")
|
||||
{ operation = HepPolyhedronProcessor::SUBTRACTION; }
|
||||
else
|
||||
{
|
||||
std::ostringstream oss;
|
||||
oss << "Solid - " << solid->GetName()
|
||||
<< " - Unrecognised composite solid"
|
||||
<< "\n Returning NULL !";
|
||||
G4Exception("StackPolyhedron()", "InvalidSetup",
|
||||
JustWarning, oss.str().c_str());
|
||||
return 0;
|
||||
}
|
||||
|
||||
G4Polyhedron* top = 0;
|
||||
const G4VSolid* solidA = solid->GetConstituentSolid(0);
|
||||
const G4VSolid* solidB = solid->GetConstituentSolid(1);
|
||||
|
||||
if (solidA->GetConstituentSolid(0))
|
||||
{
|
||||
top = StackPolyhedron(processor, solidA);
|
||||
}
|
||||
else
|
||||
{
|
||||
top = solidA->GetPolyhedron();
|
||||
}
|
||||
G4Polyhedron* operand = solidB->GetPolyhedron();
|
||||
processor.push_back (operation, *operand);
|
||||
|
||||
return top;
|
||||
}
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4DisplacedSolid.cc,v 1.27 2006/06/29 18:43:41 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
// $Id: G4DisplacedSolid.cc,v 1.29 2010/10/20 07:31:39 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-09-04 $
|
||||
//
|
||||
// Implementation for G4DisplacedSolid class for boolean
|
||||
// operations between other solids
|
||||
@@ -120,11 +120,42 @@ G4DisplacedSolid::~G4DisplacedSolid()
|
||||
delete fpPolyhedron;
|
||||
}
|
||||
|
||||
G4GeometryType G4DisplacedSolid::GetEntityType() const
|
||||
///////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copy constructor
|
||||
|
||||
G4DisplacedSolid::G4DisplacedSolid(const G4DisplacedSolid& rhs)
|
||||
: G4VSolid (rhs), fPtrSolid(rhs.fPtrSolid), fpPolyhedron(0)
|
||||
{
|
||||
return G4String("G4DisplacedSolid");
|
||||
fPtrTransform = new G4AffineTransform(*(rhs.fPtrTransform));
|
||||
fDirectTransform = new G4AffineTransform(*(rhs.fDirectTransform));
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Assignment operator
|
||||
|
||||
G4DisplacedSolid& G4DisplacedSolid::operator = (const G4DisplacedSolid& rhs)
|
||||
{
|
||||
// Check assignment to self
|
||||
//
|
||||
if (this == &rhs) { return *this; }
|
||||
|
||||
// Copy base class data
|
||||
//
|
||||
G4VSolid::operator=(rhs);
|
||||
|
||||
// Copy data
|
||||
//
|
||||
fPtrSolid = rhs.fPtrSolid;
|
||||
delete fPtrTransform; delete fDirectTransform;
|
||||
fPtrTransform = new G4AffineTransform(*(rhs.fPtrTransform));
|
||||
fDirectTransform = new G4AffineTransform(*(rhs.fDirectTransform));
|
||||
delete fpPolyhedron; fpPolyhedron= 0;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
void G4DisplacedSolid::CleanTransformations()
|
||||
{
|
||||
if(fPtrTransform)
|
||||
@@ -355,6 +386,24 @@ G4ThreeVector G4DisplacedSolid::GetPointOnSurface() const
|
||||
return fDirectTransform->TransformPoint(p);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Return object type name
|
||||
|
||||
G4GeometryType G4DisplacedSolid::GetEntityType() const
|
||||
{
|
||||
return G4String("G4DisplacedSolid");
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Make a clone of the object
|
||||
//
|
||||
G4VSolid* G4DisplacedSolid::Clone() const
|
||||
{
|
||||
return new G4DisplacedSolid(*this);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Stream object contents to an output stream
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4IntersectionSolid.cc,v 1.30 2006/11/08 09:37:41 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
// $Id: G4IntersectionSolid.cc,v 1.34 2010/10/20 07:31:39 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-09-04 $
|
||||
//
|
||||
// Implementation of methods for the class G4IntersectionSolid
|
||||
//
|
||||
@@ -49,6 +49,7 @@
|
||||
|
||||
#include "G4VGraphicsScene.hh"
|
||||
#include "G4Polyhedron.hh"
|
||||
#include "HepPolyhedronProcessor.h"
|
||||
#include "G4NURBS.hh"
|
||||
// #include "G4NURBSbox.hh"
|
||||
|
||||
@@ -107,6 +108,33 @@ G4IntersectionSolid::~G4IntersectionSolid()
|
||||
{
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copy constructor
|
||||
|
||||
G4IntersectionSolid::G4IntersectionSolid(const G4IntersectionSolid& rhs)
|
||||
: G4BooleanSolid (rhs)
|
||||
{
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Assignment operator
|
||||
|
||||
G4IntersectionSolid&
|
||||
G4IntersectionSolid::operator = (const G4IntersectionSolid& rhs)
|
||||
{
|
||||
// Check assignment to self
|
||||
//
|
||||
if (this == &rhs) { return *this; }
|
||||
|
||||
// Copy base class data
|
||||
//
|
||||
G4BooleanSolid::operator=(rhs);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////
|
||||
//
|
||||
//
|
||||
@@ -484,6 +512,15 @@ G4GeometryType G4IntersectionSolid::GetEntityType() const
|
||||
return G4String("G4IntersectionSolid");
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Make a clone of the object
|
||||
|
||||
G4VSolid* G4IntersectionSolid::Clone() const
|
||||
{
|
||||
return new G4IntersectionSolid(*this);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////
|
||||
//
|
||||
//
|
||||
@@ -501,23 +538,13 @@ G4IntersectionSolid::DescribeYourselfTo ( G4VGraphicsScene& scene ) const
|
||||
G4Polyhedron*
|
||||
G4IntersectionSolid::CreatePolyhedron () const
|
||||
{
|
||||
G4Polyhedron* pA = fPtrSolidA->GetPolyhedron();
|
||||
G4Polyhedron* pB = fPtrSolidB->GetPolyhedron();
|
||||
if (pA && pB)
|
||||
{
|
||||
G4Polyhedron* resultant = new G4Polyhedron (pA->intersect(*pB));
|
||||
return resultant;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::ostringstream oss;
|
||||
oss << "Solid - " << GetName()
|
||||
<< " - one of the Boolean components has no" << G4endl
|
||||
<< " corresponding polyhedron. Returning NULL !";
|
||||
G4Exception("G4IntersectionSolid::CreatePolyhedron()", "InvalidSetup",
|
||||
JustWarning, oss.str().c_str());
|
||||
return 0;
|
||||
}
|
||||
HepPolyhedronProcessor processor;
|
||||
// Stack components and components of components recursively
|
||||
// See G4BooleanSolid::StackPolyhedron
|
||||
G4Polyhedron* top = StackPolyhedron(processor, this);
|
||||
G4Polyhedron* result = new G4Polyhedron(*top);
|
||||
if (processor.execute(*result)) { return result; }
|
||||
else { return 0; }
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4SubtractionSolid.cc,v 1.31 2007/10/23 14:42:31 grichine Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
// $Id: G4SubtractionSolid.cc,v 1.35 2010/10/20 07:31:39 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-09-04 $
|
||||
//
|
||||
// Implementation of methods for the class G4IntersectionSolid
|
||||
//
|
||||
@@ -47,6 +47,7 @@
|
||||
|
||||
#include "G4VGraphicsScene.hh"
|
||||
#include "G4Polyhedron.hh"
|
||||
#include "HepPolyhedronProcessor.h"
|
||||
#include "G4NURBS.hh"
|
||||
// #include "G4NURBSbox.hh"
|
||||
|
||||
@@ -107,6 +108,33 @@ G4SubtractionSolid::~G4SubtractionSolid()
|
||||
{
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copy constructor
|
||||
|
||||
G4SubtractionSolid::G4SubtractionSolid(const G4SubtractionSolid& rhs)
|
||||
: G4BooleanSolid (rhs)
|
||||
{
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Assignment operator
|
||||
|
||||
G4SubtractionSolid&
|
||||
G4SubtractionSolid::operator = (const G4SubtractionSolid& rhs)
|
||||
{
|
||||
// Check assignment to self
|
||||
//
|
||||
if (this == &rhs) { return *this; }
|
||||
|
||||
// Copy base class data
|
||||
//
|
||||
G4BooleanSolid::operator=(rhs);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////
|
||||
//
|
||||
// CalculateExtent
|
||||
@@ -434,6 +462,15 @@ G4GeometryType G4SubtractionSolid::GetEntityType() const
|
||||
return G4String("G4SubtractionSolid");
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Make a clone of the object
|
||||
|
||||
G4VSolid* G4SubtractionSolid::Clone() const
|
||||
{
|
||||
return new G4SubtractionSolid(*this);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
//
|
||||
//
|
||||
@@ -462,23 +499,13 @@ G4SubtractionSolid::DescribeYourselfTo ( G4VGraphicsScene& scene ) const
|
||||
G4Polyhedron*
|
||||
G4SubtractionSolid::CreatePolyhedron () const
|
||||
{
|
||||
G4Polyhedron* pA = fPtrSolidA->GetPolyhedron();
|
||||
G4Polyhedron* pB = fPtrSolidB->GetPolyhedron();
|
||||
if (pA && pB)
|
||||
{
|
||||
G4Polyhedron* resultant = new G4Polyhedron (pA->subtract(*pB));
|
||||
return resultant;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::ostringstream oss;
|
||||
oss << "Solid - " << GetName()
|
||||
<< " - one of the Boolean components has no" << G4endl
|
||||
<< " corresponding polyhedron. Returning NULL !";
|
||||
G4Exception("G4SubtractionSolid::CreatePolyhedron()", "InvalidSetup",
|
||||
JustWarning, oss.str().c_str());
|
||||
return 0;
|
||||
}
|
||||
HepPolyhedronProcessor processor;
|
||||
// Stack components and components of components recursively
|
||||
// See G4BooleanSolid::StackPolyhedron
|
||||
G4Polyhedron* top = StackPolyhedron(processor, this);
|
||||
G4Polyhedron* result = new G4Polyhedron(*top);
|
||||
if (processor.execute(*result)) { return result; }
|
||||
else { return 0; }
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4UnionSolid.cc,v 1.35 2007/10/23 14:42:31 grichine Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
// $Id: G4UnionSolid.cc,v 1.40 2010/10/20 07:31:39 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-09-04 $
|
||||
//
|
||||
// Implementation of methods for the class G4IntersectionSolid
|
||||
//
|
||||
@@ -48,6 +48,7 @@
|
||||
|
||||
#include "G4VGraphicsScene.hh"
|
||||
#include "G4Polyhedron.hh"
|
||||
#include "HepPolyhedronProcessor.h"
|
||||
#include "G4NURBS.hh"
|
||||
// #include "G4NURBSbox.hh"
|
||||
|
||||
@@ -107,6 +108,32 @@ G4UnionSolid::~G4UnionSolid()
|
||||
{
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copy constructor
|
||||
|
||||
G4UnionSolid::G4UnionSolid(const G4UnionSolid& rhs)
|
||||
: G4BooleanSolid (rhs)
|
||||
{
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Assignment operator
|
||||
|
||||
G4UnionSolid& G4UnionSolid::operator = (const G4UnionSolid& rhs)
|
||||
{
|
||||
// Check assignment to self
|
||||
//
|
||||
if (this == &rhs) { return *this; }
|
||||
|
||||
// Copy base class data
|
||||
//
|
||||
G4BooleanSolid::operator=(rhs);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////
|
||||
//
|
||||
//
|
||||
@@ -146,11 +173,11 @@ G4UnionSolid::CalculateExtent( const EAxis pAxis,
|
||||
EInside G4UnionSolid::Inside( const G4ThreeVector& p ) const
|
||||
{
|
||||
EInside positionA = fPtrSolidA->Inside(p);
|
||||
if (positionA == kInside) return kInside;
|
||||
if (positionA == kInside) { return kInside; }
|
||||
|
||||
EInside positionB = fPtrSolidB->Inside(p);
|
||||
|
||||
if( positionA == kInside || positionB == kInside ||
|
||||
if( positionB == kInside ||
|
||||
( positionA == kSurface && positionB == kSurface &&
|
||||
( fPtrSolidA->SurfaceNormal(p) +
|
||||
fPtrSolidB->SurfaceNormal(p) ).mag2() <
|
||||
@@ -160,10 +187,10 @@ EInside G4UnionSolid::Inside( const G4ThreeVector& p ) const
|
||||
}
|
||||
else
|
||||
{
|
||||
if( ( positionA != kInside && positionB == kSurface ) ||
|
||||
( positionB != kInside && positionA == kSurface ) ||
|
||||
( positionA == kSurface && positionB == kSurface ) ) return kSurface;
|
||||
else return kOutside;
|
||||
if( ( positionB == kSurface ) || ( positionA == kSurface ) )
|
||||
{ return kSurface; }
|
||||
else
|
||||
{ return kOutside; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -425,6 +452,15 @@ G4GeometryType G4UnionSolid::GetEntityType() const
|
||||
return G4String("G4UnionSolid");
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Make a clone of the object
|
||||
|
||||
G4VSolid* G4UnionSolid::Clone() const
|
||||
{
|
||||
return new G4UnionSolid(*this);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
//
|
||||
//
|
||||
@@ -453,19 +489,13 @@ G4UnionSolid::DescribeYourselfTo ( G4VGraphicsScene& scene ) const
|
||||
G4Polyhedron*
|
||||
G4UnionSolid::CreatePolyhedron () const
|
||||
{
|
||||
G4Polyhedron* pA = fPtrSolidA->GetPolyhedron();
|
||||
G4Polyhedron* pB = fPtrSolidB->GetPolyhedron();
|
||||
if (pA && pB) {
|
||||
G4Polyhedron* resultant = new G4Polyhedron (pA->add(*pB));
|
||||
return resultant;
|
||||
} else {
|
||||
std::ostringstream oss;
|
||||
oss << GetName() <<
|
||||
": one of the Boolean components has no corresponding polyhedron.";
|
||||
G4Exception("G4UnionSolid::CreatePolyhedron",
|
||||
"", JustWarning, oss.str().c_str());
|
||||
return 0;
|
||||
}
|
||||
HepPolyhedronProcessor processor;
|
||||
// Stack components and components of components recursively
|
||||
// See G4BooleanSolid::StackPolyhedron
|
||||
G4Polyhedron* top = StackPolyhedron(processor, this);
|
||||
G4Polyhedron* result = new G4Polyhedron(*top);
|
||||
if (processor.execute(*result)) { return result; }
|
||||
else { return 0; }
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////
|
||||
|
||||
Reference in New Issue
Block a user