Import Geant4 3.2.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-08 16:10:37 +02:00
parent 137e303ecc
commit 36c080dca6
3464 changed files with 119310 additions and 52696 deletions
@@ -1,12 +1,28 @@
// This code implementation is the intellectual property of
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
// $Id: G4CompositeCurve.cc,v 1.8 2000/11/20 17:54:39 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
// $Id: G4CompositeCurve.cc,v 1.9.2.1 2001/06/28 19:08:51 gunter Exp $
// GEANT4 tag $Name: $
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
@@ -24,15 +40,15 @@ G4CompositeCurve::G4CompositeCurve(){}
G4CompositeCurve::G4CompositeCurve(const G4Point3DVector& vertices)
{
G4CurveVector cv;
for (size_t i=0; i<vertices.length(); i++)
for (size_t i=0; i<vertices.size(); i++)
{
G4Point3D p1= vertices[i];
G4Point3D p2= vertices[(i+1) % vertices.length()];
G4Point3D p2= vertices[(i+1) % vertices.size()];
G4Line* l= new G4Line;
l->Init(p1, p2-p1);
l->SetBounds(p1, p2);
cv.insert(l);
cv.push_back(l);
}
Init(cv);
@@ -40,7 +56,22 @@ G4CompositeCurve::G4CompositeCurve(const G4Point3DVector& vertices)
G4CompositeCurve::~G4CompositeCurve()
{
segments.clearAndDestroy();
// Remove segments and delete all its contents
G4Curve* a = 0;
while (segments.size()>0)
{
a = segments.back();
segments.pop_back();
for (G4CurveVector::iterator i=segments.begin(); i!=segments.end(); i++)
{
if (*i==a)
{
segments.erase(i);
i--;
}
}
if ( a ) delete a;
}
}
G4String G4CompositeCurve::GetEntityType() const
@@ -51,17 +82,34 @@ G4String G4CompositeCurve::GetEntityType() const
G4Curve* G4CompositeCurve::Project(const G4Transform3D& tr)
{
G4CurveVector newSegments;
G4Curve* a = 0;
G4Curve* c = 0;
for (size_t i=0; i<segments.entries(); i++)
for (size_t i=0; i<segments.size(); i++)
{
G4Curve* c= segments[i]->Project(tr);
c = segments[i]->Project(tr);
if (c==0)
{
newSegments.clearAndDestroy();
// Remove newSegments and delete all its contents
while (newSegments.size()>0)
{
a = newSegments.back();
newSegments.pop_back();
for (G4CurveVector::iterator i=newSegments.begin();
i!=newSegments.end(); i++)
{
if (*i==a)
{
newSegments.erase(i);
i--;
}
}
if ( a ) delete a;
}
return 0;
}
newSegments.insert(c);
newSegments.push_back(c);
}
G4CompositeCurve* r= new G4CompositeCurve;
@@ -116,9 +164,9 @@ G4int G4CompositeCurve::IntersectRay2D(const G4Ray& ray)
G4int nbinter = 0;
G4int temp = 0;
for (size_t i=0; i<segments.entries(); i++)
for (size_t i=0; i<segments.size(); i++)
{
G4Curve& c= *(segments(i));
G4Curve& c= *(segments[i]);
temp = c.IntersectRay2D(ray);
// test if the point is on the composite curve
@@ -147,7 +195,7 @@ void G4CompositeCurve::InitBounded()
const G4BoundingBox3D* b= segments[0]->BBox();
bBox.Init(b->GetBoxMin(), b->GetBoxMax());
for (size_t i=1; i<segments.entries(); i++)
for (size_t i=1; i<segments.size(); i++)
{
b= segments[i]->BBox();
bBox.Extend(b->GetBoxMin());