Skip to content
Snippets Groups Projects
Commit 98eae52c authored by Johannes Junggeburth's avatar Johannes Junggeburth :dog2:
Browse files

Use GeoDeDuplicator in the Shape processors

parent 6c806fb5
No related branches found
No related tags found
1 merge request!280Use GeoDeDuplicator in the Shape processors
Showing
with 67 additions and 51 deletions
......@@ -28,15 +28,6 @@ struct GeoShapeSorter {
};
struct GeoComposedShapeSorter {
template<class ShapeType1, class ShapeType2>
bool operator()(const GeoIntrusivePtr<ShapeType1>& a,
const GeoIntrusivePtr<ShapeType2>& b) const {
return (*this)(a.get(), b.get());
}
bool operator()(const GeoShape* a, const GeoShape* b) const;
};
/// @brief
/// @tparam ShapeType
template<class ShapeType>
......
......@@ -83,6 +83,7 @@ int GeoShapeSorter::compare(const GeoShape* objA, const GeoShape* objB) const {
std::pair<const GeoShape*, const GeoShape*> shapeOpsA{getOps(objA)};
std::pair<const GeoShape*, const GeoShape*> shapeOpsB{getOps(objB)};
CALL_SORTER(shapeOpsA.first, shapeOpsB.first);
CALL_SORTER(shapeOpsA.second, shapeOpsB.second);
}
......@@ -156,7 +157,8 @@ int GeoShapeSorter::compare(const GeoShape* objA, const GeoShape* objB) const {
CHECK_PROPERTY(trapA, trapB, getZHalfLength);
CHECK_PROPERTY(trapA, trapB, getVertices().size);
for (size_t v = 0; v < trapA->getVertices().size(); ++v) {
if (transCmp(trapA->getVertices()[v], trapB->getVertices()[v])) return true;
const int compare = transCmp.compare(trapA->getVertices()[v], trapB->getVertices()[v]);
if (compare) return compare;
}
} else if (typeID == GeoPcon::getClassTypeID()) {
const GeoPcon* pconA = dynamic_cast<const GeoPcon*>(objA);
......@@ -226,12 +228,6 @@ int GeoShapeSorter::compare(const GeoShape* objA, const GeoShape* objB) const {
return 0;
}
bool GeoComposedShapeSorter::operator()(const GeoShape* a, const GeoShape* b) const {
const unsigned int aComposed{countComposedShapes(a)};
const unsigned int bComposed{countComposedShapes(b)};
if (aComposed != bComposed) return aComposed < bComposed;
return a->typeID() < b->typeID();
}
#undef CHECK_PROPERTY
#undef CHECK_VEC_PROPERTY
#undef COMPARE_GEOVEC
......
......@@ -21,6 +21,7 @@
#include "GeoModelKernel/GeoPara.h"
#include "GeoModelKernel/GeoTorus.h"
#include "GeoModelKernel/GeoSimplePolygonBrep.h"
#include "GeoModelKernel/GeoGenericTrap.h"
#include "GeoModelKernel/Units.h"
......@@ -33,7 +34,7 @@ std::pair<const GeoShape* , const GeoShape*> getOps(const GeoShape* composed) {
} else if (composed->typeID() == GeoShapeSubtraction::getClassTypeID()) {
const GeoShapeSubtraction* shapeSubtract = dynamic_cast<const GeoShapeSubtraction*>(composed);
return std::make_pair(shapeSubtract->getOpA(), shapeSubtract->getOpB());
} else if (composed->typeID() == GeoShapeUnion::getClassTypeID()) {
} else if (composed->typeID() == GeoShapeIntersection::getClassTypeID()) {
const GeoShapeIntersection* shapeIntersect = dynamic_cast<const GeoShapeIntersection*>(composed);
return std::make_pair(shapeIntersect->getOpA(), shapeIntersect->getOpB());
} else if (composed->typeID() == GeoShapeShift::getClassTypeID()) {
......@@ -82,7 +83,7 @@ std::vector<const GeoShape*> getBooleanComponents(const GeoShape* booleanShape)
std::string printGeoShape(const GeoShape* shape) {
std::stringstream ostr{};
constexpr double toDeg{1./GeoModelKernelUnits::deg};
ostr<<shape->type()<<" ("<<shape<<") ";
ostr<<shape->type()<<" ("<<shape<<"/"<<shape->refCount()<<") ";
const int typeID = shape->typeID();
if (typeID == GeoShapeUnion::getClassTypeID()) {
const GeoShapeUnion* shapeUnion = dynamic_cast<const GeoShapeUnion*>(shape);
......@@ -138,6 +139,12 @@ std::string printGeoShape(const GeoShape* shape) {
ostr<<"Torus R="<<torus->getRTor()<<", ";
ostr<<"sPhi="<<torus->getSPhi()*toDeg<<", ";
ostr<<"dPhi="<<torus->getDPhi()*toDeg;
} else if (typeID == GeoGenericTrap::getClassTypeID()) {
const GeoGenericTrap* trap = dynamic_cast<const GeoGenericTrap*>(shape);
ostr<<"half Z: "<<trap->getZHalfLength()<<" n Vertices: "<<trap->getVertices().size()<<std::endl;
for ( const GeoTrf::Vector2D& vec : trap->getVertices()) {
ostr<<" **** "<<GeoTrf::toString(vec)<<std::endl;
}
}
return ostr.str();
}
......
......@@ -14,8 +14,8 @@ class GmxUtil;
class AddPlane {
public:
AddPlane() {};
~AddPlane() {};
AddPlane() = default;
~AddPlane() = default;
void process(const xercesc::DOMElement *element, double &zPlane, double &rMinPlane, double &rMaxPlane);
GmxUtil* gmxUtil=nullptr;
};
......
/*
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
*/
//
......@@ -12,10 +12,12 @@
#include "GeoModelXml/Element2GeoItem.h"
#include "GeoModelKernel/GeoBox.h"
class MakeBox: public Element2GeoItem {
public:
MakeBox();
MakeBox() = default;
virtual RCBase * make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const override;
};
#endif // GEO_MODEL_XML_MAKE_BOX_H
/*
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
*/
//
......@@ -13,9 +13,10 @@
#include "GeoModelXml/Element2GeoItem.h"
class MakeCons: public Element2GeoItem {
public:
MakeCons();
virtual RCBase * make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const override;
public:
MakeCons() = default;
virtual RCBase * make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const override;
};
#endif // GEO_MODEL_XML_MAKE_CONS_H
/*
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
*/
#ifndef GEO_MODEL_XML_MAKE_ELLIPTICAL_TUBE_H
......@@ -10,8 +10,9 @@
class MakeEllipticalTube: public Element2GeoItem {
public:
MakeEllipticalTube();
MakeEllipticalTube() = default;;
virtual RCBase * make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const override;
};
#endif // GEO_MODEL_XML_MAKE_ELLIPTICAL_TUBE_H
/*
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
*/
//
......@@ -12,9 +12,10 @@
#include "GeoModelXml/Element2GeoItem.h"
class MakeGenericTrap: public Element2GeoItem {
public:
MakeGenericTrap();
MakeGenericTrap() = default;
virtual RCBase * make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const override;
};
......
/*
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
*/
//
......@@ -12,10 +12,12 @@
#include "GeoModelXml/Element2GeoItem.h"
class MakeIntersection: public Element2GeoItem {
public:
MakeIntersection();
MakeIntersection() = default;
virtual RCBase * make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const override;
};
#endif // GEO_MODEL_XML_MAKE_INTERSECTION_H
/*
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
*/
//
......@@ -13,9 +13,10 @@
#include "GeoModelXml/Element2GeoItem.h"
class MakePara: public Element2GeoItem {
public:
MakePara();
public:
MakePara() = default;
virtual RCBase * make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const override;
};
#endif // GEO_MODEL_XML_MAKE_PARA_H
/*
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
*/
//
......@@ -12,10 +12,13 @@
#include "GeoModelXml/Element2GeoItem.h"
class MakePcon: public Element2GeoItem {
public:
MakePcon();
MakePcon() = default;
virtual RCBase * make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const override;
};
#endif // GEO_MODEL_XML_MAKE_PCON_H
/*
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
*/
//
......@@ -12,10 +12,12 @@
#include "GeoModelXml/Element2GeoItem.h"
class MakePgon: public Element2GeoItem {
public:
MakePgon();
virtual RCBase * make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const override;
public:
MakePgon() = default;
virtual RCBase * make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const override;
};
#endif // GEO_MODEL_XML_MAKE_PGON_H
/*
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
*/
#include <xercesc/util/XercesDefs.hpp>
//
......@@ -13,7 +13,7 @@
class MakeSimplePolygonBrep: public Element2GeoItem {
public:
MakeSimplePolygonBrep();
MakeSimplePolygonBrep() = default;
virtual RCBase * make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const override;
};
......
......@@ -12,10 +12,12 @@
#include "GeoModelXml/Element2GeoItem.h"
class MakeSubtraction: public Element2GeoItem {
public:
MakeSubtraction();
MakeSubtraction() = default;
virtual RCBase * make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const override;
};
#endif // GEO_MODEL_XML_MAKE_SUBTRACTION_H
......@@ -9,10 +9,12 @@
#include "GeoModelXml/Element2GeoItem.h"
class MakeTorus: public Element2GeoItem {
public:
MakeTorus();
MakeTorus() = default;
virtual RCBase * make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const override;
};
#endif // GEO_MODEL_XML_MAKE_TORUS_H
......@@ -14,7 +14,7 @@
class MakeTrap: public Element2GeoItem {
public:
MakeTrap();
MakeTrap() = default;
virtual RCBase * make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const override;
};
......
......@@ -14,7 +14,7 @@
class MakeTrd: public Element2GeoItem {
public:
MakeTrd();
MakeTrd() = default;
virtual RCBase * make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const override;
};
......
/*
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
*/
//
......@@ -12,10 +12,12 @@
#include "GeoModelXml/Element2GeoItem.h"
class MakeTube: public Element2GeoItem {
public:
MakeTube();
MakeTube() = default;
virtual RCBase * make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const override;
};
#endif // GEO_MODEL_XML_MAKE_TUBE_H
......@@ -12,9 +12,10 @@
#include "GeoModelXml/Element2GeoItem.h"
class MakeTubs: public Element2GeoItem {
public:
MakeTubs();
MakeTubs() = default;
virtual RCBase * make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const override;
};
......
......@@ -8,10 +8,12 @@
#include "GeoModelXml/Element2GeoItem.h"
class MakeTwistedTrap: public Element2GeoItem {
public:
MakeTwistedTrap();
MakeTwistedTrap() = default;
virtual RCBase * make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const override;
};
#endif // GEO_MODEL_XML_MAKE_TWISTED_TRAP_H
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment