-
Notifications
You must be signed in to change notification settings - Fork 4.2k
/
DDCompactView.cc
139 lines (115 loc) · 4.63 KB
/
DDCompactView.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
#include "DetectorDescription/Core/interface/DDCompactView.h"
#include <cstdlib>
#include "DetectorDescription/Core/interface/DDRotationMatrix.h"
#include "DetectorDescription/Core/interface/DDBase.h"
#include "DetectorDescription/Core/interface/DDCompactViewImpl.h"
#include "DetectorDescription/Core/interface/DDLogicalPart.h"
#include "DetectorDescription/Core/interface/DDMaterial.h"
#include "DetectorDescription/Core/interface/DDPosData.h"
#include "DetectorDescription/Core/interface/DDSolid.h"
#include "DetectorDescription/Core/interface/DDSpecifics.h"
#include "DetectorDescription/Core/src/LogicalPart.h"
#include "DetectorDescription/Core/src/Material.h"
#include "DetectorDescription/Core/src/Solid.h"
#include "DetectorDescription/Core/src/Specific.h"
class DDDivision;
/**
Compact-views can be created only after an appropriate geometrical hierarchy
has been defined using DDpos().
Further it is assumed that the DDLogicalPart defining the root of the
geometrical hierarchy has been defined using DDRootDef - singleton.
It will be extracted from this singleton using DDRootDef::instance().root()!
The first time this constructor gets called, the internal graph representation
is build up. Subsequent calls will return immidiately providing access to
the already built up compact-view representation.
Currently the only usefull methods are DDCompactView::graph(), DDCompactView::root() !
\todo define a stable interface for navigation (don't expose the user to the graph!)
*/
//
DDCompactView::DDCompactView(const DDLogicalPart & rootnodedata)
: rep_( new DDCompactViewImpl( rootnodedata )),
worldpos_( new DDPosData( DDTranslation(), DDRotation(), 0 ))
{
// 2010-01-27 I am leaving this here so that we are sure the global stores
// are open when a new DDCompactView is being made. Eventually I want to
// get rid of the need for this somehow? think about it...
DDMaterial::StoreT::instance().setReadOnly(false);
DDSolid::StoreT::instance().setReadOnly(false);
DDLogicalPart::StoreT::instance().setReadOnly(false);
DDSpecifics::StoreT::instance().setReadOnly(false);
DDRotation::StoreT::instance().setReadOnly(false);
}
DDCompactView::~DDCompactView()
{}
/**
The compact-view is kept in an acyclic directed multigraph represented
by an instance of class Graph<DDLogicalPart, DDPosData*).
Graph provides methods for navigating its content.
*/
const DDCompactView::Graph & DDCompactView::graph() const
{
return rep_->graph();
}
DDCompactView::GraphWalker
DDCompactView::walker() const
{
return rep_->walker();
}
const DDLogicalPart & DDCompactView::root() const
{
return rep_->root();
}
const DDPosData* DDCompactView::worldPosition() const
{
return worldpos_.get();
}
void DDCompactView::position (const DDLogicalPart & self,
const DDLogicalPart & parent,
const std::string& copyno,
const DDTranslation & trans,
const DDRotation & rot,
const DDDivision * div)
{
int cpno = atoi(copyno.c_str());
position(self,parent,cpno,trans,rot, div);
}
void DDCompactView::position (const DDLogicalPart & self,
const DDLogicalPart & parent,
int copyno,
const DDTranslation & trans,
const DDRotation & rot,
const DDDivision * div)
{
rep_->position( self, parent, copyno, trans, rot, div );
}
// >>---==========================<()>==========================---<<
// UNSTABLE STUFF below ...
void DDCompactView::setRoot(const DDLogicalPart & root)
{
rep_->setRoot(root);
}
void DDCompactView::swap( DDCompactView& repToSwap ) {
rep_->swap ( *(repToSwap.rep_) );
}
DDCompactView::DDCompactView()
: rep_(new DDCompactViewImpl),
worldpos_( new DDPosData( DDTranslation(), DDRotation(), 0 ))
{ }
void DDCompactView::lockdown() {
// at this point we should have a valid store of DDObjects and we will move these
// to the local storage area using swaps with the existing Singleton<Store...>'s
// 2010-01-27 memory patch
DDMaterial::StoreT::instance().swap(matStore_);
DDSolid::StoreT::instance().swap(solidStore_);
DDLogicalPart::StoreT::instance().swap(lpStore_);
DDSpecifics::StoreT::instance().swap(specStore_);
DDRotation::StoreT::instance().swap(rotStore_);
// 2010-01-27 memory patch
// not sure this will stay, but for now we want to explicitely lock the global stores.
// lock the global stores.
DDMaterial::StoreT::instance().setReadOnly(false);
DDSolid::StoreT::instance().setReadOnly(false);
DDLogicalPart::StoreT::instance().setReadOnly(false);
DDSpecifics::StoreT::instance().setReadOnly(false);
DDRotation::StoreT::instance().setReadOnly(false);
}