Ignore:
Timestamp:
Jun 18, 2010, 11:42:07 AM (14 years ago)
Author:
garnier
Message:

update geant4-09-04-beta-cand-01 interfaces-V09-03-09 vis-V09-03-08

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/geometry/solids/Boolean/src/G4BooleanSolid.cc

    r1228 r1315  
    2525//
    2626//
    27 // $Id: G4BooleanSolid.cc,v 1.21 2006/10/19 15:34:49 gcosmo Exp $
    28 // GEANT4 tag $Name: geant4-09-03 $
     27// $Id: G4BooleanSolid.cc,v 1.23 2010/05/11 15:03:45 gcosmo Exp $
     28// GEANT4 tag $Name: geant4-09-04-beta-cand-01 $
    2929//
    3030// Implementation for the abstract base class for solids created by boolean
     
    4040#include "G4VSolid.hh"
    4141#include "G4Polyhedron.hh"
     42#include "HepPolyhedronProcessor.h"
    4243#include "Randomize.hh"
    4344
     
    231232  return fpPolyhedron;
    232233}
     234
     235//////////////////////////////////////////////////////////////////////////
     236//
     237// Stacks polyhedra for processing. Returns top polyhedron.
     238
     239G4Polyhedron*
     240G4BooleanSolid::StackPolyhedron(HepPolyhedronProcessor& processor,
     241                                const G4VSolid* solid) const
     242{
     243  HepPolyhedronProcessor::Operation operation;
     244  const G4String& type = solid->GetEntityType();
     245  if (type == "G4UnionSolid")
     246    { operation = HepPolyhedronProcessor::UNION; }
     247  else if (type == "G4IntersectionSolid")
     248    { operation = HepPolyhedronProcessor::INTERSECTION; }
     249  else if (type == "G4SubtractionSolid")
     250    { operation = HepPolyhedronProcessor::SUBTRACTION; }
     251  else
     252  {
     253    std::ostringstream oss;
     254    oss << "Solid - " << solid->GetName()
     255        << " - Unrecognised composite solid"
     256        << "\n  Returning NULL !";
     257    G4Exception("StackPolyhedron()", "InvalidSetup",
     258                JustWarning, oss.str().c_str());
     259    return 0;
     260  }
     261
     262  G4Polyhedron* top = 0;
     263  const G4VSolid* solidA = solid->GetConstituentSolid(0);
     264  const G4VSolid* solidB = solid->GetConstituentSolid(1);
     265
     266  if (solidA->GetConstituentSolid(0))
     267  {
     268    top = StackPolyhedron(processor, solidA);
     269  }
     270  else
     271  {
     272    top = solidA->GetPolyhedron();
     273  }
     274  G4Polyhedron* operand = solidB->GetPolyhedron();
     275  processor.push_back (operation, *operand);
     276
     277  return top;
     278}
Note: See TracChangeset for help on using the changeset viewer.