CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 (void)
 Uninitialilzed solid reference-object; for further details on reference-objects see documentation of DDLogicalPart. More...
 
 DDSolid (const DDName &name)
 Creates a reference-object to a solid named name. 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, std::unique_ptr< DDI::Solid >vals)
 
void create (const DDName &name)
 
 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
 
const DDI::rep_traits< DDName,
std::unique_ptr< DDI::Solid >
>::reference 
rep () const
 
DDI::rep_traits< DDName,
std::unique_ptr< DDI::Solid >
>::reference 
rep ()
 
std::string toString () const
 
const DDI::rep_traits< DDName,
std::unique_ptr< DDI::Solid >
>::reference 
val () const
 
const DDI::rep_traits< DDName,
std::unique_ptr< DDI::Solid >
>::reference 
val ()
 
virtual ~DDBase ()
 

Private Member Functions

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

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::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::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().

Definition: DDBase.h:10
void create(const DDName &name, std::unique_ptr< DDI::Solid >vals)
Definition: DDBase.h:96
DDSolid::DDSolid ( const DDName name,
std::unique_ptr< DDI::Solid solid 
)
private

Definition at line 54 of file DDSolid.cc.

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

55  create(name, std::move(solid));
56 }
Definition: DDBase.h:10
def move
Definition: eostools.py:511
void create(const DDName &name, std::unique_ptr< DDI::Solid >vals)
Definition: DDBase.h:96
DDSolid::DDSolid ( const DDName name,
DDSolidShape  shape,
const std::vector< double > &  pars 
)
private

Definition at line 58 of file DDSolid.cc.

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, and eostools::move().

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 }
def move
Definition: eostools.py:511
DDSolidShape shape(void) const
The type of the solid.
Definition: DDSolid.cc:123
void create(const DDName &name, std::unique_ptr< DDI::Solid >vals)
Definition: DDBase.h:96

Member Function Documentation

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

The type of the solid.

Definition at line 123 of file DDSolid.cc.

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

Referenced by PrintGeomSummary::addSolid(), OutputMagneticFieldDDToDDL::addToSolStore(), OutputDDToDDL::addToSolStore(), PrintGeomSolids::analyze(), HcalTB02ParametersFromDD::build(), EcalSimParametersFromDD::build(), CSCGeometryParsFromDD::build(), DDG4SolidConverter::convert(), DDAssembly::DDAssembly(), DDBox::DDBox(), DDCheckLP(), DDCompareBoolSol(), DDCompareSolid(), DDCons::DDCons(), DDCutTubs::DDCutTubs(), DDEllipticalTube::DDEllipticalTube(), DDExtrudedPolygon::DDExtrudedPolygon(), DDIntersection::DDIntersection(), DDPolycone::DDPolycone(), DDPolyhedra::DDPolyhedra(), DDPseudoTrap::DDPseudoTrap(), DDShapelessSolid::DDShapelessSolid(), DDSphere::DDSphere(), DDSubtraction::DDSubtraction(), DDTorus::DDTorus(), DDTrap::DDTrap(), DDTruncTubs::DDTruncTubs(), DDTubs::DDTubs(), DDUnion::DDUnion(), DTGeometryBuilderFromDDD::extractParameters(), DTGeometryParsFromDD::extractParameters(), DreamSD::initMap(), HcalGeomParameters::loadGeometry(), HGCalGeomParameters::loadGeometryHexagon(), HGCalGeomParameters::loadGeometryHexagon8(), HGCalGeomParameters::loadGeometryHexagonModule(), DDLDivision::makeDivider(), EcalTBHodoscopeGeometryLoaderFromDDD::makeGeometry(), operator<<(), DDPolycone::rMaxVec(), DDPolyhedra::rMaxVec(), DDPolycone::rMinVec(), DDPolyhedra::rMinVec(), DDPolycone::rVec(), DDPolyhedra::rVec(), MagGeoBuilderFromDDD::volumeHandle::shape(), DDFilteredView::shape(), DDErrorDetection::so(), DDCoreToDDXMLOutput::solid(), DDG4SolidConverter::trunctubs(), MagGeoBuilderFromDDD::volumeHandle::volumeHandle(), DDPolycone::zVec(), and DDPolyhedra::zVec().

123 { return rep().shape(); }
const DDI::rep_traits< DDName, std::unique_ptr< DDI::Solid > >::reference rep() const
Definition: DDBase.h:65
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.

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

121 { return rep().volume(); }
const DDI::rep_traits< DDName, std::unique_ptr< DDI::Solid > >::reference rep() const
Definition: DDBase.h:65

Friends And Related Function Documentation

friend struct DDSolidFactory
friend

Definition at line 41 of file DDSolid.h.

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 }
def_type isDefined() const
Definition: DDBase.h:90
const DDI::rep_traits< N, C >::reference rep() const
Definition: DDBase.h:65
static const char *const name(DDSolidShape s)
Definition: DDSolidShapes.h:33
DDSolidShape shape(void) const
The type of the solid.
Definition: DDSolid.cc:123
std::pair< const N *, bool > def_type
Definition: DDBase.h:51