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
+134 -30
View File
@@ -8,6 +8,8 @@
* *
***********************************************************************/
#include <CLHEP/Geometry/Plane3D.h>
#define INITIAL_SIZE 200
#define CRAZY_POINT HepPoint3D(-10.e+6, -10.e+6, -10.e+6)
#define GRANULARITY 10.e+5;
@@ -71,7 +73,8 @@ class ExtNode {
int s;
public:
ExtNode(HepPoint3D vertex=0, int status=0) : v(vertex), s(status) {}
ExtNode(HepPoint3D vertex=HepPoint3D(), int status=0)
: v(vertex), s(status) {}
~ExtNode() {}
ExtNode(const ExtNode & node) : v(node.v), s(node.s) {}
@@ -214,6 +217,7 @@ class BooleanProcessor {
int operation; // 0 (union), 1 (intersection), 2 (subtraction)
int ifaces1, ifaces2; // lists of faces
int iout1, iout2; // lists of faces with status "out"
int iunk1, iunk2; // lists of faces with status "unknown"
double rmin[3], rmax[3]; // intersection of bounding boxes
double del; // precision (tolerance)
@@ -268,6 +272,8 @@ class BooleanProcessor {
void draw_edge(int, int);
void draw_contour(int, int, int);
void draw_faces(int, int, int);
void print_face(int);
void print_edge(int);
};
inline void ExtFace::invert()
@@ -550,7 +556,7 @@ int BooleanProcessor::testFaceVsPlane(ExtEdge & edge)
// F I N D I N T E R S E C T I O N
int ie1, ie2, s1, s2, status, nint = 0;
int ie1 = 0, ie2 = 0, s1 = 0, s2 = 0, status, nint = 0;
enum { PLUS_MINUS, MINUS_PLUS, ZERO_ZERO, ZERO_PLUS, ZERO_MINUS };
dd[nnode] = dd[0];
@@ -581,8 +587,8 @@ int BooleanProcessor::testFaceVsPlane(ExtEdge & edge)
if (s1 != ZERO_ZERO && s2 != ZERO_ZERO) {
if (s1 == s2) return NON_PLANAR_FACE;
int iedge, i1, i2, ii[2];
double d1, d2, dd ;
int iedge, i1 = 0, i2 = 0, ii[2];
double d1 = 0., d2 = 0., dd ;
ii[0] = ie1; ii[1] = ie2;
for (i=0; i<2; i++) {
iedge = faces[iface].iedges[ii[i]];
@@ -663,7 +669,7 @@ int BooleanProcessor::testEdgeVsEdge(ExtEdge & edge1, ExtEdge & edge2)
* *
***********************************************************************/
{
int i, ii;
int i, ii = 0;
double d, dd = 0.;
for (i=0; i<3; i++) {
@@ -1066,6 +1072,21 @@ void BooleanProcessor::initiateLists()
faces[i].inew = UNSUITABLE_FACE;
}
}
iface = iunk1;
while (iface > 0) {
i = iface;
iface = faces[i].inext;
unknown_faces.push_back(i);
}
iface = iunk2;
while (iface > 0) {
i = iface;
iface = faces[i].inext;
if (operation == OP_SUBTRACTION) faces[i].invert();
unknown_faces.push_back(i);
}
iface = ifaces1;
while (iface > 0) {
i = iface;
@@ -1107,7 +1128,7 @@ void BooleanProcessor::initiateLists()
break;
}
}
ifaces1 = ifaces2 = iout1 = iout2 = 0;
ifaces1 = ifaces2 = iout1 = iout2 = iunk1 = iunk2 = 0;
}
void BooleanProcessor::assemblePolyhedra()
@@ -1440,14 +1461,13 @@ void BooleanProcessor::triangulateContour(int ix, int iy, int ihead)
// C L O S E C O N T O U R
int *pnext, nnode = 0;
pnext = &ihead;
int ipnext = ihead, nnode = 1;
for (;;) {
if (*pnext > 0) {
pnext = &edges[*pnext].inext;
if (edges[ipnext].inext > 0) {
ipnext = edges[ipnext].inext;
nnode++;
}else{
*pnext = ihead;
edges[ipnext].inext = ihead;
break;
}
}
@@ -1456,7 +1476,7 @@ void BooleanProcessor::triangulateContour(int ix, int iy, int ihead)
int iedge1, iedge2, iedge3, istart = 0;
for (;;) {
iedge1 = *pnext;
iedge1 = edges[ipnext].inext;
iedge2 = edges[iedge1].inext;
if (istart == 0) {
istart = iedge1;
@@ -1486,19 +1506,18 @@ void BooleanProcessor::triangulateContour(int ix, int iy, int ihead)
// C H E C K C O R E C T N E S S O F T H E T R I A N G L E
if (checkTriangle(iedge1,iedge2,ix,iy) != 0) {
pnext = &edges[*pnext].inext;
ipnext = edges[ipnext].inext;
continue;
}
// M O D I F Y C O N T O U R
int i1 = edges[iedge1].i1;
int i2 = edges[iedge1].i2;
int i3 = edges[iedge2].i2;
int iface1 = edges[iedge1].iface1;
int iface2 = faces.size();
*pnext = edges.size();
edges[ipnext].inext = edges.size();
edges.push_back(ExtEdge(i1, i3, iface1, -(edges.size()+1), -1));
edges.back().inext = edges[iedge2].inext;
@@ -1511,7 +1530,7 @@ void BooleanProcessor::triangulateContour(int ix, int iy, int ihead)
faces.back().inew = ORIGINAL_FACE;
edges[iedge1].iface1 = iface2;
edges[iedge2].iface1 = iface2;
pnext = &edges[*pnext].inext;
ipnext = edges[ipnext].inext;
istart = 0;
nnode--;
@@ -1640,18 +1659,18 @@ void BooleanProcessor::triangulateFace(int iface)
// M O D I F Y R E F E R E N C E S
for (iface=nface; iface<faces.size(); iface++) {
iedge = faces[iface].iold;
for (int ifa=nface; ifa<faces.size(); ifa++) {
iedge = faces[ifa].iold;
while (iedge > 0) {
if (edges[iedge].iface1 != iface) {
if (edges[iedge].iface1 != ifa) {
processor_error = 1;
HepStd::cerr
<< "BooleanProcessor::triangulateFace : wrong reference to itself, "
<< "iface=" << iface << ", iface1=" << edges[iedge].iface1
<< "iface=" << ifa << ", iface1=" << edges[iedge].iface1
<< HepStd::endl;
}else if (edges[iedge].iface2 > 0) {
modifyReference(edges[iedge].iface2,
edges[iedge].i1, edges[iedge].i2, iface);
edges[iedge].i1, edges[iedge].i2, ifa);
}else if (edges[iedge].iface2 < 0) {
edges[iedge].iface2 = edges[-edges[iedge].iface2].iface1;
}
@@ -1833,15 +1852,23 @@ HepPolyhedron BooleanProcessor::execute(int op,
// P R E S E L E C T O U T S I D E F A C E S
int ifa1, ifa2;
iout1 = iout2 = 0;
for(;;) {
ifa1 = iout1;
ifa2 = iout2;
selectOutsideFaces(ifaces1, iout1);
selectOutsideFaces(ifaces2, iout2);
if (iout1 == ifa1 && iout2 == ifa2) break;
findMinMax();
selectOutsideFaces(ifaces1, iout1);
selectOutsideFaces(ifaces2, iout2);
// P R E S E L E C T N O I N T E R S E C T I O N F A C E S
int ifa1, ifa2;
iunk1 = iunk2 = 0;
if (iout1 != 0 || iout2 != 0) {
for(;;) {
ifa1 = iunk1;
ifa2 = iunk2;
selectOutsideFaces(ifaces1, iunk1);
selectOutsideFaces(ifaces2, iunk2);
if (iunk1 == ifa1 && iunk2 == ifa2) break;
findMinMax();
}
}
#define PROCESSOR_ERROR \
@@ -1896,7 +1923,7 @@ return a;
}
// C R E A T E P O L Y H E D R O N
return createPolyhedron();
}
@@ -2042,4 +2069,81 @@ BooleanProcessor::draw_contour(int i1col, int i2col, int ihead) {
int i;
std::cin >> i;
}
//--------------------------------------------------------------------
void
BooleanProcessor::print_face(int iface) {
cout.precision(3);
cout << "\n====== Face N " << iface << endl;
cout << "iedges[4] = "
<< faces[iface].iedges[0] << ", "
<< faces[iface].iedges[1] << ", "
<< faces[iface].iedges[2] << ", "
<< faces[iface].iedges[3] << endl;
cout << "rmin[3] = "
<< faces[iface].rmin[0] << ", "
<< faces[iface].rmin[1] << ", "
<< faces[iface].rmin[2] << endl;
cout << "rmax[3] = "
<< faces[iface].rmax[0] << ", "
<< faces[iface].rmax[1] << ", "
<< faces[iface].rmax[2] << endl;
cout << "iprev,inext = "
<< faces[iface].iprev << ", "
<< faces[iface].inext << endl;
cout << "iold = " << faces[iface].iold << endl;
for(int i = faces[iface].iold; i != 0;) {
print_edge(i);
i = edges[abs(i)].inext;
}
cout << "inew = ";
switch (faces[iface].inew) {
case UNKNOWN_FACE:
cout << "UNKNOWN_FACE" << endl;
break;
case ORIGINAL_FACE:
cout << "ORIGINAL_FACE" << endl;
break;
case NEW_FACE:
cout << "NEW_FACE" << endl;
break;
case UNSUITABLE_FACE:
cout << "UNSUITABLE_FACE" << endl;
break;
case DEFECTIVE_FACE:
cout << "DEFECTIVE_FACE" << endl;
break;
default:
cout << faces[iface].inew << endl;
for(int k = faces[iface].inew; k != 0;) {
print_edge(k);
k = edges[abs(k)].inext;
}
}
}
//--------------------------------------------------------------------
void
BooleanProcessor::print_edge(int iedge) {
cout << "==== Edge N " << iedge << endl;
int i = abs(iedge);
int i1 = edges[i].i1;
int i2 = edges[i].i2;
cout << "node[" << i1 << "] = "
<< nodes[i1].v.x() << ", "
<< nodes[i1].v.y() << ", "
<< nodes[i1].v.z() << endl;
cout << "node[" << i2 << "] = "
<< nodes[i2].v.x() << ", "
<< nodes[i2].v.y() << ", "
<< nodes[i2].v.z() << endl;
cout << "iface1,iface2,ivis,inext = "
<< edges[i].iface1 << ", "
<< edges[i].iface2 << ", "
<< edges[i].ivis << ", "
<< edges[i].inext << endl;
}
*/
+23 -7
View File
@@ -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: G4Circle.cc,v 1.3 2001/02/03 18:29:52 johna Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
// $Id: G4Circle.cc,v 1.3.2.1 2001/06/28 19:10:10 gunter Exp $
// GEANT4 tag $Name: $
//
//
+23 -7
View File
@@ -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: G4Colour.cc,v 1.3 1999/12/15 14:50:35 gunter Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
// $Id: G4Colour.cc,v 1.3.4.1 2001/06/28 19:10:10 gunter Exp $
// GEANT4 tag $Name: $
//
//
// John Allison 20th October 1996
+23 -7
View File
@@ -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: G4NURBS.cc,v 1.3 1999/12/15 14:50:35 gunter Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
// $Id: G4NURBS.cc,v 1.3.4.1 2001/06/28 19:10:10 gunter Exp $
// GEANT4 tag $Name: $
//
//
// Olivier Crumeyrolle 12 September 1996
+23 -7
View File
@@ -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: G4NURBSbox.cc,v 1.3 1999/12/15 14:50:35 gunter Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
// $Id: G4NURBSbox.cc,v 1.3.4.1 2001/06/28 19:10:11 gunter Exp $
// GEANT4 tag $Name: $
//
//
// Olivier Crumeyrolle 12 September 1996
+23 -7
View File
@@ -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: G4NURBScylinder.cc,v 1.3 1999/12/15 14:50:35 gunter Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
// $Id: G4NURBScylinder.cc,v 1.3.4.1 2001/06/28 19:10:11 gunter Exp $
// GEANT4 tag $Name: $
//
//
// Olivier Crumeyrolle 12 September 1996
+23 -7
View File
@@ -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: G4NURBShexahedron.cc,v 1.3 1999/12/15 14:50:36 gunter Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
// $Id: G4NURBShexahedron.cc,v 1.3.4.1 2001/06/28 19:10:11 gunter Exp $
// GEANT4 tag $Name: $
//
// hexahedron implementation
// OC 17 9 96
+23 -7
View File
@@ -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: G4NURBStube.cc,v 1.3 1999/12/15 14:50:36 gunter Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
// $Id: G4NURBStube.cc,v 1.3.4.1 2001/06/28 19:10:11 gunter Exp $
// GEANT4 tag $Name: $
//
//
// Olivier Crumeyrolle 12 September 1996
+23 -7
View File
@@ -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: G4NURBStubesector.cc,v 1.4 1999/12/15 14:50:36 gunter Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
// $Id: G4NURBStubesector.cc,v 1.4.4.1 2001/06/28 19:10:11 gunter Exp $
// GEANT4 tag $Name: $
//
//
// Olivier Crumeyrolle 12 September 1996
+23 -7
View File
@@ -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: G4PlacedPolyhedron.cc,v 1.2 1999/12/15 14:50:36 gunter Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
// $Id: G4PlacedPolyhedron.cc,v 1.2.4.1 2001/06/28 19:10:11 gunter Exp $
// GEANT4 tag $Name: $
#include "G4PlacedPolyhedron.hh"
+25 -9
View File
@@ -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: G4Point3DList.cc,v 1.3 1999/12/15 14:50:36 gunter Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
// $Id: G4Point3DList.cc,v 1.4.2.1 2001/06/28 19:10:11 gunter Exp $
// GEANT4 tag $Name: $
//
//
// John Allison July 1995
@@ -19,7 +35,7 @@ G4Point3DList::~G4Point3DList () {}
G4std::ostream& operator << (G4std::ostream& os, const G4Point3DList& points)
{
os << "G4Point3DList[" << points.entries() << "]: ";
for (int i = 0; i < points.entries(); i++) os << points(i);
os << "G4Point3DList[" << points.size() << "]: ";
for (size_t i = 0; i < points.size(); i++) os << points[i];
return os;
}
+23 -7
View File
@@ -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: G4Polyhedron.cc,v 1.10 2001/02/03 18:29:53 johna Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
// $Id: G4Polyhedron.cc,v 1.10.2.1 2001/06/28 19:10:11 gunter Exp $
// GEANT4 tag $Name: $
#include "G4Polyhedron.hh"
+23 -7
View File
@@ -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: G4Polyline.cc,v 1.5 2001/02/03 18:29:55 johna Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
// $Id: G4Polyline.cc,v 1.5.2.1 2001/06/28 19:10:12 gunter Exp $
// GEANT4 tag $Name: $
//
//
// John Allison July 1995
+23 -7
View File
@@ -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: G4Polymarker.cc,v 1.6 2001/02/03 18:29:56 johna Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
// $Id: G4Polymarker.cc,v 1.6.2.1 2001/06/28 19:10:12 gunter Exp $
// GEANT4 tag $Name: $
//
//
// John Allison November 1996
+23 -7
View File
@@ -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: G4Square.cc,v 1.2 1999/12/15 14:50:36 gunter Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
// $Id: G4Square.cc,v 1.2.4.1 2001/06/28 19:10:12 gunter Exp $
// GEANT4 tag $Name: $
//
//
+23 -7
View File
@@ -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: G4Text.cc,v 1.5 2001/02/03 18:29:58 johna Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
// $Id: G4Text.cc,v 1.5.2.1 2001/06/28 19:10:12 gunter Exp $
// GEANT4 tag $Name: $
//
//
// John Allison 17/11/96.
+23 -7
View File
@@ -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: G4VMarker.cc,v 1.6 2001/02/03 18:29:59 johna Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
// $Id: G4VMarker.cc,v 1.6.2.1 2001/06/28 19:10:12 gunter Exp $
// GEANT4 tag $Name: $
//
//
+23 -7
View File
@@ -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: G4VVisPrim.cc,v 1.6 2001/02/03 18:30:00 johna Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
// $Id: G4VVisPrim.cc,v 1.6.2.1 2001/06/28 19:10:13 gunter Exp $
// GEANT4 tag $Name: $
//
//
// John Allison August 1995
+23 -7
View File
@@ -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: G4VisAttributes.cc,v 1.5 1999/12/15 14:50:37 gunter Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
// $Id: G4VisAttributes.cc,v 1.5.4.1 2001/06/28 19:10:13 gunter Exp $
// GEANT4 tag $Name: $
//
//
// John Allison 23rd October 1996
+23 -7
View File
@@ -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: G4VisExtent.cc,v 1.4 1999/12/15 14:50:37 gunter Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
// $Id: G4VisExtent.cc,v 1.4.4.1 2001/06/28 19:10:13 gunter Exp $
// GEANT4 tag $Name: $
//
//
// A.Walkden 28/11/95
+23 -7
View File
@@ -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: G4Visible.cc,v 1.3 1999/12/15 14:50:37 gunter Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
// $Id: G4Visible.cc,v 1.3.4.1 2001/06/28 19:10:13 gunter Exp $
// GEANT4 tag $Name: $
//
//
// John Allison 30th October 1996
+78 -7
View File
@@ -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: HepPolyhedron.cc,v 1.5 2001/02/06 22:07:51 johna Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
// $Id: HepPolyhedron.cc,v 1.8.2.1 2001/06/28 19:10:13 gunter Exp $
// GEANT4 tag $Name: $
//
//
//
@@ -30,8 +46,13 @@
// 19.03.00 E.Chernyaev
// - implemented boolean operations (add, subtract, intersect) on polyhedra;
//
// 25.05.01 E.Chernyaev
// - added GetSurfaceArea() and GetVolume();
//
#include "HepPolyhedron.h"
#include <CLHEP/Units/SystemOfUnits.h>
#include <CLHEP/config/TemplateFunctions.h>
/***********************************************************************
* *
@@ -1174,6 +1195,56 @@ HepBoolean HepPolyhedron::GetNextUnitNormal(HepNormal3D &normal) const
return rep;
}
double HepPolyhedron::GetSurfaceArea() const
/***********************************************************************
* *
* Name: HepPolyhedron::GetSurfaceArea Date: 25.05.01 *
* Author: E.Chernyaev Revised: *
* *
* Function: Returns area of the surface of the polyhedron. *
* *
***********************************************************************/
{
double s = 0.;
for (int iFace=1; iFace<=nface; iFace++) {
int i0 = abs(pF[iFace].edge[0].v);
int i1 = abs(pF[iFace].edge[1].v);
int i2 = abs(pF[iFace].edge[2].v);
int i3 = abs(pF[iFace].edge[3].v);
if (i3 == 0) i3 = i0;
s += ((pV[i2] - pV[i0]).cross(pV[i3] - pV[i1])).mag();
}
return s/2.;
}
double HepPolyhedron::GetVolume() const
/***********************************************************************
* *
* Name: HepPolyhedron::GetVolume Date: 25.05.01 *
* Author: E.Chernyaev Revised: *
* *
* Function: Returns volume of the polyhedron. *
* *
***********************************************************************/
{
double v = 0.;
for (int iFace=1; iFace<=nface; iFace++) {
int i0 = abs(pF[iFace].edge[0].v);
int i1 = abs(pF[iFace].edge[1].v);
int i2 = abs(pF[iFace].edge[2].v);
int i3 = abs(pF[iFace].edge[3].v);
HepPoint3D g;
if (i3 == 0) {
i3 = i0;
g = (pV[i0]+pV[i1]+pV[i2]) * (1./3.);
}else{
g = (pV[i0]+pV[i1]+pV[i2]+pV[i3]) * 0.25;
}
v += ((pV[i2] - pV[i0]).cross(pV[i3] - pV[i1])).dot(g);
}
return v/6.;
}
HepPolyhedronTrd2::HepPolyhedronTrd2(HepDouble Dx1, HepDouble Dx2,
HepDouble Dy1, HepDouble Dy2,
HepDouble Dz)