SST  11.1.0
StructuralSimulationToolkit
timeVortexPQ.h
1 // Copyright 2009-2021 NTESS. Under the terms
2 // of Contract DE-NA0003525 with NTESS, the U.S.
3 // Government retains certain rights in this software.
4 //
5 // Copyright (c) 2009-2021, NTESS
6 // All rights reserved.
7 //
8 // This file is part of the SST software package. For license
9 // information, see the LICENSE file in the top level directory of the
10 // distribution.
11 
12 #ifndef SST_CORE_IMPL_TIMEVORTEX_TIMEVORTEXPQ_H
13 #define SST_CORE_IMPL_TIMEVORTEX_TIMEVORTEXPQ_H
14 
15 #include "sst/core/eli/elementinfo.h"
16 #include "sst/core/timeVortex.h"
17 
18 #include <functional>
19 #include <queue>
20 #include <vector>
21 
22 namespace SST {
23 
24 class Output;
25 
26 namespace IMPL {
27 
28 /**
29  * Primary Event Queue
30  */
31 template <bool TS>
33 {
34 
35 public:
36  // TimeVortexPQ();
37  TimeVortexPQBase(Params& params);
39 
40  bool empty() override;
41  int size() override;
42  void insert(Activity* activity) override;
43  Activity* pop() override;
44  Activity* front() override;
45 
46  /** Print the state of the TimeVortex */
47  void print(Output& out) const override;
48 
49  uint64_t getCurrentDepth() const override { return current_depth; }
50  uint64_t getMaxDepth() const override { return max_depth; }
51 
52 private:
53 #ifdef SST_ENFORCE_EVENT_ORDERING
54  typedef std::priority_queue<Activity*, std::vector<Activity*>, Activity::pq_less_time_priority_order> dataType_t;
55 #else
56  typedef std::priority_queue<Activity*, std::vector<Activity*>, Activity::pq_less_time_priority> dataType_t;
57 #endif
58  dataType_t data;
59  uint64_t insertOrder;
60 
61  typename std::conditional<TS, std::atomic<uint64_t>, uint64_t>::type current_depth;
62  uint64_t max_depth;
63 
64  CACHE_ALIGNED(SST::Core::ThreadSafe::Spinlock, slock);
65 };
66 
67 
68 } // namespace IMPL
69 } // namespace SST
70 
71 #endif // SST_CORE_IMPL_TIMEVORTEX_TIMEVORTEXPQ_H
Output object provides consistent method for outputting data to stdout, stderr and/or sst debug file...
Definition: output.h:51
void insert(Activity *activity) override
Insert a new activity into the queue.
Definition: timeVortexPQ.cc:64
Base class for all Activities in the SST Event Queue.
Definition: activity.h:48
Primary Event Queue.
Definition: timeVortex.h:25
Activity * pop() override
Remove and return the next activity.
Definition: timeVortexPQ.cc:76
int size() override
Returns the number of activities in the queue.
Definition: timeVortexPQ.cc:54
Primary Event Queue.
Definition: timeVortexPQ.h:32
To use with STL priority queues, that order in reverse.
Definition: activity.h:161
Definition: threadsafe.h:121
void print(Output &out) const override
Print the state of the TimeVortex.
Definition: timeVortexPQ.cc:99
Parameter store.
Definition: params.h:43
bool empty() override
Returns true if the queue is empty.
Definition: timeVortexPQ.cc:44
Activity * front() override
Returns the next activity.
Definition: timeVortexPQ.cc:89
To use with STL priority queues, that order in reverse.
Definition: activity.h:270