Import Geant4 9.6.0 source tree
This commit is contained in:
@@ -25,18 +25,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4VFacet.cc,v 1.11 2010-09-23 10:30:07 gcosmo Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
//
|
||||
// %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
//
|
||||
// MODULE: G4VFacet.hh
|
||||
//
|
||||
// Date: 15/06/2005
|
||||
// Author: P R Truscott
|
||||
// Organisation: QinetiQ Ltd, UK
|
||||
// Customer: UK Ministry of Defence : RAO CRP TD Electronic Systems
|
||||
// Contract: C/MAT/N03517
|
||||
// $Id$
|
||||
//
|
||||
// %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
//
|
||||
@@ -44,65 +33,25 @@
|
||||
// --------------
|
||||
//
|
||||
// 31 October 2004, P R Truscott, QinetiQ Ltd, UK - Created.
|
||||
// 12 October 2012, M Gayer, CERN, - Reviewed optimized implementation.
|
||||
//
|
||||
// %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
#include "G4VFacet.hh"
|
||||
#include "globals.hh"
|
||||
#include "geomdefs.hh"
|
||||
#include "G4GeometryTolerance.hh"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
G4VFacet::G4VFacet ()
|
||||
: geometryType("G4VFacet"), isDefined(false), nVertices(0),
|
||||
radius(0.), radiusSqr(0.), dirTolerance(1.0E-14), area(0.)
|
||||
{
|
||||
kCarTolerance = G4GeometryTolerance::GetInstance()->GetSurfaceTolerance();
|
||||
using namespace std;
|
||||
|
||||
P.clear();
|
||||
E.clear();
|
||||
|
||||
circumcentre = G4ThreeVector(0.0,0.0,0.0);
|
||||
}
|
||||
const G4double G4VFacet::dirTolerance = 1.0E-14;
|
||||
const G4double G4VFacet::kCarTolerance =
|
||||
G4GeometryTolerance::GetInstance()->GetSurfaceTolerance();
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
G4VFacet::~G4VFacet ()
|
||||
G4VFacet::~G4VFacet()
|
||||
{
|
||||
P.clear();
|
||||
E.clear();
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
G4VFacet::G4VFacet (const G4VFacet &rhs)
|
||||
: geometryType(rhs.geometryType), isDefined(rhs.isDefined),
|
||||
nVertices(rhs.nVertices), P0(rhs.P0), P(rhs.P), E(rhs.E), I(rhs.I),
|
||||
surfaceNormal(rhs.surfaceNormal), circumcentre(rhs.circumcentre),
|
||||
radius(rhs.radius), radiusSqr(rhs.radiusSqr),
|
||||
dirTolerance(rhs.dirTolerance), kCarTolerance(rhs.kCarTolerance),
|
||||
area(rhs.area)
|
||||
{
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
const G4VFacet &G4VFacet::operator=(G4VFacet &rhs)
|
||||
{
|
||||
// Check assignment to self
|
||||
//
|
||||
if (this == &rhs) { return *this; }
|
||||
|
||||
// Copy data
|
||||
//
|
||||
geometryType = rhs.geometryType; isDefined = rhs.isDefined;
|
||||
nVertices = rhs.nVertices; P0 = rhs.P0; P = rhs.P; E = rhs.E; I = rhs.I;
|
||||
surfaceNormal = rhs.surfaceNormal; circumcentre = rhs.circumcentre;
|
||||
radius = rhs.radius; radiusSqr = rhs.radiusSqr;
|
||||
dirTolerance = rhs.dirTolerance; kCarTolerance = rhs.kCarTolerance;
|
||||
area = rhs.area;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
@@ -110,25 +59,26 @@ const G4VFacet &G4VFacet::operator=(G4VFacet &rhs)
|
||||
G4bool G4VFacet::operator== (const G4VFacet &right) const
|
||||
{
|
||||
G4double tolerance = kCarTolerance*kCarTolerance/4.0;
|
||||
if (nVertices != right.GetNumberOfVertices())
|
||||
{ return false; }
|
||||
else if ((circumcentre-right.GetCircumcentre()).mag2() > tolerance)
|
||||
{ return false; }
|
||||
else if (std::fabs((right.GetSurfaceNormal()).dot(surfaceNormal)) < 0.9999999999)
|
||||
{ return false; }
|
||||
|
||||
if (GetNumberOfVertices() != right.GetNumberOfVertices())
|
||||
return false;
|
||||
else if ((GetCircumcentre()-right.GetCircumcentre()).mag2() > tolerance)
|
||||
return false;
|
||||
else if (std::fabs((right.GetSurfaceNormal()).dot(GetSurfaceNormal())) < 0.9999999999)
|
||||
return false;
|
||||
|
||||
G4bool coincident = true;
|
||||
size_t i = 0;
|
||||
G4int i = 0;
|
||||
do
|
||||
{
|
||||
coincident = false;
|
||||
size_t j = 0;
|
||||
G4int j = 0;
|
||||
do
|
||||
{
|
||||
coincident = (GetVertex(i)-right.GetVertex(j)).mag2() < tolerance;
|
||||
} while (!coincident && ++j < nVertices);
|
||||
} while (coincident && ++i < nVertices);
|
||||
|
||||
} while (!coincident && ++j < GetNumberOfVertices());
|
||||
} while (coincident && ++i < GetNumberOfVertices());
|
||||
|
||||
return coincident;
|
||||
}
|
||||
|
||||
@@ -136,10 +86,10 @@ G4bool G4VFacet::operator== (const G4VFacet &right) const
|
||||
//
|
||||
void G4VFacet::ApplyTranslation(const G4ThreeVector v)
|
||||
{
|
||||
P0 += v;
|
||||
for (G4ThreeVectorList::iterator it=P.begin(); it!=P.end(); it++)
|
||||
G4int n = GetNumberOfVertices();
|
||||
for (G4int i = 0; i < n; ++i)
|
||||
{
|
||||
(*it) += v;
|
||||
SetVertex(i, GetVertex(i) + v);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -150,46 +100,20 @@ std::ostream &G4VFacet::StreamInfo(std::ostream &os) const
|
||||
os << G4endl;
|
||||
os << "*********************************************************************"
|
||||
<< G4endl;
|
||||
os << "FACET TYPE = " << geometryType << G4endl;
|
||||
os << "FACET TYPE = " << GetEntityType() << G4endl;
|
||||
os << "ABSOLUTE VECTORS = " << G4endl;
|
||||
os << "P0 = " << P0 << G4endl;
|
||||
for (G4ThreeVectorList::const_iterator it=P.begin(); it!=P.end(); it++)
|
||||
{ os << "P[" << it-P.begin()+1 << "] = " << *it << G4endl; }
|
||||
|
||||
os << "RELATIVE VECTORS = " << G4endl;
|
||||
for (G4ThreeVectorList::const_iterator it=E.begin(); it!=E.end(); it++)
|
||||
{ os << "E[" << it-E.begin()+1 << "] = " << *it << G4endl; }
|
||||
|
||||
G4int n = GetNumberOfVertices();
|
||||
for (G4int i = 0; i < n; ++i)
|
||||
os << "P[" << i << "] = " << GetVertex(i) << G4endl;
|
||||
os << "*********************************************************************"
|
||||
<< G4endl;
|
||||
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
G4VFacet* G4VFacet::GetClone ()
|
||||
{return 0;}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
G4double G4VFacet::Distance (const G4ThreeVector&, const G4double)
|
||||
{return kInfinity;}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
G4double G4VFacet::Distance (const G4ThreeVector&, const G4double,
|
||||
const G4bool)
|
||||
{return kInfinity;}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
G4double G4VFacet::Extent (const G4ThreeVector)
|
||||
{return 0.0;}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
G4bool G4VFacet::Intersect (const G4ThreeVector&, const G4ThreeVector &,
|
||||
const G4bool , G4double &, G4double &,
|
||||
G4ThreeVector &)
|
||||
{return false;}
|
||||
G4bool G4VFacet::IsInside (const G4ThreeVector &p) const
|
||||
{
|
||||
G4ThreeVector d = p - GetVertex(0);
|
||||
G4double displacement = d.dot(GetSurfaceNormal());
|
||||
return displacement <= 0.0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user