SST 16.0.0
Structural Simulation Toolkit
interactiveAction.h
1// Copyright 2009-2026 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-2026, 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_INTERACTIVE_ACTION_H
13#define SST_CORE_INTERACTIVE_ACTION_H
14
15#include "sst/core/action.h"
16// Can include this because this header is not installed
17#include "sst/core/interactiveConsole.h"
18#include "sst/core/simulation.h"
19
20#include <string>
21
22namespace SST {
23
24/**
25 \class InteractiveAction An event to trigger interactive mode. This
26 is a "one shot" event and will delete itself on execute()
27*/
28class InteractiveAction : public Action
29{
30public:
31 /**
32 Create a new InteractiveAction object for the simulation core to initiate interactive mode
33 */
34 InteractiveAction(Simulation* sim, const std::string& msg) :
35 Action(),
36 sim_(sim),
37 msg_(msg)
38 {
39 setPriority(INTERACTIVEPRIOIRTY);
40 }
41
43
44 /**
45 Indicates InteractiveAction should be inserted into the
46 TimeVortex. The insertion will only happen for serial runs, as
47 InteractiveAction is managed by the SyncManager in parallel
48 runs.
49 */
50 void insertIntoTimeVortex(SimTime_t time)
51 {
52 // If this is a serial job, insert this into
53 // the time TimeVortex. If it is parallel, then the
54 // InteractiveAction is managed by the SyncManager.
55 RankInfo num_ranks = sim_->getNumRanks();
56 // if (num_ranks.rank == 1 && num_ranks.thread == 1) {
57 sim_->insertActivity(time, this);
58 //}
59 }
60
61 /** Called by TimeVortex to trigger interactive mode. */
62 void execute() override
63 {
64 sim_->enter_interactive_ = true;
65 sim_->interactive_msg_ = msg_;
66 delete this;
67 }
68
69private:
70 Simulation* sim_;
71 std::string msg_;
72};
73
74} // namespace SST
75#endif // SST_CORE_INTERACTIVE_ACTION_H
void setPriority(uint64_t priority)
Set the priority of the Activity.
Definition activity.h:200
to trigger interactive mode.
Definition interactiveAction.h:29
void insertIntoTimeVortex(SimTime_t time)
Indicates InteractiveAction should be inserted into the TimeVortex.
Definition interactiveAction.h:50
InteractiveAction(Simulation *sim, const std::string &msg)
Create a new InteractiveAction object for the simulation core to initiate interactive mode.
Definition interactiveAction.h:34
void execute() override
Called by TimeVortex to trigger interactive mode.
Definition interactiveAction.h:62
Definition rankInfo.h:24
Main control class for a SST Simulation.
Definition simulation.h:121