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