Changeset 1140


Ignore:
Timestamp:
Nov 3, 2009, 11:17:28 AM (15 years ago)
Author:
garnier
Message:

update to CVS

Location:
trunk/source
Files:
54 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/digits_hits/utils/include/G4VScoringMesh.hh

    r998 r1140  
    2525//
    2626//
    27 // $Id: G4VScoringMesh.hh,v 1.27 2007/11/06 17:17:14 asaim Exp $
    28 // GEANT4 tag $Name: geant4-09-02-ref-02 $
     27// $Id: G4VScoringMesh.hh,v 1.29 2009/10/12 04:11:25 akimura Exp $
     28// GEANT4 tag $Name: $
    2929//
    3030
     
    9494  // set size of this mesh
    9595  void SetSize(G4double size[3]);
     96  // get size of this mesh
     97  G4ThreeVector GetSize() const;
    9698  // set position of center of this mesh
    9799  void SetCenterPosition(G4double centerPosition[3]);
     100  // get position of center of this mesh
     101  G4ThreeVector GetTranslation() const {return fCenterPosition;}
    98102  // set a rotation angle around the x axis
    99103  void RotateX(G4double delta);
     
    102106  // set a rotation angle around the z axis
    103107  void RotateZ(G4double delta);
     108  // get a rotation matrix
     109  G4RotationMatrix GetRotationMatrix() const {
     110    if(fRotationMatrix) return *fRotationMatrix;
     111    else return G4RotationMatrix::IDENTITY;
     112  }
    104113  // set number of segments of this mesh
    105114  void SetNumberOfSegments(G4int nSegment[3]);
  • trunk/source/digits_hits/utils/src/G4ScoreLogColorMap.cc

    r998 r1140  
    2525//
    2626//
    27 // $Id: G4ScoreLogColorMap.cc,v 1.2 2008/03/25 04:06:08 akimura Exp $
    28 // GEANT4 tag $Name: geant4-09-02-ref-02 $
     27// $Id: G4ScoreLogColorMap.cc,v 1.3 2009/05/04 15:57:33 akimura Exp $
     28// GEANT4 tag $Name: $
    2929//
    3030
    3131#include "G4ScoreLogColorMap.hh"
    3232#include <cmath>
     33#include <string>
     34#include <sstream>
     35#include <iomanip>
    3336
    3437
     
    152155    }
    153156    // text
    154     char cstring[80];
    155     std::sprintf(cstring, "%8.1e", std::pow(10., v));
    156     G4String value(cstring);
     157    //char cstring[80];
     158    //std::sprintf(cstring, "%8.1e", std::pow(10., v));
     159    //G4String value(cstring);
     160    std::ostringstream oss;
     161    oss << std::setw(8) << std::setprecision(1) << std::scientific << std::pow(10., v);
     162    std::string str = oss.str();
     163    G4String value(str.c_str());
    157164    G4Text text(value, G4Point3D(-0.9, -0.9+0.05*n, 0));
    158165    G4double size = 12.;
  • trunk/source/digits_hits/utils/src/G4VScoreColorMap.cc

    r998 r1140  
    2525//
    2626//
    27 // $Id: G4VScoreColorMap.cc,v 1.3 2008/02/14 10:45:12 akimura Exp $
    28 // GEANT4 tag $Name: geant4-09-02-ref-02 $
     27// $Id: G4VScoreColorMap.cc,v 1.4 2009/05/04 15:57:33 akimura Exp $
     28// GEANT4 tag $Name: $
    2929//
    3030
    3131#include "G4VScoreColorMap.hh"
     32#include <string>
     33#include <sstream>
     34#include <iomanip>
    3235
    3336#include "G4VVisManager.hh"
     
    9497    }
    9598    // text
    96     char cstring[80];
    97     std::sprintf(cstring, "%8.2e", v);
    98     G4String value(cstring);
     99    //char cstring[80];
     100    //std::sprintf(cstring, "%8.2e", v);
     101    //G4String value(cstring);
     102    std::ostringstream oss;
     103    oss << std::setw(8) << std::setprecision(1) << std::scientific << v;
     104    std::string str = oss.str();
     105    G4String value(str.c_str());
     106
    99107    G4Text text(value, G4Point3D(-0.9, -0.9+0.05*n, 0));
    100108    G4double size = 12.;
  • trunk/source/digits_hits/utils/src/G4VScoringMesh.cc

    r998 r1140  
    2525//
    2626//
    27 // $Id: G4VScoringMesh.cc,v 1.35 2008/03/23 14:32:13 akimura Exp $
    28 // GEANT4 tag $Name: geant4-09-02-ref-02 $
     27// $Id: G4VScoringMesh.cc,v 1.37 2009/10/12 04:11:25 akimura Exp $
     28// GEANT4 tag $Name: $
    2929//
    3030
     
    6363  for(int i = 0; i < 3; i++) fSize[i] = size[i];
    6464  sizeIsSet = true;
     65}
     66G4ThreeVector G4VScoringMesh::GetSize() const {
     67  if(sizeIsSet)
     68    return G4ThreeVector(fSize[0], fSize[1], fSize[2]);
     69  else
     70    return G4ThreeVector(0., 0., 0.);
    6571}
    6672void G4VScoringMesh::SetCenterPosition(G4double centerPosition[3]) {
  • trunk/source/graphics_reps/History

    r932 r1140  
    1 cvs log $Id: History,v 1.135 2009/02/25 14:13:43 allison Exp $
     1cvs log $Id: History,v 1.138 2009/10/28 13:40:40 allison Exp $
    22-------------------------------------------------------------------
    33
     
    1717     * Reverse chronological order (last date on top), please *
    1818     ----------------------------------------------------------
     19
     2028th October 2009  John Allison  (greps-V09-02-03 coworks vis-V09-02-10)
     21- HepPolyhedron:
     22  o Removed static instance of BooleanProcessor.
     23  o Removed IsErrorBooleanProcess.  (Use HepPolyhedronProcessor instead -
     24    see, e.g., G4PhysicalVolumeModel.)
     25- HepPolyhedronProcessor.src: Replaced printf with G4cout.
     26
     2720th October 2009  Guy Barrand  (greps-V09-02-02 coworks vis-V09-02-09)
     28- HepPolyhedronProcessor : class to handle "overall shifting" in case
     29  of doing multiple boolean operations. This permited to solve most
     30  tricky cases in LHCb visualization.
     31- HepPolyhedron : handle the ierr variable on the BooleanProcessor.execute.
     32- BooleanProcessor.src : modifs coming from LHCb to "loop on shifts"
     33  to attempt solving the "coplanar faces cases".
     34- BooleanProcessor.src : modifs coming from LHCb to optmize the code.
     35
     3620th October 2009  John Allison  (greps-V09-02-02 coworks vis-V09-02-07)
     37- G4VGraphicsScene: Added AddCompound (const G4THitsMap<G4double>&).
    1938
    203925th February 2009  John Allison  (greps-V09-02-01)
  • trunk/source/graphics_reps/include/G4VGraphicsScene.hh

    r1058 r1140  
    2525//
    2626//
    27 // $Id: G4VGraphicsScene.hh,v 1.11 2008/01/04 22:20:59 allison Exp $
    28 // GEANT4 tag $Name: geant4-09-02-ref-02 $
     27// $Id: G4VGraphicsScene.hh,v 1.12 2009/10/21 15:36:22 allison Exp $
     28// GEANT4 tag $Name: $
    2929// John Allison  19th July 1996
    3030//
     
    3737#ifndef G4VGRAPHICSSCENE_HH
    3838#define G4VGRAPHICSSCENE_HH
     39
     40#include "globals.hh"
     41#include "G4Transform3D.hh"
    3942
    4043class G4VisAttributes;
     
    5457class G4VTrajectory;
    5558class G4VHit;
     59template <typename T> class G4THitsMap;
    5660class G4Polyline;
    5761class G4Scale;
     
    6266class G4Polyhedron;
    6367class G4NURBS;
    64 
    65 #include "G4Transform3D.hh"
    6668
    6769class G4VGraphicsScene {
     
    112114  // above.
    113115
    114   virtual void AddCompound (const G4VTrajectory&) = 0;
    115   virtual void AddCompound (const G4VHit&)        = 0;
     116  virtual void AddCompound (const G4VTrajectory&)        = 0;
     117  virtual void AddCompound (const G4VHit&)               = 0;
     118  virtual void AddCompound (const G4THitsMap<G4double>&) = 0;
    116119
    117120  ///////////////////////////////////////////////////////////////////
  • trunk/source/graphics_reps/include/HepPolyhedron.h

    r1058 r1140  
    2525//
    2626//
    27 // $Id: HepPolyhedron.h,v 1.24 2008/04/14 08:50:23 gcosmo Exp $
    28 // GEANT4 tag $Name: geant4-09-02-ref-02 $
     27// $Id: HepPolyhedron.h,v 1.25 2009/10/28 13:38:54 allison Exp $
     28// GEANT4 tag $Name: $
    2929//
    3030//
     
    107107//   ResetNumberOfRotationSteps() - reset number of steps for whole circle
    108108//                            to default value;
    109 //   IsErrorBooleanProcess()- true if there has been an error during the
    110 //                            processing of a Boolean operation.
    111109// History:
    112110//
     
    165163// - added HepPolyhedronEllipsoid
    166164//
     165// 21.10.09 J.Allison
     166// - removed IsErrorBooleanProcess (now error is returned through argument)
     167//
    167168
    168169#ifndef HEP_POLYHEDRON_HH
     
    313314  HepPolyhedron subtract(const HepPolyhedron &p) const;
    314315  HepPolyhedron intersect(const HepPolyhedron &p) const;
    315   // If there has been an error during the above processing..
    316   bool IsErrorBooleanProcess() const;
    317316
    318317  // Get area of the surface of the polyhedron
  • trunk/source/graphics_reps/src/BooleanProcessor.src

    r830 r1140  
    99 ***********************************************************************/
    1010
     11//G.Barrand : begin
     12#define BP_GEANT4
     13
     14#ifdef BP_GEANT4 //G.Barrand
     15
    1116#include <CLHEP/Geometry/Plane3D.h>
    12 
    13 using namespace HepGeom;
     17#include <CLHEP/Geometry/Plane3D.h>
     18typedef HepGeom::Plane3D<double> HVPlane3D;
     19typedef HepGeom::Point3D<double> HVPoint3D;
     20typedef HepGeom::Normal3D<double> HVNormal3D;
     21
     22#else //BP_HEPVIS
     23
     24#define ExtNode          HEPVis_ExtNode
     25#define ExtEdge          HEPVis_ExtEdge
     26#define ExtFace          HEPVis_ExtFace
     27#define FaceList         HEPVis_FaceList
     28#define ExtPolyhedron    HEPVis_ExtPolyhedron
     29#define BooleanProcessor HEPVis_BooleanProcessor
     30
     31#define HepPolyhedron SbPolyhedron
     32#define G4Facet SbFacet
     33
     34#include <HEPVis/SbPlane.h>
     35typedef HEPVis::SbPlane HVPlane3D;
     36
     37#endif
     38
     39//using namespace HepGeom;
     40
     41//#define BP_DEBUG
     42
     43//G.Barrand : end
    1444
    1545#define INITIAL_SIZE 200
    16 #define CRAZY_POINT  Point3D<double>(-10.e+6, -10.e+6, -10.e+6)
    17 #define GRANULARITY  10.e+5;
     46#define CRAZY_POINT  HVPoint3D(-10.e+6, -10.e+6, -10.e+6)
     47//#define GRANULARITY  10.e+5;
     48#define GRANULARITY  10.e+5  //G.Barrand : rm the trailing ;
    1849
    1950#define SWAP(A,B) w = A; A = B; B = w
     
    3667
    3768// -------------------------------------------- Simplified STL vector ---
     69//G.Barrand : begin
     70#include <vector>
     71using namespace std;
     72/*
    3873template<class T>
    3974class vector {
     
    68103  }
    69104};
     105*/
     106//G.Barrand : end
    70107
    71108// ---------------------------------------------------- Extended node ---
    72109class ExtNode {
    73110 public:
    74   Point3D<double> v;
     111  HVPoint3D v;
    75112  int        s;
    76113
    77114 public:
    78   ExtNode(Point3D<double> vertex=Point3D<double>(), int status=0)
     115  ExtNode(HVPoint3D vertex=HVPoint3D(), int status=0)
    79116    : v(vertex), s(status) {}
    80117  ~ExtNode() {}
     
    126163// ---------------------------------------------------- Extended face ---
    127164class ExtFace {
     165 private:
     166  std::vector<ExtEdge>& edges; //G.Barrand
    128167 public:
    129168  int        iedges[4];        // indices of original edges
    130   Plane3D<double> plane;            // face plane
     169  HVPlane3D plane;            // face plane
    131170  double     rmin[3], rmax[3]; // bounding box
    132171  int        iold;             // head of the list of the original edges
     
    136175
    137176 public:
    138   ExtFace(int iedge=0) : iold(iedge), inew(0), iprev(iprev), inext(0) {}
     177  //G.Barrand : ExtFace(int iedge=0) : iold(iedge), inew(0), iprev(iprev), inext(0) {}
     178  ExtFace(std::vector<ExtEdge>& a_edges,int iedge)
     179  : edges(a_edges), iold(iedge), inew(0), iprev(0), inext(0) {
     180    //G.Barrand : initialize arrays to quiet valgrind.
     181   {for (int i=0; i<4; i++) { iedges[i] = 0; }}
     182   {for (int i=0; i<3; i++) { rmin[i] = 0; rmax[i] = 0; }}
     183  }
    139184  ~ExtFace() {}
    140185
    141186  ExtFace(const ExtFace & face) :
     187    edges(face.edges), //G.Barrand
    142188    plane(face.plane), iold(face.iold), inew(face.inew),
    143189    iprev(face.iprev), inext(face.inext)
     
    149195
    150196  ExtFace & operator=(const ExtFace & face) {
     197    //FIXME : edges(face.edges) ???? //G.Barrand
    151198    int i;
    152199    for (i=0; i<4; i++) { iedges[i] = face.iedges[i]; }
     
    164211
    165212// ---------------------------------------------------- Global arrays ---
    166 static vector<ExtNode> nodes;        // vector of nodes
    167 static vector<ExtEdge> edges;        // vector of edges
    168 static vector<ExtFace> faces;        // vector of faces
     213//G.Barrand : MacIntel : crash with g++-4.0.1 with -O on some subtract.
     214//            Anyway static of objects is proved to be not safe.
     215//            We put the below vector as members of BooleanProcessor.
     216//GB static std::vector<ExtNode> nodes;        // vector of nodes
     217//GB static std::vector<ExtEdge> edges;        // vector of edges
     218//GB static std::vector<ExtFace> faces;        // vector of faces
    169219
    170220// ---------------------------------------------------- List of faces ---
    171221class FaceList {
    172222 private:
     223  std::vector<ExtFace>& faces; //G.Barrad : end
     224 private:
    173225  int ihead;
    174226  int ilast;
    175227
    176228 public:
    177   FaceList() : ihead(0), ilast(0) {}
     229  //G.Barrand : FaceList() : ihead(0), ilast(0) {}
     230  FaceList(std::vector<ExtFace>& a_faces) : faces(a_faces),ihead(0),ilast(0) {}
    178231  ~FaceList() {}
    179232
     
    183236  void push_back(int i) {
    184237    if (ilast == 0) { ihead = i; } else { faces[ilast].inext = i; }
    185     faces[i].iprev = ilast;
    186     faces[i].inext = 0;
     238    ExtFace& face = faces[i]; //G.Barrand : optimize.
     239    face.iprev = ilast;
     240    face.inext = 0;
    187241    ilast = i;
    188242  }
    189243
    190244  void remove(int i) {
     245    ExtFace& face = faces[i]; //G.Barrand : optimize.
    191246    if (ihead == i) {
    192       ihead = faces[i].inext;
     247      ihead = face.inext;
    193248    }else{
    194       faces[faces[i].iprev].inext = faces[i].inext;
     249      faces[face.iprev].inext = face.inext;
    195250    }
    196251    if (ilast == i) {
    197       ilast = faces[i].iprev;
     252      ilast = face.iprev;
    198253    }else{
    199       faces[faces[i].inext].iprev = faces[i].iprev;
    200     }
    201     faces[i].iprev = 0;
    202     faces[i].inext = 0;
     254      faces[face.inext].iprev = face.iprev;
     255    }
     256    face.iprev = 0;
     257    face.inext = 0;
    203258  }
    204259};
     
    215270// ----------------------------------------- Boolean processor class ---
    216271class BooleanProcessor {
     272 private:
     273  static int ishift; //G.Barrand
     274  std::vector<ExtNode> nodes;        // vector of nodes //G.Barrand
     275  std::vector<ExtEdge> edges;        // vector of edges //G.Barrand
     276  std::vector<ExtFace> faces;        // vector of faces //G.Barrand
    217277 private:
    218278  int             processor_error;   // is set in case of error
     
    264324
    265325 public:
    266   BooleanProcessor() {}
     326  //G.Barrand : BooleanProcessor() {}
     327  BooleanProcessor() //G.Barrand
     328  :result_faces(faces)
     329  ,suitable_faces(faces)
     330  ,unsuitable_faces(faces)
     331  ,unknown_faces(faces)
     332  {
     333  }
     334
    267335  ~BooleanProcessor() {}
    268336
    269337  HepPolyhedron execute(int op,
    270338                        const HepPolyhedron &a,
    271                         const HepPolyhedron &b);
     339                        const HepPolyhedron &b,
     340                        int& err);
    272341
    273342  void draw();
     
    278347  void print_edge(int);
    279348  int get_processor_error() const {return processor_error;}
     349
     350  void dump(); //G.Barrand
     351  static int get_shift(); //G.Barrand
     352  static void set_shift(int); //G.Barrand
     353  static int get_num_shift(); //G.Barrand
    280354};
    281355
     
    294368  iEprev = 0; iEcur = iold;
    295369  while (iEcur > 0) {
    296     edges[iEcur].invert();
    297     iEnext = edges[iEcur].inext;
    298     edges[iEcur].inext = iEprev;
     370    ExtEdge& edge = edges[iEcur]; //G.Barrand : optimize.
     371    edge.invert();
     372    iEnext = edge.inext;
     373    edge.inext = iEprev;
    299374    iEprev = iEcur;
    300375    iEcur  = iEnext;
     
    304379  iEprev = 0; iEcur = inew;
    305380  while (iEcur > 0) {
    306     edges[iEcur].invert();
    307     iEnext = edges[iEcur].inext;
    308     edges[iEcur].inext = iEprev;
     381    ExtEdge& edge = edges[iEcur]; //G.Barrand : optimize.
     382    edge.invert();
     383    iEnext = edge.inext;
     384    edge.inext = iEprev;
    309385    iEprev = iEcur;
    310386    iEcur  = iEnext;
     
    312388  if (inew > 0) inew = iEprev;
    313389
    314   plane = Plane3D<double>(-plane.a(), -plane.b(), -plane.c(), -plane.d());
     390#ifdef BP_GEANT4 //G.Barrand
     391  plane = HVPlane3D(-plane.a(), -plane.b(), -plane.c(), -plane.d());
     392#else
     393  plane = HVPlane3D(-plane.getNormal(), -plane.getDistanceFromOrigin());
     394#endif
    315395}
    316396
     
    336416  //  }
    337417
    338   Point3D<double> ppp;       
     418  HVPoint3D ppp;       
    339419  for (i=1; i <= p.GetNoVertices(); i++) { 
     420#ifdef BP_GEANT4 //G.Barrand
    340421    ppp = p.GetVertex(i);
    341422    ppp.setX(ppp.x()+dx);
    342423    ppp.setY(ppp.y()+dy);
    343424    ppp.setZ(ppp.z()+dz);
     425#else
     426    ppp = p.GetVertexFast(i);
     427    ppp += HVPoint3D(dx,dy,dz);
     428#endif
    344429    nodes.push_back(ExtNode(ppp));
    345430  }
     
    348433
    349434  for (int iface=1; iface <= p.GetNoFacets(); iface++) {
    350     faces.push_back(ExtFace(edges.size()));
     435    faces.push_back(ExtFace(edges,edges.size()));
    351436
    352437    //   S E T   F A C E   N O D E S
     
    354439    p.GetFacet(iface, nnode, iNodes, iVis, iFaces);
    355440    for (i=0; i<nnode; i++) {
    356       if (iNodes[i] < 1 || iNodes[i] > p.GetNoVertices()) processor_error = 1;
    357       if (iFaces[i] < 1 || iFaces[i] > p.GetNoFacets())   processor_error = 1;
     441      //if (iNodes[i] < 1 || iNodes[i] > p.GetNoVertices()) processor_error = 1;
     442      //if (iFaces[i] < 1 || iFaces[i] > p.GetNoFacets())   processor_error = 1;
     443
     444      if (iNodes[i] < 1 || iNodes[i] > p.GetNoVertices()) { //G.Barrand
     445        processor_error = 1;
     446#ifdef BP_DEBUG
     447        std::cerr
     448          << "BooleanProcessor::takePolyhedron : problem 1."
     449          << std::endl;
     450#endif
     451      }
     452      if (iFaces[i] < 1 || iFaces[i] > p.GetNoFacets()) { //G.Barrand
     453        processor_error = 1;
     454#ifdef BP_DEBUG
     455        std::cerr
     456          << "BooleanProcessor::takePolyhedron : problem 2."
     457          << std::endl;
     458#endif
     459      }
    358460      iNodes[i] += dnode;
    359461      iFaces[i] += dface;
     
    374476    //   S E T   F A C E   M I N - M A X
    375477
     478    ExtFace& face = faces.back();     //G.Barrand : optimize.
    376479    for (i=0; i<3; i++) {
    377       faces.back().rmin[i] = nodes[iNodes[0]].v[i];
    378       faces.back().rmax[i] = nodes[iNodes[0]].v[i];
     480      face.rmin[i] = nodes[iNodes[0]].v[i];
     481      face.rmax[i] = nodes[iNodes[0]].v[i];
    379482    }
    380483    for (i=1; i<nnode; i++) {
     484      ExtNode& node = nodes[iNodes[i]]; //G.Barrand : optimize.
    381485      for (k=0; k<3; k++) {
    382         if (faces.back().rmin[k] > nodes[iNodes[i]].v[k])
    383             faces.back().rmin[k] = nodes[iNodes[i]].v[k];
    384         if (faces.back().rmax[k] < nodes[iNodes[i]].v[k])
    385             faces.back().rmax[k] = nodes[iNodes[i]].v[k];
     486        if (face.rmin[k] > node.v[k])
     487            face.rmin[k] = node.v[k];
     488        if (face.rmax[k] < node.v[k])
     489            face.rmax[k] = node.v[k];
    386490      }
    387491    }
     
    389493    //   S E T   F A C E   P L A N E
    390494
    391     Normal3D<double> n = (nodes[iNodes[2]].v-nodes[iNodes[0]].v).cross
     495    HVNormal3D n = (nodes[iNodes[2]].v-nodes[iNodes[0]].v).cross
    392496                    (nodes[iNodes[3]].v-nodes[iNodes[1]].v);
    393     Point3D<double>  p(0,0,0);
     497    HVPoint3D  p(0,0,0);
    394498   
    395499    for (i=0; i<nnode; i++) { p += nodes[iNodes[i]].v; }
    396500    p *= (1./nnode);
    397     faces.back().plane = Plane3D<double>(n.unit(), p);
     501    //G.Barrand : faces.back().plane = HVPlane3D(n.unit(), p);
     502    faces.back().plane = HVPlane3D(n, p); //G.Barrand
    398503
    399504    //   S E T   R E F E R E N C E   T O   T H E   N E X T   F A C E
     
    431536  iface = faces[ifaces1].inext;
    432537  while(iface > 0) {
     538    ExtFace& face = faces[iface]; //G.Barrand
    433539    for (i=0; i<3; i++) {
    434       if (rmin1[i] > faces[iface].rmin[i]) rmin1[i] = faces[iface].rmin[i];
    435       if (rmax1[i] < faces[iface].rmax[i]) rmax1[i] = faces[iface].rmax[i];
    436     }
    437     iface = faces[iface].inext;
     540      if (rmin1[i] > face.rmin[i]) rmin1[i] = face.rmin[i];
     541      if (rmax1[i] < face.rmax[i]) rmax1[i] = face.rmax[i];
     542    }
     543    iface = face.inext;
    438544  }
    439545
    440546  iface = faces[ifaces2].inext;
    441547  while(iface > 0) {
     548    ExtFace& face = faces[iface]; //G.Barrand
    442549    for (i=0; i<3; i++) {
    443       if (rmin2[i] > faces[iface].rmin[i]) rmin2[i] = faces[iface].rmin[i];
    444       if (rmax2[i] < faces[iface].rmax[i]) rmax2[i] = faces[iface].rmax[i];
    445     }
    446     iface = faces[iface].inext;
     550      if (rmin2[i] > face.rmin[i]) rmin2[i] = face.rmin[i];
     551      if (rmax2[i] < face.rmax[i]) rmax2[i] = face.rmax[i];
     552    }
     553    iface = face.inext;
    447554  }
    448555
     
    476583{
    477584  int i, outflag, iface = ifaces, *prev;
    478   Point3D<double> mmbox[8] = { Point3D<double>(rmin[0],rmin[1],rmin[2]),
    479                                Point3D<double>(rmax[0],rmin[1],rmin[2]),
    480                                Point3D<double>(rmin[0],rmax[1],rmin[2]),
    481                                Point3D<double>(rmax[0],rmax[1],rmin[2]),
    482                                Point3D<double>(rmin[0],rmin[1],rmax[2]),
    483                                Point3D<double>(rmax[0],rmin[1],rmax[2]),
    484                                Point3D<double>(rmin[0],rmax[1],rmax[2]),
    485                                Point3D<double>(rmax[0],rmax[1],rmax[2]) };
     585  HVPoint3D mmbox[8] = { HVPoint3D(rmin[0],rmin[1],rmin[2]),
     586                               HVPoint3D(rmax[0],rmin[1],rmin[2]),
     587                               HVPoint3D(rmin[0],rmax[1],rmin[2]),
     588                               HVPoint3D(rmax[0],rmax[1],rmin[2]),
     589                               HVPoint3D(rmin[0],rmin[1],rmax[2]),
     590                               HVPoint3D(rmax[0],rmin[1],rmax[2]),
     591                               HVPoint3D(rmin[0],rmax[1],rmax[2]),
     592                               HVPoint3D(rmax[0],rmax[1],rmax[2]) };
    486593  prev = &ifaces;
    487594  while (iface > 0) {
     
    490597
    491598    outflag = 0;
     599    ExtFace& face = faces[iface]; //G.Barrand : optimize.
    492600    for (i=0; i<3; i++) {
    493       if (faces[iface].rmin[i] > rmax[i] + del) { outflag = 1; break; }
    494       if (faces[iface].rmax[i] < rmin[i] - del) { outflag = 1; break; }
     601      if (face.rmin[i] > rmax[i] + del) { outflag = 1; break; }
     602      if (face.rmax[i] < rmin[i] - del) { outflag = 1; break; }
    495603    }
    496604
     
    501609      double d;
    502610      for (i=0; i<8; i++) {
    503         d = faces[iface].plane.distance(mmbox[i]);
     611        d = face.plane.distance(mmbox[i]); //G.Barrand : optimize
    504612        if (d > +del) npos++;
    505613        if (d < -del) nneg++;
     
    511619
    512620    if (outflag == 1) {
    513       *prev = faces[iface].inext;
    514       faces[iface].inext = iout;
     621      *prev = face.inext;
     622      face.inext = iout;
    515623      iout = iface;
    516624    }else{
    517       prev = &faces[iface].inext;
    518     }
     625      prev = &face.inext;
     626    }
     627
    519628    iface = *prev;
    520629  }
     
    532641{
    533642  int        iface = edge.iface1;
    534   Plane3D<double> plane = faces[edge.iface2].plane;
     643  HVPlane3D plane = faces[edge.iface2].plane;
    535644  int        i, nnode, npos = 0, nneg = 0, nzer = 0;
    536645  double     dd[5];
     
    599708        i1 = edges[iedge].i1;
    600709        i2 = edges[iedge].i2;
     710   
    601711        d1 = plane.distance(nodes[i1].v);
    602712        d2 = plane.distance(nodes[i2].v);
     
    610720        iedge = edges[iedge].inext;
    611721      }
    612       if (ii[i] == nodes.size()) {
     722      if (ii[i] == (int)nodes.size()) {
    613723        dd = d2-d1; d1 = d1/dd; d2 = d2/dd;
    614724        nodes.push_back(ExtNode(d2*nodes[i1].v-d1*nodes[i2].v, iedge));
     
    795905{
    796906  processor_error = 1;
     907#ifdef BP_DEBUG
    797908  std::cout
    798909    << "BooleanProcessor::caseIE : unimplemented case"
    799910    << std::endl;
     911#endif
    800912}
    801913
     
    811923{
    812924  processor_error = 1;
     925#ifdef BP_DEBUG
    813926  std::cout
    814927    << "BooleanProcessor::caseEE : unimplemented case"
    815928    << std::endl;
     929#endif
    816930}
    817931
     
    831945  //   M I N - M A X
    832946
     947 {const ExtFace& face_1 = faces[iface1]; //G.Barrand : optimize
     948  const ExtFace& face_2 = faces[iface2];
    833949  for (int i=0; i<3; i++) {
    834     if (faces[iface1].rmin[i] > faces[iface2].rmax[i] + del) return;
    835     if (faces[iface1].rmax[i] < faces[iface2].rmin[i] - del) return;
    836   }
     950    if (face_1.rmin[i] > face_2.rmax[i] + del) return;
     951    if (face_1.rmax[i] < face_2.rmin[i] - del) return;
     952  }}
    837953
    838954  //   F A C E - 1   vs   P L A N E - 2
     
    9291045*ilink = A; ilink = &edges[A].inext; *ilink = 0
    9301046
     1047  ExtFace& face = faces[iface]; //G.Barrand : optimize.
    9311048  ilink = &ihead;
    9321049  for(;;) {
    933     if (faces[iface].inew == 0) break;
     1050    if (face.inew == 0) break;
    9341051
    9351052    //   S T A R T   N E W   C O N T O U R
    9361053
    937     icur   = faces[iface].inew;
    938     faces[iface].inew = edges[icur].inext;
     1054    icur   = face.inew;
     1055    face.inew = edges[icur].inext;
    9391056    INSERT_EDGE_TO_THE_LIST(icur);
    9401057    ifirst = edges[icur].i1;
     
    9431060
    9441061    for (;;) {
    945       i = &faces[iface].inew;
     1062      i = &face.inew;
     1063      ExtEdge& edge_cur = edges[icur];
    9461064      while(*i > 0) {
    947         if (edges[*i].i1 == edges[icur].i2) break;
    948         i = &edges[*i].inext;
     1065        ExtEdge& edge_i = edges[*i];
     1066        if (edge_i.i1 == edge_cur.i2) break;
     1067        i = &edge_i.inext;
    9491068      }
    9501069      if (*i == 0) {
    951         i = &faces[iface].iold;
    952         while(*i > 0) {
    953           if (edges[*i].i1 == edges[icur].i2) ioldflag = 1;
    954           if (edges[*i].i1 == edges[icur].i2) break;
    955           i = &edges[*i].inext;
     1070        i = &face.iold;   
     1071        while(*i > 0) {       
     1072          ExtEdge& edge_i = edges[*i];
     1073          if (edge_i.i1 == edge_cur.i2) {
     1074            ioldflag = 1;
     1075            break;
     1076          }
     1077          i = &edge_i.inext;
    9561078        }
    9571079      }
     
    9631085      }else{
    9641086        processor_error = 1;
     1087#ifdef BP_DEBUG
    9651088        std::cerr
    9661089          << "BooleanProcessor::assembleFace(" << iface << ") : "
    9671090          << "could not find next edge of the contour"
    9681091          << std::endl;
    969         faces[iface].inew = DEFECTIVE_FACE;
     1092#endif
     1093        face.inew = DEFECTIVE_FACE;
    9701094        return;
    9711095      }
     
    9761100
    9771101  int iedge;
    978   iedge = faces[iface].iold;
     1102  iedge = face.iold;
    9791103  if (what == 0 && ioldflag == 0 && iedge > 0) {
    9801104    for (;;) {
     
    9861110        }
    9871111      }else{
    988         if (edges[iedge].i2 == edges[faces[iface].iold].i1) {
     1112        if (edges[iedge].i2 == edges[face.iold].i1) {
    9891113          edges[iedge].inext = ihead;   // set new face
    9901114          return;
     
    9991123
    10001124  int iface2;
    1001   iedge = faces[iface].iold;
     1125  iedge = face.iold;
    10021126  while(iedge > 0) {
    10031127    iface2 = edges[iedge].iface2;
     
    10051129    iedge = edges[iedge].inext;
    10061130  }
    1007   faces[iface].iold = ihead;            // set new face
     1131  face.iold = ihead;            // set new face
    10081132}
    10091133
     
    11861310    unsuitable_faces.remove(i);
    11871311  }
     1312
     1313  //G.Barrand : begin
     1314  /* From S.Ponce
     1315   At last, there is a problem in the assemblePolyhedra method. At least, I
     1316  think it is there. The problem deals with boolean operations on solids,
     1317  when one of the two contains entirely the other one. It has no sense for
     1318  intersection and union but still has sense for subtraction. In this
     1319  case, faces from the inner solid are stored in the unknown_faces
     1320  FaceList. And an error occurs in the execute method. This may be correct
     1321  for intersection and union but in the case of subtraction, one should do
     1322  that in assemblePolyhedra :
     1323  */
     1324  //   Unknown faces are actually suitable face !!!
     1325   iface = unknown_faces.front();
     1326   while(iface > 0) {
     1327     i = iface;
     1328     faces[i].inew = ORIGINAL_FACE;
     1329     iface = faces[i].inext;
     1330     unknown_faces.remove(i);
     1331     result_faces.push_back(i);
     1332   }
     1333  /*
     1334   Otherwise, the inner hole that the second solid was building in the
     1335  first one does not exist. I'm not very clear on what to do for unions
     1336  and intersections. I think this kind of situation should be detected and
     1337  one of the solid should simply be ignored.
     1338  */
     1339  //G.Barrand : end
    11881340}
    11891341
     
    12031355  a  = y1 - y2;
    12041356  b  = x2 - x1;
    1205   w  = std::abs(a)+std::abs(b);
     1357  //G.Barrand : w  = std::abs(a)+std::abs(b);
     1358  w  = ::fabs(a)+::fabs(b); //G.Barrand
    12061359  a /= w;
    12071360  b /= w;
     
    12681421  int icontour, iedge, k1, k2;
    12691422  double x3, y3, x4, y4, a2, b2, c2, d1, d2;
    1270   for(icontour=0; icontour<external_contours.size(); icontour++) {
     1423  for(icontour=0; icontour<(int)external_contours.size(); icontour++) {
    12711424    iedge = external_contours[icontour];
    12721425    while(iedge > 0) {
     
    12961449  //  L O O P   A L O N G   E X T E R N A L   C O N T O U R S
    12971450
    1298   for(icontour=0; icontour<internal_contours.size(); icontour++) {
     1451  for(icontour=0; icontour<(int)internal_contours.size(); icontour++) {
    12991452    iedge = internal_contours[icontour];
    13001453    while(iedge > 0) {
     
    14781631  //   L O O P   A L O N G   C O N T O U R 
    14791632
     1633  //std::cerr << "debug : contour : begin : =================" << std::endl;
     1634  //dump();//debug
     1635
    14801636  int iedge1, iedge2, iedge3, istart = 0;
    14811637  for (;;) {
    14821638    iedge1 = edges[ipnext].inext;
    14831639    iedge2 = edges[iedge1].inext;
     1640/*
     1641    std::cerr << "debug :"
     1642              << " ipnext " << ipnext
     1643              << " iedge1 " << iedge1
     1644              << " iedge2 " << iedge2
     1645              << " : istart " << istart
     1646              << std::endl;
     1647*/
    14841648    if (istart == 0) {
    14851649      istart = iedge1;
     
    14901654        edges[iedge3].iface1 = faces.size();
    14911655        edges[iedge3].inext = 0;
    1492         faces.push_back(ExtFace());
     1656        faces.push_back(ExtFace(edges,0)); //G.Barrand : ok ?
    14931657        faces.back().iold = iedge1;
    14941658        faces.back().inew = ORIGINAL_FACE;
     
    15001664    }else if (istart == iedge1) {
    15011665      processor_error = 1;
     1666#ifdef BP_DEBUG
    15021667      std::cerr
    15031668        << "BooleanProcessor::triangulateContour : "
    15041669        << "could not generate a triangle (infinite loop)"
    15051670        << std::endl;
     1671#endif
    15061672      break;
    15071673    }
     
    15291695    edges[iedge2].inext = edges.size();
    15301696    edges.push_back(ExtEdge(i3, i1, iface2, -(edges.size()-1), -1));
    1531     faces.push_back(ExtFace());
     1697    faces.push_back(ExtFace(edges,0)); //G.Barrand : ok ?
    15321698    faces.back().iold   = iedge1;
    15331699    faces.back().inew   = ORIGINAL_FACE;
     
    15621728  }
    15631729  processor_error = 1;
     1730#ifdef BP_DEBUG
    15641731  std::cerr
    15651732    << "BooleanProcessor::modifyReference : could not find the edge, "
    15661733    << "iface=" << iface << ", i1,i2=" << i1 << "," << i2 << ", iref=" << iref
    15671734    << std::endl;
     1735#endif
    15681736}
    15691737
     
    15821750  //   S E T  IX, IY, IZ
    15831751
    1584   Normal3D<double> normal = faces[iface].plane.normal();
     1752#ifdef BP_GEANT4 //G.Barrand
     1753  HVNormal3D normal = faces[iface].plane.normal();
     1754#else
     1755  const HVNormal3D& normal = faces[iface].plane.getNormal();
     1756#endif
    15851757  int ix, iy, iz = 0;
    1586   if (std::abs(normal[1]) > std::abs(normal[iz])) iz = 1;
    1587   if (std::abs(normal[2]) > std::abs(normal[iz])) iz = 2;
     1758  //G.Barrand : if (std::abs(normal[1]) > std::abs(normal[iz])) iz = 1;
     1759  //G.Barrand : if (std::abs(normal[2]) > std::abs(normal[iz])) iz = 2;
     1760  if (::fabs(normal[1]) > ::fabs(normal[iz])) iz = 1; //G.Barrand
     1761  if (::fabs(normal[2]) > ::fabs(normal[iz])) iz = 2; //G.Barrand
    15881762  if (normal[iz] > 0) {
    15891763    ix = (iz+1)%3; iy = (ix+1)%3;
     
    16061780        i1 = edges[iedge].i1;
    16071781        i2 = edges[iedge].i2;
    1608         z += nodes[i1].v[ix]*nodes[i2].v[iy]-nodes[i2].v[ix]*nodes[i1].v[iy];
     1782        ExtNode& node_1 = nodes[i1];
     1783        ExtNode& node_2 = nodes[i2];
     1784        z += node_1.v[ix]*node_2.v[iy]-node_2.v[ix]*node_1.v[iy];
    16091785        if (ifirst != i2) {
    16101786          iedge = edges[iedge].inext;
     
    16171793          }else{ 
    16181794            processor_error = 1;
     1795#ifdef BP_DEBUG
    16191796            std::cerr
    16201797              << "BooleanProcessor::triangulateFace : too small contour"
    16211798              << std::endl;
     1799#endif
    16221800          }
    16231801          icontour = edges[iedge].inext;
     
    16271805      }else{
    16281806        processor_error = 1;
     1807#ifdef BP_DEBUG
    16291808        std::cerr
    16301809          << "BooleanProcessor::triangulateFace : broken contour"
    16311810          << std::endl;
     1811#endif
    16321812        icontour = 0;
    16331813        break;
     
    16391819
    16401820  int kint, kext;
    1641   for (kint=0; kint < internal_contours.size(); kint++) {
    1642     for (kext=0; kext < external_contours.size(); kext++) {
     1821  for (kint=0; kint < (int)internal_contours.size(); kint++) {
     1822    for (kext=0; kext < (int)external_contours.size(); kext++) {
    16431823      mergeContours(ix, iy, kext, kint);
    16441824      if (internal_contours[kint] == 0) break;
    16451825    }
    1646     if (kext == external_contours.size()) {
     1826    if (kext == (int)external_contours.size()) {
    16471827      processor_error = 1;
     1828#ifdef BP_DEBUG
    16481829      std::cerr
    16491830        << "BooleanProcessor::triangulateFace : "
    16501831        << "could not merge internal contour " << kint
    16511832        << std::endl;
     1833#endif
    16521834    }     
    16531835  }
     
    16561838
    16571839  int nface = faces.size();
    1658   for (kext=0; kext < external_contours.size(); kext++) {
     1840  for (kext=0; kext < (int)external_contours.size(); kext++) {
    16591841    triangulateContour(ix, iy, external_contours[kext]);
     1842#ifdef BP_DEBUG
     1843    if(processor_error) { //G.Barrand
     1844      std::cerr
     1845        << "BooleanProcessor::triangulateFace : "
     1846        << "triangulateContour failed."
     1847        << std::endl;
     1848      break; //G.Barrand : ok ?
     1849    }
     1850#endif     
    16601851  }
    16611852  faces[iface].inew = UNSUITABLE_FACE;
     
    16631854  //   M O D I F Y   R E F E R E N C E S
    16641855
    1665   for (int ifa=nface; ifa<faces.size(); ifa++) {
     1856  for (int ifa=nface; ifa<(int)faces.size(); ifa++) {
    16661857    iedge = faces[ifa].iold;
    16671858    while (iedge > 0) {
    16681859      if (edges[iedge].iface1 != ifa) {
    16691860        processor_error = 1;
     1861#ifdef BP_DEBUG
    16701862        std::cerr
    16711863          << "BooleanProcessor::triangulateFace : wrong reference to itself, "
    16721864          << "iface=" << ifa << ", iface1=" << edges[iedge].iface1
    16731865          << std::endl;
     1866#endif
    16741867      }else if (edges[iedge].iface2 > 0) {
    16751868        modifyReference(edges[iedge].iface2,
     
    16971890  //   R E N U M E R A T E   N O D E S   A N D   F A C E S
    16981891
    1699   for (i=1; i<nodes.size(); i++) nodes[i].s = 0;
    1700 
    1701   for (i=1; i<faces.size(); i++) {
     1892  for (i=1; i<(int)nodes.size(); i++) nodes[i].s = 0;
     1893
     1894  for (i=1; i<(int)faces.size(); i++) {
    17021895    if (faces[i].inew == ORIGINAL_FACE) {
    17031896      faces[i].inew = ++nface;
     
    17121905  }
    17131906
    1714   for (i=1; i<nodes.size(); i++) {
     1907  for (i=1; i<(int)nodes.size(); i++) {
    17151908    if (nodes[i].s == 1) nodes[i].s = ++nnode;
    17161909  }
     
    17241917  //   S E T   N O D E S
    17251918
    1726   for (i=1; i<nodes.size(); i++) {
     1919  for (i=1; i<(int)nodes.size(); i++) {
    17271920    if (nodes[i].s != 0)  polyhedron.pV[nodes[i].s] = nodes[i].v;
    17281921  }
     
    17311924
    17321925  int k, v[4], f[4];
    1733   for (i=1; i<faces.size(); i++) {
     1926  for (i=1; i<(int)faces.size(); i++) {
    17341927    if (faces[i].inew == 0) continue;
    17351928    v[3] = f[3] = k = 0;
     
    17551948    }
    17561949    polyhedron.pF[faces[i].inew] =
    1757       G4Facet(v[0],f[0], v[1],f[1], v[2],f[2], v[3],f[3]);
     1950      G4Facet(v[0],f[0], v[1],f[1], v[2],f[2], v[3],f[3]); 
    17581951  }
    17591952  return polyhedron;
    17601953}
     1954
     1955int BooleanProcessor::ishift = 0; //G.Barrand
     1956int BooleanProcessor::get_shift() { return ishift;} //G.Barrand
     1957void BooleanProcessor::set_shift(int a_shift) { ishift = a_shift;} //G.Barrand
     1958#define NUM_SHIFT 8
     1959int BooleanProcessor::get_num_shift() { return NUM_SHIFT;} //G.Barrand
    17611960
    17621961HepPolyhedron BooleanProcessor::execute(int op,
    17631962                                        const HepPolyhedron & a,
    1764                                         const HepPolyhedron & b)
     1963                                        const HepPolyhedron & b,
     1964                                        int& err) //G.Barrand
    17651965/***********************************************************************
    17661966 *                                                                     *
     
    17721972 ***********************************************************************/
    17731973{
    1774   static int ishift = 0;
    1775   static double shift[8][3] = {
     1974  //static int ishift = 0; //G.Barrand
     1975  //static double shift[8][3] = {
     1976  static double shift[NUM_SHIFT][3] = { //G.Barrand
    17761977    {  31,  23,  17},
    17771978    { -31, -23, -17},
     
    17841985  };           
    17851986
     1987/*
     1988  std::cerr << "BooleanProcessor::execute : ++++++++++++++++++++++"
     1989            << a.getName().getString()
     1990            << b.getName().getString()
     1991            << std::endl;
     1992*/
     1993
    17861994  //   I N I T I A T E   P R O C E S S O R
    17871995
     
    17901998  nodes.clear(); nodes.push_back(CRAZY_POINT);
    17911999  edges.clear(); edges.push_back(ExtEdge());
    1792   faces.clear(); faces.push_back(ExtFace());
     2000  faces.clear(); faces.push_back(ExtFace(edges,0)); //G.Barrand : ok ?
    17932001
    17942002  //   T A K E   P O L Y H E D R A
     
    18012009      << "BooleanProcessor: corrapted input polyhedron"
    18022010      << std::endl;
     2011    err = processor_error; //G.Barrand
    18032012    return HepPolyhedron();
    18042013  }
    18052014  if (ifaces1 == ifaces2) {          // a is empty
     2015    err = processor_error; //G.Barrand
    18062016    switch (operation) {
    18072017    case OP_UNION:
     
    18192029    }
    18202030  }
    1821   if (ifaces2 == faces.size()) {     // b is empty
     2031  if (ifaces2 == (int)faces.size()) {     // b is empty
     2032    err = processor_error; //G.Barrand
    18222033    switch (operation) {
    18232034    case OP_UNION:
     
    18392050  //   W O R K A R O U N D   T O   A V O I D   I E   A N D   E E
    18402051         
     2052/*
     2053#define PROCESSOR_ERROR(a_what) \
     2054  std::cerr << "BooleanProcessor: boolean operation problem (" << a_what \
     2055            << "). Try again with other shifts."\
     2056            << std::endl;
     2057*/
     2058#define PROCESSOR_ERROR(a_what)
     2059
     2060  unsigned int try_count = 1;
     2061  while(true) { //G.Barrand
     2062
    18412063  double ddxx = del*shift[ishift][0];
    18422064  double ddyy = del*shift[ishift][1];
    18432065  double ddzz = del*shift[ishift][2];
    1844   ishift++; if (ishift == 8) ishift = 0;
    1845 
     2066  ishift++; if (ishift == get_num_shift()) ishift = 0;
     2067
     2068  processor_error = 0; //G.Barrand
    18462069  operation = op;
    18472070  nodes.clear(); nodes.push_back(CRAZY_POINT);
    18482071  edges.clear(); edges.push_back(ExtEdge());
    1849   faces.clear(); faces.push_back(ExtFace());
     2072  faces.clear(); faces.push_back(ExtFace(edges,0)); //G.Barrand : ok ?
    18502073
    18512074  ifaces1 = faces.size(); takePolyhedron(a,0,0,0);
    18522075  ifaces2 = faces.size(); takePolyhedron(b,ddxx,ddyy,ddzz);
     2076
     2077  if (processor_error) { PROCESSOR_ERROR(1) } //G.Barrand
    18532078
    18542079  del = findMinMax();
     
    18592084  selectOutsideFaces(ifaces1, iout1);
    18602085  selectOutsideFaces(ifaces2, iout2);
     2086
     2087  if (processor_error) { PROCESSOR_ERROR(2) } //G.Barrand
    18612088
    18622089  //   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
     
    18752102  }
    18762103
    1877 #define PROCESSOR_ERROR \
    1878 std::cerr << "BooleanProcessor: boolean operation failed" << std::endl;\
    1879 return a;
     2104  if (processor_error) { PROCESSOR_ERROR(3) } //G.Barrand
    18802105
    18812106  //   F I N D   N E W   E D G E S
     
    18922117    }
    18932118  }
    1894   if (processor_error) { PROCESSOR_ERROR }
     2119  if (processor_error) { PROCESSOR_ERROR(4) } //G.Barrand
    18952120
    18962121  //   C O N S T R U C T   N E W   F A C E S
    18972122
    18982123  assembleNewFaces((operation == OP_INTERSECTION) ? 1 : 0, ifaces1);
    1899   if (processor_error) { PROCESSOR_ERROR }
     2124  if (processor_error) { PROCESSOR_ERROR(5) } //G.Barrand
    19002125  assembleNewFaces((operation == OP_UNION) ? 0 : 1, ifaces2);
    1901   if (processor_error) { PROCESSOR_ERROR }
     2126  if (processor_error) { PROCESSOR_ERROR(6) } //G.Barrand
    19022127
    19032128  //   A S S E M B L E   S U I T A B L E   F A C E S
     
    19082133    if (unknown_faces.front() != 0) {
    19092134      processor_error = 1;
     2135#ifdef BP_DEBUG
    19102136      std::cerr
    19112137        << "BooleanProcessor::execute : unknown faces !!!"
    19122138        << std::endl;
     2139#endif
    19132140    }
    19142141    break;
    19152142  }
    1916   if (processor_error) { PROCESSOR_ERROR }
     2143  if (processor_error) { PROCESSOR_ERROR(7) } //G.Barrand
    19172144
    19182145  //   T R I A N G U L A T E   A C C E P T E D   F A C E S
     
    19232150    ifa1 = faces[ifa2].inext;
    19242151    if (faces[ifa2].inew == NEW_FACE) triangulateFace(ifa2);
    1925     if (processor_error) { PROCESSOR_ERROR }
    1926   }
     2152    if (processor_error) {
     2153      PROCESSOR_ERROR(8) //G.Barrand
     2154      break; //G.Barrand
     2155    }
     2156  }
     2157
     2158  if(!processor_error) {   
     2159#ifdef BP_DEBUG
     2160    if(try_count!=1) {
     2161      std::cerr
     2162         << "BooleanProcessor::execute : had converged."
     2163         << std::endl;
     2164    }
     2165#endif
     2166    break;
     2167  }
     2168
     2169  if((int)try_count>get_num_shift()) {
     2170#ifdef BP_DEBUG
     2171    std::cerr << "BooleanProcessor: "
     2172              << " all shifts tried. Boolean operation (" << op << ") failure."
     2173              << " a name \"" << a.getName().getString() << "\""
     2174              << " b name \"" << b.getName().getString() << "\""
     2175              << std::endl;
     2176#endif
     2177    err = processor_error;
     2178    return a;
     2179  }
     2180
     2181#ifdef BP_DEBUG
     2182  std::cerr
     2183     << "BooleanProcessor::execute : try another tilt..."
     2184     << std::endl;
     2185#endif
     2186
     2187  try_count++;
     2188
     2189  } //G.Barrand : end while shift.
     2190#undef PROCESSOR_ERROR //G.Barrand
    19272191
    19282192  //   C R E A T E   P O L Y H E D R O N
    19292193 
     2194  err = processor_error;
    19302195  return createPolyhedron();
    19312196}
     
    21492414}
    21502415*/
     2416
     2417void BooleanProcessor::dump() {//G.Barrand
     2418  unsigned int number = nodes.size();
     2419  std::cout << "nodes : " << number << endl;
     2420  for(unsigned int index=0;index<number;index++) {
     2421    const ExtNode& node = nodes[index];
     2422    std::cout << " " << index
     2423              << " x = " << node.v[0]
     2424              << " y = " << node.v[1]
     2425              << " z = " << node.v[2]
     2426              << std::endl;
     2427  }
     2428}
  • trunk/source/graphics_reps/src/HepPolyhedron.cc

    r1058 r1140  
    2525//
    2626//
    27 // $Id: HepPolyhedron.cc,v 1.32 2008/11/13 09:05:27 gcosmo Exp $
    28 // GEANT4 tag $Name: geant4-09-02-ref-02 $
     27// $Id: HepPolyhedron.cc,v 1.34 2009/10/28 13:36:32 allison Exp $
     28// GEANT4 tag $Name: $
    2929//
    3030//
     
    22552255
    22562256#include "BooleanProcessor.src"
    2257 static BooleanProcessor processor;
    22582257
    22592258HepPolyhedron HepPolyhedron::add(const HepPolyhedron & p) const
     
    22672266 ***********************************************************************/
    22682267{
    2269   return processor.execute(OP_UNION, *this, p);
     2268  int ierr;
     2269  BooleanProcessor processor;
     2270  return processor.execute(OP_UNION, *this, p,ierr);
    22702271}
    22712272
     
    22802281 ***********************************************************************/
    22812282{
    2282   return processor.execute(OP_INTERSECTION, *this, p);
     2283  int ierr;
     2284  BooleanProcessor processor;
     2285  return processor.execute(OP_INTERSECTION, *this, p,ierr);
    22832286}
    22842287
     
    22932296 ***********************************************************************/
    22942297{
    2295   return processor.execute(OP_SUBTRACTION, *this, p);
    2296 }
    2297 
    2298 bool HepPolyhedron::IsErrorBooleanProcess() const {
    2299   return processor.get_processor_error();
    2300 }
     2298  int ierr;
     2299  BooleanProcessor processor;
     2300  return processor.execute(OP_SUBTRACTION, *this, p,ierr);
     2301}
     2302
     2303//NOTE : include the code of HepPolyhedronProcessor here
     2304//       since there is no BooleanProcessor.h
     2305
     2306#undef INTERSECTION
     2307
     2308#include "HepPolyhedronProcessor.src"
     2309
  • trunk/source/intercoms/include/G4UImanager.hh

    r1016 r1140  
    200200  public: // with description
    201201      inline void SetSession(G4UIsession *const value)
    202       { session = value; }
     202  { printf("+++++++SetSession value:%d \n",value);session = value; }
    203203      //  This method defines the active (G)UI session.
    204204     void SetCoutDestination(G4UIsession *const value);
  • trunk/source/interfaces/basic/src/G4UIQt.cc

    r1139 r1140  
    169169
    170170
    171 ...finir de mettre de QGL dans le splitter du haut
     171  // FIXME ...finir de mettre de QGL dans le splitter du haut
    172172
    173173
  • trunk/source/visualization/FukuiRenderer/GNUmakefile

    r834 r1140  
    1 # $Id: GNUmakefile,v 1.5 2004/06/03 11:40:12 gcosmo Exp $
     1# $Id: GNUmakefile,v 1.6 2009/10/21 14:59:17 allison Exp $
    22
    33name := G4FR
     
    2727CPPFLAGS += -I$(G4BASE)/geometry/solids/specific/include
    2828CPPFLAGS += -I$(G4BASE)/geometry/management/include
     29CPPFLAGS += -I$(G4BASE)/digits_hits/hits/include
    2930
    3031include $(G4INSTALL)/config/common.gmk
  • trunk/source/visualization/FukuiRenderer/History

    r834 r1140  
    1 $Id: History,v 1.26 2006/07/10 15:32:27 allison Exp $
     1$Id: History,v 1.27 2009/10/21 14:59:17 allison Exp $
    22-------------------------------------------------------------------
    33
     
    2020History file for visualization/FukuiRenderer sub-category
    2121---------------------------------------------------------
     22
     2321st October 2009  John Allison  (DAWN-V09-02-00 coworks greps-V09-02-02)
     24- Added default AddCompound (const G4THitsMap<G4double>&) methods.
     25  o Prevents warnings about hiding - calls G4VSceneHandler base class.
    2226
    232710th July 2006  John Allison  (DAWN-V08-01-00)
  • trunk/source/visualization/FukuiRenderer/include/G4DAWNFILESceneHandler.hh

    r944 r1140  
    2525//
    2626//
    27 // $Id: G4DAWNFILESceneHandler.hh,v 1.16 2006/06/29 21:16:30 gunter Exp $
     27// $Id: G4DAWNFILESceneHandler.hh,v 1.17 2009/10/21 14:59:17 allison Exp $
    2828// GEANT4 tag $Name:  $
    2929//
     
    9898    G4VSceneHandler::AddCompound(hit);
    9999  }
     100  void AddCompound ( const G4THitsMap<G4double> & hits) {
     101    G4VSceneHandler::AddCompound(hits);
     102  }
    100103
    101104  void ClearTransientStore();  // Used for triggering detector re-drawing.
  • trunk/source/visualization/FukuiRenderer/include/G4FukuiRendererSceneHandler.hh

    r944 r1140  
    2525//
    2626//
    27 // $Id: G4FukuiRendererSceneHandler.hh,v 1.15 2006/06/29 21:16:46 gunter Exp $
     27// $Id: G4FukuiRendererSceneHandler.hh,v 1.16 2009/10/21 14:59:17 allison Exp $
    2828// GEANT4 tag $Name:  $
    2929//
     
    100100  void AddCompound ( const G4VHit& hit) {
    101101    G4VSceneHandler::AddCompound(hit);
     102  }
     103  void AddCompound ( const G4THitsMap<G4double> & hits) {
     104    G4VSceneHandler::AddCompound(hits);
    102105  }
    103106
  • trunk/source/visualization/GNUmakefile

    r959 r1140  
    1 # $Id: GNUmakefile,v 1.23 2009/03/05 11:32:07 lgarnier Exp $
     1# $Id: GNUmakefile,v 1.24 2009/10/12 10:28:38 akimura Exp $
    22# -----------------------------------------------------------------------
    33# GNUmakefile for visualization and modeling.  John Allison, 5/7/95.
     
    2626
    2727# For Debug mode
    28 CPPFLAGS += -DG4DEBUG_VIS_OGL
    29 CPPFLAGS += -DG4DEBUG_VIS_OI
    30 CPPFLAGS += -DG4DEBUG_VIS_MANAGEMENT
     28# CPPFLAGS += -DG4DEBUG_VIS_OGL
     29# CPPFLAGS += -DG4DEBUG_VIS_OI
     30# CPPFLAGS += -DG4DEBUG_VIS_MANAGEMENT
    3131
    3232# Libraries which can be used without external packages or libraries...
     
    4646  SUBDIRS += XXX
    4747  SUBLIBS += G4visXXX
     48  SUBDIRS += gMocren
     49  SUBLIBS += G4GMocren
    4850
    4951ifdef G4VIS_BUILD_OPENGL_DRIVER
  • trunk/source/visualization/HepRep/History

    r1040 r1140  
    1 .$Id: History,v 1.129 2009/05/08 09:29:23 gcosmo Exp $
     1.$Id: History,v 1.131 2009/10/21 15:13:36 allison Exp $
    22-------------------------------------------------------------------
    33
     
    2020History file for visualization/HepRep sub-category
    2121--------------------------------------------------
     22
     2321st October 2009  John Allison  (vis-HepRep-V09-02-02 coworks greps-V09-02-02)
     24- Added default AddCompound (const G4THitsMap<G4double>&) methods.
     25  o Prevents warnings about hiding - calls G4VSceneHandler base class.
    2226
    23278 May 2009  Gabriele Cosmo  (vis-HepRep-V09-02-00)
  • trunk/source/visualization/HepRep/include/G4HepRepFileSceneHandler.hh

    r944 r1140  
    2525//
    2626//
    27 // $Id: G4HepRepFileSceneHandler.hh,v 1.30 2008/01/04 22:11:31 allison Exp $
     27// $Id: G4HepRepFileSceneHandler.hh,v 1.31 2009/10/21 15:08:35 allison Exp $
    2828// GEANT4 tag $Name:  $
    2929//
     
    8282  void AddCompound (const G4VHit&);
    8383  void InitHit();
     84  void AddCompound (const G4THitsMap<G4double>& hits) {
     85    G4VSceneHandler::AddCompound(hits);
     86  }
    8487  // void PreAddSolid(const G4Transform3D& objectTransformation,
    8588  //                 const G4VisAttributes&);
  • trunk/source/visualization/HepRep/include/G4HepRepSceneHandler.hh

    r944 r1140  
    2424// ********************************************************************
    2525//
    26 // $Id: G4HepRepSceneHandler.hh,v 1.42 2006/11/06 09:22:26 allison Exp $
     26// $Id: G4HepRepSceneHandler.hh,v 1.43 2009/10/21 15:08:35 allison Exp $
    2727// GEANT4 tag $Name:  $
    2828//
     
    8585        void AddCompound (const G4VTrajectory&);
    8686        void AddCompound (const G4VHit& hit);
     87        void AddCompound (const G4THitsMap<G4double>& hits) {
     88          G4VSceneHandler::AddCompound(hits);
     89        }
    8790
    8891        void PreAddSolid (const G4Transform3D& objectTransformation, const G4VisAttributes& visAttribs);
  • trunk/source/visualization/History

    r1136 r1140  
    1 $Id: History,v 1.445 2009/08/20 15:16:58 lgarnier Exp $
     1$Id: History,v 1.453 2009/10/25 10:43:42 allison Exp $
    22-------------------------------------------------------------------
    33
     
    3030 - G4OpenGLQtViewer.cc/G4OpenGLStoreQtViewer.cc : Fix problems with
    3131   mac OS X 10.6
     32
     3323rd October 2009  John Allison  (vis-V09-02-09, greps-V09-02-02, digits_hits-V09-02-02)
     34- visman-V09-02-05: Implemented default behaviour in
     35  G4VSceneHandler::AddCompound (const G4THitsMap<G4double>&).
     36
     3722nd October 2009  John Allison  (vis-V09-02-08, greps-V09-02-02, digits_hits-V09-02-02)
     38- modeling-V09-02-05: Added G4PSHitsModel for gMocren driver.
     39- gMocren-V09-02-00: G4PSHitsModel moved to modelling.
     40
     4121st October 2009  John Allison  (vis-V09-02-07 coworks greps-V09-02-02)
     42- greps-V09-02-02 adds new pure virtual function,
     43  AddCompound (const G4THitsMap<G4double>&).  The following tags
     44  accomodate:
     45  o modeling-V09-02-04
     46  o visman-V09-02-04
     47  o DAWN-V09-02-00
     48  o vis-HepRep-V09-02-02
     49  o opengl-V09-02-08
     50  o raytracer-V09-02-01
     51  o VRML-V09-02-01
     52  o visXXX-V09-02-00
     53
     5410th October 2009 Joseph Perl (vis-V09-02-06)
     55- new global tag for vis, in preparation for  addition of gMocren file driver
     56
     5710th October 2009  John Allison
     58- modeling-V09-02-03: Added G4PhysicalVolumeModelTouchable.  Used in
     59  ComputeMaterial.  Effective for nested parameterisations.
     60
     6129th September 2009  John Allison  (allison20090929)
     62- modeling-V09-02-02: Added warning if logical volume not defined.
     63- visman-V09-02-03:
     64  o Allow refresh in GeomClosed as well as Idle state.
     65  o Fixed uninitialised pointers.
     66  o G4VisManager.cc: Considerable tidy up.
     67- opengl-V09-02-07:  Tagged work by Laurent Garnier:
     68  o G4OpenGLXmViewer : Fix a wrong initialization introduce by the
     69    new way of handling window size hints (January 2009)
     70  o G4OpenGLQtViewer : Ensure the GL frame size will be correct
     71    by setting a 0 size margin around
     72  o G4OpenGLStoredQtViewer : Remove picking to true at initialisation
     73- openinventor-V09-02-02:  Tagged work by Laurent Garnier:
     74  o G4OpenInventorXt/WinViewer: Fix a wrong initialization introduce by the
     75    new way of handling window size hints (January 2009)
     76  o Remove Geant4_gl2ps.h gl2ps.cc gl2ps.h which were copied in external/gl2ps
     77    in february but forgot to remove them from OpenInventor
     78- vistest-V09-02-00: Changed main program, test19.cc, to use G4UIExecutive.
     79- VRML-V09-02-00: Tagged change of disclaimer on file headings (made long ago).
     80
     8116 September 2009  John Allison
     82- raytracer-V09-02-00: Cosmetic adjustments and tagging.
    3283
    338419 August 2009 Laurent Garnier
  • trunk/source/visualization/OpenGL/History

    r1135 r1140  
    1 $Id: History,v 1.155 2009/10/21 08:14:44 lgarnier Exp $
     1$Id: History,v 1.156 2009/10/21 15:21:09 allison Exp $
    22-------------------------------------------------------------------
    33
     
    202021 October 2009 Laurent Garnier
    2121 -  G4OpenGLQtViewer : Prepare to attach viewer In UI
     22
     2321st October 2009  John Allison  (opengl-V09-02-08 coworks greps-V09-02-02)
     24- Added default AddCompound (const G4THitsMap<G4double>&) methods.
     25  o Prevents warnings about hiding - calls G4VSceneHandler base class.
    2226
    232715 October 2009 Laurent Garnier
  • trunk/source/visualization/OpenGL/include/G4OpenGLSceneHandler.hh

    r1022 r1140  
    2525//
    2626//
    27 // $Id: G4OpenGLSceneHandler.hh,v 1.26 2009/04/23 10:13:56 lgarnier Exp $
     27// $Id: G4OpenGLSceneHandler.hh,v 1.27 2009/10/21 15:18:14 allison Exp $
    2828// GEANT4 tag $Name:  $
    2929//
     
    8383  void AddCompound (const G4VTrajectory&);
    8484  void AddCompound (const G4VHit&);
     85  void AddCompound (const G4THitsMap<G4double>&);
    8586
    8687protected:
  • trunk/source/visualization/OpenGL/src/G4OpenGLSceneHandler.cc

    r1129 r1140  
    2525//
    2626//
    27 // $Id: G4OpenGLSceneHandler.cc,v 1.55 2009/03/03 14:51:29 lgarnier Exp $
     27// $Id: G4OpenGLSceneHandler.cc,v 1.56 2009/10/21 15:18:43 allison Exp $
    2828// GEANT4 tag $Name:  $
    2929//
     
    879879}
    880880
     881void G4OpenGLSceneHandler::AddCompound(const G4THitsMap<G4double>& hits) {
     882  G4VSceneHandler::AddCompound(hits);  // For now.
     883}
     884
    881885#endif
  • trunk/source/visualization/RayTracer/History

    r1136 r1140  
    1 $Id: History,v 1.58 2009/09/16 16:58:26 allison Exp $
     1$Id: History,v 1.59 2009/10/21 15:24:53 allison Exp $
    22-------------------------------------------------------------------
    33
     
    2424History file for Ray Tracer category
    2525---------------------------------------
     26
     2721st October 2009  John Allison  (raytracer-V09-02-01 coworks greps-V09-02-02)
     28- Added AddCompound (const G4THitsMap<G4double>&) methods.
     29  o Prevents warnings about hiding - calls G4VSceneHandler base class.
    2630
    273116 September 2009  John Allison  (raytracer-V09-02-00)
  • trunk/source/visualization/RayTracer/include/G4RayTracerSceneHandler.hh

    r954 r1140  
    2525//
    2626//
    27 // $Id: G4RayTracerSceneHandler.hh,v 1.11 2006/06/29 21:23:37 gunter Exp $
     27// $Id: G4RayTracerSceneHandler.hh,v 1.12 2009/10/21 15:24:53 allison Exp $
    2828// GEANT4 tag $Name:  $
    2929
     
    6565  void AddCompound(const G4VTrajectory&){}
    6666  void AddCompound(const G4VHit&){}
     67  void AddCompound(const G4THitsMap<G4double>&) {}
    6768
    6869private:
  • trunk/source/visualization/Tree/src/G4ASCIITreeViewer.cc

    r954 r1140  
    3434  G4VTreeViewer(sceneHandler, name) {
    3535  // Make changes to view parameters for ASCIITree...
     36//   if (!fVP) {
     37    printf("G4ASCIITreeViewer::G4ASCIITreeViewer SHOULD CRASH HERE-----------------------------------------------------------\n");
     38//   } else {
     39//     printf("G4ASCIITreeViewer::G4ASCIITreeViewer SHOULD NOT CRASH HERE------------------------------------------------------------\n");
     40//   }
    3641  fVP.SetCulling(false);
     42  printf("G4ASCIITreeViewer::G4ASCIITreeViewer 2\n");
    3743  fDefaultVP.SetCulling(false);
     44  printf("G4ASCIITreeViewer::G4ASCIITreeViewer 3\n");
    3845}
    3946
  • trunk/source/visualization/VRML/GNUmakefile

    r834 r1140  
    1 # $Id: GNUmakefile,v 1.7 2004/06/03 11:40:14 gcosmo Exp $
     1# $Id: GNUmakefile,v 1.8 2009/10/21 15:27:21 allison Exp $
    22
    33# lib name
     
    2929CPPFLAGS += -I$(G4BASE)/geometry/management/include
    3030CPPFLAGS += -I$(G4BASE)/visualization/VRML/include
     31CPPFLAGS += -I$(G4BASE)/digits_hits/hits/include
    3132
    3233include $(G4INSTALL)/config/common.gmk
  • trunk/source/visualization/VRML/History

    r834 r1140  
    1 $Id: History,v 1.15 2006/06/12 08:32:16 allison Exp $
     1$Id: History,v 1.17 2009/10/21 15:27:21 allison Exp $
    22-------------------------------------------------------------------
    33
     
    2020History file for visualization/VRML sub-category
    2121------------------------------------------------
     22
     2321st October 2009  John Allison  (VRML-V09-02-01 coworks greps-V09-02-02)
     24- Added AddCompound (const G4THitsMap<G4double>&) methods.
     25  o Prevents warnings about hiding - calls G4VSceneHandler base class.
     26
     2729 September 2009  John Allison (VRML-V09-02-00)
     28- Tagged change of disclaimer on file headings (made long ago).
    2229
    233012th June 2006  John Allison  (VRML-V08-00-02)
  • trunk/source/visualization/VRML/include/G4VRML1FileSceneHandler.hh

    r944 r1140  
    2525//
    2626//
    27 // $Id: G4VRML1FileSceneHandler.hh,v 1.17 2006/06/29 21:25:27 gunter Exp $
     27// $Id: G4VRML1FileSceneHandler.hh,v 1.18 2009/10/21 15:27:21 allison Exp $
    2828// GEANT4 tag $Name:  $
    2929//
     
    7373          G4VSceneHandler::AddCompound(hit);
    7474        }
     75        void AddCompound ( const G4THitsMap<G4double> & hits) {
     76          G4VSceneHandler::AddCompound(hits);
     77        }
    7578
    7679        void BeginPrimitives(const G4Transform3D& objectTransformation);
  • trunk/source/visualization/VRML/include/G4VRML1SceneHandler.hh

    r944 r1140  
    2525//
    2626//
    27 // $Id: G4VRML1SceneHandler.hh,v 1.14 2006/06/29 21:25:31 gunter Exp $
     27// $Id: G4VRML1SceneHandler.hh,v 1.15 2009/10/21 15:27:21 allison Exp $
    2828// GEANT4 tag $Name:  $
    2929//
     
    7878          G4VSceneHandler::AddCompound(hit);
    7979        }
     80        void AddCompound ( const G4THitsMap<G4double> & hits) {
     81          G4VSceneHandler::AddCompound(hits);
     82        }
    8083
    8184        void BeginPrimitives(const G4Transform3D& objectTransformation);
  • trunk/source/visualization/VRML/include/G4VRML2FileSceneHandler.hh

    r944 r1140  
    2525//
    2626//
    27 // $Id: G4VRML2FileSceneHandler.hh,v 1.16 2006/06/29 21:25:39 gunter Exp $
     27// $Id: G4VRML2FileSceneHandler.hh,v 1.17 2009/10/21 15:27:21 allison Exp $
    2828// GEANT4 tag $Name:  $
    2929//
     
    7373          G4VSceneHandler::AddCompound(hit);
    7474        }
     75        void AddCompound ( const G4THitsMap<G4double> & hits) {
     76          G4VSceneHandler::AddCompound(hits);
     77        }
    7578
    7679        void BeginPrimitives(const G4Transform3D& objectTransformation);
  • trunk/source/visualization/VRML/include/G4VRML2SceneHandler.hh

    r944 r1140  
    2525//
    2626//
    27 // $Id: G4VRML2SceneHandler.hh,v 1.13 2006/06/29 21:25:43 gunter Exp $
     27// $Id: G4VRML2SceneHandler.hh,v 1.14 2009/10/21 15:27:21 allison Exp $
    2828// GEANT4 tag $Name:  $
    2929//
     
    7676          G4VSceneHandler::AddCompound(hit);
    7777        }
     78        void AddCompound ( const G4THitsMap<G4double> & hits) {
     79          G4VSceneHandler::AddCompound(hits);
     80        }
    7881
    7982        void BeginPrimitives(const G4Transform3D& objectTransformation);
  • trunk/source/visualization/XXX/GNUmakefile

    r834 r1140  
    1 # $Id: GNUmakefile,v 1.7 2006/03/28 17:16:41 allison Exp $
     1# $Id: GNUmakefile,v 1.8 2009/10/21 15:28:53 allison Exp $
    22
    33name := G4visXXX
     
    2828CPPFLAGS += -I$(G4BASE)/geometry/solids/specific/include
    2929CPPFLAGS += -I$(G4BASE)/tracking/include
     30CPPFLAGS += -I$(G4BASE)/digits_hits/hits/include
    3031
    3132ifdef G4VIS_BUILD_XXXSG_DRIVER
  • trunk/source/visualization/XXX/History

    r834 r1140  
    1 $Id: History,v 1.27 2006/11/05 20:41:55 allison Exp $
     1$Id: History,v 1.28 2009/10/21 15:28:53 allison Exp $
    22-------------------------------------------------------------------
    33
     
    2020History file for visualization/XXX sub-category (a template graphics system)
    2121---------------------------------------------------------------------------
     22
     2321st October 2009  John Allison  (visXXX-V09-02-00 coworks greps-V09-02-02)
     24- Added AddCompound (const G4THitsMap<G4double>&) methods.
     25  o Prevents warnings about hiding - calls G4VSceneHandler base class.
    2226
    23275th November 2006  John Allison  (visXXX-V08-01-06)
  • trunk/source/visualization/XXX/include/G4XXXFileSceneHandler.hh

    r944 r1140  
    2525//
    2626//
    27 // $Id: G4XXXFileSceneHandler.hh,v 1.3 2006/06/29 21:26:42 gunter Exp $
     27// $Id: G4XXXFileSceneHandler.hh,v 1.4 2009/10/21 15:28:53 allison Exp $
    2828// GEANT4 tag $Name:  $
    2929//
     
    7676  // void AddCompound(const G4VTrajectory&);
    7777  // void AddCompound(const G4VHit&);
     78  // void AddCompound(const G4THitsMap<G4double>&);
    7879  // void PreAddSolid(const G4Transform3D& objectTransformation,
    7980  //       const G4VisAttributes&);
  • trunk/source/visualization/XXX/include/G4XXXSGSceneHandler.hh

    r944 r1140  
    2525//
    2626//
    27 // $Id: G4XXXSGSceneHandler.hh,v 1.3 2006/06/29 21:26:56 gunter Exp $
     27// $Id: G4XXXSGSceneHandler.hh,v 1.4 2009/10/21 15:28:53 allison Exp $
    2828// GEANT4 tag $Name:  $
    2929//
     
    8080  // void AddCompound(const G4VTrajectory&);
    8181  // void AddCompound(const G4VHit&);
     82  // void AddCompound(const G4THitsMap<G4double>&);
    8283  void PreAddSolid(const G4Transform3D& objectTransformation,
    8384                   const G4VisAttributes&);
  • trunk/source/visualization/XXX/include/G4XXXStoredSceneHandler.hh

    r944 r1140  
    2525//
    2626//
    27 // $Id: G4XXXStoredSceneHandler.hh,v 1.3 2006/06/29 21:27:06 gunter Exp $
     27// $Id: G4XXXStoredSceneHandler.hh,v 1.4 2009/10/21 15:28:53 allison Exp $
    2828// GEANT4 tag $Name:  $
    2929//
     
    7878  // void AddCompound(const G4VTrajectory&);
    7979  // void AddCompound(const G4VHit&);
     80  // void AddCompound(const G4THitsMap<G4double>&);
    8081  void PreAddSolid(const G4Transform3D& objectTransformation,
    8182                   const G4VisAttributes&);
  • trunk/source/visualization/externals/gl2ps/GNUmakefile

    r1051 r1140  
    1 # $Id: GNUmakefile,v 1.1 2009/02/18 09:54:12 lgarnier Exp $
     1# $Id: GNUmakefile,v 1.2 2009/11/02 14:54:31 lgarnier Exp $
    22# -------------------------------------------------------------
    33# GNUmakefile for gl2ps.  Laurent Garnier, 6/2/09.
     
    66
    77# For debug mode
    8 CPPFLAGS += -DG4DEBUG_VIS_GL2PS
     8# CPPFLAGS += -DG4DEBUG_VIS_GL2PS
    99
    1010ifndef G4INSTALL
  • trunk/source/visualization/externals/gl2ps/History

    r1040 r1140  
    1 $Id: History,v 1.9 2009/04/29 19:23:10 allison Exp $
     1$Id: History,v 1.10 2009/11/02 14:54:31 lgarnier Exp $
    22-------------------------------------------------------------------
    33
     
    1717     * Reverse chronological order (last date on top), please *
    1818     ----------------------------------------------------------
     19
     202 Nov 2009, Laurent Garnier
     21 - Add debug flag in GNUMakefile
    1922
    202329 April 2009, Laurent Garnier (visexternal-V09-02-04)
  • trunk/source/visualization/management/History

    r1087 r1140  
    1 $Id: History,v 1.122 2009/07/24 09:20:52 lgarnier Exp $
     1$Id: History,v 1.127 2009/10/30 16:05:30 allison Exp $
    22
    33-------------------------------------------------------------------
     
    2626History file for visualization management sub-category
    2727------------------------------------------------------
     28
     2930th October 2009  John Allison  (visman-V09-02-06 coworks greps-V09-02-03)
     30- Added /vis/scene/add/psHits.
     31- G4VisManager.cc: As above and also:
     32  o Tidied view creation.
     33  o Improved message ("scene" should be "scene handler").
     34
     3523rd October 2009  John Allison  (visman-V09-02-05 coworks greps-V09-02-02)
     36- Implemented default behaviour in
     37  G4VSceneHandler::AddCompound (const G4THitsMap<G4double>&).
     38
     3921st October 2009  John Allison  (visman-V09-02-04 coworks greps-V09-02-02)
     40- G4VSceneHandler:
     41  o Added default AddCompound (const G4THitsMap<G4double>&) methods.
     42    (For time being just issues warning.)
     43
     4429th September 2009  John Allison  (visman-V09-02-03)
     45- G4VSceneHandler.cc: Allow refresh in GeomClosed as well as Idle state.
     46- G4VisCommandsSceneAdd.cc: Fixed uninitialised pointers.
     47- G4VisManager.cc: Considerable tidy up.
    2848
    294924th July 2009  Laurent Garnier
  • trunk/source/visualization/management/include/G4VSceneHandler.hh

    r954 r1140  
    2525//
    2626//
    27 // $Id: G4VSceneHandler.hh,v 1.40 2008/01/04 22:03:45 allison Exp $
     27// $Id: G4VSceneHandler.hh,v 1.41 2009/10/21 14:26:59 allison Exp $
    2828// GEANT4 tag $Name:  $
    2929//
     
    4242#include "globals.hh"
    4343
    44 #include <stack>
    45 
    4644#include "G4VGraphicsScene.hh"
    4745#include "G4ViewerList.hh"
    4846#include "G4ViewParameters.hh"
     47#include "G4THitsMap.hh"
    4948
    5049class G4Scene;
     
    130129  virtual void AddCompound (const G4VTrajectory&);
    131130  virtual void AddCompound (const G4VHit&);
     131  virtual void AddCompound (const G4THitsMap<G4double>&);
    132132
    133133  //////////////////////////////////////////////////////////////
  • trunk/source/visualization/management/include/G4VisCommandsSceneAdd.hh

    r954 r1140  
    2525//
    2626//
    27 // $Id: G4VisCommandsSceneAdd.hh,v 1.17 2006/11/01 10:50:28 allison Exp $
     27// $Id: G4VisCommandsSceneAdd.hh,v 1.18 2009/10/30 15:58:50 allison Exp $
    2828// GEANT4 tag $Name:  $
    2929
     
    133133};
    134134
     135class G4VisCommandSceneAddPSHits: public G4VVisCommandScene {
     136public:
     137  G4VisCommandSceneAddPSHits ();
     138  virtual ~G4VisCommandSceneAddPSHits ();
     139  G4String GetCurrentValue (G4UIcommand* command);
     140  void SetNewValue (G4UIcommand* command, G4String newValue);
     141private:
     142  G4VisCommandSceneAddPSHits (const G4VisCommandSceneAddPSHits&);
     143  G4VisCommandSceneAddPSHits& operator = (const G4VisCommandSceneAddPSHits&);
     144  G4UIcmdWithoutParameter* fpCommand;
     145};
     146
    135147class G4VisCommandSceneAddScale: public G4VVisCommandScene {
    136148public:
  • trunk/source/visualization/management/include/G4VisExecutive.icc

    r944 r1140  
    2525//
    2626//
    27 // $Id: G4VisExecutive.icc,v 1.21 2009/03/14 11:43:42 allison Exp $
     27// $Id: G4VisExecutive.icc,v 1.22 2009/10/12 11:54:50 akimura Exp $
    2828// GEANT4 tag $Name:  $
    2929//
     
    4747#include "G4VRML1File.hh"
    4848#include "G4VRML2File.hh"
     49#include "G4GMocrenFile.hh"
    4950
    5051// Needing external packages or libraries...
     
    110111  RegisterGraphicsSystem (new G4VRML1File);
    111112  RegisterGraphicsSystem (new G4VRML2File);
     113  RegisterGraphicsSystem (new G4GMocrenFile);
    112114  // Graphics systems needing external packages or libraries...
    113115
  • trunk/source/visualization/management/src/G4VSceneHandler.cc

    r1136 r1140  
    2525//
    2626//
    27 // $Id: G4VSceneHandler.cc,v 1.83 2008/01/04 22:03:46 allison Exp $
     27// $Id: G4VSceneHandler.cc,v 1.86 2009/10/23 07:58:36 allison Exp $
    2828// GEANT4 tag $Name:  $
    2929//
     
    262262
    263263void G4VSceneHandler::AddCompound (const G4VHit& hit) {
    264   ((G4VHit&)hit).Draw(); // Cast to non-const because Draw is non-const!!!!
     264  static_cast<G4VHit>(hit).Draw(); // Cast because Draw is non-const!!!!
     265}
     266
     267void G4VSceneHandler::AddCompound (const G4THitsMap<G4double>& hits) {
     268  // Cast because DrawAllHits is non-const!!!!
     269  static_cast<G4THitsMap<G4double> >(hits).DrawAllHits();
    265270}
    266271
     
    583588  printf("G4VSceneHandler::ProcessScene : Idle ?\n");
    584589#endif
    585   // Refresh event from end-of-event model list.  Allow only in Idle state...
     590  // Refresh event from end-of-event model list.
     591  // Allow only in Idle or GeomClosed state...
    586592  G4StateManager* stateManager = G4StateManager::GetStateManager();
    587593  G4ApplicationState state = stateManager->GetCurrentState();
    588   if (state == G4State_Idle) {
     594  if (state == G4State_Idle || state == G4State_GeomClosed) {
    589595#ifdef G4DEBUG_VIS_MANAGEMENT
    590596    printf("G4VSceneHandler::ProcessScene : IDLE\n");
  • trunk/source/visualization/management/src/G4VisCommandsSceneAdd.cc

    r1136 r1140  
    2525//
    2626//
    27 // $Id: G4VisCommandsSceneAdd.cc,v 1.74 2009/07/24 09:20:52 lgarnier Exp $
     27// $Id: G4VisCommandsSceneAdd.cc,v 1.76 2009/10/30 15:58:50 allison Exp $
    2828// GEANT4 tag $Name:  $
    2929// /vis/scene commands - John Allison  9th August 1998
     
    3737#include "G4ModelingParameters.hh"
    3838#include "G4HitsModel.hh"
     39#include "G4PSHitsModel.hh"
    3940#include "G4TrajectoriesModel.hh"
    4041#include "G4ScaleModel.hh"
     
    229230  const G4Run* currentRun = 0;
    230231  G4RunManager* runManager = G4RunManager::GetRunManager();
    231   if (runManager)  currentRun = runManager->GetCurrentRun();
     232  if (runManager) currentRun = runManager->GetCurrentRun();
    232233
    233234  G4VModel* model = fpVisManager->GetCurrentSceneHandler()->GetModel();
    234   const G4ModelingParameters* mp;
    235   const G4Event* currentEvent;
     235  const G4ModelingParameters* mp = 0;
     236  const G4Event* currentEvent = 0;
    236237  if (model) {
    237238   mp = model->GetModelingParameters();
     
    240241    G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
    241242    if (verbosity >= G4VisManager::errors) {
    242       G4cout << "ERROR: No model defined for this SceneHandler : "<< fpVisManager->GetCurrentSceneHandler()->GetName() << G4endl;
     243      G4cout << "ERROR: No model defined for this SceneHandler : "
     244             << fpVisManager->GetCurrentSceneHandler()->GetName()
     245             << G4endl;
    243246    }
    244247  }
     
    890893  sceneHandler.AddPrimitive(*fp4);
    891894  sceneHandler.EndPrimitives();
     895}
     896
     897////////////// /vis/scene/add/psHits ///////////////////////////////////////
     898
     899G4VisCommandSceneAddPSHits::G4VisCommandSceneAddPSHits () {
     900  fpCommand = new G4UIcmdWithoutParameter ("/vis/scene/add/psHits", this);
     901  fpCommand -> SetGuidance
     902    ("Adds Primitive Scorer Hits (PSHits) to current scene.");
     903  fpCommand -> SetGuidance
     904    ("PSHits are drawn at end of run when the scene in which"
     905     "\nthey are added is current.");
     906}
     907
     908G4VisCommandSceneAddPSHits::~G4VisCommandSceneAddPSHits () {
     909  delete fpCommand;
     910}
     911
     912G4String G4VisCommandSceneAddPSHits::GetCurrentValue (G4UIcommand*) {
     913  return "";
     914}
     915
     916void G4VisCommandSceneAddPSHits::SetNewValue (G4UIcommand*, G4String) {
     917
     918  G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
     919  G4bool warn(verbosity >= G4VisManager::warnings);
     920
     921  G4Scene* pScene = fpVisManager->GetCurrentScene();
     922  if (!pScene) {
     923    if (verbosity >= G4VisManager::errors) {
     924      G4cout << "ERROR: No current scene.  Please create one." << G4endl;
     925    }
     926    return;
     927  }
     928
     929  G4PSHitsModel* model = new G4PSHitsModel;
     930  const G4String& currentSceneName = pScene -> GetName ();
     931  G4bool successful = pScene -> AddEndOfEventModel (model, warn);
     932  if (successful) {
     933    if (verbosity >= G4VisManager::confirmations) {
     934      G4cout << "Primitive Scorer hits will be drawn in scene \""
     935             << currentSceneName << "\"."
     936             << G4endl;
     937    }
     938  }
     939  else G4VisCommandsSceneAddUnsuccessful(verbosity);
     940  UpdateVisManagerScene (currentSceneName);
    892941}
    893942
  • trunk/source/visualization/management/src/G4VisManager.cc

    r1136 r1140  
    2424// ********************************************************************
    2525//
    26 // $Id: G4VisManager.cc,v 1.118 2009/03/09 12:42:00 allison Exp $
     26// $Id: G4VisManager.cc,v 1.121 2009/10/30 16:03:41 allison Exp $
    2727// GEANT4 tag $Name:  $
    2828//
     
    656656        G4cout << "ERROR in G4VisManager::CreateSceneHandler during "
    657657               << fpGraphicsSystem -> GetName ()
    658                << " scene creation.\n  No action taken."
     658               << " scene handler creation.\n  No action taken."
    659659               << G4endl;
    660660      }
     
    669669  if (!fInitialised) Initialise ();
    670670
    671   if (fpSceneHandler) {
    672     printf("G4VisManager::CreateViewer 1-------------------- %s ----%s\n",name.c_str(),XGeometry.c_str());
    673     G4VViewer* p = fpGraphicsSystem -> CreateViewer (*fpSceneHandler, name);
    674     printf("G4VisManager::CreateViewer 2-------------------- %s ----%s\n",name.c_str(),XGeometry.c_str());
    675 
    676     // Viewer is created, now we can set geometry parameters
    677     // Before 12/2008, it was done in G4VViewer.cc but it did not have to be there!
     671  if (!fpSceneHandler) {
     672    PrintInvalidPointers ();
     673    return;
     674  }
     675
     676  printf("G4VisManager::CreateViewer 1-------------------- %s ----%s\n",name.c_str(),XGeometry.c_str());
     677  G4VViewer* p = fpGraphicsSystem -> CreateViewer (*fpSceneHandler, name);
     678  printf("G4VisManager::CreateViewer 2-------------------- %s ----%s\n",name.c_str(),XGeometry.c_str());
     679
     680  if (!p) {
     681    if (fVerbosity >= errors) {
     682      G4cout << "ERROR in G4VisManager::CreateViewer during "
     683             << fpGraphicsSystem -> GetName ()
     684             << " viewer creation.\n  No action taken."
     685             << G4endl;
     686    }
     687    return;
     688  }
     689
     690  if (p -> GetViewId() < 0) {
     691    if (fVerbosity >= errors) {
     692      G4cout << "ERROR in G4VisManager::CreateViewer during "
     693             << fpGraphicsSystem -> GetName ()
     694             << " viewer initialisation.\n  No action taken."
     695             << G4endl;
     696    }
     697    return;
     698  }
     699
     700  // Viewer is created, now we can set geometry parameters
     701  // Before 12/2008, it was done in G4VViewer.cc but it did not have to be there!
    678702   
    679     //    printf("G4VisManager::CreateViewer 3-------------------- %s ----%s\n",name.c_str(),XGeometry.c_str());
    680     G4ViewParameters vp = p->GetViewParameters();
    681     //    printf("G4VisManager::CreateViewer 4-------------------- %s ----%s\n",name.c_str(),XGeometry.c_str());
    682     vp.SetXGeometryString(XGeometry);
    683     p->SetViewParameters(vp); //parse string and store parameters
    684 
    685     if (!p) {
    686       if (fVerbosity >= errors) {
    687         G4cout << "ERROR in G4VisManager::CreateViewer during "
    688                << fpGraphicsSystem -> GetName ()
    689                << " viewer creation.\n  No action taken."
    690                << G4endl;
    691       }
    692     } else {
    693       p -> Initialise ();
    694       if (p -> GetViewId() < 0) {
    695         if (fVerbosity >= errors) {
    696         G4cout << "ERROR in G4VisManager::CreateViewer during "
    697                << fpGraphicsSystem -> GetName ()
    698                << " viewer initialisation.\n  No action taken."
    699                << G4endl;
    700         }
    701       } else {
    702         fpViewer = p;                             // Make current.
    703         fpSceneHandler -> AddViewerToList (fpViewer);
    704         fpSceneHandler -> SetCurrentViewer (fpViewer);
    705 
    706         if (fVerbosity >= confirmations) {
    707           G4cout << "G4VisManager::CreateViewer: new viewer created."
    708                  << G4endl;
    709         }
    710 
    711         const G4ViewParameters& vp = fpViewer->GetViewParameters();
    712         if (fVerbosity >= parameters) {
    713           G4cout << " view parameters are:\n  " << vp << G4endl;
    714         }
    715 
    716         if (vp.IsCulling () && vp.IsCullingInvisible ()) {
    717           static G4bool warned = false;
    718           if (fVerbosity >= confirmations) {
    719             if (!warned) {
    720               G4cout <<
     703  G4ViewParameters initialvp = p -> GetViewParameters();
     704  initialvp.SetXGeometryString(XGeometry); //parse string and store parameters
     705  p -> SetViewParameters(initialvp);
     706  p -> Initialise ();  // (Viewer itself may change view parameters further.)
     707
     708  fpViewer = p;                             // Make current.
     709  fpSceneHandler -> AddViewerToList (fpViewer);
     710  fpSceneHandler -> SetCurrentViewer (fpViewer);
     711  if (fVerbosity >= confirmations) {
     712    G4cout << "G4VisManager::CreateViewer: new viewer created."
     713           << G4endl;
     714  }
     715
     716  const G4ViewParameters& vp = fpViewer->GetViewParameters();
     717  if (fVerbosity >= parameters) {
     718    G4cout << " view parameters are:\n  " << vp << G4endl;
     719  }
     720
     721  if (vp.IsCulling () && vp.IsCullingInvisible ()) {
     722    static G4bool warned = false;
     723    if (fVerbosity >= confirmations) {
     724      if (!warned) {
     725        G4cout <<
    721726  "NOTE: objects with visibility flag set to \"false\""
    722727  " will not be drawn!"
    723728  "\n  \"/vis/viewer/set/culling global false\" to Draw such objects."
    724729  "\n  Also see other \"/vis/viewer/set\" commands."
    725                      << G4endl;
    726               warned = true;
    727             }
    728           }
    729         }
    730         if (vp.IsCullingCovered ()) {
    731           static G4bool warned = false;
    732           if (fVerbosity >= warnings) {
    733             if (!warned) {
    734               G4cout <<
     730               << G4endl;
     731        warned = true;
     732      }
     733    }
     734  }
     735  if (vp.IsCullingCovered ()) {
     736    static G4bool warned = false;
     737    if (fVerbosity >= warnings) {
     738      if (!warned) {
     739        G4cout <<
    735740  "WARNING: covered objects in solid mode will not be rendered!"
    736741  "\n  \"/vis/viewer/set/culling coveredDaughters false\" to reverse this."
    737742  "\n  Also see other \"/vis/viewer/set\" commands."
    738                      << G4endl;
    739               warned = true;
    740             }
    741           }
    742         }
    743       }
    744     }
    745   }
    746   else PrintInvalidPointers ();
     743               << G4endl;
     744        warned = true;
     745      }
     746    }
     747  }
    747748}
    748749
     
    10881089  RegisterMessenger(new G4VisCommandSceneAddLogicalVolume);
    10891090  RegisterMessenger(new G4VisCommandSceneAddLogo);
     1091  RegisterMessenger(new G4VisCommandSceneAddPSHits);
    10901092  RegisterMessenger(new G4VisCommandSceneAddScale);
    10911093  RegisterMessenger(new G4VisCommandSceneAddText);
     
    13311333          printf("G4VisManager::EndOfEvent 7 \n");
    13321334          G4cout <<
    1333             "WARNING: G4VisManager::EndOfEvent: Event keeping suspended."
    1334             "\n  The number of events exceeds the maximum that may be kept, "
    1335                  << maxNumberOfKeptEvents << '.'
     1335 "WARNING: G4VisManager::EndOfEvent: Automatic event keeping suspended."
     1336 "\n  The number of events exceeds the maximum, "
     1337                 << maxNumberOfKeptEvents <<
     1338 ", that can be kept by the vis manager."
    13361339                 << G4endl;
    13371340        }
     
    13711374    if (fEventKeepingSuspended && fVerbosity >= warnings) {
    13721375      G4cout <<
    1373         "WARNING: G4VisManager::EndOfRun: Event keeping was suspended."
    1374         "\n  The number of events in the run exceeded the maximum to be kept, "
    1375              << fpScene->GetMaxNumberOfKeptEvents() << '.' <<
    1376         "\n  The number of events to be kept can be changed with"
    1377         "\n  \"/vis/scene/endOfEventAction accumulate <N>\", where N is the"
    1378         "\n  maximum number you wish to allow.  N < 0 means \"unlimited\"."
     1376 "WARNING: G4VisManager::EndOfRun: Automatic event keeping has been suspended."
     1377 "\n  The number of events in the run exceeded the maximum, "
     1378             << fpScene->GetMaxNumberOfKeptEvents() <<
     1379 ", that can be kept by the vis manager." <<
     1380 "\n  The number of events kept by the vis manager can be changed with"
     1381 "\n  \"/vis/scene/endOfEventAction accumulate <N>\", where N is the"
     1382 "\n  maximum number you wish to allow.  N < 0 means \"unlimited\"."
    13791383             << G4endl;
    13801384    }
  • trunk/source/visualization/modeling/History

    r931 r1140  
    1 $Id: History,v 1.109 2009/02/25 14:21:45 allison Exp $
     1$Id: History,v 1.114 2009/10/22 15:40:00 allison Exp $
    22-------------------------------------------------------------------
    33
     
    2020History file for visualization/modeling
    2121---------------------------------------
     22
     2322nd October 2009  John Allison  (modeling-V09-02-05 coworks greps-V09-02-02)
     24- Added G4PSHitsModel for gMocren driver.
     25
     2621st October 2009  John Allison  (modeling-V09-02-04 coworks greps-V09-02-02)
     27- G4BoundingSphereScene, G4PhysicalVolumeMassScene,
     28  G4PhysicalVolumeSearchScene:
     29  o Added empty AddCompound (const G4THitsMap<G4double>&) methods.
     30
     3110th October 2009  John Allison  (modeling-V09-02-03)
     32- G4PhysicalVolumeModel: Added G4PhysicalVolumeModelTouchable.  Used in
     33  ComputeMaterial.  Effective for nested parameterisations.
     34
     3529th September 2009  John Allison  (modeling-V09-02-02)
     36- G4PhysicalVolumeModel.cc: Added warning if logical volume not defined.
    2237
    233825th February 2009  John Allison  (modeling-V09-02-01 - needs greps-V09-02-01)
  • trunk/source/visualization/modeling/include/G4BoundingSphereScene.hh

    r954 r1140  
    2525//
    2626//
    27 // $Id: G4BoundingSphereScene.hh,v 1.18 2008/01/04 21:59:15 allison Exp $
     27// $Id: G4BoundingSphereScene.hh,v 1.19 2009/10/21 14:17:33 allison Exp $
    2828// GEANT4 tag $Name:  $
    2929//
     
    7171  void AddCompound (const G4VTrajectory&) {}
    7272  void AddCompound (const G4VHit&) {}
     73  void AddCompound (const G4THitsMap<G4double>&) {}
    7374  G4VisExtent GetBoundingSphereExtent ();
    7475  const G4Point3D& GetCentre() const {return fCentre;}
  • trunk/source/visualization/modeling/include/G4PhysicalVolumeMassScene.hh

    r954 r1140  
    2525//
    2626//
    27 // $Id: G4PhysicalVolumeMassScene.hh,v 1.9 2008/01/04 21:59:15 allison Exp $
     27// $Id: G4PhysicalVolumeMassScene.hh,v 1.10 2009/10/21 14:17:33 allison Exp $
    2828// GEANT4 tag $Name:  $
    2929//
     
    109109  void AddCompound (const G4VTrajectory&) {}
    110110  void AddCompound (const G4VHit&) {}
     111  void AddCompound (const G4THitsMap<G4double>&) {}
    111112
    112113  ////////////////////////////////////////////////////////////////
  • trunk/source/visualization/modeling/include/G4PhysicalVolumeModel.hh

    r954 r1140  
    2525//
    2626//
    27 // $Id: G4PhysicalVolumeModel.hh,v 1.34 2007/04/03 13:46:49 allison Exp $
     27// $Id: G4PhysicalVolumeModel.hh,v 1.35 2009/10/10 14:29:59 allison Exp $
    2828// GEANT4 tag $Name:  $
    2929//
     
    4949
    5050#include "G4VModel.hh"
     51#include "G4VTouchable.hh"
    5152
    5253#include "G4Transform3D.hh"
     
    7677  public:
    7778    G4PhysicalVolumeNodeID
    78     (G4VPhysicalVolume* pPV = 0, G4int iCopyNo = 0, G4int depth = 0):
    79       fpPV(pPV), fCopyNo(iCopyNo), fNonCulledDepth(depth) {}
     79    (G4VPhysicalVolume* pPV = 0,
     80     G4int iCopyNo = 0,
     81     G4int depth = 0,
     82     const G4Transform3D& transform = G4Transform3D()):
     83      fpPV(pPV),
     84      fCopyNo(iCopyNo),
     85      fNonCulledDepth(depth),
     86      fTransform(transform) {}
    8087    G4VPhysicalVolume* GetPhysicalVolume() const {return fpPV;}
    8188    G4int GetCopyNo() const {return fCopyNo;}
    8289    G4int GetNonCulledDepth() const {return fNonCulledDepth;}
     90    const G4Transform3D& GetTransform() const {return fTransform;}
    8391    G4bool operator< (const G4PhysicalVolumeNodeID& right) const;
    8492  private:
     
    8694    G4int fCopyNo;
    8795    G4int fNonCulledDepth;
     96    G4Transform3D fTransform;
    8897  };
    8998  // Nested class for identifying physical volume nodes.
     99
     100  class G4PhysicalVolumeModelTouchable: public G4VTouchable {
     101  public:
     102    G4PhysicalVolumeModelTouchable
     103    (const std::vector<G4PhysicalVolumeNodeID>& fullPVPath);
     104    const G4ThreeVector& GetTranslation(G4int depth) const;
     105    const G4RotationMatrix* GetRotation(G4int depth) const;
     106    G4VPhysicalVolume* GetVolume(G4int depth) const;
     107    G4VSolid* GetSolid(G4int depth) const;
     108    G4int GetReplicaNumber(G4int depth) const;
     109    G4int GetHistoryDepth() const {return fFullPVPath.size();}
     110  private:
     111    const std::vector<G4PhysicalVolumeNodeID>& fFullPVPath;
     112  };
     113  // Nested class for handling nested parameterisations.
    90114
    91115  G4PhysicalVolumeModel
  • trunk/source/visualization/modeling/include/G4PhysicalVolumeSearchScene.hh

    r954 r1140  
    2525//
    2626//
    27 // $Id: G4PhysicalVolumeSearchScene.hh,v 1.18 2008/01/04 21:59:15 allison Exp $
     27// $Id: G4PhysicalVolumeSearchScene.hh,v 1.19 2009/10/21 14:17:33 allison Exp $
    2828// GEANT4 tag $Name:  $
    2929//
     
    7474  void AddCompound (const G4VTrajectory&) {}
    7575  void AddCompound (const G4VHit&) {}
     76  void AddCompound (const G4THitsMap<G4double>&) {}
    7677  G4int                GetFoundDepth          () const;
    7778  G4VPhysicalVolume*   GetFoundVolume         () const;
  • trunk/source/visualization/modeling/src/G4PhysicalVolumeModel.cc

    r1089 r1140  
    2525//
    2626//
    27 // $Id: G4PhysicalVolumeModel.cc,v 1.63 2007/11/10 14:56:36 allison Exp $
     27// $Id: G4PhysicalVolumeModel.cc,v 1.66 2009/10/23 08:08:19 allison Exp $
    2828// GEANT4 tag $Name:  $
    2929//
     
    4646#include "G4TransportationManager.hh"
    4747#include "G4Polyhedron.hh"
     48#include "HepPolyhedronProcessor.h"
    4849#include "G4AttDefStore.hh"
    4950#include "G4AttDef.hh"
     
    5354
    5455#include <sstream>
    55 
    56 G4bool G4PhysicalVolumeModel::G4PhysicalVolumeNodeID::operator<
    57   (const G4PhysicalVolumeModel::G4PhysicalVolumeNodeID& right) const
    58 {
    59   if (fpPV < right.fpPV) return true;
    60   if (fpPV == right.fpPV) {
    61     if (fCopyNo < right.fCopyNo) return true;
    62     if (fCopyNo == right.fCopyNo)
    63       return fNonCulledDepth < right.fNonCulledDepth;
    64   }
    65   return false;
    66 }
    67 
    68 std::ostream& operator<<
    69   (std::ostream& os, const G4PhysicalVolumeModel::G4PhysicalVolumeNodeID node)
    70 {
    71   G4VPhysicalVolume* pPV = node.GetPhysicalVolume();
    72   if (pPV) {
    73     os << pPV->GetName()
    74        << ':' << node.GetCopyNo()
    75        << '[' << node.GetNonCulledDepth() << ']';
    76   } else {
    77     os << "Null node";
    78   }
    79   return os;
    80 }
    8156
    8257G4PhysicalVolumeModel::G4PhysicalVolumeModel
     
    232207    G4VPVParameterisation* pP = pVPV -> GetParameterisation ();
    233208    if (pP) {  // Parametrised volume.
     209      if (fCurrentDepth == 0) nReplicas = 1;  // Just draw first
    234210      for (int n = 0; n < nReplicas; n++) {
    235211        pSol = pP -> ComputeSolid (n, pVPV);
    236         pMaterial = pP -> ComputeMaterial (n, pVPV);
    237212        pP -> ComputeTransformation (n, pVPV);
    238213        pSol -> ComputeDimensions (pP, n, pVPV);
    239214        pVPV -> SetCopyNo (n);
     215        // Create a touchable of current parent for ComputeMaterial.
     216        // fFullPVPath has not been updated yet so at this point it
     217        // corresponds to the parent.
     218        G4PhysicalVolumeModelTouchable parentTouchable(fFullPVPath);
     219        pMaterial = pP -> ComputeMaterial (n, pVPV, &parentTouchable);
    240220        DescribeAndDescend (pVPV, requestedDepth, pLV, pSol, pMaterial,
    241221                            theAT, sceneHandler);
     
    363343  fpCurrentTransform = &theNewAT;
    364344
    365   /********************************************************
    366   G4cout << "G4PhysicalVolumeModel::DescribeAndDescend: "
    367          << pVPV -> GetName () << "." << pVPV -> GetCopyNo ();
    368   G4cout << "\n  theAT: ";
    369   G4cout << "\n    Rotation: ";
    370   G4RotationMatrix rotation = theAT.getRotation ();
    371   G4cout << rotation.thetaX() << ", "
    372          << rotation.phiX() << ", "
    373          << rotation.thetaY() << ", "
    374          << rotation.phiY() << ", "
    375          << rotation.thetaZ() << ", "
    376          << rotation.phiZ();
    377   G4cout << "\n    Translation: " << theAT.getTranslation();
    378   G4cout << "\n  theNewAT: ";
    379   G4cout << "\n    Rotation: ";
    380   rotation = theNewAT.getRotation ();
    381   G4cout << rotation.thetaX() << ", "
    382          << rotation.phiX() << ", "
    383          << rotation.thetaY() << ", "
    384          << rotation.phiY() << ", "
    385          << rotation.thetaZ() << ", "
    386          << rotation.phiZ();
    387   G4cout << "\n    Translation: " << theNewAT.getTranslation();
    388   G4cout << G4endl;
    389   **********************************************************/
    390 
    391345  // Make decision to draw...
    392346  const G4VisAttributes* pVisAttribs = pLV->GetVisAttributes();
     
    429383  G4int copyNo = fpCurrentPV->GetCopyNo();
    430384  fFullPVPath.push_back
    431     (G4PhysicalVolumeNodeID(fpCurrentPV,copyNo,fCurrentDepth));
     385    (G4PhysicalVolumeNodeID
     386     (fpCurrentPV,copyNo,fCurrentDepth,*fpCurrentTransform));
    432387
    433388  if (thisToBeDrawn) {
     
    436391    G4int copyNo = fpCurrentPV->GetCopyNo();
    437392    fDrawnPVPath.push_back
    438       (G4PhysicalVolumeNodeID(fpCurrentPV,copyNo,fCurrentDepth));
     393      (G4PhysicalVolumeNodeID
     394       (fpCurrentPV,copyNo,fCurrentDepth,*fpCurrentTransform));
    439395
    440396    if (fpMP->IsExplode() && fDrawnPVPath.size() == 1) {
     
    563519    G4Polyhedron* pOriginal = pSol->GetPolyhedron();
    564520    G4Polyhedron::ResetNumberOfRotationSteps();
     521
    565522    if (!pOriginal) {
    566         if (fpMP->IsWarning())
    567           G4cout <<
    568  "WARNING: G4PhysicalVolumeModel::DescribeSolid: solid\n  \""
    569                  << pSol->GetName() <<
    570  "\" has no polyhedron.  Cannot by clipped."
    571                  << G4endl;
    572         pSol -> DescribeYourselfTo (sceneHandler);  // Standard treatment.
     523
     524      if (fpMP->IsWarning())
     525        G4cout <<
     526          "WARNING: G4PhysicalVolumeModel::DescribeSolid: solid\n  \""
     527               << pSol->GetName() <<
     528          "\" has no polyhedron.  Cannot by clipped."
     529               << G4endl;
     530      pSol -> DescribeYourselfTo (sceneHandler);  // Standard treatment.
     531
    573532    } else {
    574533
    575534      G4Polyhedron resultant = *pOriginal;
     535      G4VisAttributes resultantVisAttribs(*pVisAttribs);
    576536
    577537      if (fpClippingPolyhedron) {
    578538        G4Polyhedron clipper = *fpClippingPolyhedron;  // Local copy.
    579539        clipper.Transform(theAT.inverse());
     540        HepPolyhedronProcessor processor;
    580541        switch (fClippingMode) {
    581542        default:
    582         case subtraction: resultant = resultant.subtract(clipper); break;
    583         case intersection: resultant = resultant.intersect(clipper); break;
     543        case subtraction: processor.push_back(HepPolyhedronProcessor::SUBTRACTION, clipper); break;
     544        case intersection: processor.push_back(HepPolyhedronProcessor::INTERSECTION, clipper); break;
    584545        }
    585         if(resultant.IsErrorBooleanProcess()) {
     546        if (!processor.execute(resultant)) {
    586547          if (fpMP->IsWarning())
    587548            G4cout <<
     
    589550 "\n  solid \"" << pSol->GetName() <<
    590551 "\" not defined due to error during Boolean processing."
     552 "\n  It will be drawn in red."
    591553                   << G4endl;
    592           // Nevertheless, keep resultant.
     554          // Nevertheless, keep resultant, but draw it in red
     555          resultantVisAttribs.SetColour(G4Colour::Red());
    593556        }
    594557      }
     
    597560        G4Polyhedron sectioner = *pSectionPolyhedron;  // Local copy.
    598561        sectioner.Transform(theAT.inverse());
    599         resultant = resultant.intersect(sectioner);
    600         if(resultant.IsErrorBooleanProcess()) {
     562        HepPolyhedronProcessor processor;
     563        processor.push_back(HepPolyhedronProcessor::INTERSECTION, sectioner);
     564        if (!processor.execute(resultant)) {
    601565          if (fpMP->IsWarning())
    602566            G4cout <<
     
    604568 "\n  solid \"" << pSol->GetName() <<
    605569 "\" not defined due to error during Boolean processing."
     570 "\n  It will be drawn in red."
    606571                   << G4endl;
    607           // Nevertheless, keep resultant.
     572          // Nevertheless, keep resultant, but draw it in red
     573          resultantVisAttribs.SetColour(G4Colour::Red());
    608574        }
    609575      }
     
    612578        G4Polyhedron cutter = *pCutawayPolyhedron;  // Local copy.
    613579        cutter.Transform(theAT.inverse());
    614         resultant = resultant.subtract(cutter);
    615         if(resultant.IsErrorBooleanProcess()) {
     580        HepPolyhedronProcessor processor;
     581        processor.push_back(HepPolyhedronProcessor::SUBTRACTION, cutter);
     582        if (!processor.execute(resultant)) {
    616583          if (fpMP->IsWarning())
    617584            G4cout <<
     
    619586 "\n  solid \"" << pSol->GetName() <<
    620587 "\" not defined due to error during Boolean processing."
     588 "\n  It will be drawn in red."
    621589                   << G4endl;
    622           // Nevertheless, keep resultant.
     590          // Nevertheless, keep resultant, but draw it in red
     591          resultantVisAttribs.SetColour(G4Colour::Red());
    623592        }
    624593      }
    625594
    626595      // Finally, force polyhedron drawing...
    627       resultant.SetVisAttributes(pVisAttribs);
     596      resultant.SetVisAttributes(resultantVisAttribs);
    628597      sceneHandler.BeginPrimitives(theAT);
    629598      sceneHandler.AddPrimitive(resultant);
     
    760729    if (i != fFullPVPath.size() - 1) oss << '/';
    761730  }
     731
     732  if (!fpCurrentLV) {
     733     G4Exception
     734        ("G4PhysicalVolumeModel::CreateCurrentAttValues",
     735         "",
     736         JustWarning,
     737         "Current logical volume not defined.");
     738     return values;
     739  }
     740
    762741  values->push_back(G4AttValue("PVPath", oss.str(),""));
    763742  if (fpCurrentLV) {
     
    787766  return values;
    788767}
     768
     769G4bool G4PhysicalVolumeModel::G4PhysicalVolumeNodeID::operator<
     770  (const G4PhysicalVolumeModel::G4PhysicalVolumeNodeID& right) const
     771{
     772  if (fpPV < right.fpPV) return true;
     773  if (fpPV == right.fpPV) {
     774    if (fCopyNo < right.fCopyNo) return true;
     775    if (fCopyNo == right.fCopyNo)
     776      return fNonCulledDepth < right.fNonCulledDepth;
     777  }
     778  return false;
     779}
     780
     781std::ostream& operator<<
     782  (std::ostream& os, const G4PhysicalVolumeModel::G4PhysicalVolumeNodeID node)
     783{
     784  G4VPhysicalVolume* pPV = node.GetPhysicalVolume();
     785  if (pPV) {
     786    os << pPV->GetName()
     787       << ':' << node.GetCopyNo()
     788       << '[' << node.GetNonCulledDepth() << ']'
     789       << ':' << node.GetTransform();
     790  } else {
     791    os << "Null node";
     792  }
     793  return os;
     794}
     795
     796G4PhysicalVolumeModel::G4PhysicalVolumeModelTouchable::G4PhysicalVolumeModelTouchable
     797(const std::vector<G4PhysicalVolumeNodeID>& fullPVPath):
     798  fFullPVPath(fullPVPath) {}
     799
     800const G4ThreeVector& G4PhysicalVolumeModel::G4PhysicalVolumeModelTouchable::GetTranslation(G4int depth) const
     801{
     802  size_t i = fFullPVPath.size() - depth - 1;
     803  if (i >= fFullPVPath.size()) {
     804    G4Exception("G4PhysicalVolumeModelTouchable::GetTranslation",
     805                "Index out of range",
     806                FatalErrorInArgument,
     807                "Asking for non-existent depth");
     808  }
     809  static G4ThreeVector tempTranslation;
     810  tempTranslation = fFullPVPath[i].GetTransform().getTranslation();
     811  return tempTranslation;
     812}
     813
     814const G4RotationMatrix* G4PhysicalVolumeModel::G4PhysicalVolumeModelTouchable::GetRotation(G4int depth) const
     815{
     816  size_t i = fFullPVPath.size() - depth - 1;
     817  if (i >= fFullPVPath.size()) {
     818    G4Exception("G4PhysicalVolumeModelTouchable::GetRotation",
     819                "Index out of range",
     820                FatalErrorInArgument,
     821                "Asking for non-existent depth");
     822  }
     823  static G4RotationMatrix tempRotation;
     824  tempRotation = fFullPVPath[i].GetTransform().getRotation();
     825  return &tempRotation;
     826}
     827
     828G4VPhysicalVolume* G4PhysicalVolumeModel::G4PhysicalVolumeModelTouchable::GetVolume(G4int depth) const
     829{
     830  size_t i = fFullPVPath.size() - depth - 1;
     831  if (i >= fFullPVPath.size()) {
     832    G4Exception("G4PhysicalVolumeModelTouchable::GetVolume",
     833                "Index out of range",
     834                FatalErrorInArgument,
     835                "Asking for non-existent depth");
     836  }
     837  return fFullPVPath[i].GetPhysicalVolume();
     838}
     839
     840G4VSolid* G4PhysicalVolumeModel::G4PhysicalVolumeModelTouchable::GetSolid(G4int depth) const
     841{
     842  size_t i = fFullPVPath.size() - depth - 1;
     843  if (i >= fFullPVPath.size()) {
     844    G4Exception("G4PhysicalVolumeModelTouchable::GetSolid",
     845                "Index out of range",
     846                FatalErrorInArgument,
     847                "Asking for non-existent depth");
     848  }
     849  return fFullPVPath[i].GetPhysicalVolume()->GetLogicalVolume()->GetSolid();
     850}
     851
     852G4int G4PhysicalVolumeModel::G4PhysicalVolumeModelTouchable::GetReplicaNumber(G4int depth) const
     853{
     854  size_t i = fFullPVPath.size() - depth - 1;
     855  if (i >= fFullPVPath.size()) {
     856    G4Exception("G4PhysicalVolumeModelTouchable::GetReplicaNumber",
     857                "Index out of range",
     858                FatalErrorInArgument,
     859                "Asking for non-existent depth");
     860  }
     861  return fFullPVPath[i].GetCopyNo();
     862}
  • trunk/source/visualization/test/History

    r1093 r1140  
    1 $Id: History,v 1.117 2009/07/28 12:50:51 lgarnier Exp $
     1$Id: History,v 1.119 2009/09/29 21:36:38 allison Exp $
    22
    33History file for visualization/test subdirectory
     
    55
    66$Log: History,v $
     7Revision 1.119  2009/09/29 21:36:38  allison
     8vistest-V09-02-00
     9
     10Revision 1.118  2009/09/29 21:35:56  allison
     11Changed main program, test19.cc, to use G4UIExecutive.
     12
    713Revision 1.117  2009/07/28 12:50:51  lgarnier
    814Adding Qt support for test19
  • trunk/source/visualization/test/test19.cc

    r1093 r1140  
    2525//
    2626//
    27 // $Id: test19.cc,v 1.30 2009/07/28 12:50:51 lgarnier Exp $
     27// $Id: test19.cc,v 1.31 2009/09/29 21:35:56 allison Exp $
    2828// GEANT4 tag $Name:  $
    2929//
     
    4848#include "MySteppingAction.hh"
    4949
    50 #include "G4UIterminal.hh"
    51 #if defined(G4UI_USE_GAG)
    52   #include "G4UIGAG.hh"
    53 #elif defined(G4UI_USE_TCSH)
    54   #include "G4UItcsh.hh"
    55 #elif defined(G4UI_USE_WO)
    56   #include "G4UIWo.hh"
    57 #elif defined(G4UI_USE_XM)
    58   #include "G4UIXm.hh"
    59 #elif defined(G4UI_USE_XAW)
    60   #include "G4UIXaw.hh"
    61 #elif defined(G4UI_USE_WIN32)
    62   #include "G4UIWin32.hh"
    63 #elif defined(G4UI_USE_QT)
    64   #include "G4UIQt.hh"
     50#ifdef G4UI_USE
     51#include "G4UIExecutive.hh"
    6552#endif
    6653
     
    9380#endif
    9481
     82#ifdef G4UI_USE
    9583  // Choose (G)UI.
    96   G4UIsession* session;
    97 #ifdef G4UI_USE_WIN32
    98   session = new G4UIWin32 (hInstance,hPrevInstance,lpszCmdLine,nCmdShow);
    99 #else
    100   if (argc >= 2) {
    101   #if defined(G4UI_USE_TCSH)
    102     if (strcmp (argv[1], "tcsh")==0)     session =
    103       new G4UIterminal(new G4UItcsh);
    104   #elif defined(G4UI_USE_WO)
    105     if (strcmp (argv[1], "Wo")==0)  session = new G4UIWo (argc, argv);
    106   #elif defined(G4UI_USE_XM)
    107     if (strcmp (argv[1], "Xm")==0)  session = new G4UIXm (argc, argv);
    108   #elif defined(G4UI_USE_XAW)
    109     if (strcmp (argv[1], "Xaw")==0) session = new G4UIXaw (argc, argv);
    110   #elif defined(G4UI_USE_GAG)
    111     if (strcmp (argv[1], "gag")==0) session = new G4UIGAG ;
    112   #elif defined(G4UI_USE_QT)
    113     if (strcmp (argv[1], "Qt")==0)  session = new G4UIQt (argc, argv);
    114   #else
    115     session = new G4UIterminal();
    116   #endif
    117     else  session = new G4UIterminal();
    118   }
    119   else                                   
    120   {
    121     G4cerr << "You should define a UI in order to interact with test" << G4endl;
    122     return 0;
    123   }
     84  G4UIExecutive* UIexecutive = new G4UIExecutive(argc, argv);
     85  G4UImanager::GetUIpointer()->SetSession(UIexecutive->GetSession());  //So that Pause works..
    12486#endif
    125   G4UImanager::GetUIpointer()->SetSession(session);  //So that Pause works..
    12687
    12788  // Run manager
     
    159120
    160121  G4UImanager* UI = G4UImanager::GetUIpointer ();
    161 
    162122#ifdef G4UI_USE_WIN32
    163123  G4cout << "Reading win32.g4m file...." << G4endl;
     
    173133       << G4endl;
    174134
     135#ifdef G4UI_USE
    175136  // Start an interactive session.
    176   session -> SessionStart();
     137  UIexecutive -> SessionStart();
     138#endif
    177139
    178140#ifdef G4VIS_USE
     
    185147  G4cout << "vis_test19: Run manager deleted." << G4endl;
    186148  G4cout << "vis_test19: Deleting session..." << G4endl;
    187   delete session;
     149#ifdef G4UI_USE
     150  delete UIexecutive;
    188151  G4cout << "vis_test19: Session deleted." << G4endl;
     152#endif
    189153
    190154  return 0;
Note: See TracChangeset for help on using the changeset viewer.