Changeset 1140 for trunk/source
- Timestamp:
- Nov 3, 2009, 11:17:28 AM (15 years ago)
- Location:
- trunk/source
- Files:
-
- 54 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/digits_hits/utils/include/G4VScoringMesh.hh
r998 r1140 25 25 // 26 26 // 27 // $Id: G4VScoringMesh.hh,v 1.2 7 2007/11/06 17:17:14 asaimExp $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: $ 29 29 // 30 30 … … 94 94 // set size of this mesh 95 95 void SetSize(G4double size[3]); 96 // get size of this mesh 97 G4ThreeVector GetSize() const; 96 98 // set position of center of this mesh 97 99 void SetCenterPosition(G4double centerPosition[3]); 100 // get position of center of this mesh 101 G4ThreeVector GetTranslation() const {return fCenterPosition;} 98 102 // set a rotation angle around the x axis 99 103 void RotateX(G4double delta); … … 102 106 // set a rotation angle around the z axis 103 107 void RotateZ(G4double delta); 108 // get a rotation matrix 109 G4RotationMatrix GetRotationMatrix() const { 110 if(fRotationMatrix) return *fRotationMatrix; 111 else return G4RotationMatrix::IDENTITY; 112 } 104 113 // set number of segments of this mesh 105 114 void SetNumberOfSegments(G4int nSegment[3]); -
trunk/source/digits_hits/utils/src/G4ScoreLogColorMap.cc
r998 r1140 25 25 // 26 26 // 27 // $Id: G4ScoreLogColorMap.cc,v 1. 2 2008/03/25 04:06:08akimura 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: $ 29 29 // 30 30 31 31 #include "G4ScoreLogColorMap.hh" 32 32 #include <cmath> 33 #include <string> 34 #include <sstream> 35 #include <iomanip> 33 36 34 37 … … 152 155 } 153 156 // 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()); 157 164 G4Text text(value, G4Point3D(-0.9, -0.9+0.05*n, 0)); 158 165 G4double size = 12.; -
trunk/source/digits_hits/utils/src/G4VScoreColorMap.cc
r998 r1140 25 25 // 26 26 // 27 // $Id: G4VScoreColorMap.cc,v 1. 3 2008/02/14 10:45:12akimura 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: $ 29 29 // 30 30 31 31 #include "G4VScoreColorMap.hh" 32 #include <string> 33 #include <sstream> 34 #include <iomanip> 32 35 33 36 #include "G4VVisManager.hh" … … 94 97 } 95 98 // 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 99 107 G4Text text(value, G4Point3D(-0.9, -0.9+0.05*n, 0)); 100 108 G4double size = 12.; -
trunk/source/digits_hits/utils/src/G4VScoringMesh.cc
r998 r1140 25 25 // 26 26 // 27 // $Id: G4VScoringMesh.cc,v 1.3 5 2008/03/23 14:32:13akimura 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: $ 29 29 // 30 30 … … 63 63 for(int i = 0; i < 3; i++) fSize[i] = size[i]; 64 64 sizeIsSet = true; 65 } 66 G4ThreeVector G4VScoringMesh::GetSize() const { 67 if(sizeIsSet) 68 return G4ThreeVector(fSize[0], fSize[1], fSize[2]); 69 else 70 return G4ThreeVector(0., 0., 0.); 65 71 } 66 72 void G4VScoringMesh::SetCenterPosition(G4double centerPosition[3]) { -
trunk/source/graphics_reps/History
r932 r1140 1 cvs log $Id: History,v 1.13 5 2009/02/25 14:13:43allison Exp $1 cvs log $Id: History,v 1.138 2009/10/28 13:40:40 allison Exp $ 2 2 ------------------------------------------------------------------- 3 3 … … 17 17 * Reverse chronological order (last date on top), please * 18 18 ---------------------------------------------------------- 19 20 28th 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 27 20th 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 36 20th October 2009 John Allison (greps-V09-02-02 coworks vis-V09-02-07) 37 - G4VGraphicsScene: Added AddCompound (const G4THitsMap<G4double>&). 19 38 20 39 25th February 2009 John Allison (greps-V09-02-01) -
trunk/source/graphics_reps/include/G4VGraphicsScene.hh
r1058 r1140 25 25 // 26 26 // 27 // $Id: G4VGraphicsScene.hh,v 1.1 1 2008/01/04 22:20:59allison 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: $ 29 29 // John Allison 19th July 1996 30 30 // … … 37 37 #ifndef G4VGRAPHICSSCENE_HH 38 38 #define G4VGRAPHICSSCENE_HH 39 40 #include "globals.hh" 41 #include "G4Transform3D.hh" 39 42 40 43 class G4VisAttributes; … … 54 57 class G4VTrajectory; 55 58 class G4VHit; 59 template <typename T> class G4THitsMap; 56 60 class G4Polyline; 57 61 class G4Scale; … … 62 66 class G4Polyhedron; 63 67 class G4NURBS; 64 65 #include "G4Transform3D.hh"66 68 67 69 class G4VGraphicsScene { … … 112 114 // above. 113 115 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; 116 119 117 120 /////////////////////////////////////////////////////////////////// -
trunk/source/graphics_reps/include/HepPolyhedron.h
r1058 r1140 25 25 // 26 26 // 27 // $Id: HepPolyhedron.h,v 1.2 4 2008/04/14 08:50:23 gcosmoExp $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: $ 29 29 // 30 30 // … … 107 107 // ResetNumberOfRotationSteps() - reset number of steps for whole circle 108 108 // to default value; 109 // IsErrorBooleanProcess()- true if there has been an error during the110 // processing of a Boolean operation.111 109 // History: 112 110 // … … 165 163 // - added HepPolyhedronEllipsoid 166 164 // 165 // 21.10.09 J.Allison 166 // - removed IsErrorBooleanProcess (now error is returned through argument) 167 // 167 168 168 169 #ifndef HEP_POLYHEDRON_HH … … 313 314 HepPolyhedron subtract(const HepPolyhedron &p) const; 314 315 HepPolyhedron intersect(const HepPolyhedron &p) const; 315 // If there has been an error during the above processing..316 bool IsErrorBooleanProcess() const;317 316 318 317 // Get area of the surface of the polyhedron -
trunk/source/graphics_reps/src/BooleanProcessor.src
r830 r1140 9 9 ***********************************************************************/ 10 10 11 //G.Barrand : begin 12 #define BP_GEANT4 13 14 #ifdef BP_GEANT4 //G.Barrand 15 11 16 #include <CLHEP/Geometry/Plane3D.h> 12 13 using namespace HepGeom; 17 #include <CLHEP/Geometry/Plane3D.h> 18 typedef HepGeom::Plane3D<double> HVPlane3D; 19 typedef HepGeom::Point3D<double> HVPoint3D; 20 typedef 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> 35 typedef HEPVis::SbPlane HVPlane3D; 36 37 #endif 38 39 //using namespace HepGeom; 40 41 //#define BP_DEBUG 42 43 //G.Barrand : end 14 44 15 45 #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 ; 18 49 19 50 #define SWAP(A,B) w = A; A = B; B = w … … 36 67 37 68 // -------------------------------------------- Simplified STL vector --- 69 //G.Barrand : begin 70 #include <vector> 71 using namespace std; 72 /* 38 73 template<class T> 39 74 class vector { … … 68 103 } 69 104 }; 105 */ 106 //G.Barrand : end 70 107 71 108 // ---------------------------------------------------- Extended node --- 72 109 class ExtNode { 73 110 public: 74 Point3D<double>v;111 HVPoint3D v; 75 112 int s; 76 113 77 114 public: 78 ExtNode( Point3D<double> vertex=Point3D<double>(), int status=0)115 ExtNode(HVPoint3D vertex=HVPoint3D(), int status=0) 79 116 : v(vertex), s(status) {} 80 117 ~ExtNode() {} … … 126 163 // ---------------------------------------------------- Extended face --- 127 164 class ExtFace { 165 private: 166 std::vector<ExtEdge>& edges; //G.Barrand 128 167 public: 129 168 int iedges[4]; // indices of original edges 130 Plane3D<double>plane; // face plane169 HVPlane3D plane; // face plane 131 170 double rmin[3], rmax[3]; // bounding box 132 171 int iold; // head of the list of the original edges … … 136 175 137 176 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 } 139 184 ~ExtFace() {} 140 185 141 186 ExtFace(const ExtFace & face) : 187 edges(face.edges), //G.Barrand 142 188 plane(face.plane), iold(face.iold), inew(face.inew), 143 189 iprev(face.iprev), inext(face.inext) … … 149 195 150 196 ExtFace & operator=(const ExtFace & face) { 197 //FIXME : edges(face.edges) ???? //G.Barrand 151 198 int i; 152 199 for (i=0; i<4; i++) { iedges[i] = face.iedges[i]; } … … 164 211 165 212 // ---------------------------------------------------- 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 169 219 170 220 // ---------------------------------------------------- List of faces --- 171 221 class FaceList { 172 222 private: 223 std::vector<ExtFace>& faces; //G.Barrad : end 224 private: 173 225 int ihead; 174 226 int ilast; 175 227 176 228 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) {} 178 231 ~FaceList() {} 179 232 … … 183 236 void push_back(int i) { 184 237 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; 187 241 ilast = i; 188 242 } 189 243 190 244 void remove(int i) { 245 ExtFace& face = faces[i]; //G.Barrand : optimize. 191 246 if (ihead == i) { 192 ihead = face s[i].inext;247 ihead = face.inext; 193 248 }else{ 194 faces[face s[i].iprev].inext = faces[i].inext;249 faces[face.iprev].inext = face.inext; 195 250 } 196 251 if (ilast == i) { 197 ilast = face s[i].iprev;252 ilast = face.iprev; 198 253 }else{ 199 faces[face s[i].inext].iprev = faces[i].iprev;200 } 201 face s[i].iprev = 0;202 face s[i].inext = 0;254 faces[face.inext].iprev = face.iprev; 255 } 256 face.iprev = 0; 257 face.inext = 0; 203 258 } 204 259 }; … … 215 270 // ----------------------------------------- Boolean processor class --- 216 271 class 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 217 277 private: 218 278 int processor_error; // is set in case of error … … 264 324 265 325 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 267 335 ~BooleanProcessor() {} 268 336 269 337 HepPolyhedron execute(int op, 270 338 const HepPolyhedron &a, 271 const HepPolyhedron &b); 339 const HepPolyhedron &b, 340 int& err); 272 341 273 342 void draw(); … … 278 347 void print_edge(int); 279 348 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 280 354 }; 281 355 … … 294 368 iEprev = 0; iEcur = iold; 295 369 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; 299 374 iEprev = iEcur; 300 375 iEcur = iEnext; … … 304 379 iEprev = 0; iEcur = inew; 305 380 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; 309 385 iEprev = iEcur; 310 386 iEcur = iEnext; … … 312 388 if (inew > 0) inew = iEprev; 313 389 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 315 395 } 316 396 … … 336 416 // } 337 417 338 Point3D<double>ppp;418 HVPoint3D ppp; 339 419 for (i=1; i <= p.GetNoVertices(); i++) { 420 #ifdef BP_GEANT4 //G.Barrand 340 421 ppp = p.GetVertex(i); 341 422 ppp.setX(ppp.x()+dx); 342 423 ppp.setY(ppp.y()+dy); 343 424 ppp.setZ(ppp.z()+dz); 425 #else 426 ppp = p.GetVertexFast(i); 427 ppp += HVPoint3D(dx,dy,dz); 428 #endif 344 429 nodes.push_back(ExtNode(ppp)); 345 430 } … … 348 433 349 434 for (int iface=1; iface <= p.GetNoFacets(); iface++) { 350 faces.push_back(ExtFace(edges .size()));435 faces.push_back(ExtFace(edges,edges.size())); 351 436 352 437 // S E T F A C E N O D E S … … 354 439 p.GetFacet(iface, nnode, iNodes, iVis, iFaces); 355 440 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 } 358 460 iNodes[i] += dnode; 359 461 iFaces[i] += dface; … … 374 476 // S E T F A C E M I N - M A X 375 477 478 ExtFace& face = faces.back(); //G.Barrand : optimize. 376 479 for (i=0; i<3; i++) { 377 face s.back().rmin[i] = nodes[iNodes[0]].v[i];378 face s.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]; 379 482 } 380 483 for (i=1; i<nnode; i++) { 484 ExtNode& node = nodes[iNodes[i]]; //G.Barrand : optimize. 381 485 for (k=0; k<3; k++) { 382 if (face s.back().rmin[k] > nodes[iNodes[i]].v[k])383 face s.back().rmin[k] = nodes[iNodes[i]].v[k];384 if (face s.back().rmax[k] < nodes[iNodes[i]].v[k])385 face s.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]; 386 490 } 387 491 } … … 389 493 // S E T F A C E P L A N E 390 494 391 Normal3D<double>n = (nodes[iNodes[2]].v-nodes[iNodes[0]].v).cross495 HVNormal3D n = (nodes[iNodes[2]].v-nodes[iNodes[0]].v).cross 392 496 (nodes[iNodes[3]].v-nodes[iNodes[1]].v); 393 Point3D<double>p(0,0,0);497 HVPoint3D p(0,0,0); 394 498 395 499 for (i=0; i<nnode; i++) { p += nodes[iNodes[i]].v; } 396 500 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 398 503 399 504 // 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 … … 431 536 iface = faces[ifaces1].inext; 432 537 while(iface > 0) { 538 ExtFace& face = faces[iface]; //G.Barrand 433 539 for (i=0; i<3; i++) { 434 if (rmin1[i] > face s[iface].rmin[i]) rmin1[i] = faces[iface].rmin[i];435 if (rmax1[i] < face s[iface].rmax[i]) rmax1[i] = faces[iface].rmax[i];436 } 437 iface = face s[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; 438 544 } 439 545 440 546 iface = faces[ifaces2].inext; 441 547 while(iface > 0) { 548 ExtFace& face = faces[iface]; //G.Barrand 442 549 for (i=0; i<3; i++) { 443 if (rmin2[i] > face s[iface].rmin[i]) rmin2[i] = faces[iface].rmin[i];444 if (rmax2[i] < face s[iface].rmax[i]) rmax2[i] = faces[iface].rmax[i];445 } 446 iface = face s[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; 447 554 } 448 555 … … 476 583 { 477 584 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]) }; 486 593 prev = &ifaces; 487 594 while (iface > 0) { … … 490 597 491 598 outflag = 0; 599 ExtFace& face = faces[iface]; //G.Barrand : optimize. 492 600 for (i=0; i<3; i++) { 493 if (face s[iface].rmin[i] > rmax[i] + del) { outflag = 1; break; }494 if (face s[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; } 495 603 } 496 604 … … 501 609 double d; 502 610 for (i=0; i<8; i++) { 503 d = face s[iface].plane.distance(mmbox[i]);611 d = face.plane.distance(mmbox[i]); //G.Barrand : optimize 504 612 if (d > +del) npos++; 505 613 if (d < -del) nneg++; … … 511 619 512 620 if (outflag == 1) { 513 *prev = face s[iface].inext;514 face s[iface].inext = iout;621 *prev = face.inext; 622 face.inext = iout; 515 623 iout = iface; 516 624 }else{ 517 prev = &faces[iface].inext; 518 } 625 prev = &face.inext; 626 } 627 519 628 iface = *prev; 520 629 } … … 532 641 { 533 642 int iface = edge.iface1; 534 Plane3D<double>plane = faces[edge.iface2].plane;643 HVPlane3D plane = faces[edge.iface2].plane; 535 644 int i, nnode, npos = 0, nneg = 0, nzer = 0; 536 645 double dd[5]; … … 599 708 i1 = edges[iedge].i1; 600 709 i2 = edges[iedge].i2; 710 601 711 d1 = plane.distance(nodes[i1].v); 602 712 d2 = plane.distance(nodes[i2].v); … … 610 720 iedge = edges[iedge].inext; 611 721 } 612 if (ii[i] == nodes.size()) {722 if (ii[i] == (int)nodes.size()) { 613 723 dd = d2-d1; d1 = d1/dd; d2 = d2/dd; 614 724 nodes.push_back(ExtNode(d2*nodes[i1].v-d1*nodes[i2].v, iedge)); … … 795 905 { 796 906 processor_error = 1; 907 #ifdef BP_DEBUG 797 908 std::cout 798 909 << "BooleanProcessor::caseIE : unimplemented case" 799 910 << std::endl; 911 #endif 800 912 } 801 913 … … 811 923 { 812 924 processor_error = 1; 925 #ifdef BP_DEBUG 813 926 std::cout 814 927 << "BooleanProcessor::caseEE : unimplemented case" 815 928 << std::endl; 929 #endif 816 930 } 817 931 … … 831 945 // M I N - M A X 832 946 947 {const ExtFace& face_1 = faces[iface1]; //G.Barrand : optimize 948 const ExtFace& face_2 = faces[iface2]; 833 949 for (int i=0; i<3; i++) { 834 if (face s[iface1].rmin[i] > faces[iface2].rmax[i] + del) return;835 if (face s[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 }} 837 953 838 954 // F A C E - 1 vs P L A N E - 2 … … 929 1045 *ilink = A; ilink = &edges[A].inext; *ilink = 0 930 1046 1047 ExtFace& face = faces[iface]; //G.Barrand : optimize. 931 1048 ilink = &ihead; 932 1049 for(;;) { 933 if (face s[iface].inew == 0) break;1050 if (face.inew == 0) break; 934 1051 935 1052 // S T A R T N E W C O N T O U R 936 1053 937 icur = face s[iface].inew;938 face s[iface].inew = edges[icur].inext;1054 icur = face.inew; 1055 face.inew = edges[icur].inext; 939 1056 INSERT_EDGE_TO_THE_LIST(icur); 940 1057 ifirst = edges[icur].i1; … … 943 1060 944 1061 for (;;) { 945 i = &faces[iface].inew; 1062 i = &face.inew; 1063 ExtEdge& edge_cur = edges[icur]; 946 1064 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; 949 1068 } 950 1069 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; 956 1078 } 957 1079 } … … 963 1085 }else{ 964 1086 processor_error = 1; 1087 #ifdef BP_DEBUG 965 1088 std::cerr 966 1089 << "BooleanProcessor::assembleFace(" << iface << ") : " 967 1090 << "could not find next edge of the contour" 968 1091 << std::endl; 969 faces[iface].inew = DEFECTIVE_FACE; 1092 #endif 1093 face.inew = DEFECTIVE_FACE; 970 1094 return; 971 1095 } … … 976 1100 977 1101 int iedge; 978 iedge = face s[iface].iold;1102 iedge = face.iold; 979 1103 if (what == 0 && ioldflag == 0 && iedge > 0) { 980 1104 for (;;) { … … 986 1110 } 987 1111 }else{ 988 if (edges[iedge].i2 == edges[face s[iface].iold].i1) {1112 if (edges[iedge].i2 == edges[face.iold].i1) { 989 1113 edges[iedge].inext = ihead; // set new face 990 1114 return; … … 999 1123 1000 1124 int iface2; 1001 iedge = face s[iface].iold;1125 iedge = face.iold; 1002 1126 while(iedge > 0) { 1003 1127 iface2 = edges[iedge].iface2; … … 1005 1129 iedge = edges[iedge].inext; 1006 1130 } 1007 face s[iface].iold = ihead; // set new face1131 face.iold = ihead; // set new face 1008 1132 } 1009 1133 … … 1186 1310 unsuitable_faces.remove(i); 1187 1311 } 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 1188 1340 } 1189 1341 … … 1203 1355 a = y1 - y2; 1204 1356 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 1206 1359 a /= w; 1207 1360 b /= w; … … 1268 1421 int icontour, iedge, k1, k2; 1269 1422 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++) { 1271 1424 iedge = external_contours[icontour]; 1272 1425 while(iedge > 0) { … … 1296 1449 // 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 1297 1450 1298 for(icontour=0; icontour< internal_contours.size(); icontour++) {1451 for(icontour=0; icontour<(int)internal_contours.size(); icontour++) { 1299 1452 iedge = internal_contours[icontour]; 1300 1453 while(iedge > 0) { … … 1478 1631 // L O O P A L O N G C O N T O U R 1479 1632 1633 //std::cerr << "debug : contour : begin : =================" << std::endl; 1634 //dump();//debug 1635 1480 1636 int iedge1, iedge2, iedge3, istart = 0; 1481 1637 for (;;) { 1482 1638 iedge1 = edges[ipnext].inext; 1483 1639 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 */ 1484 1648 if (istart == 0) { 1485 1649 istart = iedge1; … … 1490 1654 edges[iedge3].iface1 = faces.size(); 1491 1655 edges[iedge3].inext = 0; 1492 faces.push_back(ExtFace( ));1656 faces.push_back(ExtFace(edges,0)); //G.Barrand : ok ? 1493 1657 faces.back().iold = iedge1; 1494 1658 faces.back().inew = ORIGINAL_FACE; … … 1500 1664 }else if (istart == iedge1) { 1501 1665 processor_error = 1; 1666 #ifdef BP_DEBUG 1502 1667 std::cerr 1503 1668 << "BooleanProcessor::triangulateContour : " 1504 1669 << "could not generate a triangle (infinite loop)" 1505 1670 << std::endl; 1671 #endif 1506 1672 break; 1507 1673 } … … 1529 1695 edges[iedge2].inext = edges.size(); 1530 1696 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 ? 1532 1698 faces.back().iold = iedge1; 1533 1699 faces.back().inew = ORIGINAL_FACE; … … 1562 1728 } 1563 1729 processor_error = 1; 1730 #ifdef BP_DEBUG 1564 1731 std::cerr 1565 1732 << "BooleanProcessor::modifyReference : could not find the edge, " 1566 1733 << "iface=" << iface << ", i1,i2=" << i1 << "," << i2 << ", iref=" << iref 1567 1734 << std::endl; 1735 #endif 1568 1736 } 1569 1737 … … 1582 1750 // S E T IX, IY, IZ 1583 1751 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 1585 1757 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 1588 1762 if (normal[iz] > 0) { 1589 1763 ix = (iz+1)%3; iy = (ix+1)%3; … … 1606 1780 i1 = edges[iedge].i1; 1607 1781 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]; 1609 1785 if (ifirst != i2) { 1610 1786 iedge = edges[iedge].inext; … … 1617 1793 }else{ 1618 1794 processor_error = 1; 1795 #ifdef BP_DEBUG 1619 1796 std::cerr 1620 1797 << "BooleanProcessor::triangulateFace : too small contour" 1621 1798 << std::endl; 1799 #endif 1622 1800 } 1623 1801 icontour = edges[iedge].inext; … … 1627 1805 }else{ 1628 1806 processor_error = 1; 1807 #ifdef BP_DEBUG 1629 1808 std::cerr 1630 1809 << "BooleanProcessor::triangulateFace : broken contour" 1631 1810 << std::endl; 1811 #endif 1632 1812 icontour = 0; 1633 1813 break; … … 1639 1819 1640 1820 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++) { 1643 1823 mergeContours(ix, iy, kext, kint); 1644 1824 if (internal_contours[kint] == 0) break; 1645 1825 } 1646 if (kext == external_contours.size()) {1826 if (kext == (int)external_contours.size()) { 1647 1827 processor_error = 1; 1828 #ifdef BP_DEBUG 1648 1829 std::cerr 1649 1830 << "BooleanProcessor::triangulateFace : " 1650 1831 << "could not merge internal contour " << kint 1651 1832 << std::endl; 1833 #endif 1652 1834 } 1653 1835 } … … 1656 1838 1657 1839 int nface = faces.size(); 1658 for (kext=0; kext < external_contours.size(); kext++) {1840 for (kext=0; kext < (int)external_contours.size(); kext++) { 1659 1841 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 1660 1851 } 1661 1852 faces[iface].inew = UNSUITABLE_FACE; … … 1663 1854 // M O D I F Y R E F E R E N C E S 1664 1855 1665 for (int ifa=nface; ifa< faces.size(); ifa++) {1856 for (int ifa=nface; ifa<(int)faces.size(); ifa++) { 1666 1857 iedge = faces[ifa].iold; 1667 1858 while (iedge > 0) { 1668 1859 if (edges[iedge].iface1 != ifa) { 1669 1860 processor_error = 1; 1861 #ifdef BP_DEBUG 1670 1862 std::cerr 1671 1863 << "BooleanProcessor::triangulateFace : wrong reference to itself, " 1672 1864 << "iface=" << ifa << ", iface1=" << edges[iedge].iface1 1673 1865 << std::endl; 1866 #endif 1674 1867 }else if (edges[iedge].iface2 > 0) { 1675 1868 modifyReference(edges[iedge].iface2, … … 1697 1890 // R E N U M E R A T E N O D E S A N D F A C E S 1698 1891 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++) { 1702 1895 if (faces[i].inew == ORIGINAL_FACE) { 1703 1896 faces[i].inew = ++nface; … … 1712 1905 } 1713 1906 1714 for (i=1; i< nodes.size(); i++) {1907 for (i=1; i<(int)nodes.size(); i++) { 1715 1908 if (nodes[i].s == 1) nodes[i].s = ++nnode; 1716 1909 } … … 1724 1917 // S E T N O D E S 1725 1918 1726 for (i=1; i< nodes.size(); i++) {1919 for (i=1; i<(int)nodes.size(); i++) { 1727 1920 if (nodes[i].s != 0) polyhedron.pV[nodes[i].s] = nodes[i].v; 1728 1921 } … … 1731 1924 1732 1925 int k, v[4], f[4]; 1733 for (i=1; i< faces.size(); i++) {1926 for (i=1; i<(int)faces.size(); i++) { 1734 1927 if (faces[i].inew == 0) continue; 1735 1928 v[3] = f[3] = k = 0; … … 1755 1948 } 1756 1949 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]); 1758 1951 } 1759 1952 return polyhedron; 1760 1953 } 1954 1955 int BooleanProcessor::ishift = 0; //G.Barrand 1956 int BooleanProcessor::get_shift() { return ishift;} //G.Barrand 1957 void BooleanProcessor::set_shift(int a_shift) { ishift = a_shift;} //G.Barrand 1958 #define NUM_SHIFT 8 1959 int BooleanProcessor::get_num_shift() { return NUM_SHIFT;} //G.Barrand 1761 1960 1762 1961 HepPolyhedron BooleanProcessor::execute(int op, 1763 1962 const HepPolyhedron & a, 1764 const HepPolyhedron & b) 1963 const HepPolyhedron & b, 1964 int& err) //G.Barrand 1765 1965 /*********************************************************************** 1766 1966 * * … … 1772 1972 ***********************************************************************/ 1773 1973 { 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 1776 1977 { 31, 23, 17}, 1777 1978 { -31, -23, -17}, … … 1784 1985 }; 1785 1986 1987 /* 1988 std::cerr << "BooleanProcessor::execute : ++++++++++++++++++++++" 1989 << a.getName().getString() 1990 << b.getName().getString() 1991 << std::endl; 1992 */ 1993 1786 1994 // I N I T I A T E P R O C E S S O R 1787 1995 … … 1790 1998 nodes.clear(); nodes.push_back(CRAZY_POINT); 1791 1999 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 ? 1793 2001 1794 2002 // T A K E P O L Y H E D R A … … 1801 2009 << "BooleanProcessor: corrapted input polyhedron" 1802 2010 << std::endl; 2011 err = processor_error; //G.Barrand 1803 2012 return HepPolyhedron(); 1804 2013 } 1805 2014 if (ifaces1 == ifaces2) { // a is empty 2015 err = processor_error; //G.Barrand 1806 2016 switch (operation) { 1807 2017 case OP_UNION: … … 1819 2029 } 1820 2030 } 1821 if (ifaces2 == faces.size()) { // b is empty 2031 if (ifaces2 == (int)faces.size()) { // b is empty 2032 err = processor_error; //G.Barrand 1822 2033 switch (operation) { 1823 2034 case OP_UNION: … … 1839 2050 // W O R K A R O U N D T O A V O I D I E A N D E E 1840 2051 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 1841 2063 double ddxx = del*shift[ishift][0]; 1842 2064 double ddyy = del*shift[ishift][1]; 1843 2065 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 1846 2069 operation = op; 1847 2070 nodes.clear(); nodes.push_back(CRAZY_POINT); 1848 2071 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 ? 1850 2073 1851 2074 ifaces1 = faces.size(); takePolyhedron(a,0,0,0); 1852 2075 ifaces2 = faces.size(); takePolyhedron(b,ddxx,ddyy,ddzz); 2076 2077 if (processor_error) { PROCESSOR_ERROR(1) } //G.Barrand 1853 2078 1854 2079 del = findMinMax(); … … 1859 2084 selectOutsideFaces(ifaces1, iout1); 1860 2085 selectOutsideFaces(ifaces2, iout2); 2086 2087 if (processor_error) { PROCESSOR_ERROR(2) } //G.Barrand 1861 2088 1862 2089 // 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 … … 1875 2102 } 1876 2103 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 1880 2105 1881 2106 // F I N D N E W E D G E S … … 1892 2117 } 1893 2118 } 1894 if (processor_error) { PROCESSOR_ERROR }2119 if (processor_error) { PROCESSOR_ERROR(4) } //G.Barrand 1895 2120 1896 2121 // C O N S T R U C T N E W F A C E S 1897 2122 1898 2123 assembleNewFaces((operation == OP_INTERSECTION) ? 1 : 0, ifaces1); 1899 if (processor_error) { PROCESSOR_ERROR }2124 if (processor_error) { PROCESSOR_ERROR(5) } //G.Barrand 1900 2125 assembleNewFaces((operation == OP_UNION) ? 0 : 1, ifaces2); 1901 if (processor_error) { PROCESSOR_ERROR }2126 if (processor_error) { PROCESSOR_ERROR(6) } //G.Barrand 1902 2127 1903 2128 // A S S E M B L E S U I T A B L E F A C E S … … 1908 2133 if (unknown_faces.front() != 0) { 1909 2134 processor_error = 1; 2135 #ifdef BP_DEBUG 1910 2136 std::cerr 1911 2137 << "BooleanProcessor::execute : unknown faces !!!" 1912 2138 << std::endl; 2139 #endif 1913 2140 } 1914 2141 break; 1915 2142 } 1916 if (processor_error) { PROCESSOR_ERROR }2143 if (processor_error) { PROCESSOR_ERROR(7) } //G.Barrand 1917 2144 1918 2145 // T R I A N G U L A T E A C C E P T E D F A C E S … … 1923 2150 ifa1 = faces[ifa2].inext; 1924 2151 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 1927 2191 1928 2192 // C R E A T E P O L Y H E D R O N 1929 2193 2194 err = processor_error; 1930 2195 return createPolyhedron(); 1931 2196 } … … 2149 2414 } 2150 2415 */ 2416 2417 void 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 25 25 // 26 26 // 27 // $Id: HepPolyhedron.cc,v 1.3 2 2008/11/13 09:05:27 gcosmoExp $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: $ 29 29 // 30 30 // … … 2255 2255 2256 2256 #include "BooleanProcessor.src" 2257 static BooleanProcessor processor;2258 2257 2259 2258 HepPolyhedron HepPolyhedron::add(const HepPolyhedron & p) const … … 2267 2266 ***********************************************************************/ 2268 2267 { 2269 return processor.execute(OP_UNION, *this, p); 2268 int ierr; 2269 BooleanProcessor processor; 2270 return processor.execute(OP_UNION, *this, p,ierr); 2270 2271 } 2271 2272 … … 2280 2281 ***********************************************************************/ 2281 2282 { 2282 return processor.execute(OP_INTERSECTION, *this, p); 2283 int ierr; 2284 BooleanProcessor processor; 2285 return processor.execute(OP_INTERSECTION, *this, p,ierr); 2283 2286 } 2284 2287 … … 2293 2296 ***********************************************************************/ 2294 2297 { 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 200 200 public: // with description 201 201 inline void SetSession(G4UIsession *const value) 202 {session = value; }202 { printf("+++++++SetSession value:%d \n",value);session = value; } 203 203 // This method defines the active (G)UI session. 204 204 void SetCoutDestination(G4UIsession *const value); -
trunk/source/interfaces/basic/src/G4UIQt.cc
r1139 r1140 169 169 170 170 171 ...finir de mettre de QGL dans le splitter du haut171 // FIXME ...finir de mettre de QGL dans le splitter du haut 172 172 173 173 -
trunk/source/visualization/FukuiRenderer/GNUmakefile
r834 r1140 1 # $Id: GNUmakefile,v 1. 5 2004/06/03 11:40:12 gcosmoExp $1 # $Id: GNUmakefile,v 1.6 2009/10/21 14:59:17 allison Exp $ 2 2 3 3 name := G4FR … … 27 27 CPPFLAGS += -I$(G4BASE)/geometry/solids/specific/include 28 28 CPPFLAGS += -I$(G4BASE)/geometry/management/include 29 CPPFLAGS += -I$(G4BASE)/digits_hits/hits/include 29 30 30 31 include $(G4INSTALL)/config/common.gmk -
trunk/source/visualization/FukuiRenderer/History
r834 r1140 1 $Id: History,v 1.2 6 2006/07/10 15:32:27 allison Exp $1 $Id: History,v 1.27 2009/10/21 14:59:17 allison Exp $ 2 2 ------------------------------------------------------------------- 3 3 … … 20 20 History file for visualization/FukuiRenderer sub-category 21 21 --------------------------------------------------------- 22 23 21st 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. 22 26 23 27 10th July 2006 John Allison (DAWN-V08-01-00) -
trunk/source/visualization/FukuiRenderer/include/G4DAWNFILESceneHandler.hh
r944 r1140 25 25 // 26 26 // 27 // $Id: G4DAWNFILESceneHandler.hh,v 1.1 6 2006/06/29 21:16:30 gunterExp $27 // $Id: G4DAWNFILESceneHandler.hh,v 1.17 2009/10/21 14:59:17 allison Exp $ 28 28 // GEANT4 tag $Name: $ 29 29 // … … 98 98 G4VSceneHandler::AddCompound(hit); 99 99 } 100 void AddCompound ( const G4THitsMap<G4double> & hits) { 101 G4VSceneHandler::AddCompound(hits); 102 } 100 103 101 104 void ClearTransientStore(); // Used for triggering detector re-drawing. -
trunk/source/visualization/FukuiRenderer/include/G4FukuiRendererSceneHandler.hh
r944 r1140 25 25 // 26 26 // 27 // $Id: G4FukuiRendererSceneHandler.hh,v 1.1 5 2006/06/29 21:16:46 gunterExp $27 // $Id: G4FukuiRendererSceneHandler.hh,v 1.16 2009/10/21 14:59:17 allison Exp $ 28 28 // GEANT4 tag $Name: $ 29 29 // … … 100 100 void AddCompound ( const G4VHit& hit) { 101 101 G4VSceneHandler::AddCompound(hit); 102 } 103 void AddCompound ( const G4THitsMap<G4double> & hits) { 104 G4VSceneHandler::AddCompound(hits); 102 105 } 103 106 -
trunk/source/visualization/GNUmakefile
r959 r1140 1 # $Id: GNUmakefile,v 1.2 3 2009/03/05 11:32:07 lgarnierExp $1 # $Id: GNUmakefile,v 1.24 2009/10/12 10:28:38 akimura Exp $ 2 2 # ----------------------------------------------------------------------- 3 3 # GNUmakefile for visualization and modeling. John Allison, 5/7/95. … … 26 26 27 27 # For Debug mode 28 CPPFLAGS += -DG4DEBUG_VIS_OGL29 CPPFLAGS += -DG4DEBUG_VIS_OI30 CPPFLAGS += -DG4DEBUG_VIS_MANAGEMENT28 # CPPFLAGS += -DG4DEBUG_VIS_OGL 29 # CPPFLAGS += -DG4DEBUG_VIS_OI 30 # CPPFLAGS += -DG4DEBUG_VIS_MANAGEMENT 31 31 32 32 # Libraries which can be used without external packages or libraries... … … 46 46 SUBDIRS += XXX 47 47 SUBLIBS += G4visXXX 48 SUBDIRS += gMocren 49 SUBLIBS += G4GMocren 48 50 49 51 ifdef G4VIS_BUILD_OPENGL_DRIVER -
trunk/source/visualization/HepRep/History
r1040 r1140 1 .$Id: History,v 1.1 29 2009/05/08 09:29:23 gcosmoExp $1 .$Id: History,v 1.131 2009/10/21 15:13:36 allison Exp $ 2 2 ------------------------------------------------------------------- 3 3 … … 20 20 History file for visualization/HepRep sub-category 21 21 -------------------------------------------------- 22 23 21st 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. 22 26 23 27 8 May 2009 Gabriele Cosmo (vis-HepRep-V09-02-00) -
trunk/source/visualization/HepRep/include/G4HepRepFileSceneHandler.hh
r944 r1140 25 25 // 26 26 // 27 // $Id: G4HepRepFileSceneHandler.hh,v 1.3 0 2008/01/04 22:11:31allison Exp $27 // $Id: G4HepRepFileSceneHandler.hh,v 1.31 2009/10/21 15:08:35 allison Exp $ 28 28 // GEANT4 tag $Name: $ 29 29 // … … 82 82 void AddCompound (const G4VHit&); 83 83 void InitHit(); 84 void AddCompound (const G4THitsMap<G4double>& hits) { 85 G4VSceneHandler::AddCompound(hits); 86 } 84 87 // void PreAddSolid(const G4Transform3D& objectTransformation, 85 88 // const G4VisAttributes&); -
trunk/source/visualization/HepRep/include/G4HepRepSceneHandler.hh
r944 r1140 24 24 // ******************************************************************** 25 25 // 26 // $Id: G4HepRepSceneHandler.hh,v 1.4 2 2006/11/06 09:22:26allison Exp $26 // $Id: G4HepRepSceneHandler.hh,v 1.43 2009/10/21 15:08:35 allison Exp $ 27 27 // GEANT4 tag $Name: $ 28 28 // … … 85 85 void AddCompound (const G4VTrajectory&); 86 86 void AddCompound (const G4VHit& hit); 87 void AddCompound (const G4THitsMap<G4double>& hits) { 88 G4VSceneHandler::AddCompound(hits); 89 } 87 90 88 91 void PreAddSolid (const G4Transform3D& objectTransformation, const G4VisAttributes& visAttribs); -
trunk/source/visualization/History
r1136 r1140 1 $Id: History,v 1.4 45 2009/08/20 15:16:58 lgarnierExp $1 $Id: History,v 1.453 2009/10/25 10:43:42 allison Exp $ 2 2 ------------------------------------------------------------------- 3 3 … … 30 30 - G4OpenGLQtViewer.cc/G4OpenGLStoreQtViewer.cc : Fix problems with 31 31 mac OS X 10.6 32 33 23rd 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 37 22nd 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 41 21st 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 54 10th October 2009 Joseph Perl (vis-V09-02-06) 55 - new global tag for vis, in preparation for addition of gMocren file driver 56 57 10th October 2009 John Allison 58 - modeling-V09-02-03: Added G4PhysicalVolumeModelTouchable. Used in 59 ComputeMaterial. Effective for nested parameterisations. 60 61 29th 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 81 16 September 2009 John Allison 82 - raytracer-V09-02-00: Cosmetic adjustments and tagging. 32 83 33 84 19 August 2009 Laurent Garnier -
trunk/source/visualization/OpenGL/History
r1135 r1140 1 $Id: History,v 1.15 5 2009/10/21 08:14:44 lgarnierExp $1 $Id: History,v 1.156 2009/10/21 15:21:09 allison Exp $ 2 2 ------------------------------------------------------------------- 3 3 … … 20 20 21 October 2009 Laurent Garnier 21 21 - G4OpenGLQtViewer : Prepare to attach viewer In UI 22 23 21st 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. 22 26 23 27 15 October 2009 Laurent Garnier -
trunk/source/visualization/OpenGL/include/G4OpenGLSceneHandler.hh
r1022 r1140 25 25 // 26 26 // 27 // $Id: G4OpenGLSceneHandler.hh,v 1.2 6 2009/04/23 10:13:56 lgarnierExp $27 // $Id: G4OpenGLSceneHandler.hh,v 1.27 2009/10/21 15:18:14 allison Exp $ 28 28 // GEANT4 tag $Name: $ 29 29 // … … 83 83 void AddCompound (const G4VTrajectory&); 84 84 void AddCompound (const G4VHit&); 85 void AddCompound (const G4THitsMap<G4double>&); 85 86 86 87 protected: -
trunk/source/visualization/OpenGL/src/G4OpenGLSceneHandler.cc
r1129 r1140 25 25 // 26 26 // 27 // $Id: G4OpenGLSceneHandler.cc,v 1.5 5 2009/03/03 14:51:29 lgarnierExp $27 // $Id: G4OpenGLSceneHandler.cc,v 1.56 2009/10/21 15:18:43 allison Exp $ 28 28 // GEANT4 tag $Name: $ 29 29 // … … 879 879 } 880 880 881 void G4OpenGLSceneHandler::AddCompound(const G4THitsMap<G4double>& hits) { 882 G4VSceneHandler::AddCompound(hits); // For now. 883 } 884 881 885 #endif -
trunk/source/visualization/RayTracer/History
r1136 r1140 1 $Id: History,v 1.5 8 2009/09/16 16:58:26allison Exp $1 $Id: History,v 1.59 2009/10/21 15:24:53 allison Exp $ 2 2 ------------------------------------------------------------------- 3 3 … … 24 24 History file for Ray Tracer category 25 25 --------------------------------------- 26 27 21st 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. 26 30 27 31 16 September 2009 John Allison (raytracer-V09-02-00) -
trunk/source/visualization/RayTracer/include/G4RayTracerSceneHandler.hh
r954 r1140 25 25 // 26 26 // 27 // $Id: G4RayTracerSceneHandler.hh,v 1.1 1 2006/06/29 21:23:37 gunterExp $27 // $Id: G4RayTracerSceneHandler.hh,v 1.12 2009/10/21 15:24:53 allison Exp $ 28 28 // GEANT4 tag $Name: $ 29 29 … … 65 65 void AddCompound(const G4VTrajectory&){} 66 66 void AddCompound(const G4VHit&){} 67 void AddCompound(const G4THitsMap<G4double>&) {} 67 68 68 69 private: -
trunk/source/visualization/Tree/src/G4ASCIITreeViewer.cc
r954 r1140 34 34 G4VTreeViewer(sceneHandler, name) { 35 35 // 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 // } 36 41 fVP.SetCulling(false); 42 printf("G4ASCIITreeViewer::G4ASCIITreeViewer 2\n"); 37 43 fDefaultVP.SetCulling(false); 44 printf("G4ASCIITreeViewer::G4ASCIITreeViewer 3\n"); 38 45 } 39 46 -
trunk/source/visualization/VRML/GNUmakefile
r834 r1140 1 # $Id: GNUmakefile,v 1. 7 2004/06/03 11:40:14 gcosmoExp $1 # $Id: GNUmakefile,v 1.8 2009/10/21 15:27:21 allison Exp $ 2 2 3 3 # lib name … … 29 29 CPPFLAGS += -I$(G4BASE)/geometry/management/include 30 30 CPPFLAGS += -I$(G4BASE)/visualization/VRML/include 31 CPPFLAGS += -I$(G4BASE)/digits_hits/hits/include 31 32 32 33 include $(G4INSTALL)/config/common.gmk -
trunk/source/visualization/VRML/History
r834 r1140 1 $Id: History,v 1.1 5 2006/06/12 08:32:16allison Exp $1 $Id: History,v 1.17 2009/10/21 15:27:21 allison Exp $ 2 2 ------------------------------------------------------------------- 3 3 … … 20 20 History file for visualization/VRML sub-category 21 21 ------------------------------------------------ 22 23 21st 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 27 29 September 2009 John Allison (VRML-V09-02-00) 28 - Tagged change of disclaimer on file headings (made long ago). 22 29 23 30 12th June 2006 John Allison (VRML-V08-00-02) -
trunk/source/visualization/VRML/include/G4VRML1FileSceneHandler.hh
r944 r1140 25 25 // 26 26 // 27 // $Id: G4VRML1FileSceneHandler.hh,v 1.1 7 2006/06/29 21:25:27 gunterExp $27 // $Id: G4VRML1FileSceneHandler.hh,v 1.18 2009/10/21 15:27:21 allison Exp $ 28 28 // GEANT4 tag $Name: $ 29 29 // … … 73 73 G4VSceneHandler::AddCompound(hit); 74 74 } 75 void AddCompound ( const G4THitsMap<G4double> & hits) { 76 G4VSceneHandler::AddCompound(hits); 77 } 75 78 76 79 void BeginPrimitives(const G4Transform3D& objectTransformation); -
trunk/source/visualization/VRML/include/G4VRML1SceneHandler.hh
r944 r1140 25 25 // 26 26 // 27 // $Id: G4VRML1SceneHandler.hh,v 1.1 4 2006/06/29 21:25:31 gunterExp $27 // $Id: G4VRML1SceneHandler.hh,v 1.15 2009/10/21 15:27:21 allison Exp $ 28 28 // GEANT4 tag $Name: $ 29 29 // … … 78 78 G4VSceneHandler::AddCompound(hit); 79 79 } 80 void AddCompound ( const G4THitsMap<G4double> & hits) { 81 G4VSceneHandler::AddCompound(hits); 82 } 80 83 81 84 void BeginPrimitives(const G4Transform3D& objectTransformation); -
trunk/source/visualization/VRML/include/G4VRML2FileSceneHandler.hh
r944 r1140 25 25 // 26 26 // 27 // $Id: G4VRML2FileSceneHandler.hh,v 1.1 6 2006/06/29 21:25:39 gunterExp $27 // $Id: G4VRML2FileSceneHandler.hh,v 1.17 2009/10/21 15:27:21 allison Exp $ 28 28 // GEANT4 tag $Name: $ 29 29 // … … 73 73 G4VSceneHandler::AddCompound(hit); 74 74 } 75 void AddCompound ( const G4THitsMap<G4double> & hits) { 76 G4VSceneHandler::AddCompound(hits); 77 } 75 78 76 79 void BeginPrimitives(const G4Transform3D& objectTransformation); -
trunk/source/visualization/VRML/include/G4VRML2SceneHandler.hh
r944 r1140 25 25 // 26 26 // 27 // $Id: G4VRML2SceneHandler.hh,v 1.1 3 2006/06/29 21:25:43 gunterExp $27 // $Id: G4VRML2SceneHandler.hh,v 1.14 2009/10/21 15:27:21 allison Exp $ 28 28 // GEANT4 tag $Name: $ 29 29 // … … 76 76 G4VSceneHandler::AddCompound(hit); 77 77 } 78 void AddCompound ( const G4THitsMap<G4double> & hits) { 79 G4VSceneHandler::AddCompound(hits); 80 } 78 81 79 82 void BeginPrimitives(const G4Transform3D& objectTransformation); -
trunk/source/visualization/XXX/GNUmakefile
r834 r1140 1 # $Id: GNUmakefile,v 1. 7 2006/03/28 17:16:41allison Exp $1 # $Id: GNUmakefile,v 1.8 2009/10/21 15:28:53 allison Exp $ 2 2 3 3 name := G4visXXX … … 28 28 CPPFLAGS += -I$(G4BASE)/geometry/solids/specific/include 29 29 CPPFLAGS += -I$(G4BASE)/tracking/include 30 CPPFLAGS += -I$(G4BASE)/digits_hits/hits/include 30 31 31 32 ifdef G4VIS_BUILD_XXXSG_DRIVER -
trunk/source/visualization/XXX/History
r834 r1140 1 $Id: History,v 1.2 7 2006/11/05 20:41:55allison Exp $1 $Id: History,v 1.28 2009/10/21 15:28:53 allison Exp $ 2 2 ------------------------------------------------------------------- 3 3 … … 20 20 History file for visualization/XXX sub-category (a template graphics system) 21 21 --------------------------------------------------------------------------- 22 23 21st 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. 22 26 23 27 5th November 2006 John Allison (visXXX-V08-01-06) -
trunk/source/visualization/XXX/include/G4XXXFileSceneHandler.hh
r944 r1140 25 25 // 26 26 // 27 // $Id: G4XXXFileSceneHandler.hh,v 1. 3 2006/06/29 21:26:42 gunterExp $27 // $Id: G4XXXFileSceneHandler.hh,v 1.4 2009/10/21 15:28:53 allison Exp $ 28 28 // GEANT4 tag $Name: $ 29 29 // … … 76 76 // void AddCompound(const G4VTrajectory&); 77 77 // void AddCompound(const G4VHit&); 78 // void AddCompound(const G4THitsMap<G4double>&); 78 79 // void PreAddSolid(const G4Transform3D& objectTransformation, 79 80 // const G4VisAttributes&); -
trunk/source/visualization/XXX/include/G4XXXSGSceneHandler.hh
r944 r1140 25 25 // 26 26 // 27 // $Id: G4XXXSGSceneHandler.hh,v 1. 3 2006/06/29 21:26:56 gunterExp $27 // $Id: G4XXXSGSceneHandler.hh,v 1.4 2009/10/21 15:28:53 allison Exp $ 28 28 // GEANT4 tag $Name: $ 29 29 // … … 80 80 // void AddCompound(const G4VTrajectory&); 81 81 // void AddCompound(const G4VHit&); 82 // void AddCompound(const G4THitsMap<G4double>&); 82 83 void PreAddSolid(const G4Transform3D& objectTransformation, 83 84 const G4VisAttributes&); -
trunk/source/visualization/XXX/include/G4XXXStoredSceneHandler.hh
r944 r1140 25 25 // 26 26 // 27 // $Id: G4XXXStoredSceneHandler.hh,v 1. 3 2006/06/29 21:27:06 gunterExp $27 // $Id: G4XXXStoredSceneHandler.hh,v 1.4 2009/10/21 15:28:53 allison Exp $ 28 28 // GEANT4 tag $Name: $ 29 29 // … … 78 78 // void AddCompound(const G4VTrajectory&); 79 79 // void AddCompound(const G4VHit&); 80 // void AddCompound(const G4THitsMap<G4double>&); 80 81 void PreAddSolid(const G4Transform3D& objectTransformation, 81 82 const G4VisAttributes&); -
trunk/source/visualization/externals/gl2ps/GNUmakefile
r1051 r1140 1 # $Id: GNUmakefile,v 1. 1 2009/02/18 09:54:12lgarnier Exp $1 # $Id: GNUmakefile,v 1.2 2009/11/02 14:54:31 lgarnier Exp $ 2 2 # ------------------------------------------------------------- 3 3 # GNUmakefile for gl2ps. Laurent Garnier, 6/2/09. … … 6 6 7 7 # For debug mode 8 CPPFLAGS += -DG4DEBUG_VIS_GL2PS8 # CPPFLAGS += -DG4DEBUG_VIS_GL2PS 9 9 10 10 ifndef G4INSTALL -
trunk/source/visualization/externals/gl2ps/History
r1040 r1140 1 $Id: History,v 1. 9 2009/04/29 19:23:10 allisonExp $1 $Id: History,v 1.10 2009/11/02 14:54:31 lgarnier Exp $ 2 2 ------------------------------------------------------------------- 3 3 … … 17 17 * Reverse chronological order (last date on top), please * 18 18 ---------------------------------------------------------- 19 20 2 Nov 2009, Laurent Garnier 21 - Add debug flag in GNUMakefile 19 22 20 23 29 April 2009, Laurent Garnier (visexternal-V09-02-04) -
trunk/source/visualization/management/History
r1087 r1140 1 $Id: History,v 1.12 2 2009/07/24 09:20:52 lgarnierExp $1 $Id: History,v 1.127 2009/10/30 16:05:30 allison Exp $ 2 2 3 3 ------------------------------------------------------------------- … … 26 26 History file for visualization management sub-category 27 27 ------------------------------------------------------ 28 29 30th 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 35 23rd 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 39 21st 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 44 29th 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. 28 48 29 49 24th July 2009 Laurent Garnier -
trunk/source/visualization/management/include/G4VSceneHandler.hh
r954 r1140 25 25 // 26 26 // 27 // $Id: G4VSceneHandler.hh,v 1.4 0 2008/01/04 22:03:45allison Exp $27 // $Id: G4VSceneHandler.hh,v 1.41 2009/10/21 14:26:59 allison Exp $ 28 28 // GEANT4 tag $Name: $ 29 29 // … … 42 42 #include "globals.hh" 43 43 44 #include <stack>45 46 44 #include "G4VGraphicsScene.hh" 47 45 #include "G4ViewerList.hh" 48 46 #include "G4ViewParameters.hh" 47 #include "G4THitsMap.hh" 49 48 50 49 class G4Scene; … … 130 129 virtual void AddCompound (const G4VTrajectory&); 131 130 virtual void AddCompound (const G4VHit&); 131 virtual void AddCompound (const G4THitsMap<G4double>&); 132 132 133 133 ////////////////////////////////////////////////////////////// -
trunk/source/visualization/management/include/G4VisCommandsSceneAdd.hh
r954 r1140 25 25 // 26 26 // 27 // $Id: G4VisCommandsSceneAdd.hh,v 1.1 7 2006/11/01 10:50:28allison Exp $27 // $Id: G4VisCommandsSceneAdd.hh,v 1.18 2009/10/30 15:58:50 allison Exp $ 28 28 // GEANT4 tag $Name: $ 29 29 … … 133 133 }; 134 134 135 class G4VisCommandSceneAddPSHits: public G4VVisCommandScene { 136 public: 137 G4VisCommandSceneAddPSHits (); 138 virtual ~G4VisCommandSceneAddPSHits (); 139 G4String GetCurrentValue (G4UIcommand* command); 140 void SetNewValue (G4UIcommand* command, G4String newValue); 141 private: 142 G4VisCommandSceneAddPSHits (const G4VisCommandSceneAddPSHits&); 143 G4VisCommandSceneAddPSHits& operator = (const G4VisCommandSceneAddPSHits&); 144 G4UIcmdWithoutParameter* fpCommand; 145 }; 146 135 147 class G4VisCommandSceneAddScale: public G4VVisCommandScene { 136 148 public: -
trunk/source/visualization/management/include/G4VisExecutive.icc
r944 r1140 25 25 // 26 26 // 27 // $Id: G4VisExecutive.icc,v 1.2 1 2009/03/14 11:43:42 allisonExp $27 // $Id: G4VisExecutive.icc,v 1.22 2009/10/12 11:54:50 akimura Exp $ 28 28 // GEANT4 tag $Name: $ 29 29 // … … 47 47 #include "G4VRML1File.hh" 48 48 #include "G4VRML2File.hh" 49 #include "G4GMocrenFile.hh" 49 50 50 51 // Needing external packages or libraries... … … 110 111 RegisterGraphicsSystem (new G4VRML1File); 111 112 RegisterGraphicsSystem (new G4VRML2File); 113 RegisterGraphicsSystem (new G4GMocrenFile); 112 114 // Graphics systems needing external packages or libraries... 113 115 -
trunk/source/visualization/management/src/G4VSceneHandler.cc
r1136 r1140 25 25 // 26 26 // 27 // $Id: G4VSceneHandler.cc,v 1.8 3 2008/01/04 22:03:46 allison Exp $27 // $Id: G4VSceneHandler.cc,v 1.86 2009/10/23 07:58:36 allison Exp $ 28 28 // GEANT4 tag $Name: $ 29 29 // … … 262 262 263 263 void 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 267 void G4VSceneHandler::AddCompound (const G4THitsMap<G4double>& hits) { 268 // Cast because DrawAllHits is non-const!!!! 269 static_cast<G4THitsMap<G4double> >(hits).DrawAllHits(); 265 270 } 266 271 … … 583 588 printf("G4VSceneHandler::ProcessScene : Idle ?\n"); 584 589 #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... 586 592 G4StateManager* stateManager = G4StateManager::GetStateManager(); 587 593 G4ApplicationState state = stateManager->GetCurrentState(); 588 if (state == G4State_Idle ) {594 if (state == G4State_Idle || state == G4State_GeomClosed) { 589 595 #ifdef G4DEBUG_VIS_MANAGEMENT 590 596 printf("G4VSceneHandler::ProcessScene : IDLE\n"); -
trunk/source/visualization/management/src/G4VisCommandsSceneAdd.cc
r1136 r1140 25 25 // 26 26 // 27 // $Id: G4VisCommandsSceneAdd.cc,v 1.7 4 2009/07/24 09:20:52 lgarnierExp $27 // $Id: G4VisCommandsSceneAdd.cc,v 1.76 2009/10/30 15:58:50 allison Exp $ 28 28 // GEANT4 tag $Name: $ 29 29 // /vis/scene commands - John Allison 9th August 1998 … … 37 37 #include "G4ModelingParameters.hh" 38 38 #include "G4HitsModel.hh" 39 #include "G4PSHitsModel.hh" 39 40 #include "G4TrajectoriesModel.hh" 40 41 #include "G4ScaleModel.hh" … … 229 230 const G4Run* currentRun = 0; 230 231 G4RunManager* runManager = G4RunManager::GetRunManager(); 231 if (runManager) 232 if (runManager) currentRun = runManager->GetCurrentRun(); 232 233 233 234 G4VModel* model = fpVisManager->GetCurrentSceneHandler()->GetModel(); 234 const G4ModelingParameters* mp ;235 const G4Event* currentEvent ;235 const G4ModelingParameters* mp = 0; 236 const G4Event* currentEvent = 0; 236 237 if (model) { 237 238 mp = model->GetModelingParameters(); … … 240 241 G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity(); 241 242 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; 243 246 } 244 247 } … … 890 893 sceneHandler.AddPrimitive(*fp4); 891 894 sceneHandler.EndPrimitives(); 895 } 896 897 ////////////// /vis/scene/add/psHits /////////////////////////////////////// 898 899 G4VisCommandSceneAddPSHits::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 908 G4VisCommandSceneAddPSHits::~G4VisCommandSceneAddPSHits () { 909 delete fpCommand; 910 } 911 912 G4String G4VisCommandSceneAddPSHits::GetCurrentValue (G4UIcommand*) { 913 return ""; 914 } 915 916 void 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); 892 941 } 893 942 -
trunk/source/visualization/management/src/G4VisManager.cc
r1136 r1140 24 24 // ******************************************************************** 25 25 // 26 // $Id: G4VisManager.cc,v 1.1 18 2009/03/09 12:42:00allison Exp $26 // $Id: G4VisManager.cc,v 1.121 2009/10/30 16:03:41 allison Exp $ 27 27 // GEANT4 tag $Name: $ 28 28 // … … 656 656 G4cout << "ERROR in G4VisManager::CreateSceneHandler during " 657 657 << fpGraphicsSystem -> GetName () 658 << " scene creation.\n No action taken."658 << " scene handler creation.\n No action taken." 659 659 << G4endl; 660 660 } … … 669 669 if (!fInitialised) Initialise (); 670 670 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! 678 702 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 << 721 726 "NOTE: objects with visibility flag set to \"false\"" 722 727 " will not be drawn!" 723 728 "\n \"/vis/viewer/set/culling global false\" to Draw such objects." 724 729 "\n Also see other \"/vis/viewer/set\" commands." 725 726 727 728 729 730 731 732 733 734 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 << 735 740 "WARNING: covered objects in solid mode will not be rendered!" 736 741 "\n \"/vis/viewer/set/culling coveredDaughters false\" to reverse this." 737 742 "\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 } 747 748 } 748 749 … … 1088 1089 RegisterMessenger(new G4VisCommandSceneAddLogicalVolume); 1089 1090 RegisterMessenger(new G4VisCommandSceneAddLogo); 1091 RegisterMessenger(new G4VisCommandSceneAddPSHits); 1090 1092 RegisterMessenger(new G4VisCommandSceneAddScale); 1091 1093 RegisterMessenger(new G4VisCommandSceneAddText); … … 1331 1333 printf("G4VisManager::EndOfEvent 7 \n"); 1332 1334 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." 1336 1339 << G4endl; 1337 1340 } … … 1371 1374 if (fEventKeepingSuspended && fVerbosity >= warnings) { 1372 1375 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\"." 1379 1383 << G4endl; 1380 1384 } -
trunk/source/visualization/modeling/History
r931 r1140 1 $Id: History,v 1.1 09 2009/02/25 14:21:45allison Exp $1 $Id: History,v 1.114 2009/10/22 15:40:00 allison Exp $ 2 2 ------------------------------------------------------------------- 3 3 … … 20 20 History file for visualization/modeling 21 21 --------------------------------------- 22 23 22nd October 2009 John Allison (modeling-V09-02-05 coworks greps-V09-02-02) 24 - Added G4PSHitsModel for gMocren driver. 25 26 21st 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 31 10th October 2009 John Allison (modeling-V09-02-03) 32 - G4PhysicalVolumeModel: Added G4PhysicalVolumeModelTouchable. Used in 33 ComputeMaterial. Effective for nested parameterisations. 34 35 29th September 2009 John Allison (modeling-V09-02-02) 36 - G4PhysicalVolumeModel.cc: Added warning if logical volume not defined. 22 37 23 38 25th February 2009 John Allison (modeling-V09-02-01 - needs greps-V09-02-01) -
trunk/source/visualization/modeling/include/G4BoundingSphereScene.hh
r954 r1140 25 25 // 26 26 // 27 // $Id: G4BoundingSphereScene.hh,v 1.1 8 2008/01/04 21:59:15allison Exp $27 // $Id: G4BoundingSphereScene.hh,v 1.19 2009/10/21 14:17:33 allison Exp $ 28 28 // GEANT4 tag $Name: $ 29 29 // … … 71 71 void AddCompound (const G4VTrajectory&) {} 72 72 void AddCompound (const G4VHit&) {} 73 void AddCompound (const G4THitsMap<G4double>&) {} 73 74 G4VisExtent GetBoundingSphereExtent (); 74 75 const G4Point3D& GetCentre() const {return fCentre;} -
trunk/source/visualization/modeling/include/G4PhysicalVolumeMassScene.hh
r954 r1140 25 25 // 26 26 // 27 // $Id: G4PhysicalVolumeMassScene.hh,v 1. 9 2008/01/04 21:59:15allison Exp $27 // $Id: G4PhysicalVolumeMassScene.hh,v 1.10 2009/10/21 14:17:33 allison Exp $ 28 28 // GEANT4 tag $Name: $ 29 29 // … … 109 109 void AddCompound (const G4VTrajectory&) {} 110 110 void AddCompound (const G4VHit&) {} 111 void AddCompound (const G4THitsMap<G4double>&) {} 111 112 112 113 //////////////////////////////////////////////////////////////// -
trunk/source/visualization/modeling/include/G4PhysicalVolumeModel.hh
r954 r1140 25 25 // 26 26 // 27 // $Id: G4PhysicalVolumeModel.hh,v 1.3 4 2007/04/03 13:46:49 allison Exp $27 // $Id: G4PhysicalVolumeModel.hh,v 1.35 2009/10/10 14:29:59 allison Exp $ 28 28 // GEANT4 tag $Name: $ 29 29 // … … 49 49 50 50 #include "G4VModel.hh" 51 #include "G4VTouchable.hh" 51 52 52 53 #include "G4Transform3D.hh" … … 76 77 public: 77 78 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) {} 80 87 G4VPhysicalVolume* GetPhysicalVolume() const {return fpPV;} 81 88 G4int GetCopyNo() const {return fCopyNo;} 82 89 G4int GetNonCulledDepth() const {return fNonCulledDepth;} 90 const G4Transform3D& GetTransform() const {return fTransform;} 83 91 G4bool operator< (const G4PhysicalVolumeNodeID& right) const; 84 92 private: … … 86 94 G4int fCopyNo; 87 95 G4int fNonCulledDepth; 96 G4Transform3D fTransform; 88 97 }; 89 98 // 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. 90 114 91 115 G4PhysicalVolumeModel -
trunk/source/visualization/modeling/include/G4PhysicalVolumeSearchScene.hh
r954 r1140 25 25 // 26 26 // 27 // $Id: G4PhysicalVolumeSearchScene.hh,v 1.1 8 2008/01/04 21:59:15allison Exp $27 // $Id: G4PhysicalVolumeSearchScene.hh,v 1.19 2009/10/21 14:17:33 allison Exp $ 28 28 // GEANT4 tag $Name: $ 29 29 // … … 74 74 void AddCompound (const G4VTrajectory&) {} 75 75 void AddCompound (const G4VHit&) {} 76 void AddCompound (const G4THitsMap<G4double>&) {} 76 77 G4int GetFoundDepth () const; 77 78 G4VPhysicalVolume* GetFoundVolume () const; -
trunk/source/visualization/modeling/src/G4PhysicalVolumeModel.cc
r1089 r1140 25 25 // 26 26 // 27 // $Id: G4PhysicalVolumeModel.cc,v 1.6 3 2007/11/10 14:56:36allison Exp $27 // $Id: G4PhysicalVolumeModel.cc,v 1.66 2009/10/23 08:08:19 allison Exp $ 28 28 // GEANT4 tag $Name: $ 29 29 // … … 46 46 #include "G4TransportationManager.hh" 47 47 #include "G4Polyhedron.hh" 48 #include "HepPolyhedronProcessor.h" 48 49 #include "G4AttDefStore.hh" 49 50 #include "G4AttDef.hh" … … 53 54 54 55 #include <sstream> 55 56 G4bool G4PhysicalVolumeModel::G4PhysicalVolumeNodeID::operator<57 (const G4PhysicalVolumeModel::G4PhysicalVolumeNodeID& right) const58 {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 }81 56 82 57 G4PhysicalVolumeModel::G4PhysicalVolumeModel … … 232 207 G4VPVParameterisation* pP = pVPV -> GetParameterisation (); 233 208 if (pP) { // Parametrised volume. 209 if (fCurrentDepth == 0) nReplicas = 1; // Just draw first 234 210 for (int n = 0; n < nReplicas; n++) { 235 211 pSol = pP -> ComputeSolid (n, pVPV); 236 pMaterial = pP -> ComputeMaterial (n, pVPV);237 212 pP -> ComputeTransformation (n, pVPV); 238 213 pSol -> ComputeDimensions (pP, n, pVPV); 239 214 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); 240 220 DescribeAndDescend (pVPV, requestedDepth, pLV, pSol, pMaterial, 241 221 theAT, sceneHandler); … … 363 343 fpCurrentTransform = &theNewAT; 364 344 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 391 345 // Make decision to draw... 392 346 const G4VisAttributes* pVisAttribs = pLV->GetVisAttributes(); … … 429 383 G4int copyNo = fpCurrentPV->GetCopyNo(); 430 384 fFullPVPath.push_back 431 (G4PhysicalVolumeNodeID(fpCurrentPV,copyNo,fCurrentDepth)); 385 (G4PhysicalVolumeNodeID 386 (fpCurrentPV,copyNo,fCurrentDepth,*fpCurrentTransform)); 432 387 433 388 if (thisToBeDrawn) { … … 436 391 G4int copyNo = fpCurrentPV->GetCopyNo(); 437 392 fDrawnPVPath.push_back 438 (G4PhysicalVolumeNodeID(fpCurrentPV,copyNo,fCurrentDepth)); 393 (G4PhysicalVolumeNodeID 394 (fpCurrentPV,copyNo,fCurrentDepth,*fpCurrentTransform)); 439 395 440 396 if (fpMP->IsExplode() && fDrawnPVPath.size() == 1) { … … 563 519 G4Polyhedron* pOriginal = pSol->GetPolyhedron(); 564 520 G4Polyhedron::ResetNumberOfRotationSteps(); 521 565 522 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 573 532 } else { 574 533 575 534 G4Polyhedron resultant = *pOriginal; 535 G4VisAttributes resultantVisAttribs(*pVisAttribs); 576 536 577 537 if (fpClippingPolyhedron) { 578 538 G4Polyhedron clipper = *fpClippingPolyhedron; // Local copy. 579 539 clipper.Transform(theAT.inverse()); 540 HepPolyhedronProcessor processor; 580 541 switch (fClippingMode) { 581 542 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; 584 545 } 585 if (resultant.IsErrorBooleanProcess()) {546 if (!processor.execute(resultant)) { 586 547 if (fpMP->IsWarning()) 587 548 G4cout << … … 589 550 "\n solid \"" << pSol->GetName() << 590 551 "\" not defined due to error during Boolean processing." 552 "\n It will be drawn in red." 591 553 << G4endl; 592 // Nevertheless, keep resultant. 554 // Nevertheless, keep resultant, but draw it in red 555 resultantVisAttribs.SetColour(G4Colour::Red()); 593 556 } 594 557 } … … 597 560 G4Polyhedron sectioner = *pSectionPolyhedron; // Local copy. 598 561 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)) { 601 565 if (fpMP->IsWarning()) 602 566 G4cout << … … 604 568 "\n solid \"" << pSol->GetName() << 605 569 "\" not defined due to error during Boolean processing." 570 "\n It will be drawn in red." 606 571 << G4endl; 607 // Nevertheless, keep resultant. 572 // Nevertheless, keep resultant, but draw it in red 573 resultantVisAttribs.SetColour(G4Colour::Red()); 608 574 } 609 575 } … … 612 578 G4Polyhedron cutter = *pCutawayPolyhedron; // Local copy. 613 579 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)) { 616 583 if (fpMP->IsWarning()) 617 584 G4cout << … … 619 586 "\n solid \"" << pSol->GetName() << 620 587 "\" not defined due to error during Boolean processing." 588 "\n It will be drawn in red." 621 589 << G4endl; 622 // Nevertheless, keep resultant. 590 // Nevertheless, keep resultant, but draw it in red 591 resultantVisAttribs.SetColour(G4Colour::Red()); 623 592 } 624 593 } 625 594 626 595 // Finally, force polyhedron drawing... 627 resultant.SetVisAttributes( pVisAttribs);596 resultant.SetVisAttributes(resultantVisAttribs); 628 597 sceneHandler.BeginPrimitives(theAT); 629 598 sceneHandler.AddPrimitive(resultant); … … 760 729 if (i != fFullPVPath.size() - 1) oss << '/'; 761 730 } 731 732 if (!fpCurrentLV) { 733 G4Exception 734 ("G4PhysicalVolumeModel::CreateCurrentAttValues", 735 "", 736 JustWarning, 737 "Current logical volume not defined."); 738 return values; 739 } 740 762 741 values->push_back(G4AttValue("PVPath", oss.str(),"")); 763 742 if (fpCurrentLV) { … … 787 766 return values; 788 767 } 768 769 G4bool 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 781 std::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 796 G4PhysicalVolumeModel::G4PhysicalVolumeModelTouchable::G4PhysicalVolumeModelTouchable 797 (const std::vector<G4PhysicalVolumeNodeID>& fullPVPath): 798 fFullPVPath(fullPVPath) {} 799 800 const 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 814 const 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 828 G4VPhysicalVolume* 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 840 G4VSolid* 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 852 G4int 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.11 7 2009/07/28 12:50:51 lgarnierExp $1 $Id: History,v 1.119 2009/09/29 21:36:38 allison Exp $ 2 2 3 3 History file for visualization/test subdirectory … … 5 5 6 6 $Log: History,v $ 7 Revision 1.119 2009/09/29 21:36:38 allison 8 vistest-V09-02-00 9 10 Revision 1.118 2009/09/29 21:35:56 allison 11 Changed main program, test19.cc, to use G4UIExecutive. 12 7 13 Revision 1.117 2009/07/28 12:50:51 lgarnier 8 14 Adding Qt support for test19 -
trunk/source/visualization/test/test19.cc
r1093 r1140 25 25 // 26 26 // 27 // $Id: test19.cc,v 1.3 0 2009/07/28 12:50:51 lgarnierExp $27 // $Id: test19.cc,v 1.31 2009/09/29 21:35:56 allison Exp $ 28 28 // GEANT4 tag $Name: $ 29 29 // … … 48 48 #include "MySteppingAction.hh" 49 49 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" 65 52 #endif 66 53 … … 93 80 #endif 94 81 82 #ifdef G4UI_USE 95 83 // 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.. 124 86 #endif 125 G4UImanager::GetUIpointer()->SetSession(session); //So that Pause works..126 87 127 88 // Run manager … … 159 120 160 121 G4UImanager* UI = G4UImanager::GetUIpointer (); 161 162 122 #ifdef G4UI_USE_WIN32 163 123 G4cout << "Reading win32.g4m file...." << G4endl; … … 173 133 << G4endl; 174 134 135 #ifdef G4UI_USE 175 136 // Start an interactive session. 176 session -> SessionStart(); 137 UIexecutive -> SessionStart(); 138 #endif 177 139 178 140 #ifdef G4VIS_USE … … 185 147 G4cout << "vis_test19: Run manager deleted." << G4endl; 186 148 G4cout << "vis_test19: Deleting session..." << G4endl; 187 delete session; 149 #ifdef G4UI_USE 150 delete UIexecutive; 188 151 G4cout << "vis_test19: Session deleted." << G4endl; 152 #endif 189 153 190 154 return 0;
Note: See TracChangeset
for help on using the changeset viewer.