VGM Version 5.3
Loading...
Searching...
No Matches
IFactory.h
Go to the documentation of this file.
1// $Id$
2
3// -----------------------------------------------------------------------
4// The VGM package of the Virtual Geometry Model
5// Copyright (C) 2007, Ivana Hrivnacova
6// All rights reserved.
7//
8// For the licensing terms see vgm/LICENSE.
9// Contact: ivana@ipno.in2p3.fr
10// -----------------------------------------------------------------------
11
13//
20
21#ifndef VGM_I_FACTORY_H
22#define VGM_I_FACTORY_H
23
24#include "VGM/common/Axis.h"
28
29#include <string>
30#include <vector>
31
33
34namespace VGM {
35
36class ISolid;
37class IVolume;
38class IPlacement;
39class IMaterialFactory;
40class IExtrudedSolid;
41
42typedef std::vector<ISolid*> SolidStore;
43typedef std::vector<IVolume*> VolumeStore;
44
47constexpr double kDefaultDummyBoxDimensions = 1.; // in mm
48
50{
51 public:
52 virtual ~IFactory() {}
53
54 //
55 // solids
56 //
57
80 virtual ISolid* CreateArb8(const std::string& name, double hz,
81 std::vector<VGM::TwoVector> vertices) = 0;
82
88 virtual ISolid* CreateBox(
89 const std::string& name, double hx, double hy, double hz) = 0;
90
100 virtual ISolid* CreateCons(const std::string& name, double rin1, double rout1,
101 double rin2, double rout2, double hz, double sphi, double dphi) = 0;
102
123 virtual ISolid* CreateCtubs(const std::string& name, double rin, double rout,
124 double hz, double sphi, double dphi, double nxlow, double nylow,
125 double nzlow, double nxhigh, double nyhigh, double nzhigh) = 0;
126
134 virtual ISolid* CreateEllipsoid(const std::string& name, double dx, double dy,
135 double dz, double zBottomCut, double zTopCut) = 0;
136
143 const std::string& name, double dx, double dy, double hz) = 0;
144
151 virtual ISolid* CreateExtrudedSolid(const std::string& name,
152 std::vector<TwoVector> polygon,
153 std::vector<std::vector<double> > zsections) = 0;
154
162 virtual ISolid* CreateHype(const std::string& name, double r1, double r2,
163 double stereo1, double stereo2, double hz) = 0;
164
177 virtual ISolid* CreatePara(const std::string& name, double hx, double hy,
178 double hz, double alpha, double theta, double phi) = 0;
179
186 const std::string& name, double r1, double r2, double hz) = 0;
187
197 virtual ISolid* CreatePolycone(const std::string& name, double sphi,
198 double dphi, int nofZplanes, double* z, double* rin, double* rout) = 0;
199
212 virtual ISolid* CreatePolyhedra(const std::string& name, double sphi,
213 double dphi, int nofSides, int nofZplanes, double* z, double* rin,
214 double* rout) = 0;
215
225 virtual ISolid* CreateSphere(const std::string& name, double rin, double rout,
226 double sphi, double dphi, double stheta, double dtheta) = 0;
227
233 virtual ISolid* CreateTessellatedSolid(const std::string& name,
234 std::vector<std::vector<VGM::ThreeVector> > facets) = 0;
235
244 virtual ISolid* CreateTorus(const std::string& name, double rin, double rout,
245 double rax, double sphi, double dphi) = 0;
246
272 virtual ISolid* CreateTrap(const std::string& name, double hz, double theta,
273 double phi, double dy1, double dx1, double dx2, double alpha1, double dy2,
274 double dx3, double dx4, double alpha2) = 0;
275
288 virtual ISolid* CreateTrd(const std::string& name, double hx1, double hx2,
289 double hy1, double hy2, double hz) = 0;
290
298 virtual ISolid* CreateTubs(const std::string& name, double rin, double rout,
299 double hz, double sphi, double dphi) = 0;
300
301 //
302 // Boolean solids
303 //
304
309 virtual ISolid* CreateIntersectionSolid(const std::string& name,
310 VGM::ISolid* solidA, VGM::ISolid* solidB,
311 const VGM::Transform& transform) = 0;
312
317 virtual ISolid* CreateSubtractionSolid(const std::string& name,
318 VGM::ISolid* solidA, VGM::ISolid* solidB,
319 const VGM::Transform& transform) = 0;
320
325 virtual ISolid* CreateUnionSolid(const std::string& name, VGM::ISolid* solidA,
326 VGM::ISolid* solidB, const VGM::Transform& transform) = 0;
327
332 virtual ISolid* CreateDisplacedSolid(const std::string& name,
333 VGM::ISolid* solid, const VGM::Transform& transform) = 0;
334
338 virtual ISolid* CreateScaledSolid(const std::string& name, VGM::ISolid* solid,
339 const VGM::Transform& transform) = 0;
340
344 virtual ISolid* CreateMultiUnion(const std::string& name,
345 std::vector<VGM::ISolid*> constituents,
346 std::vector<VGM::Transform> transforms) = 0;
347
348 //
349 // volumes
350 //
351
356 virtual IVolume* CreateVolume(const std::string& name, VGM::ISolid* solid,
357 const std::string& mediumName) = 0;
358
359 //
360 // placements
361 //
362
369 virtual IPlacement* CreatePlacement(const std::string& name, int copyNo,
370 VGM::IVolume* volume, VGM::IVolume* motherVolume,
371 const VGM::Transform& transform) = 0;
372
385 virtual IPlacement* CreateMultiplePlacement(const std::string& name,
386 VGM::IVolume* volume, VGM::IVolume* motherVolume, VGM::Axis axis,
387 int nofItems, double width, double offset, double halfGap) = 0;
388
389 // TO DO: IVolume* volume parameter is redundant;
390 // IVolume and ISolid should be created automatically
391 // via factory; this is however not available in
392 // Geant4 now (it would have to be done on the VGM level)
393 // - should be possible with G4Division class, so lets wait
394 // for it
395
401 virtual VGM::IPlacement* CreateParameterisedPlacement(const std::string& name,
402 VGM::IVolume* motherVolume,
403 const std::vector<VGM::Transform>& transforms,
404 const std::vector<VGM::IVolume*>& volumes) = 0;
405
407 // top volume
408 //
411 virtual IPlacement* Top() const = 0;
413 virtual ISolid* SingleSolid() const = 0;
414
415 //
416 // access
417 //
420 virtual std::string Name() const = 0;
421
424 virtual const SolidStore& Solids() const = 0;
427 virtual const VolumeStore& Volumes() const = 0;
430 virtual IMaterialFactory* MaterialFactory() const = 0;
431
432 //
433 // listings
434 //
437 virtual void PrintSolids() const = 0;
440 virtual void PrintVolumes() const = 0;
441
442 //
443 // export
444 //
447 virtual bool Export(IFactory* factory) const = 0;
448
449 //
450 // debug
451 //
454 virtual void SetDebug(int value) = 0;
457 virtual int Debug() const = 0;
458
459 //
460 // options
461 //
467 virtual void SetIgnore(
468 bool value, double dummyBoxDimensions = kDefaultDummyBoxDimensions) = 0;
471 virtual bool Ignore() const = 0;
472
475 virtual void SetDummyBoxDimensions(double value) = 0;
478 virtual double DummyBoxDimensions() const = 0;
479
489 virtual void SetBestMatch(bool value) = 0;
492 virtual bool BestMatch() const = 0;
493
499 virtual void SetSingleMode(bool value) = 0;
502 virtual bool SingleMode() const = 0;
503
505 virtual void SetSolid(VGM::ISolid* solid) = 0;
506
507 private:
508 //
509 // import
510 //
519 virtual bool Import(void* /*topVolume*/) = 0;
521 virtual bool ImportSolid(void* /*solid*/) = 0;
522};
523
524} // namespace VGM
525
526#endif // VGM_I_FACTORY_H
VGM Axis enumeration.
The VGM interface to geometry factory providing functions for geometry construction and conversions.
Definition IFactory.h:50
virtual IVolume * CreateVolume(const std::string &name, VGM::ISolid *solid, const std::string &mediumName)=0
Create the volume.
virtual ISolid * CreateTessellatedSolid(const std::string &name, std::vector< std::vector< VGM::ThreeVector > > facets)=0
Create tessellated solid = solid composed from triangular and rectangular facets.
virtual int Debug() const =0
Return the debug level.
virtual void SetIgnore(bool value, double dummyBoxDimensions=kDefaultDummyBoxDimensions)=0
Set ignoring of unsupported features.
virtual bool SingleMode() const =0
Return the single mode option.
virtual IMaterialFactory * MaterialFactory() const =0
Return the associated material factory.
virtual IPlacement * CreateMultiplePlacement(const std::string &name, VGM::IVolume *volume, VGM::IVolume *motherVolume, VGM::Axis axis, int nofItems, double width, double offset, double halfGap)=0
Create the multiple volume placement.
virtual ISolid * CreateScaledSolid(const std::string &name, VGM::ISolid *solid, const VGM::Transform &transform)=0
Create scaled solid.
virtual ISolid * CreateExtrudedSolid(const std::string &name, std::vector< TwoVector > polygon, std::vector< std::vector< double > > zsections)=0
Create the extruded solid.
virtual bool Export(IFactory *factory) const =0
Export geometry to the specified factory.
virtual ~IFactory()
Definition IFactory.h:52
virtual void PrintVolumes() const =0
Print all volumes.
virtual ISolid * CreateEllipsoid(const std::string &name, double dx, double dy, double dz, double zBottomCut, double zTopCut)=0
Create the ellipsoid solid.
virtual void SetSolid(VGM::ISolid *solid)=0
Set solid (in single mode)
virtual ISolid * CreateParaboloid(const std::string &name, double r1, double r2, double hz)=0
Create the paraboloid solid.
virtual const VolumeStore & Volumes() const =0
Return the store of volumes.
virtual IPlacement * CreatePlacement(const std::string &name, int copyNo, VGM::IVolume *volume, VGM::IVolume *motherVolume, const VGM::Transform &transform)=0
Create the simple volume placement.
virtual ISolid * CreateTorus(const std::string &name, double rin, double rout, double rax, double sphi, double dphi)=0
Create the torus solid = phi segment of a torus.
virtual ISolid * CreateCtubs(const std::string &name, double rin, double rout, double hz, double sphi, double dphi, double nxlow, double nylow, double nzlow, double nxhigh, double nyhigh, double nzhigh)=0
Create the cut tubs solid = phi segment of a tube cut with two planes.
virtual IPlacement * Top() const =0
Return the top volume placement.
virtual ISolid * CreateSphere(const std::string &name, double rin, double rout, double sphi, double dphi, double stheta, double dtheta)=0
Create the sphere solid = phi segment of a spherical shell.
virtual ISolid * CreatePolycone(const std::string &name, double sphi, double dphi, int nofZplanes, double *z, double *rin, double *rout)=0
Create the polycone solid = phi segment of a polycone.
virtual ISolid * CreateSubtractionSolid(const std::string &name, VGM::ISolid *solidA, VGM::ISolid *solidB, const VGM::Transform &transform)=0
Create the subtraction of two solids.
virtual ISolid * CreatePara(const std::string &name, double hx, double hy, double hz, double alpha, double theta, double phi)=0
Create the para solid = parallelepiped.
virtual ISolid * CreateTubs(const std::string &name, double rin, double rout, double hz, double sphi, double dphi)=0
Create the trd solid = phi segment of a tube.
virtual void SetDummyBoxDimensions(double value)=0
Set the dimensions in mm of a dummy box replacing the unsupported shapes if the 'ignore' option is ac...
virtual ISolid * CreateIntersectionSolid(const std::string &name, VGM::ISolid *solidA, VGM::ISolid *solidB, const VGM::Transform &transform)=0
Create the intersection of two solids.
virtual ISolid * CreatePolyhedra(const std::string &name, double sphi, double dphi, int nofSides, int nofZplanes, double *z, double *rin, double *rout)=0
Create the polyhedra solid = phi segment of a polyhedra (polygone)
virtual VGM::IPlacement * CreateParameterisedPlacement(const std::string &name, VGM::IVolume *motherVolume, const std::vector< VGM::Transform > &transforms, const std::vector< VGM::IVolume * > &volumes)=0
Create the parameterised volume placement.
virtual ISolid * CreateTrd(const std::string &name, double hx1, double hx2, double hy1, double hy2, double hz)=0
Create the trd solid = a trapezoid with the x and y dimensions varying along z.
virtual void PrintSolids() const =0
Print all solids.
virtual void SetSingleMode(bool value)=0
Set single mode option.
virtual const SolidStore & Solids() const =0
Return the store of solids.
virtual double DummyBoxDimensions() const =0
Return the ignore option.
virtual ISolid * CreateTrap(const std::string &name, double hz, double theta, double phi, double dy1, double dx1, double dx2, double alpha1, double dy2, double dx3, double dx4, double alpha2)=0
Create the trap solid = general trapezoid ( Note that of the 11 parameters described below,...
virtual ISolid * CreateUnionSolid(const std::string &name, VGM::ISolid *solidA, VGM::ISolid *solidB, const VGM::Transform &transform)=0
Create the union of two solids.
virtual void SetDebug(int value)=0
Set the debug level.
virtual ISolid * SingleSolid() const =0
Return solid (if in one solid conversion mode)
virtual bool Ignore() const =0
Return the ignore option.
virtual ISolid * CreateMultiUnion(const std::string &name, std::vector< VGM::ISolid * > constituents, std::vector< VGM::Transform > transforms)=0
Create the multi union of solids.
virtual std::string Name() const =0
Return the name of this factory.
virtual ISolid * CreateDisplacedSolid(const std::string &name, VGM::ISolid *solid, const VGM::Transform &transform)=0
Create displaced solid.
virtual bool BestMatch() const =0
Return the single mode option.
virtual ISolid * CreateBox(const std::string &name, double hx, double hy, double hz)=0
Create the box solid.
virtual ISolid * CreateEllipticalTube(const std::string &name, double dx, double dy, double hz)=0
Create the elliptical tube solid.
virtual void SetBestMatch(bool value)=0
Set best match option.
virtual ISolid * CreateArb8(const std::string &name, double hz, std::vector< VGM::TwoVector > vertices)=0
Create the arbitrary trapezoid with 8 vertices standing on two paralel planes perpendicular to Z axis...
virtual ISolid * CreateHype(const std::string &name, double r1, double r2, double stereo1, double stereo2, double hz)=0
Create the hyperboloid solid.
virtual ISolid * CreateCons(const std::string &name, double rin1, double rout1, double rin2, double rout2, double hz, double sphi, double dphi)=0
Create the cons solid = phi segment of a conical tube.
The VGM interface to material factory providing functions for material conversions.
The VGM interface to positions of volumes.
Definition IPlacement.h:44
The VGM interface to solids.
Definition ISolid.h:58
The VGM interface to volumes.
Definition IVolume.h:32
VGM interfaces.
Definition VMedium.h:28
std::vector< double > Transform
Definition Transform.h:40
constexpr double kDefaultDummyBoxDimensions
The default value for the dimensions in mm of a dummy box replacing the unsupported shapes if the 'ig...
Definition IFactory.h:47
std::vector< IVolume * > VolumeStore
Definition IFactory.h:43
std::vector< ISolid * > SolidStore
Definition IFactory.h:42