File indexing completed on 2024-04-06 12:05:25
0001 #include "DetectorDescription/Core/interface/DDCompactViewImpl.h"
0002 #include "DetectorDescription/Core/interface/DDName.h"
0003 #include "DetectorDescription/Core/interface/DDPosData.h"
0004 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0005
0006 DDCompactViewImpl::DDCompactViewImpl(const DDLogicalPart& rootnodedata) : root_(rootnodedata) {
0007 LogDebug("DDCompactViewImpl") << "Root node data = " << rootnodedata << std::endl;
0008 }
0009
0010 DDCompactViewImpl::~DDCompactViewImpl() {
0011 Graph::adj_list::size_type it = 0;
0012 if (graph_.size() == 0) {
0013 LogDebug("DDCompactViewImpl") << "In destructor, graph is empty." << std::endl;
0014 } else {
0015 LogDebug("DDCompactViewImpl") << "In destructor, graph is NOT empty."
0016 << " graph_.size() = " << graph_.size() << std::endl;
0017 for (; it < graph_.size(); ++it) {
0018 Graph::edge_range erange = graph_.edges(it);
0019 for (; erange.first != erange.second; ++(erange.first)) {
0020 DDPosData* pd = graph_.edgeData(erange.first->second);
0021 delete pd;
0022 pd = nullptr;
0023 }
0024 }
0025 }
0026 edm::LogInfo("DDCompactViewImpl") << std::endl
0027 << "DDD transient representation has been destructed." << std::endl
0028 << std::endl;
0029 }
0030
0031 DDCompactViewImpl::GraphWalker DDCompactViewImpl::walker() const { return GraphWalker(graph_, root_); }
0032
0033 void DDCompactViewImpl::position(const DDLogicalPart& self,
0034 const DDLogicalPart& parent,
0035 int copyno,
0036 const DDTranslation& trans,
0037 const DDRotation& rot,
0038 const DDDivision* div) {
0039 DDPosData* pd = new DDPosData(trans, rot, copyno, div);
0040 graph_.addEdge(parent, self, pd);
0041 }
0042
0043 void DDCompactViewImpl::swap(DDCompactViewImpl& implToSwap) { graph_.swap(implToSwap.graph_); }
0044
0045 DDCompactViewImpl::DDCompactViewImpl() {}