Import Geant4 8.3.0 source tree
This commit is contained in:
@@ -0,0 +1,173 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4ExtrudedSolid.hh,v 1.5 2007/02/26 08:40:01 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-08-03 $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// GEANT 4 class header file
|
||||
//
|
||||
//
|
||||
// G4ExtrudedSolid
|
||||
//
|
||||
// Class description:
|
||||
//
|
||||
// G4ExtrudedSolid is a solid which represents the extrusion of an arbitrary
|
||||
// polygon with fixed outline in the defined Z sections.
|
||||
// The z-sides of the solid are the scaled versions of the same polygon.
|
||||
// The solid is implemented as a specification of G4TessellatedSolid.
|
||||
//
|
||||
// Parameters in the constructor:
|
||||
// const G4String& pName - solid name
|
||||
// std::vector<G4TwoVector> polygon - the vertices of the outlined polygon
|
||||
// defined in clock-wise order
|
||||
// std::vector<ZSection> - the z-sections defined by
|
||||
// z position, offset and scale
|
||||
// in increasing z-position order
|
||||
//
|
||||
// Parameters in the special constructor (for solid with 2 z-sections:
|
||||
// G4double hz - the solid half length in Z
|
||||
// G4TwoVector off1 - offset of the side in -hz
|
||||
// G4double scale1 - scale of the side in -hz
|
||||
// G4TwoVector off2 - offset of the side in +hz
|
||||
// G4double scale2 - scale of the side in -hz
|
||||
|
||||
// Author:
|
||||
// Ivana Hrivnacova, IPN Orsay
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#ifndef G4ExtrudedSolid_HH
|
||||
#define G4ExtrudedSolid_HH
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "G4TwoVector.hh"
|
||||
|
||||
#include "G4TessellatedSolid.hh"
|
||||
|
||||
class G4ExtrudedSolid : public G4TessellatedSolid
|
||||
{
|
||||
|
||||
public: // without description
|
||||
|
||||
struct ZSection
|
||||
{
|
||||
ZSection(G4double z, G4TwoVector offset, G4double scale)
|
||||
: fZ(z), fOffset(offset), fScale(scale) {}
|
||||
|
||||
G4double fZ;
|
||||
G4TwoVector fOffset;
|
||||
G4double fScale;
|
||||
};
|
||||
|
||||
public: // with description
|
||||
|
||||
G4ExtrudedSolid( const G4String& pName,
|
||||
std::vector<G4TwoVector> polygon,
|
||||
std::vector<ZSection> zsections);
|
||||
// General constructor
|
||||
|
||||
G4ExtrudedSolid( const G4String& pName,
|
||||
std::vector<G4TwoVector> polygon,
|
||||
G4double hz,
|
||||
G4TwoVector off1, G4double scale1,
|
||||
G4TwoVector off2, G4double scale2 );
|
||||
// Special constructor for solid with 2 z-sections
|
||||
|
||||
virtual ~G4ExtrudedSolid();
|
||||
// Destructor
|
||||
|
||||
// Accessors
|
||||
|
||||
inline G4int GetNofVertices() const;
|
||||
inline G4TwoVector GetVertex(G4int index) const;
|
||||
inline std::vector<G4TwoVector> GetPolygon() const;
|
||||
|
||||
inline G4int GetNofZSections() const;
|
||||
inline ZSection GetZSection(G4int index) const;
|
||||
inline std::vector<ZSection> GetZSections() const;
|
||||
|
||||
// Solid methods
|
||||
|
||||
EInside Inside (const G4ThreeVector &p) const;
|
||||
G4double DistanceToOut(const G4ThreeVector &p,
|
||||
const G4ThreeVector &v,
|
||||
const G4bool calcNorm=false,
|
||||
G4bool *validNorm=0, G4ThreeVector *n=0) const;
|
||||
G4double DistanceToOut (const G4ThreeVector &p) const;
|
||||
G4GeometryType GetEntityType () const;
|
||||
|
||||
std::ostream& StreamInfo(std::ostream &os) const;
|
||||
|
||||
public: // without description
|
||||
|
||||
G4ExtrudedSolid(__void__&);
|
||||
// Fake default constructor for usage restricted to direct object
|
||||
// persistency for clients requiring preallocation of memory for
|
||||
// persistifiable objects.
|
||||
|
||||
private:
|
||||
|
||||
void ComputeProjectionParameters();
|
||||
|
||||
G4ThreeVector GetVertex(G4int iz, G4int ind) const;
|
||||
G4TwoVector ProjectPoint(const G4ThreeVector& point) const;
|
||||
|
||||
G4bool IsSameLine(G4TwoVector p,
|
||||
G4TwoVector l1, G4TwoVector l2) const;
|
||||
G4bool IsSameSide(G4TwoVector p1, G4TwoVector p2,
|
||||
G4TwoVector l1, G4TwoVector l2) const;
|
||||
G4bool IsPointInside(G4TwoVector a, G4TwoVector b, G4TwoVector c,
|
||||
G4TwoVector p) const;
|
||||
|
||||
G4VFacet* MakeDownFacet(G4int ind1, G4int ind2, G4int ind3) const;
|
||||
G4VFacet* MakeUpFacet(G4int ind1, G4int ind2, G4int ind3) const;
|
||||
|
||||
G4bool AddGeneralPolygonFacets();
|
||||
G4bool MakeFacets();
|
||||
G4bool IsConvex() const;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
G4int fNv;
|
||||
G4int fNz;
|
||||
std::vector<G4TwoVector> fPolygon;
|
||||
std::vector<ZSection> fZSections;
|
||||
std::vector< std::vector<G4int> > fTriangles;
|
||||
G4bool fIsConvex;
|
||||
G4GeometryType fGeometryType;
|
||||
|
||||
std::vector<G4double> fKScales;
|
||||
std::vector<G4double> fScale0s;
|
||||
std::vector<G4TwoVector> fKOffsets;
|
||||
std::vector<G4TwoVector> fOffset0s;
|
||||
};
|
||||
|
||||
#include "G4ExtrudedSolid.icc"
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,83 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4ExtrudedSolid.icc,v 1.2 2007/02/19 10:17:45 ivana Exp $
|
||||
// GEANT4 tag $Name: geant4-08-03 $
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// GEANT 4 inline definitions file
|
||||
//
|
||||
// G4ExtrudedSolid.icc
|
||||
//
|
||||
// Implementation of inline methods of G4ExtrudedSolid
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
inline
|
||||
G4int G4ExtrudedSolid::GetNofVertices() const
|
||||
{
|
||||
return fNv;
|
||||
}
|
||||
|
||||
inline G4TwoVector G4ExtrudedSolid::GetVertex(G4int index) const
|
||||
{
|
||||
if ( index<0 || index >= fNv )
|
||||
{
|
||||
G4Exception ("G4ExtrudedSolid::GetVertex()", "InvalidInput",
|
||||
FatalException, "Index outside range.");
|
||||
return G4TwoVector();
|
||||
}
|
||||
return fPolygon[index];
|
||||
}
|
||||
|
||||
inline
|
||||
std::vector<G4TwoVector> G4ExtrudedSolid::GetPolygon() const
|
||||
{
|
||||
return fPolygon;
|
||||
}
|
||||
|
||||
inline
|
||||
G4int G4ExtrudedSolid::GetNofZSections() const
|
||||
{
|
||||
return fNz;
|
||||
}
|
||||
|
||||
inline
|
||||
G4ExtrudedSolid::ZSection G4ExtrudedSolid::GetZSection(G4int index) const
|
||||
{
|
||||
if ( index<0 || index >= fNz )
|
||||
{
|
||||
G4Exception ("G4ExtrudedSolid::GetZSection()", "InvalidInput",
|
||||
FatalException, "Index outside range.");
|
||||
return ZSection(0.0, G4TwoVector(), 0.0);
|
||||
}
|
||||
return fZSections[index];
|
||||
}
|
||||
|
||||
inline
|
||||
std::vector<G4ExtrudedSolid::ZSection> G4ExtrudedSolid::GetZSections() const
|
||||
{
|
||||
return fZSections;
|
||||
}
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4Polycone.hh,v 1.19 2006/06/29 18:47:12 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
// $Id: G4Polycone.hh,v 1.20 2007/04/26 06:18:20 tnikitin Exp $
|
||||
// GEANT4 tag $Name: geant4-08-03 $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
@@ -175,6 +175,10 @@ class G4Polycone : public G4VCSGfaceted
|
||||
G4double zOne, G4double zTwo,
|
||||
G4double& totArea) const;
|
||||
|
||||
G4ThreeVector GetPointOnRing(G4double fRMin, G4double fRMax,
|
||||
G4double fRMin2, G4double fRMax2,
|
||||
G4double zOne) const;
|
||||
|
||||
protected: // without description
|
||||
|
||||
// Here are our parameters
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4Polyhedra.hh,v 1.16 2006/06/29 18:47:18 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
// $Id: G4Polyhedra.hh,v 1.17 2007/01/22 12:58:53 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-08-03 $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
@@ -143,8 +143,13 @@ class G4Polyhedra : public G4VCSGfaceted
|
||||
inline G4bool IsGeneric() const;
|
||||
inline G4int GetNumRZCorner() const;
|
||||
inline G4PolyhedraSideRZ GetCorner( const G4int index ) const;
|
||||
|
||||
inline G4PolyhedraHistorical* GetOriginalParameters() const;
|
||||
// Returns internal scaled parameters.
|
||||
inline void SetOriginalParameters(G4PolyhedraHistorical* pars);
|
||||
// Sets internal parameters. Parameters 'Rmin' and 'Rmax' in input must
|
||||
// be scaled first by a factor computed as 'cos(0.5*phiTotal/theNumSide)',
|
||||
// if not already scaled.
|
||||
|
||||
public: // without description
|
||||
|
||||
@@ -155,14 +160,15 @@ class G4Polyhedra : public G4VCSGfaceted
|
||||
|
||||
protected: // without description
|
||||
|
||||
// Generic initializer, call by all constructors
|
||||
|
||||
inline void SetOriginalParameters();
|
||||
|
||||
// Sets internal parameters for the generic constructor.
|
||||
|
||||
void Create( G4double phiStart, // initial phi starting angle
|
||||
G4double phiTotal, // total phi angle
|
||||
G4int numSide, // number sides
|
||||
G4ReduciblePolygon *rz ); // rz coordinates
|
||||
// Generates the shape and is called by each constructor, after the
|
||||
// conversion of the arguments
|
||||
|
||||
void CopyStuff( const G4Polyhedra &source );
|
||||
void DeleteStuff();
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4Polyhedra.icc,v 1.10 2006/06/29 18:47:20 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
// $Id: G4Polyhedra.icc,v 1.11 2007/01/22 12:58:53 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-08-03 $
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// GEANT 4 inline definitions file
|
||||
@@ -87,8 +87,10 @@ inline
|
||||
void G4Polyhedra::SetOriginalParameters(G4PolyhedraHistorical* pars)
|
||||
{
|
||||
if (!pars)
|
||||
{
|
||||
G4Exception("G4Polyhedra::SetOriginalParameters()", "InvalidSetup",
|
||||
FatalException, "NULL pointer to parameters!");
|
||||
}
|
||||
*original_parameters = *pars;
|
||||
fCubicVolume = 0.;
|
||||
fpPolyhedron = 0;
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4QuadrangularFacet.hh,v 1.3 2006/06/29 18:47:26 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
// $Id: G4QuadrangularFacet.hh,v 1.5 2007/02/26 08:39:13 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-08-03 $
|
||||
//
|
||||
// %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
//
|
||||
@@ -88,7 +88,7 @@ class G4QuadrangularFacet : public G4VFacet
|
||||
G4QuadrangularFacet (const G4QuadrangularFacet &right);
|
||||
const G4QuadrangularFacet &operator=(G4QuadrangularFacet &right);
|
||||
|
||||
G4VFacet *GetClone();
|
||||
G4VFacet *GetClone ();
|
||||
|
||||
G4ThreeVector Distance (const G4ThreeVector &p);
|
||||
G4double Distance (const G4ThreeVector &p, const G4double minDist);
|
||||
@@ -98,8 +98,10 @@ class G4QuadrangularFacet : public G4VFacet
|
||||
G4bool Intersect (const G4ThreeVector &p, const G4ThreeVector &v,
|
||||
const G4bool outgoing, G4double &distance,
|
||||
G4double &distFromSurface, G4ThreeVector &normal);
|
||||
G4bool IsInside (const G4ThreeVector &p) const;
|
||||
|
||||
G4double GetArea ();
|
||||
G4ThreeVector GetPointOnFace () const;
|
||||
|
||||
private:
|
||||
|
||||
G4TriangularFacet *facet1;
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4TessellatedSolid.hh,v 1.4 2006/10/20 13:45:20 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
// $Id: G4TessellatedSolid.hh,v 1.7 2007/02/12 11:51:25 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-08-03 $
|
||||
//
|
||||
// %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
//
|
||||
@@ -129,7 +129,7 @@ class G4TessellatedSolid : public G4VSolid
|
||||
|
||||
G4TessellatedSolid ();
|
||||
G4TessellatedSolid (const G4String &name);
|
||||
~G4TessellatedSolid ();
|
||||
virtual ~G4TessellatedSolid ();
|
||||
|
||||
G4TessellatedSolid (const G4TessellatedSolid &s);
|
||||
const G4TessellatedSolid &operator= (const G4TessellatedSolid &s);
|
||||
@@ -139,45 +139,52 @@ class G4TessellatedSolid : public G4VSolid
|
||||
G4VFacet *GetFacet (size_t i) const;
|
||||
size_t GetNumberOfFacets () const;
|
||||
|
||||
G4double GetCubicVolume ();
|
||||
G4double GetSurfaceArea ();
|
||||
virtual G4double GetCubicVolume ();
|
||||
virtual G4double GetSurfaceArea ();
|
||||
|
||||
//
|
||||
// void ComputeDimensions (G4VPVParameterisation* p, const G4int n,
|
||||
// const G4VPhysicalVolume* pRep) const;
|
||||
// virtual void ComputeDimensions (G4VPVParameterisation* p, const G4int n,
|
||||
// const G4VPhysicalVolume* pRep) const;
|
||||
|
||||
EInside Inside (const G4ThreeVector &p) const;
|
||||
G4ThreeVector SurfaceNormal (const G4ThreeVector &p) const;
|
||||
G4double DistanceToIn(const G4ThreeVector &p, const G4ThreeVector &v) const;
|
||||
G4double DistanceToIn(const G4ThreeVector &p) const;
|
||||
G4double DistanceToOut(const G4ThreeVector &p, const G4ThreeVector &v,
|
||||
const G4bool calcNorm=false,
|
||||
virtual EInside Inside (const G4ThreeVector &p) const;
|
||||
virtual G4ThreeVector SurfaceNormal (const G4ThreeVector &p) const;
|
||||
virtual G4double DistanceToIn(const G4ThreeVector &p,
|
||||
const G4ThreeVector &v) const;
|
||||
virtual G4double DistanceToIn(const G4ThreeVector &p) const;
|
||||
virtual G4double DistanceToOut(const G4ThreeVector &p,
|
||||
const G4ThreeVector &v,
|
||||
const G4bool calcNorm=false,
|
||||
G4bool *validNorm=0, G4ThreeVector *n=0) const;
|
||||
G4double DistanceToOut (const G4ThreeVector &p) const;
|
||||
G4GeometryType GetEntityType () const;
|
||||
virtual G4double DistanceToOut (const G4ThreeVector &p) const;
|
||||
virtual G4GeometryType GetEntityType () const;
|
||||
|
||||
void SetSolidClosed (const G4bool t);
|
||||
G4bool GetSolidClosed () const;
|
||||
|
||||
G4bool CalculateExtent(const EAxis pAxis, const G4VoxelLimits& pVoxelLimit,
|
||||
const G4AffineTransform& pTransform, G4double& pMin,
|
||||
G4double& pMax) const;
|
||||
virtual G4ThreeVector GetPointOnSurface() const;
|
||||
|
||||
std::ostream &StreamInfo(std::ostream &os) const;
|
||||
virtual G4bool CalculateExtent(const EAxis pAxis,
|
||||
const G4VoxelLimits& pVoxelLimit,
|
||||
const G4AffineTransform& pTransform,
|
||||
G4double& pMin, G4double& pMax) const;
|
||||
|
||||
virtual std::ostream &StreamInfo(std::ostream &os) const;
|
||||
|
||||
// Functions for visualization
|
||||
|
||||
void DescribeYourselfTo (G4VGraphicsScene& scene) const;
|
||||
G4VisExtent GetExtent () const;
|
||||
virtual void DescribeYourselfTo (G4VGraphicsScene& scene) const;
|
||||
virtual G4VisExtent GetExtent () const;
|
||||
|
||||
G4double GetMinXExtent () const;
|
||||
G4double GetMaxXExtent () const;
|
||||
G4double GetMinYExtent () const;
|
||||
G4double GetMaxYExtent () const;
|
||||
G4double GetMinZExtent () const;
|
||||
G4double GetMaxZExtent () const;
|
||||
G4Polyhedron* CreatePolyhedron () const;
|
||||
G4Polyhedron* GetPolyhedron () const;
|
||||
G4NURBS* CreateNURBS () const;
|
||||
|
||||
virtual G4Polyhedron* CreatePolyhedron () const;
|
||||
virtual G4Polyhedron* GetPolyhedron () const;
|
||||
virtual G4NURBS* CreateNURBS () const;
|
||||
|
||||
public: // without description
|
||||
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4TriangularFacet.hh,v 1.3 2006/06/29 18:47:40 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
// $Id: G4TriangularFacet.hh,v 1.6 2007/02/26 08:39:40 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-08-03 $
|
||||
//
|
||||
// %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
//
|
||||
@@ -83,7 +83,7 @@ class G4TriangularFacet : public G4VFacet
|
||||
G4TriangularFacet (const G4TriangularFacet &right);
|
||||
const G4TriangularFacet &operator=(G4TriangularFacet &right);
|
||||
|
||||
G4VFacet *GetClone();
|
||||
G4VFacet *GetClone ();
|
||||
G4TriangularFacet *GetFlippedFacet ();
|
||||
|
||||
G4ThreeVector Distance (const G4ThreeVector &p);
|
||||
@@ -94,8 +94,9 @@ class G4TriangularFacet : public G4VFacet
|
||||
G4bool Intersect (const G4ThreeVector &p, const G4ThreeVector &v,
|
||||
const G4bool outgoing, G4double &distance,
|
||||
G4double &distFromSurface, G4ThreeVector &normal);
|
||||
G4bool IsInside(const G4ThreeVector &p) const;
|
||||
|
||||
G4double GetArea ();
|
||||
G4ThreeVector GetPointOnFace () const;
|
||||
|
||||
private:
|
||||
|
||||
G4double a;
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4VFacet.hh,v 1.3 2006/06/29 18:48:12 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
// $Id: G4VFacet.hh,v 1.4 2007/02/12 09:34:44 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-08-03 $
|
||||
//
|
||||
// %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
//
|
||||
@@ -72,23 +72,20 @@ class G4VFacet
|
||||
G4VFacet ();
|
||||
virtual ~G4VFacet ();
|
||||
|
||||
G4VFacet (const G4VFacet &right);
|
||||
const G4VFacet &operator=(G4VFacet &right);
|
||||
|
||||
G4bool operator== (const G4VFacet &right) const;
|
||||
|
||||
size_t GetNumberOfVertices () const;
|
||||
G4ThreeVector GetVertex (size_t i) const;
|
||||
inline size_t GetNumberOfVertices () const;
|
||||
inline G4ThreeVector GetVertex (size_t i) const;
|
||||
|
||||
G4GeometryType GetEntityType () const;
|
||||
G4ThreeVector GetSurfaceNormal () const;
|
||||
G4bool IsInside(const G4ThreeVector &p) const;
|
||||
G4bool IsDefined () const;
|
||||
void SetVertexIndex (const size_t i, const size_t j);
|
||||
size_t GetVertexIndex (const size_t i) const;
|
||||
G4ThreeVector GetCentroid () const;
|
||||
G4double GetRadius () const;
|
||||
G4double GetRadiusSquared() const;
|
||||
inline G4GeometryType GetEntityType () const;
|
||||
inline G4ThreeVector GetSurfaceNormal () const;
|
||||
inline G4bool IsInside(const G4ThreeVector &p) const;
|
||||
inline G4bool IsDefined () const;
|
||||
inline void SetVertexIndex (const size_t i, const size_t j);
|
||||
inline size_t GetVertexIndex (const size_t i) const;
|
||||
inline G4ThreeVector GetCentroid () const;
|
||||
inline G4double GetRadius () const;
|
||||
inline G4double GetRadiusSquared() const;
|
||||
|
||||
void ApplyTranslation (const G4ThreeVector v);
|
||||
|
||||
@@ -102,6 +99,9 @@ class G4VFacet
|
||||
virtual G4bool Intersect (const G4ThreeVector&, const G4ThreeVector &,
|
||||
const G4bool , G4double &, G4double &,
|
||||
G4ThreeVector &);
|
||||
virtual G4double GetArea() = 0;
|
||||
virtual G4ThreeVector GetPointOnFace() const = 0;
|
||||
|
||||
protected:
|
||||
|
||||
G4GeometryType geometryType;
|
||||
@@ -117,6 +117,12 @@ class G4VFacet
|
||||
G4double radiusSqr;
|
||||
|
||||
G4double dirTolerance;
|
||||
G4double area;
|
||||
|
||||
private:
|
||||
|
||||
G4VFacet (const G4VFacet &right);
|
||||
const G4VFacet &operator=(G4VFacet &right);
|
||||
};
|
||||
|
||||
typedef std::vector<G4VFacet*>::iterator FacetI;
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4VFacet.icc,v 1.3 2006/06/29 18:48:15 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
// $Id: G4VFacet.icc,v 1.4 2007/02/12 09:34:44 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-08-03 $
|
||||
//
|
||||
// %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
//
|
||||
@@ -47,28 +47,6 @@
|
||||
//
|
||||
// %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
inline G4VFacet::G4VFacet ()
|
||||
{
|
||||
dirTolerance = 1.0E-14;
|
||||
|
||||
P.clear();
|
||||
E.clear();
|
||||
|
||||
centroid = G4ThreeVector(0.0,0.0,0.0);
|
||||
radius = 0.0;
|
||||
radiusSqr = 0.0;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
inline G4VFacet::~G4VFacet ()
|
||||
{
|
||||
P.clear();
|
||||
E.clear();
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
inline G4ThreeVector G4VFacet::GetSurfaceNormal () const
|
||||
@@ -99,8 +77,8 @@ inline G4bool G4VFacet::IsDefined () const
|
||||
//
|
||||
inline size_t G4VFacet::GetVertexIndex (const size_t i) const
|
||||
{
|
||||
if (i < I.size()) return I[i];
|
||||
else return 999999999;
|
||||
if (i < I.size()) { return I[i]; }
|
||||
else { return 999999999; }
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
@@ -119,45 +97,9 @@ inline void G4VFacet::SetVertexIndex (const size_t i, const size_t j)
|
||||
//
|
||||
inline G4ThreeVector G4VFacet::GetVertex (size_t i) const
|
||||
{
|
||||
if (i == 0) return P0;
|
||||
else if (i < nVertices) return P[i-1];
|
||||
else return G4ThreeVector(0.0,0.0,0.0);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
inline void G4VFacet::ApplyTranslation(const G4ThreeVector v)
|
||||
{
|
||||
P0 += v;
|
||||
for (G4ThreeVectorList::iterator it=P.begin(); it!=P.end(); it++)
|
||||
(*it) += v;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
inline G4bool G4VFacet::operator== (const G4VFacet &right) const
|
||||
{
|
||||
G4double tolerance = kCarTolerance*kCarTolerance/4.0;
|
||||
if (nVertices != right.GetNumberOfVertices())
|
||||
return false;
|
||||
else if ((centroid-right.GetCentroid()).mag2() > tolerance)
|
||||
return false;
|
||||
else if (std::fabs((right.GetSurfaceNormal()).dot(surfaceNormal)) < 0.9999999999)
|
||||
return false;
|
||||
|
||||
G4bool coincident = true;
|
||||
size_t i = 0;
|
||||
do
|
||||
{
|
||||
coincident = false;
|
||||
size_t j = 0;
|
||||
do
|
||||
{
|
||||
coincident = (GetVertex(i)-right.GetVertex(j)).mag2() < tolerance;
|
||||
} while (!coincident && j++ < nVertices);
|
||||
} while (coincident && i++ < nVertices);
|
||||
|
||||
return coincident;
|
||||
if (i == 0) { return P0; }
|
||||
else if (i < nVertices) { return P[i-1]; }
|
||||
else { return G4ThreeVector(0.0,0.0,0.0); }
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
@@ -174,31 +116,3 @@ inline G4double G4VFacet::GetRadius () const
|
||||
//
|
||||
inline G4double G4VFacet::GetRadiusSquared () const
|
||||
{return radiusSqr;}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
inline G4VFacet* G4VFacet::GetClone ()
|
||||
{return 0;}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
inline G4double G4VFacet::Distance (const G4ThreeVector&, const G4double)
|
||||
{return kInfinity;}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
inline G4double G4VFacet::Distance (const G4ThreeVector&, const G4double,
|
||||
const G4bool)
|
||||
{return kInfinity;}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
inline G4double G4VFacet::Extent (const G4ThreeVector)
|
||||
{return 0.0;}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
inline G4bool G4VFacet::Intersect (const G4ThreeVector&, const G4ThreeVector &,
|
||||
const G4bool , G4double &, G4double &,
|
||||
G4ThreeVector &)
|
||||
{return false;}
|
||||
|
||||
Reference in New Issue
Block a user