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
1a39f6b2
Unverified
Commit
1a39f6b2
authored
Mar 20, 2020
by
Nick Draper
Committed by
GitHub
Mar 20, 2020
Browse files
Merge pull request #28398 from mantidproject/eventlist_reserve
Eventlist: reserve capacity of the specified event type
parents
cb38adb0
86e40d9f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Framework/DataObjects/src/EventList.cpp
View file @
1a39f6b2
...
...
@@ -932,16 +932,26 @@ void EventList::clearData() { this->clear(false); }
*/
void
EventList
::
setMRU
(
EventWorkspaceMRU
*
newMRU
)
{
mru
=
newMRU
;
}
/** Reserve a certain number of entries in the (NOT-WEIGHTED) event list. Do NOT
*call
* on weighted events!
/** Reserve a certain number of entries in event list of the specified eventType
*
* Calls std::vector<>::reserve() in order to pre-allocate the length of the
*event list vector.
*
* @param num :: number of events that will be in this EventList
*/
void
EventList
::
reserve
(
size_t
num
)
{
this
->
events
.
reserve
(
num
);
}
void
EventList
::
reserve
(
size_t
num
)
{
switch
(
this
->
eventType
)
{
case
TOF
:
this
->
events
.
reserve
(
num
);
break
;
case
WEIGHTED
:
this
->
weightedEvents
.
reserve
(
num
);
break
;
case
WEIGHTED_NOTIME
:
this
->
weightedEventsNoTime
.
reserve
(
num
);
break
;
}
}
// ==============================================================================================
// --- Sorting functions -----------------------------------------------------
...
...
Framework/Types/inc/MantidTypes/Core/DateAndTime.h
View file @
1a39f6b2
...
...
@@ -151,14 +151,10 @@ inline DateAndTime::DateAndTime() : _nanoseconds(0) {}
/** Construct a date from nanoseconds.
* @param total_nanoseconds :: nanoseconds since Jan 1, 1990 (our epoch).
*/
inline
DateAndTime
::
DateAndTime
(
const
int64_t
total_nanoseconds
)
{
inline
DateAndTime
::
DateAndTime
(
const
int64_t
total_nanoseconds
)
:
_nanoseconds
{
std
::
clamp
(
total_nanoseconds
,
MIN_NANOSECONDS
,
MAX_NANOSECONDS
)}
{
// Make sure that you cannot construct a date that is beyond the limits...
if
(
total_nanoseconds
>
MAX_NANOSECONDS
)
_nanoseconds
=
MAX_NANOSECONDS
;
else
if
(
total_nanoseconds
<
MIN_NANOSECONDS
)
_nanoseconds
=
MIN_NANOSECONDS
;
else
_nanoseconds
=
total_nanoseconds
;
}
/** + operator to add time.
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment