SST  14.0.0
StructuralSimulationToolkit
timeVortex.h
1 // Copyright 2009-2024 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-2024, 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_TIMEVORTEX_H
13 #define SST_CORE_TIMEVORTEX_H
14 
15 #include "sst/core/activityQueue.h"
16 #include "sst/core/module.h"
17 #include "sst/core/serialization/serialize_impl_fwd.h"
18 
19 namespace SST {
20 
21 class Output;
22 class Simulation_impl;
23 
24 /**
25  * Primary Event Queue
26  */
27 class TimeVortex : public ActivityQueue
28 {
29 public:
30  SST_ELI_DECLARE_BASE(TimeVortex)
31  SST_ELI_DECLARE_INFO_EXTERN(ELI::ProvidesParams)
32  SST_ELI_DECLARE_CTOR_EXTERN(SST::Params&)
33 
34  TimeVortex();
35  ~TimeVortex() {}
36 
37  // Inherited from ActivityQueue
38  virtual bool empty() override = 0;
39  virtual int size() override = 0;
40  virtual void insert(Activity* activity) override = 0;
41  virtual Activity* pop() override = 0;
42  virtual Activity* front() override = 0;
43 
44  /** Print the state of the TimeVortex */
45  virtual void print(Output& out) const = 0;
46  virtual uint64_t getMaxDepth() const { return max_depth; }
47  virtual uint64_t getCurrentDepth() const = 0;
48  virtual void dbg_print(Output& out) { print(out); }
49 
50  // Functions for checkpointing
51  virtual void serialize_order(SST::Core::Serialization::serializer& ser) { ser& max_depth; }
52  virtual void fixup_handlers() {}
53 
54 protected:
55  uint64_t max_depth;
56 
57  void fixup(Activity* act);
58 
59 private:
60  Simulation_impl* sim_ = nullptr;
61 };
62 
63 namespace TV {
64 namespace pvt {
65 
66 void pack_timevortex(TimeVortex*& s, SST::Core::Serialization::serializer& ser);
67 void unpack_timevortex(TimeVortex*& s, SST::Core::Serialization::serializer& ser);
68 
69 } // namespace pvt
70 } // namespace TV
71 
72 template <>
74 {
75 
76  template <class A>
77  friend class serialize;
78  void operator()(TimeVortex*& s, SST::Core::Serialization::serializer& ser)
79  {
80  switch ( ser.mode() ) {
81  case serializer::SIZER:
82  case serializer::PACK:
83  TV::pvt::pack_timevortex(s, ser);
84  break;
85  case serializer::UNPACK:
86  TV::pvt::unpack_timevortex(s, ser);
87  break;
88  }
89  }
90 };
91 
92 } // namespace SST
93 
94 #endif // SST_CORE_TIMEVORTEX_H
Output object provides consistent method for outputting data to stdout, stderr and/or sst debug file...
Definition: output.h:53
virtual Activity * pop() override=0
Remove and return the next activity.
This class is basically a wrapper for objects to declare the order in which their members should be s...
Definition: serializer.h:35
Base class for all Activities in the SST Event Queue.
Definition: activity.h:45
virtual Activity * front() override=0
Returns the next activity.
Primary Event Queue.
Definition: timeVortex.h:27
Base serialize class.
Definition: serialize.h:32
Definition: action.cc:18
Serialization "gateway" object.
Definition: serialize.h:110
Definition: paramsInfo.h:40
Main control class for a SST Simulation.
Definition: simulation_impl.h:70
Parameter store.
Definition: params.h:55
Base Class for a queue of Activities.
Definition: activityQueue.h:21
virtual void insert(Activity *activity) override=0
Insert a new activity into the queue.
virtual int size() override=0
Returns the number of activities in the queue.
virtual bool empty() override=0
Returns true if the queue is empty.
virtual void print(Output &out) const =0
Print the state of the TimeVortex.