CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Friends
DDSolid Class Reference

A DDSolid represents the shape of a part. More...

#include <DDSolid.h>

Inheritance diagram for DDSolid:
DDBase< DDName, std::unique_ptr< DDI::Solid > > DDAssembly DDBooleanSolid DDBox DDCons DDCutTubs DDEllipsoid DDEllipticalTube DDMultiUnionSolid DDOrb DDParallelepiped DDPolySolid DDPseudoTrap DDShapelessSolid DDSphere DDTorus DDTrap DDTruncTubs DDTubs

Public Member Functions

 DDSolid (const DDName &name)
 Creates a reference-object to a solid named name. More...
 
 DDSolid (void)
 Uninitialilzed solid reference-object; for further details on reference-objects see documentation of DDLogicalPart. More...
 
const std::vector< double > & parameters (void) const
 Give the parameters of the solid. More...
 
DDSolidShape shape (void) const
 The type of the solid. More...
 
double volume (void) const
 Returns the volume of the given solid (does not work with boolean soids !) More...
 
- Public Member Functions inherited from DDBase< DDName, std::unique_ptr< DDI::Solid > >
void create (const DDName &name)
 
void create (const DDName &name, std::unique_ptr< DDI::Solid > vals)
 
 DDBase ()
 
const DDNameddname () const
 
def_type isDefined () const
 
bool isValid () const
 true, if the wrapped pointer is valid More...
 
const DDNamename () const
 
 operator bool () const
 
bool operator< (const DDBase &b) const
 
bool operator== (const DDBase &b) const
 
bool operator> (const DDBase &b) const
 
DDI::rep_traits< DDName, std::unique_ptr< DDI::Solid > >::reference rep ()
 
const DDI::rep_traits< DDName, std::unique_ptr< DDI::Solid > >::reference rep () const
 
std::string toString () const
 
const DDI::rep_traits< DDName, std::unique_ptr< DDI::Solid > >::reference val ()
 
const DDI::rep_traits< DDName, std::unique_ptr< DDI::Solid > >::reference val () const
 
virtual ~DDBase ()
 

Private Member Functions

 DDSolid (const DDName &, DDSolidShape, const std::vector< double > &)
 
 DDSolid (const DDName &, std::unique_ptr< DDI::Solid >)
 

Friends

struct DDSolidFactory
 
std::ostream & operator<< (std::ostream &, const DDSolid &)
 

Additional Inherited Members

- Public Types inherited from DDBase< DDName, std::unique_ptr< DDI::Solid > >
using def_type = std::pair< const DDName *, bool >
 
using StoreT = DDI::Singleton< DDI::Store< DDName, std::unique_ptr< DDI::Solid > > >
 
- Static Public Member Functions inherited from DDBase< DDName, std::unique_ptr< DDI::Solid > >
static auto begin ()
 
static auto end ()
 

Detailed Description

A DDSolid represents the shape of a part.

An object of this class is a reference-object and thus is a lightweight class. It can be copied by value without having a large overhead. Assignment to the reference-object invalidates the object to which it was referred. Assignment also affects all other instances of this class which were created using the same value of DDName. In fact, the value of DDName identifies a DDSolid uniquely.

For further details concerning the usage of reference-objects refer to the documentation of DDLogicalPart.

Definition at line 39 of file DDSolid.h.

Constructor & Destructor Documentation

◆ DDSolid() [1/4]

DDSolid::DDSolid ( void  )

Uninitialilzed solid reference-object; for further details on reference-objects see documentation of DDLogicalPart.

Definition at line 50 of file DDSolid.cc.

◆ DDSolid() [2/4]

DDSolid::DDSolid ( const DDName name)

Creates a reference-object to a solid named name.

If the solid was not yet created using one of the solid generating factory functions DDbox(), DDtub , ... this constructor creates a (default) initialized reference object named name. It can be used as placeholder everywhere and becomes a reference to a valid solid as soon as one of the factory functions DDBox, ... has been called (using the same value for DDName).

For further details concerning reference-objects refer to the documentation of DDLogicalPart.

Definition at line 52 of file DDSolid.cc.

References DDBase< DDName, std::unique_ptr< DDI::Solid > >::create(), and DDBase< DDName, std::unique_ptr< DDI::Solid > >::name().

◆ DDSolid() [3/4]

DDSolid::DDSolid ( const DDName name,
std::unique_ptr< DDI::Solid solid 
)
private

◆ DDSolid() [4/4]

DDSolid::DDSolid ( const DDName name,
DDSolidShape  shape,
const std::vector< double > &  pars 
)
private

Definition at line 58 of file DDSolid.cc.

58  {
59  std::unique_ptr<DDI::Solid> solid(nullptr);
60  std::vector<double> dummy;
61  switch (shape) {
63  solid = std::make_unique<DDI::Box>(0, 0, 0);
64  break;
66  solid = std::make_unique<DDI::Tubs>(0, 0, 0, 0, 0);
67  break;
69  solid = std::make_unique<DDI::Cons>(0, 0, 0, 0, 0, 0, 0);
70  break;
72  solid = std::make_unique<DDI::PseudoTrap>(0, 0, 0, 0, 0, 0, false);
73  break;
75  solid = std::make_unique<DDI::Shapeless>();
76  break;
78  solid = std::make_unique<DDI::Trap>(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
79  break;
81  solid = std::make_unique<DDI::Polyhedra>(0, 0, 0, dummy, dummy);
82  break;
84  solid = std::make_unique<DDI::Polyhedra>(0, 0, 0, dummy, dummy, dummy);
85  break;
87  solid = std::make_unique<DDI::Polycone>(0, 0, dummy, dummy);
88  break;
90  solid = std::make_unique<DDI::Polycone>(0, 0, dummy, dummy, dummy);
91  break;
93  solid = std::make_unique<DDI::TruncTubs>(0, 0, 0, 0, 0, 0, 0, false);
94  break;
96  solid = std::make_unique<DDI::Torus>(0, 0, 0, 0, 0);
97  break;
99  solid = std::make_unique<DDI::Sphere>(0, 0, 0, 0, 0, 0);
100  break;
102  solid = std::make_unique<DDI::EllipticalTube>(0, 0, 0);
103  break;
105  solid = std::make_unique<DDI::CutTubs>(0., 0., 0., 0., 0., 0., 0., 1., 0., 0., -1.);
106  break;
108  solid = std::make_unique<DDI::ExtrudedPolygon>(dummy, dummy, dummy, dummy, dummy, dummy);
109  break;
111  solid = std::make_unique<DDI::Assembly>();
112  break;
113  default:
114  throw cms::Exception("DDException")
115  << "DDSolid::DDSolid( DDName, DDSolidShape, std::vector<double> ): wrong shape.";
116  }
117  solid->setParameters(pars);
118  create(name, std::move(solid));
119 }

References DDBase< DDName, std::unique_ptr< DDI::Solid > >::create(), ddassembly, ddbox, ddcons, ddcuttubs, ddellipticaltube, ddextrudedpolygon, ddpolycone_rrz, ddpolycone_rz, ddpolyhedra_rrz, ddpolyhedra_rz, ddpseudotrap, ddshapeless, ddsphere, ddtorus, ddtrap, ddtrunctubs, ddtubs, Exception, eostools::move(), DDBase< DDName, std::unique_ptr< DDI::Solid > >::name(), and shape().

Member Function Documentation

◆ parameters()

const std::vector< double > & DDSolid::parameters ( void  ) const

◆ shape()

DDSolidShape DDSolid::shape ( void  ) const

◆ volume()

double DDSolid::volume ( void  ) const

Returns the volume of the given solid (does not work with boolean soids !)

Definition at line 121 of file DDSolid.cc.

121 { return rep().volume(); }

References DDBase< DDName, std::unique_ptr< DDI::Solid > >::rep().

Friends And Related Function Documentation

◆ DDSolidFactory

friend struct DDSolidFactory
friend

Definition at line 41 of file DDSolid.h.

◆ operator<<

std::ostream& operator<< ( std::ostream &  os,
const DDSolid solid 
)
friend

Definition at line 34 of file DDSolid.cc.

34  {
36  if (defined.first) {
37  os << *(defined.first) << " ";
38  if (defined.second) {
39  os << " " << DDSolidShapesName::name(solid.shape()) << ": ";
40  solid.rep().stream(os);
41  } else {
42  os << "* solid not defined * ";
43  }
44  } else {
45  os << "* solid not declared * ";
46  }
47  return os;
48 }
DDBase::def_type
std::pair< const N *, bool > def_type
Definition: DDBase.h:51
DDSolidShape::ddtrap
DDSolidShape::ddtorus
DDBase::isDefined
def_type isDefined() const
Definition: DDBase.h:90
DDSolidShape::ddpseudotrap
DDSolidShape::ddpolyhedra_rrz
DDSolidShape::ddassembly
DDSolid::shape
DDSolidShape shape(void) const
The type of the solid.
Definition: DDSolid.cc:123
DDSolidShape::ddtubs
DDSolidShape::ddtrunctubs
DDSolidShape::ddpolyhedra_rz
DDBase< DDName, std::unique_ptr< DDI::Solid > >::name
const DDName & name() const
Definition: DDBase.h:59
DDBase< DDName, std::unique_ptr< DDI::Solid > >::rep
const DDI::rep_traits< DDName, std::unique_ptr< DDI::Solid > >::reference rep() const
Definition: DDBase.h:65
DDSolidShapesName::name
static const char *const name(DDSolidShape s)
Definition: DDSolidShapes.h:33
DDSolidShape::ddellipticaltube
DDSolidShape::ddsphere
DDSolidShape::ddcons
eostools.move
def move(src, dest)
Definition: eostools.py:511
DDSolidShape::ddbox
DDBase< DDName, std::unique_ptr< DDI::Solid > >::create
void create(const DDName &name, std::unique_ptr< DDI::Solid > vals)
Definition: DDBase.h:96
Exception
Definition: hltDiff.cc:245
DDSolidShape::ddextrudedpolygon
DDSolidShape::ddshapeless
DDSolidShape::ddcuttubs
DDSolidShape::ddpolycone_rrz
dummy
Definition: DummySelector.h:38
DDBase
Definition: DDBase.h:10
DDSolidShape::ddpolycone_rz