Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
mantidproject
mantid
Commits
7200b707
Commit
7200b707
authored
Jan 06, 2016
by
Hahn, Steven
Browse files
Refs #14764. Reviewed files.
parent
146c0c77
Changes
43
Hide whitespace changes
Inline
Side-by-side
Framework/DataObjects/src/EventList.cpp
View file @
7200b707
...
...
@@ -343,9 +343,9 @@ EventList &EventList::operator+=(const std::vector<TofEvent> &more_events) {
// and append to the list
this
->
weightedEvents
.
reserve
(
this
->
weightedEvents
.
size
()
+
more_events
.
size
());
for
(
auto
i
t
=
more_events
.
begin
();
it
!=
more_events
.
end
();
++
i
t
)
this
->
weightedEvents
.
push_back
(
WeightedEvent
(
*
it
));
for
(
const
auto
&
even
t
:
more_events
)
{
this
->
weightedEvents
.
emplace_back
(
even
t
)
;
}
break
;
case
WEIGHTED_NOTIME
:
...
...
@@ -355,7 +355,7 @@ EventList &EventList::operator+=(const std::vector<TofEvent> &more_events) {
more_events
.
size
());
for
(
auto
it
=
more_events
.
begin
();
it
!=
more_events
.
end
();
++
it
)
this
->
weightedEventsNoTime
.
push_back
(
WeightedEventNoTime
(
*
it
)
)
;
this
->
weightedEventsNoTime
.
emplace_back
(
*
it
);
break
;
}
...
...
@@ -405,9 +405,9 @@ operator+=(const std::vector<WeightedEvent> &more_events) {
// and append to the list
this
->
weightedEventsNoTime
.
reserve
(
this
->
weightedEventsNoTime
.
size
()
+
more_events
.
size
());
for
(
auto
i
t
=
more_events
.
begin
();
it
!=
more_events
.
end
();
++
it
)
this
->
weightedEventsNoTime
.
push_back
(
WeightedEventNoTime
(
*
it
));
for
(
const
auto
&
even
t
:
more_events
)
{
this
->
weightedEventsNoTime
.
emplace_back
(
event
);
}
break
;
}
...
...
@@ -501,14 +501,14 @@ void EventList::minusHelper(std::vector<T1> &events,
* Using it caused a segault, Ticket #2306.
* So we cache the end (this speeds up too).
*/
auto
more_begin
=
more_events
.
begin
();
auto
more_end
=
more_events
.
end
();
auto
more_begin
=
more_events
.
c
begin
();
auto
more_end
=
more_events
.
c
end
();
for
(
itev
=
more_begin
;
itev
!=
more_end
;
itev
++
)
{
// We call the constructor for T1. In the case of WeightedEventNoTime, the
// pulse time will just be ignored.
events
.
push
_back
(
T1
(
itev
->
tof
(),
itev
->
pulseTime
(),
itev
->
weight
()
*
(
-
1.0
),
itev
->
errorSquared
())
)
;
events
.
emplace
_back
(
itev
->
tof
(),
itev
->
pulseTime
(),
itev
->
weight
()
*
(
-
1.0
),
itev
->
errorSquared
());
}
}
...
...
@@ -1628,10 +1628,7 @@ EventList::compressEventsHelper(const std::vector<T> &events,
double
weight
=
0
;
double
errorSquared
=
0
;
typename
std
::
vector
<
T
>::
const_iterator
it
;
auto
it_end
=
events
.
end
();
// cache for speed
for
(
it
=
events
.
begin
();
it
!=
it_end
;
it
++
)
{
for
(
auto
it
=
events
.
cbegin
();
it
!=
events
.
cend
();
it
++
)
{
if
((
it
->
m_tof
-
lastTof
)
<=
tolerance
)
{
// Carry the error and weight
weight
+=
it
->
weight
();
...
...
@@ -1847,9 +1844,8 @@ void EventList::compressEvents(double tolerance, EventList *destination,
template
<
class
T
>
typename
std
::
vector
<
T
>::
const_iterator
EventList
::
findFirstEvent
(
const
std
::
vector
<
T
>
&
events
,
const
double
seek_tof
)
{
auto
itev
=
events
.
begin
();
auto
itev_end
=
events
.
end
();
// cache for speed
auto
itev
=
events
.
cbegin
();
auto
itev_end
=
events
.
cend
();
// cache for speed
// if tof < X[0], that means that you need to skip some events
while
((
itev
!=
itev_end
)
&&
(
itev
->
tof
()
<
seek_tof
))
...
...
@@ -1903,9 +1899,8 @@ template <class T>
typename
std
::
vector
<
T
>::
const_iterator
EventList
::
findFirstTimeAtSampleEvent
(
const
std
::
vector
<
T
>
&
events
,
const
double
seek_time
,
const
double
&
tofFactor
,
const
double
&
tofOffset
)
const
{
auto
itev
=
events
.
begin
();
auto
itev_end
=
events
.
end
();
// cache for speed
auto
itev
=
events
.
cbegin
();
auto
itev_end
=
events
.
cend
();
// cache for speed
// if tof < X[0], that means that you need to skip some events
while
((
itev
!=
itev_end
)
&&
...
...
@@ -1987,7 +1982,7 @@ void EventList::histogramForWeightsHelper(const std::vector<T> &events,
if
(
events
.
size
()
>
0
)
{
// Iterate through all events (sorted by tof)
auto
itev
=
findFirstEvent
(
events
,
X
[
0
]);
auto
itev_end
=
events
.
end
();
auto
itev_end
=
events
.
c
end
();
// The above can still take you to end() if no events above X[0], so check
// again.
if
(
itev
==
itev_end
)
...
...
@@ -2182,8 +2177,7 @@ void EventList::generateCountsHistogramPulseTime(const MantidVec &X,
// Iterate through all events (sorted by pulse time)
auto
itev
=
findFirstPulseEvent
(
this
->
events
,
X
[
0
]);
std
::
vector
<
TofEvent
>::
const_iterator
itev_end
=
events
.
end
();
// cache for speed
auto
itev_end
=
events
.
cend
();
// cache for speed
// The above can still take you to end() if no events above X[0], so check
// again.
if
(
itev
==
itev_end
)
...
...
@@ -2607,10 +2601,9 @@ template <class T>
void
EventList
::
convertTofHelper
(
std
::
vector
<
T
>
&
events
,
const
double
factor
,
const
double
offset
)
{
// iterate through all events
typename
std
::
vector
<
T
>::
iterator
itev
;
auto
itev_end
=
events
.
end
();
// cache for speed
for
(
itev
=
events
.
begin
();
itev
!=
itev_end
;
itev
++
)
itev
->
m_tof
=
itev
->
m_tof
*
factor
+
offset
;
for
(
auto
&
event
:
events
)
{
event
.
m_tof
=
event
.
m_tof
*
factor
+
offset
;
}
}
// --------------------------------------------------------------------------
...
...
@@ -2639,10 +2632,9 @@ template <class T>
void
EventList
::
addPulsetimeHelper
(
std
::
vector
<
T
>
&
events
,
const
double
seconds
)
{
// iterate through all events
typename
std
::
vector
<
T
>::
iterator
itev
;
auto
itev_end
=
events
.
end
();
// cache for speed
for
(
itev
=
events
.
begin
();
itev
!=
itev_end
;
itev
++
)
itev
->
m_pulsetime
+=
seconds
;
for
(
auto
&
event
:
events
)
{
event
.
m_pulsetime
+=
seconds
;
}
}
// --------------------------------------------------------------------------
...
...
@@ -2761,11 +2753,8 @@ void EventList::maskTof(const double tofMin, const double tofMax) {
template
<
class
T
>
void
EventList
::
getTofsHelper
(
const
std
::
vector
<
T
>
&
events
,
std
::
vector
<
double
>
&
tofs
)
{
typename
std
::
vector
<
T
>::
const_iterator
itev
;
auto
itev_end
=
events
.
end
();
// cache for speed
tofs
.
clear
();
for
(
itev
=
events
.
begin
();
itev
!=
itev_end
;
itev
++
)
for
(
auto
itev
=
events
.
c
begin
();
itev
!=
events
.
cend
();
++
itev
)
tofs
.
push_back
(
itev
->
m_tof
);
}
...
...
@@ -2809,12 +2798,10 @@ std::vector<double> EventList::getTofs() const {
template
<
class
T
>
void
EventList
::
getWeightsHelper
(
const
std
::
vector
<
T
>
&
events
,
std
::
vector
<
double
>
&
weights
)
{
typename
std
::
vector
<
T
>::
const_iterator
itev
;
auto
itev_end
=
events
.
end
();
// cache for speed
weights
.
clear
();
for
(
itev
=
events
.
begin
();
itev
!=
itev_end
;
itev
++
)
weights
.
push_back
(
itev
->
weight
());
for
(
const
auto
&
event
:
events
)
{
weights
.
push_back
(
event
.
weight
());
}
}
/** Fill a vector with the list of Weights
...
...
@@ -2858,12 +2845,10 @@ std::vector<double> EventList::getWeights() const {
template
<
class
T
>
void
EventList
::
getWeightErrorsHelper
(
const
std
::
vector
<
T
>
&
events
,
std
::
vector
<
double
>
&
weightErrors
)
{
typename
std
::
vector
<
T
>::
const_iterator
itev
;
auto
itev_end
=
events
.
end
();
// cache for speed
weightErrors
.
clear
();
for
(
itev
=
events
.
begin
();
itev
!=
itev_end
;
itev
++
)
weightErrors
.
push_back
(
itev
->
error
());
for
(
const
auto
&
event
:
events
)
{
weightErrors
.
push_back
(
event
.
error
());
}
}
/** Fill a vector with the list of Weight Errors
...
...
@@ -2908,12 +2893,10 @@ template <class T>
void
EventList
::
getPulseTimesHelper
(
const
std
::
vector
<
T
>
&
events
,
std
::
vector
<
Mantid
::
Kernel
::
DateAndTime
>
&
times
)
{
typename
std
::
vector
<
T
>::
const_iterator
itev
;
auto
itev_end
=
events
.
end
();
// cache for speed
times
.
clear
();
for
(
itev
=
events
.
begin
();
itev
!=
itev_end
;
itev
++
)
times
.
push_back
(
itev
->
pulseTime
());
for
(
const
auto
&
event
:
events
)
{
times
.
push_back
(
event
.
pulseTime
());
}
}
/** Get the pulse times of each event in this EventList.
...
...
@@ -3290,19 +3273,18 @@ void EventList::multiplyHelper(std::vector<T> &events, const double value,
double
errorSquared
=
error
*
error
;
double
valueSquared
=
value
*
value
;
typename
std
::
vector
<
T
>::
iterator
itev
;
auto
itev_end
=
events
.
end
();
if
(
error
==
0
)
{
// Error-less calculation
for
(
itev
=
events
.
begin
();
itev
!=
itev_end
;
itev
++
)
{
for
(
auto
itev
=
events
.
begin
();
itev
!=
itev_end
;
itev
++
)
{
itev
->
m_errorSquared
=
static_cast
<
float
>
(
itev
->
m_errorSquared
*
valueSquared
);
itev
->
m_weight
*=
static_cast
<
float
>
(
value
);
}
}
else
{
// Carry the scalar error
for
(
itev
=
events
.
begin
();
itev
!=
itev_end
;
itev
++
)
{
for
(
auto
itev
=
events
.
begin
();
itev
!=
itev_end
;
itev
++
)
{
itev
->
m_errorSquared
=
static_cast
<
float
>
(
itev
->
m_errorSquared
*
valueSquared
+
errorSquared
*
itev
->
m_weight
*
itev
->
m_weight
);
...
...
@@ -4548,11 +4530,9 @@ template <class T>
void
EventList
::
convertUnitsQuicklyHelper
(
typename
std
::
vector
<
T
>
&
events
,
const
double
&
factor
,
const
double
&
power
)
{
auto
itev
=
events
.
begin
();
auto
itev_end
=
events
.
end
();
for
(;
itev
!=
itev_end
;
itev
++
)
{
for
(
auto
&
event
:
events
)
{
// Output unit = factor * (input) ^ power
itev
->
m_tof
=
factor
*
std
::
pow
(
itev
->
m_tof
,
power
);
event
.
m_tof
=
factor
*
std
::
pow
(
event
.
m_tof
,
power
);
}
}
...
...
Framework/DataObjects/src/FractionalRebinning.cpp
View file @
7200b707
...
...
@@ -43,17 +43,15 @@ bool getIntersectionRegion(MatrixWorkspace_const_sptr outputWS,
yn_hi
<
verticalAxis
.
front
()
||
yn_lo
>
verticalAxis
.
back
())
return
false
;
auto
start_it
=
std
::
upper_bound
(
xAxis
.
begin
(),
xAxis
.
end
(),
xn_lo
);
auto
end_it
=
std
::
upper_bound
(
xAxis
.
begin
(),
xAxis
.
end
(),
xn_hi
);
auto
start_it
=
std
::
upper_bound
(
xAxis
.
cbegin
(),
xAxis
.
cend
(),
xn_lo
);
auto
end_it
=
std
::
upper_bound
(
xAxis
.
cbegin
(),
xAxis
.
cend
(),
xn_hi
);
x_start
=
0
;
x_end
=
xAxis
.
size
()
-
1
;
if
(
start_it
!=
xAxis
.
begin
())
{
x_start
=
(
start_it
-
xAxis
.
begin
()
-
1
);
if
(
start_it
!=
xAxis
.
c
begin
())
{
x_start
=
(
start_it
-
xAxis
.
c
begin
()
-
1
);
}
if
(
end_it
!=
xAxis
.
end
())
{
x_end
=
end_it
-
xAxis
.
begin
();
if
(
end_it
!=
xAxis
.
c
end
())
{
x_end
=
end_it
-
xAxis
.
c
begin
();
}
// Q region
...
...
Framework/DataObjects/src/MDBoxFlatTree.cpp
View file @
7200b707
...
...
@@ -409,8 +409,7 @@ void MDBoxFlatTree::loadExperimentInfos(
std
::
map
<
std
::
string
,
std
::
string
>
entries
;
file
->
getEntries
(
entries
);
std
::
list
<
uint16_t
>
ExperimentBlockNum
;
auto
it
=
entries
.
begin
();
for
(;
it
!=
entries
.
end
();
++
it
)
{
for
(
auto
it
=
entries
.
begin
();
it
!=
entries
.
end
();
++
it
)
{
std
::
string
name
=
it
->
first
;
if
(
boost
::
starts_with
(
name
,
"experiment"
))
{
try
{
...
...
Framework/DataObjects/src/MaskWorkspace.cpp
View file @
7200b707
...
...
@@ -197,8 +197,7 @@ bool MaskWorkspace::isMasked(const std::set<detid_t> &detectorIDs) const {
}
bool
masked
(
true
);
for
(
auto
it
=
detectorIDs
.
begin
();
it
!=
detectorIDs
.
end
();
++
it
)
{
for
(
auto
it
=
detectorIDs
.
cbegin
();
it
!=
detectorIDs
.
cend
();
++
it
)
{
if
(
!
this
->
isMasked
(
*
it
))
{
masked
=
false
;
break
;
// allows space for a debug print statement
...
...
Framework/DataObjects/src/PeakShapeEllipsoid.cpp
View file @
7200b707
...
...
@@ -82,10 +82,8 @@ std::vector<Kernel::V3D> PeakShapeEllipsoid::getDirectionInSpecificFrame(
"compatible with the direction vector"
);
}
for
(
auto
it
=
m_directions
.
begin
();
it
!=
m_directions
.
end
();
++
it
)
{
for
(
auto
it
=
m_directions
.
cbegin
();
it
!=
m_directions
.
cend
();
++
it
)
{
directionsInFrame
.
push_back
(
invertedGoniometerMatrix
*
(
*
it
));
Mantid
::
Kernel
::
V3D
d
=
invertedGoniometerMatrix
*
(
*
it
);
}
return
directionsInFrame
;
...
...
Framework/DataObjects/src/TableWorkspace.cpp
View file @
7200b707
...
...
@@ -34,10 +34,10 @@ TableWorkspace::TableWorkspace(const TableWorkspace &other)
:
ITableWorkspace
(
other
),
m_rowCount
(
0
),
m_LogManager
(
new
API
::
LogManager
)
{
setRowCount
(
other
.
m_rowCount
);
auto
it
=
other
.
m_columns
.
begin
();
while
(
it
!=
other
.
m_columns
.
end
())
{
auto
it
=
other
.
m_columns
.
c
begin
();
while
(
it
!=
other
.
m_columns
.
c
end
())
{
addColumn
(
boost
::
shared_ptr
<
API
::
Column
>
((
*
it
)
->
clone
()));
it
++
;
++
it
;
}
// copy logs/properties.
m_LogManager
=
boost
::
make_shared
<
API
::
LogManager
>
(
*
(
other
.
m_LogManager
));
...
...
@@ -48,7 +48,7 @@ TableWorkspace::~TableWorkspace() {}
size_t
TableWorkspace
::
getMemorySize
()
const
{
size_t
data_size
=
0
;
for
(
auto
c
=
m_columns
.
begin
();
c
!=
m_columns
.
end
();
c
++
)
{
for
(
auto
c
=
m_columns
.
c
begin
();
c
!=
m_columns
.
c
end
();
++
c
)
{
data_size
+=
(
*
c
)
->
sizeOfData
();
}
data_size
+=
m_LogManager
->
getMemorySize
();
...
...
@@ -118,9 +118,7 @@ API::Column_sptr TableWorkspace::getColumn(const std::string &name) {
/// Gets the shared pointer to a column.
API
::
Column_const_sptr
TableWorkspace
::
getColumn
(
const
std
::
string
&
name
)
const
{
auto
c_it
=
m_columns
.
begin
();
auto
c_end
=
m_columns
.
end
();
for
(;
c_it
!=
c_end
;
c_it
++
)
{
for
(
auto
c_it
=
m_columns
.
cbegin
();
c_it
!=
m_columns
.
cend
();
++
c_it
)
{
if
(
c_it
->
get
()
->
name
()
==
name
)
{
return
*
c_it
;
}
...
...
Framework/Geometry/src/Instrument.cpp
View file @
7200b707
...
...
@@ -182,8 +182,7 @@ void Instrument::getDetectors(detid2det_map &out_map) const {
const
detid2det_map
&
in_dets
=
static_cast
<
const
Instrument
*>
(
m_base
)
->
m_detectorCache
;
// And turn them into parametrized versions
for
(
auto
it
=
in_dets
.
begin
();
it
!=
in_dets
.
end
();
++
it
)
{
for
(
auto
it
=
in_dets
.
cbegin
();
it
!=
in_dets
.
cend
();
++
it
)
{
out_map
.
insert
(
std
::
pair
<
detid_t
,
IDetector_sptr
>
(
it
->
first
,
ParComponentFactory
::
createDetector
(
it
->
second
.
get
(),
m_map
)));
...
...
@@ -201,14 +200,12 @@ std::vector<detid_t> Instrument::getDetectorIDs(bool skipMonitors) const {
if
(
m_map
)
{
const
detid2det_map
&
in_dets
=
static_cast
<
const
Instrument
*>
(
m_base
)
->
m_detectorCache
;
for
(
auto
it
=
in_dets
.
begin
();
it
!=
in_dets
.
end
();
++
it
)
for
(
auto
it
=
in_dets
.
cbegin
();
it
!=
in_dets
.
cend
();
++
it
)
if
(
!
skipMonitors
||
!
it
->
second
->
isMonitor
())
out
.
push_back
(
it
->
first
);
}
else
{
const
detid2det_map
&
in_dets
=
m_detectorCache
;
for
(
auto
it
=
in_dets
.
begin
();
it
!=
in_dets
.
end
();
++
it
)
for
(
auto
it
=
in_dets
.
cbegin
();
it
!=
in_dets
.
cend
();
++
it
)
if
(
!
skipMonitors
||
!
it
->
second
->
isMonitor
())
out
.
push_back
(
it
->
first
);
}
...
...
@@ -231,8 +228,7 @@ std::size_t Instrument::getNumberDetectors(bool skipMonitors) const {
if
(
m_map
)
{
const
detid2det_map
&
in_dets
=
static_cast
<
const
Instrument
*>
(
m_base
)
->
m_detectorCache
;
for
(
auto
it
=
in_dets
.
begin
();
it
!=
in_dets
.
end
();
++
it
)
for
(
auto
it
=
in_dets
.
cbegin
();
it
!=
in_dets
.
cend
();
++
it
)
if
(
it
->
second
->
isMonitor
())
monitors
+=
1
;
}
else
{
...
...
@@ -509,8 +505,7 @@ bool Instrument::isMonitor(const std::set<detid_t> &detector_ids) const {
if
(
detector_ids
.
empty
())
return
false
;
for
(
auto
it
=
detector_ids
.
begin
();
it
!=
detector_ids
.
end
();
++
it
)
{
for
(
auto
it
=
detector_ids
.
cbegin
();
it
!=
detector_ids
.
cend
();
++
it
)
{
if
(
this
->
isMonitor
(
*
it
))
return
true
;
}
...
...
@@ -557,8 +552,7 @@ bool Instrument::isDetectorMasked(const std::set<detid_t> &detector_ids) const {
if
(
detector_ids
.
empty
())
return
false
;
for
(
auto
it
=
detector_ids
.
begin
();
it
!=
detector_ids
.
end
();
++
it
)
{
for
(
auto
it
=
detector_ids
.
cbegin
();
it
!=
detector_ids
.
cend
();
++
it
)
{
if
(
!
this
->
isDetectorMasked
(
*
it
))
return
false
;
}
...
...
@@ -832,8 +826,7 @@ void Instrument::getBoundingBox(BoundingBox &assemblyBox) const {
m_cachedBoundingBox
=
new
BoundingBox
();
ComponentID
sourceID
=
getSource
()
->
getComponentID
();
// Loop over the children and define a box large enough for all of them
for
(
auto
it
=
m_children
.
begin
();
it
!=
m_children
.
end
();
++
it
)
{
for
(
auto
it
=
m_children
.
cbegin
();
it
!=
m_children
.
cend
();
++
it
)
{
BoundingBox
compBox
;
IComponent
*
component
=
*
it
;
if
(
component
&&
component
->
getComponentID
()
!=
sourceID
)
{
...
...
@@ -958,10 +951,9 @@ double Instrument::calcConversion(
const
std
::
map
<
detid_t
,
double
>
&
offsets
)
{
double
factor
=
0.
;
double
offset
;
for
(
auto
iter
=
detectors
.
begin
();
iter
!=
detectors
.
end
();
++
iter
)
{
for
(
auto
iter
=
detectors
.
cbegin
();
iter
!=
detectors
.
cend
();
++
iter
)
{
auto
off_iter
=
offsets
.
find
(
*
iter
);
if
(
off_iter
!=
offsets
.
end
())
{
if
(
off_iter
!=
offsets
.
c
end
())
{
offset
=
offsets
.
find
(
*
iter
)
->
second
;
}
else
{
offset
=
0.
;
...
...
Framework/Geometry/src/Instrument/CompAssembly.cpp
View file @
7200b707
...
...
@@ -372,8 +372,7 @@ void CompAssembly::getBoundingBox(BoundingBox &assemblyBox) const {
if
(
!
m_cachedBoundingBox
)
{
m_cachedBoundingBox
=
new
BoundingBox
();
// Loop over the children and define a box large enough for all of them
for
(
auto
it
=
m_children
.
begin
();
it
!=
m_children
.
end
();
++
it
)
{
for
(
auto
it
=
m_children
.
cbegin
();
it
!=
m_children
.
cend
();
++
it
)
{
BoundingBox
compBox
;
if
(
*
it
)
{
(
*
it
)
->
getBoundingBox
(
compBox
);
...
...
Framework/Geometry/src/Instrument/DetectorGroup.cpp
View file @
7200b707
...
...
@@ -353,8 +353,7 @@ std::string DetectorGroup::getParameterAsString(const std::string &pname,
void
DetectorGroup
::
getBoundingBox
(
BoundingBox
&
boundingBox
)
const
{
// boundingBox = BoundingBox(); // this change may modify a lot of behaviour
// -> verify
for
(
auto
cit
=
m_detectors
.
begin
();
cit
!=
m_detectors
.
end
();
++
cit
)
{
for
(
auto
cit
=
m_detectors
.
cbegin
();
cit
!=
m_detectors
.
cend
();
++
cit
)
{
BoundingBox
memberBox
;
if
(
!
boundingBox
.
isAxisAligned
())
{
// coordinate system
...
...
Framework/Geometry/src/Instrument/InstrumentDefinitionParser.cpp
View file @
7200b707
...
...
@@ -1108,10 +1108,9 @@ void InstrumentDefinitionParser::appendAssembly(
InstrumentDefinitionParser
::
getParentComponent
(
pElem
);
// check if this location is in the exclude list
auto
it
=
find
(
excludeList
.
begin
(),
excludeList
.
end
(),
InstrumentDefinitionParser
::
getNameOfLocationElement
(
pElem
,
pParentElem
));
auto
it
=
find
(
excludeList
.
cbegin
(),
excludeList
.
cend
(),
InstrumentDefinitionParser
::
getNameOfLocationElement
(
pElem
,
pParentElem
));
if
(
it
==
excludeList
.
end
())
{
std
::
string
typeName
=
...
...
Framework/Geometry/src/Instrument/ParameterMap.cpp
View file @
7200b707
...
...
@@ -104,14 +104,14 @@ bool ParameterMap::operator==(const ParameterMap &rhs) const {
// asString method turns the ComponentIDs to full-qualified name identifiers
// so we will use the same approach to compare them
auto
thisEnd
=
this
->
m_map
.
end
();
auto
rhsEnd
=
rhs
.
m_map
.
end
();
auto
thisEnd
=
this
->
m_map
.
c
end
();
auto
rhsEnd
=
rhs
.
m_map
.
c
end
();
for
(
auto
thisIt
=
this
->
m_map
.
begin
();
thisIt
!=
thisEnd
;
++
thisIt
)
{
const
IComponent
*
comp
=
static_cast
<
IComponent
*>
(
thisIt
->
first
);
const
std
::
string
fullName
=
comp
->
getFullName
();
const
auto
&
param
=
thisIt
->
second
;
bool
match
(
false
);
for
(
auto
rhsIt
=
rhs
.
m_map
.
begin
();
rhsIt
!=
rhsEnd
;
++
rhsIt
)
{
for
(
auto
rhsIt
=
rhs
.
m_map
.
c
begin
();
rhsIt
!=
rhsEnd
;
++
rhsIt
)
{
const
IComponent
*
rhsComp
=
static_cast
<
IComponent
*>
(
rhsIt
->
first
);
const
std
::
string
rhsFullName
=
rhsComp
->
getFullName
();
if
(
fullName
==
rhsFullName
&&
(
*
param
)
==
(
*
rhsIt
->
second
))
{
...
...
@@ -203,14 +203,14 @@ const std::string ParameterMap::diff(const ParameterMap &rhs,
// so we will use the same approach to compare them
std
::
stringstream
strOutput
;
auto
thisEnd
=
this
->
m_map
.
end
();
auto
rhsEnd
=
rhs
.
m_map
.
end
();
for
(
auto
thisIt
=
this
->
m_map
.
begin
();
thisIt
!=
thisEnd
;
++
thisIt
)
{
auto
thisEnd
=
this
->
m_map
.
c
end
();
auto
rhsEnd
=
rhs
.
m_map
.
c
end
();
for
(
auto
thisIt
=
this
->
m_map
.
c
begin
();
thisIt
!=
thisEnd
;
++
thisIt
)
{
const
IComponent
*
comp
=
static_cast
<
IComponent
*>
(
thisIt
->
first
);
const
std
::
string
fullName
=
comp
->
getFullName
();
const
auto
&
param
=
thisIt
->
second
;
bool
match
(
false
);
for
(
auto
rhsIt
=
rhs
.
m_map
.
begin
();
rhsIt
!=
rhsEnd
;
++
rhsIt
)
{
for
(
auto
rhsIt
=
rhs
.
m_map
.
c
begin
();
rhsIt
!=
rhsEnd
;
++
rhsIt
)
{
const
IComponent
*
rhsComp
=
static_cast
<
IComponent
*>
(
rhsIt
->
first
);
const
std
::
string
rhsFullName
=
rhsComp
->
getFullName
();
if
(
fullName
==
rhsFullName
&&
(
*
param
)
==
(
*
rhsIt
->
second
))
{
...
...
@@ -227,7 +227,7 @@ const std::string ParameterMap::diff(const ParameterMap &rhs,
<<
" and value: "
<<
(
*
param
).
asString
()
<<
std
::
endl
;
bool
componentWithSameNameRHS
=
false
;
bool
parameterWithSameNameRHS
=
false
;
for
(
auto
rhsIt
=
rhs
.
m_map
.
begin
();
rhsIt
!=
rhsEnd
;
++
rhsIt
)
{
for
(
auto
rhsIt
=
rhs
.
m_map
.
c
begin
();
rhsIt
!=
rhsEnd
;
++
rhsIt
)
{
const
IComponent
*
rhsComp
=
static_cast
<
IComponent
*>
(
rhsIt
->
first
);
const
std
::
string
rhsFullName
=
rhsComp
->
getFullName
();
if
(
fullName
==
rhsFullName
)
{
...
...
@@ -939,7 +939,7 @@ std::set<std::string> ParameterMap::names(const IComponent *comp) const {
*/
std
::
string
ParameterMap
::
asString
()
const
{
std
::
stringstream
out
;
for
(
auto
it
=
m_map
.
begin
();
it
!=
m_map
.
end
();
it
++
)
{
for
(
auto
it
=
m_map
.
c
begin
();
it
!=
m_map
.
c
end
();
++
it
)
{
boost
::
shared_ptr
<
Parameter
>
p
=
it
->
second
;
if
(
p
&&
it
->
first
)
{
const
IComponent
*
comp
=
(
const
IComponent
*
)(
it
->
first
);
...
...
Framework/Geometry/src/MDGeometry/MDGeometryXMLBuilder.cpp
View file @
7200b707
...
...
@@ -64,8 +64,7 @@ bool MDGeometryBuilderXML<CheckDimensionPolicy>::addOrdinaryDimension(
template
<
typename
CheckDimensionPolicy
>
void
MDGeometryBuilderXML
<
CheckDimensionPolicy
>::
addManyOrdinaryDimensions
(
VecIMDDimension_sptr
manyDims
)
const
{
auto
it
=
manyDims
.
begin
();
for
(;
it
!=
manyDims
.
end
();
++
it
)
{
for
(
auto
it
=
manyDims
.
begin
();
it
!=
manyDims
.
end
();
++
it
)
{
addOrdinaryDimension
(
*
it
);
}
}
...
...
@@ -205,9 +204,7 @@ const std::string &MDGeometryBuilderXML<CheckDimensionPolicy>::create() const {
// Loop through dimensions and generate xml for each.
std
::
string
dimensionXMLString
;
auto
it
=
m_vecDimensions
.
begin
();
for
(;
it
!=
m_vecDimensions
.
end
();
++
it
)
{
for
(
auto
it
=
m_vecDimensions
.
begin
();
it
!=
m_vecDimensions
.
end
();
++
it
)
{
dimensionXMLString
+=
(
*
it
)
->
toXMLString
();
}
...
...
Framework/Geometry/src/Math/Algebra.cpp
View file @
7200b707
...
...
@@ -177,7 +177,7 @@ std::string Algebra::writeMCNPX() const
for
(
int
i
=
0
;
i
<
lenOut
;
i
++
)
{
if
(
islower
(
Out
[
i
])
||
isupper
(
Out
[
i
]))
{
auto
vc
=
find_if
(
SurfMap
.
begin
(),
SurfMap
.
end
(),
SurfMap
.
c
begin
(),
SurfMap
.
c
end
(),
MapSupport
::
valEqual
<
int
,
std
::
string
>
(
std
::
string
(
1
,
Out
[
i
])));
if
(
vc
==
SurfMap
.
end
())
{
std
::
cout
<<
"SurfMap size == "
<<
SurfMap
.
size
()
<<
std
::
endl
;
...
...
Framework/Geometry/src/Math/BnId.cpp
View file @
7200b707
...
...
@@ -91,10 +91,9 @@ int BnId::operator==(const BnId &A) const
{
if
(
A
.
size
!=
size
||
A
.
Tnum
!=
Tnum
||
A
.
Znum
!=
Znum
)
return
0
;
std
::
vector
<
int
>::
const_iterator
vc
;
auto
ac
=
A
.
Tval
.
begin
();
for
(
vc
=
Tval
.
begin
();
vc
!=
Tval
.
end
();
++
vc
,
++
ac
)
{
if
(
ac
==
A
.
Tval
.
end
())
// This should neve happen
auto
ac
=
A
.
Tval
.
cbegin
();
for
(
auto
vc
=
Tval
.
cbegin
();
vc
!=
Tval
.
cend
();
++
vc
,
++
ac
)
{
if
(
ac
==
A
.
Tval
.
cend
())
// This should never happen
return
0
;
if
(
*
vc
!=
*
ac
)
return
0
;
...
...
@@ -150,9 +149,9 @@ int BnId::operator<(const BnId &A) const
if
(
Tnum
!=
A
.
Tnum
)
return
(
Tnum
<
A
.
Tnum
)
?
1
:
0
;
auto
tvc
=
Tval
.
rbegin
();
auto
avc
=
A
.
Tval
.
rbegin
();
while
(
tvc
!=
Tval
.
rend
())
{
auto
tvc
=
Tval
.
c
rbegin
();
auto
avc
=
A
.
Tval
.
c
rbegin
();
while
(
tvc
!=
Tval
.
c
rend
())
{
if
(
*
tvc
!=
*
avc
)
return
*
tvc
<
*
avc
;
++
tvc
;
...
...
@@ -318,10 +317,9 @@ std::pair<int, BnId> BnId::makeCombination(const BnId &A) const
int
flag
(
0
);
// numb of diff
std
::
pair
<
int
,
int
>
Tcnt
(
0
,
0
);
// this counter
std
::
pair
<
int
,
int
>
Acnt
(
0
,
0
);
// A counter
std
::
vector
<
int
>::
const_iterator
tvc
;
auto
avc
=
A
.
Tval
.
begin
();
auto
avc
=
A
.
Tval
.
cbegin
();
std
::
vector
<
int
>::
const_iterator
chpt
;
// change point
for
(
tvc
=
Tval
.
begin
();
tvc
!=
Tval
.
end
();
++
tvc
,
++
avc
)
{
for
(
auto
tvc
=
Tval
.
c
begin
();
tvc
!=
Tval
.
c
end
();
++
tvc
,
++
avc
)
{
if
((
*
avc
*
*
tvc
)
<
0
)
// false/true
{
if
(
flag
)
// failed
...
...
Framework/Geometry/src/Objects/Track.cpp
View file @
7200b707
...
...
@@ -80,7 +80,7 @@ int Track::nonComplete() const {
if
(
m_links
.
size
()
<
2
)
{
return
0
;
}
auto
ac
=
m_links
.
begin
();
auto
ac
=
m_links
.
c
begin
();
if
(
m_startPoint
.
distance
(
ac
->
entryPoint
)
>
Tolerance
)
{
return
1
;
}
...
...
@@ -187,7 +187,7 @@ void Track::buildLink() {
// The surface points were added in order when they were built so no sorting
// is required here.
PType
::
const_iter
ato
r
ac
=
m_surfPoints
.
begin
();
a
u
to
ac
=
m_surfPoints
.
c
begin
();
auto
bc
=
ac
;
++
bc
;