42 #if !defined(G4GEOM_USE_UGENERICPOLYCONE) 
   54 using namespace CLHEP;
 
   70   Create( phiStart, phiTotal, rz );
 
   94     std::ostringstream message;
 
   95     message << 
"Illegal input parameters - " << 
GetName() << 
G4endl 
   96             << 
"        All R values must be >= 0 !";
 
   97     G4Exception(
"G4GenericPolycone::Create()", 
"GeomSolids0002",
 
  107     std::ostringstream message;
 
  108     message << 
"Illegal input parameters - " << 
GetName() << 
G4endl 
  109             << 
"        R/Z cross section is zero or near zero: " << rzArea;
 
  110     G4Exception(
"G4GenericPolycone::Create()", 
"GeomSolids0002",
 
  117     std::ostringstream message;
 
  118     message << 
"Illegal input parameters - " << 
GetName() << 
G4endl 
  119             << 
"        Too few unique R/Z values !";
 
  120     G4Exception(
"G4GenericPolycone::Create()", 
"GeomSolids0002",
 
  126     std::ostringstream message;
 
  127     message << 
"Illegal input parameters - " << 
GetName() << 
G4endl 
  128             << 
"        R/Z segments cross !";
 
  129     G4Exception(
"G4GenericPolycone::Create()", 
"GeomSolids0002",
 
  139   if (phiTotal <= 0 || phiTotal > 
twopi-1E-10)
 
  156     endPhi = phiStart+phiTotal;
 
  175     next->
r = iterRZ.
GetA();
 
  176     next->
z = iterRZ.
GetB();
 
  177   } 
while( ++next, iterRZ.
Next() );
 
  209     if (corner->
z > next->
z)
 
  226   } 
while( prev=corner, corner=next, corner > 
corners );
 
  255   : 
G4VCSGfaceted(a), startPhi(0.),  endPhi(0.), phiIsOpen(false),
 
  256      numCorner(0), corners(0), enclosingCylinder(0)
 
  286   if (
this == &source) 
return *
this;
 
  342     std::ostringstream message;
 
  343     message << 
"Solid " << 
GetName() << 
" built using generic construct." 
  344             << 
G4endl << 
"Not applicable to the generic construct !";
 
  345     G4Exception(
"G4GenericPolycone::Reset()", 
"GeomSolids1001",
 
  418   return G4String(
"G4GenericPolycone");
 
  435   G4int oldprc = os.precision(16);
 
  436   os << 
"-----------------------------------------------------------\n" 
  437      << 
"    *** Dump for solid - " << 
GetName() << 
" ***\n" 
  438      << 
"    ===================================================\n" 
  439      << 
" Solid type: G4GenericPolycone\n" 
  442      << 
"    ending phi angle   : " << 
endPhi/
degree << 
" degrees \n";
 
  445   os << 
"    number of RZ points: " << 
numCorner << 
"\n" 
  446      << 
"              RZ values (corners): \n";
 
  452   os << 
"-----------------------------------------------------------\n";
 
  453   os.precision(oldprc);
 
  496     const G4int numSide =
 
  497           G4int(G4Polyhedron::GetNumberOfRotationSteps()
 
  503     typedef G4int int4[4];
 
  510       std::vector<G4bool> chopped(
numCorner, 
false);
 
  511       std::vector<G4int*> triQuads;
 
  514       while (remaining >= 3)    
 
  519         G4int iStepper = iStarter;
 
  522           if (A < 0)      { A = iStepper; }
 
  523           else if (
B < 0) { 
B = iStepper; }
 
  524           else if (
C < 0) { 
C = iStepper; }
 
  527             if (++iStepper >= 
numCorner) { iStepper = 0; }
 
  529           while (chopped[iStepper]);
 
  531         while (
C < 0 && iStepper != iStarter);
 
  546           triQuads.push_back(tq);
 
  554             if (++iStarter >= 
numCorner) { iStarter = 0; }
 
  556           while (chopped[iStarter]);
 
  562       nFaces = numSide * 
numCorner + 2 * triQuads.size();
 
  563       faces_vec = 
new int4[nFaces];
 
  567       for (
G4int iEnd = 0; iEnd < 2; ++iEnd)
 
  569         for (
size_t i = 0; i < triQuads.size(); ++i)
 
  582             a = triQuads[i][0] + addition;
 
  583             b = triQuads[i][2] + addition;
 
  584             c = triQuads[i][1] + addition;
 
  587           G4int bc = std::abs(c - b);
 
  588           G4int ca = std::abs(a - c);
 
  589           faces_vec[iface][0] = (ab == 1 || ab == d)? a: -a;
 
  590           faces_vec[iface][1] = (bc == 1 || bc == d)? b: -b;
 
  591           faces_vec[iface][2] = (ca == 1 || ca == d)? c: -c;
 
  592           faces_vec[iface][3] = 0;
 
  599       xyz = 
new double3[nNodes];
 
  603       for (
G4int iSide = 0; iSide < numSide; ++iSide)
 
  607           xyz[ixyz][0] = 
corners[iCorner].
r * std::cos(phi);
 
  608           xyz[ixyz][1] = 
corners[iCorner].
r * std::sin(phi);
 
  612             if (iCorner < numCorner - 1)
 
  614               faces_vec[iface][0] = ixyz + 1;
 
  615               faces_vec[iface][1] = -(ixyz + numCorner + 1);
 
  616               faces_vec[iface][2] = ixyz + numCorner + 2;
 
  617               faces_vec[iface][3] = ixyz + 2;
 
  621               faces_vec[iface][0] = ixyz + 1;
 
  622               faces_vec[iface][1] = -(ixyz + numCorner + 1);
 
  623               faces_vec[iface][2] = ixyz + 2;
 
  624               faces_vec[iface][3] = ixyz - numCorner + 2;
 
  627           else if (iSide == numSide - 1)   
 
  629             if (iCorner < numCorner - 1)
 
  631                 faces_vec[iface][0] = ixyz + 1;
 
  632                 faces_vec[iface][1] = ixyz + numCorner + 1;
 
  633                 faces_vec[iface][2] = ixyz + numCorner + 2;
 
  634                 faces_vec[iface][3] = -(ixyz + 2);
 
  638                 faces_vec[iface][0] = ixyz + 1;
 
  639                 faces_vec[iface][1] = ixyz + numCorner + 1;
 
  640                 faces_vec[iface][2] = ixyz + 2;
 
  641                 faces_vec[iface][3] = -(ixyz - numCorner + 2);
 
  646             if (iCorner < numCorner - 1)
 
  648                 faces_vec[iface][0] = ixyz + 1;
 
  649                 faces_vec[iface][1] = -(ixyz + numCorner + 1);
 
  650                 faces_vec[iface][2] = ixyz + numCorner + 2;
 
  651                 faces_vec[iface][3] = -(ixyz + 2);
 
  655                 faces_vec[iface][0] = ixyz + 1;
 
  656                 faces_vec[iface][1] = -(ixyz + numCorner + 1);
 
  657                 faces_vec[iface][2] = ixyz + 2;
 
  658                 faces_vec[iface][3] = -(ixyz - numCorner + 2);
 
  671         xyz[ixyz][0] = 
corners[iCorner].
r * std::cos(phi);
 
  672         xyz[ixyz][1] = 
corners[iCorner].
r * std::sin(phi);
 
  681       xyz = 
new double3[nNodes];
 
  682       faces_vec = 
new int4[nFaces];
 
  685       G4int ixyz = 0, iface = 0;
 
  686       for (
G4int iSide = 0; iSide < numSide; ++iSide)
 
  690           xyz[ixyz][0] = 
corners[iCorner].
r * std::cos(phi);
 
  691           xyz[ixyz][1] = 
corners[iCorner].
r * std::sin(phi);
 
  694           if (iSide < numSide - 1)
 
  696             if (iCorner < numCorner - 1)
 
  698               faces_vec[iface][0] = ixyz + 1;
 
  699               faces_vec[iface][1] = -(ixyz + numCorner + 1);
 
  700               faces_vec[iface][2] = ixyz + numCorner + 2;
 
  701               faces_vec[iface][3] = -(ixyz + 2);
 
  705               faces_vec[iface][0] = ixyz + 1;
 
  706               faces_vec[iface][1] = -(ixyz + numCorner + 1);
 
  707               faces_vec[iface][2] = ixyz + 2;
 
  708               faces_vec[iface][3] = -(ixyz - numCorner + 2);
 
  713             if (iCorner < numCorner - 1)
 
  715               faces_vec[iface][0] = ixyz + 1;
 
  716               faces_vec[iface][1] = -(ixyz + numCorner - nFaces + 1);
 
  717               faces_vec[iface][2] = ixyz + numCorner - nFaces + 2;
 
  718               faces_vec[iface][3] = -(ixyz + 2);
 
  722               faces_vec[iface][0] = ixyz + 1;
 
  723               faces_vec[iface][1] = -(ixyz - nFaces + numCorner + 1);
 
  724               faces_vec[iface][2] = ixyz - nFaces + 2;
 
  725               faces_vec[iface][3] = -(ixyz - numCorner + 2);
 
  735     G4int problem = polyhedron->createPolyhedron(nNodes, nFaces, xyz, faces_vec);
 
  740       std::ostringstream message;
 
  741       message << 
"Problem creating G4Polyhedron for: " << 
GetName();
 
  742       G4Exception(
"G4GenericPolycone::CreatePolyhedron()", 
"GeomSolids1002",
 
G4bool CrossesItself(G4double tolerance)
 
G4VCSGfaceted & operator=(const G4VCSGfaceted &source)
 
G4bool fRebuildPolyhedron
 
G4Polyhedron * fpPolyhedron
 
static const G4double kInfinity
 
G4PolyconeSideRZ * corners
 
CLHEP::Hep3Vector G4ThreeVector
 
virtual G4double DistanceToIn(const G4ThreeVector &p, const G4ThreeVector &v) const 
 
G4bool MustBeOutside(const G4ThreeVector &p) const 
 
double B(double temperature)
 
G4GenericPolycone(const G4String &name, G4double phiStart, G4double phiTotal, G4int numRZ, const G4double r[], const G4double z[])
 
G4GeometryType GetEntityType() const 
 
G4Polyhedron * CreatePolyhedron() const 
 
G4bool RemoveDuplicateVertices(G4double tolerance)
 
G4ThreeVector GetPointOnSurface() const 
 
G4EnclosingCylinder * enclosingCylinder
 
void Create(G4double phiStart, G4double phiTotal, G4ReduciblePolygon *rz)
 
G4bool RemoveRedundantVertices(G4double tolerance)
 
G4ThreeVector GetPointOnSurfaceGeneric() const 
 
double A(double temperature)
 
G4int NumVertices() const 
 
void CopyStuff(const G4GenericPolycone &source)
 
std::ostream & StreamInfo(std::ostream &os) const 
 
G4double DistanceToIn(const G4ThreeVector &p, const G4ThreeVector &v) const 
 
static const double twopi
 
virtual ~G4GenericPolycone()
 
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
 
G4GenericPolycone & operator=(const G4GenericPolycone &source)
 
EInside Inside(const G4ThreeVector &p) const 
 
static const double degree
 
G4bool BisectedBy(G4double a1, G4double b1, G4double a2, G4double b2, G4double tolerance)
 
virtual EInside Inside(const G4ThreeVector &p) const 
 
G4bool ShouldMiss(const G4ThreeVector &p, const G4ThreeVector &v) const