CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes
DDCompareSolid Struct Reference

Needs to know about rotmat because of BooleanSolid. More...

#include <DDCompareTools.h>

Inheritance diagram for DDCompareSolid:

Public Member Functions

 DDCompareSolid ()
 
 DDCompareSolid (const DDCompOptions &ddco)
 
bool operator() (const DDSolid &lhs, const DDSolid &rhs) const
 

Public Attributes

DDCompOptions ddco_
 

Detailed Description

Needs to know about rotmat because of BooleanSolid.

Definition at line 63 of file DDCompareTools.h.

Constructor & Destructor Documentation

DDCompareSolid::DDCompareSolid ( )

Definition at line 221 of file DDCompareTools.cc.

Referenced by operator()().

221 : ddco_() { }
DDCompOptions ddco_
DDCompareSolid::DDCompareSolid ( const DDCompOptions ddco)

Definition at line 223 of file DDCompareTools.cc.

223 : ddco_(ddco) { }
DDCompOptions ddco_

Member Function Documentation

bool DDCompareSolid::operator() ( const DDSolid lhs,
const DDSolid rhs 
) const

Definition at line 225 of file DDCompareTools.cc.

References gather_cfg::cout, dd_not_init, ddbox, ddco_, DDCompareSolid(), ddcons, ddcuttubs, ddellipsoid, ddellipticaltube, ddintersection, ddorb, ddparallelepiped, ddpolycone_rrz, ddpolycone_rz, ddpolyhedra_rrz, ddpolyhedra_rz, ddpseudotrap, ddreflected, ddshapeless, ddsphere, ddsubtraction, ddtorus, ddtrap, ddtrunctubs, ddtubs, ddunion, DDName::fullname(), DDBase< N, C >::name(), DDSolid::parameters(), DDSolid::shape(), and DDReflectionSolid::unreflected().

225  {
226  bool ret(true);
227  switch ( lhs.shape() ) {
228  case dd_not_init:
229  case ddbox:
230  case ddtubs:
231  case ddcuttubs:
232  case ddtrap:
233  case ddcons:
234  case ddpolycone_rz:
235  case ddpolyhedra_rz:
236  case ddpolycone_rrz:
237  case ddpolyhedra_rrz:
238  case ddtorus:
239  case ddpseudotrap:
240  case ddtrunctubs:
241  case ddsphere:
242  case ddorb:
243  case ddellipticaltube:
244  case ddellipsoid:
245  case ddparallelepiped:
246  case ddshapeless:
247  {
248  if ( lhs.name().fullname() != rhs.name().fullname() ) {
249  ret = false;
250  std::cout << "Solid names do not match for solid " << lhs.name().fullname() << " and " << rhs.name().fullname() << std::endl;
251  } else if ( lhs.shape() != rhs.shape() ) {
252  ret = false;
253  std::cout << "Shape types do not match for solids " << lhs.name().fullname()
254  << " and " << rhs.name().fullname()
255  << " even though their names match " << std::endl;
256  } else if ( ! DDCompareDBLVEC()(lhs.parameters(), rhs.parameters()) ) {
257  ret = false;
258  std::cout << "Parameters do not match for solids " << lhs.name().fullname()
259  << " and " << rhs.name().fullname()
260  << " even though their names and shape type match." << std::endl;
261  std::cout << "size: " << lhs.parameters().size() << " " << rhs.parameters().size() << std::endl;
262  }
263  break;
264  }
265  case ddunion:
266  case ddsubtraction:
267  case ddintersection:
268  {
269  if ( ! DDCompareBoolSol(ddco_)(lhs, rhs) ) {
270  ret = false;
271  }
272  break;
273  }
274  case ddreflected:
275  {
276  DDReflectionSolid rs1(lhs);
277  DDReflectionSolid rs2(rhs);
278  if ( ! DDCompareSolid(ddco_)( rs1.unreflected(), rs2.unreflected()) ) {
279  ret = false;
280  std::cout << "Unreflected volumes of DDReflections do not match. Reflections are "
281  << lhs.name().fullname() << " and " << rhs.name().fullname() << std::endl;
282  }
283  break;
284  }
285  default:
286  break;
287  }
288  return ret;
289 }
const std::vector< double > & parameters(void) const
Give the parameters of the solid.
Definition: DDSolid.cc:146
const N & name() const
Definition: DDBase.h:78
Needs to know because of Rotation Matrix of Boolean Relationship.
const std::string fullname() const
Definition: DDName.h:53
DDSolidShape shape(void) const
The type of the solid.
Definition: DDSolid.cc:140
DDCompOptions ddco_

Member Data Documentation

DDCompOptions DDCompareSolid::ddco_

Definition at line 67 of file DDCompareTools.h.

Referenced by operator()().