WarpTwin
Documentation for WarpTwin models and classes.
Loading...
Searching...
No Matches
WarpTwinPyConfigWriter.h
Go to the documentation of this file.
1/******************************************************************************
2 * Copyright (c) ATTX INC 2025. All Rights Reserved.
3 *
4 * This software and associated documentation (the "Software") are the
5 * proprietary and confidential information of ATTX INC. The Software is
6 * furnished under a license agreement between ATTX and the user organization
7 * and may be used or copied only in accordance with the terms of the agreement.
8 * Refer to 'license/attx_license.adoc' for standard license terms.
9 *
10 * EXPORT CONTROL NOTICE: THIS SOFTWARE MAY INCLUDE CONTENT CONTROLLED UNDER THE
11 * INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) OR THE EXPORT ADMINISTRATION
12 * REGULATIONS (EAR99). No part of the Software may be used, reproduced, or
13 * transmitted in any form or by any means, for any purpose, without the express
14 * written permission of ATTX INC.
15 ******************************************************************************/
16#ifndef CPP_APP_MODELSPACE_PY_CONFIGURATION_WRITER_H
17#define CPP_APP_MODELSPACE_PY_CONFIGURATION_WRITER_H
18
19#include "ConfigurationWriter.h"
20
21namespace warptwin {
22// Define some handy constants to make life easy, and to make updating this for other stuff easy
23namespace ms_py_writer {
24const std::string LINE_ENDING = "\n";
25const std::string CODE_ENDING = "";
26const std::string TAB = " ";
27
28// Set the sequencing priority
29const std::vector<node_types_e> SEQUENCE_PRIORITY = {FRAME, STANDARD, MODEL, LOGGER, VIZKIT, CESIUM_VIZ};
30} // namespace ms_py_writer
31
34 public:
37
39 std::future<int> build();
40
42 std::future<int> run();
43
47 std::vector<int> stop(std::vector<std::string> &pids);
48
50 int post();
51
53 void resetRunStatus() {_is_run = false; }
54
55 protected:
59 int _runPythonSim(const std::string &cmd);
60
63 std::vector<std::string> _getPythonScriptPIDs();
64
67 std::vector<std::string> _getStreamlitPIDs();
68
70 void _killStreamlitPIDs();
71
73 virtual void _setNodeConnectionSequence() override;
74
76 virtual void _decomposeNodeInformation() override;
77
79 virtual void _writeOutputStart() override;
80
83 virtual void _writeDataValue(ImNode *node) override;
84
88 virtual void _writeDataConnection(Connection *upstream, Connection *downstream) override;
89
91 virtual void _writeLogData() override;
92
94 virtual void _writeOutputEnd() override;
95
99 std::string _getSignalName(Connection *signal);
100
104 ImNode *_getNodeByUid(int uid);
105
110
115 std::vector<Connection *> _getConnectionsByName(ImNode *node, const std::string &name);
116
121 std::vector<Connection *> _getConnectionsByType(ImNode *node, int type);
122
125
128};
129
130} // namespace warptwin
131
132#endif
ConfigurationWriter()
Definition ConfigurationWriter.h:30
virtual ~WarpTwinPyConfigWriter()
Definition WarpTwinPyConfigWriter.h:36
std::vector< std::string > _getPythonScriptPIDs()
Retrieves the list of PIDs generated by running the Python file.
Definition WarpTwinPyConfigWriter.cpp:139
virtual void _setNodeConnectionSequence() override
Set the sequence of nodes for creation and write paired connections.
Definition WarpTwinPyConfigWriter.cpp:210
std::string _getSignalName(Connection *signal)
Get the full warptwin name of a signal from Connection object.
Definition WarpTwinPyConfigWriter.cpp:732
virtual void _writeDataValue(ImNode *node) override
Write the creation of a single node, given by node.
Definition WarpTwinPyConfigWriter.cpp:467
int post()
Call the dallin tool to post process data.
Definition WarpTwinPyConfigWriter.cpp:100
virtual void _writeLogData() override
Write all logged data to file.
Definition WarpTwinPyConfigWriter.cpp:595
ImNode * _getNodeByUid(int uid)
Get pointer to a node by uid.
Definition WarpTwinPyConfigWriter.cpp:762
std::future< int > run()
Write the Python file and run as configured.
Definition WarpTwinPyConfigWriter.cpp:66
std::vector< std::string > _getStreamlitPIDs()
Retrieves the list of PIDs generated by running the Streamlit app.
Definition WarpTwinPyConfigWriter.cpp:161
bool _is_build
Boolean to indicate whether this is a build or run. True indicates build.
Definition WarpTwinPyConfigWriter.h:127
void _killStreamlitPIDs()
Kill the PIDs generated by running the Streamlit app.
Definition WarpTwinPyConfigWriter.cpp:183
std::vector< Connection * > _getConnectionsByType(ImNode *node, int type)
Return all connections matching set criteria in a node.
Definition WarpTwinPyConfigWriter.cpp:810
int _runPythonSim(const std::string &cmd)
Function wrapper of system() call for async purposes.
Definition WarpTwinPyConfigWriter.cpp:117
virtual void _writeDataConnection(Connection *upstream, Connection *downstream) override
Write the connection of one "Connection" to another.
Definition WarpTwinPyConfigWriter.cpp:558
virtual void _writeOutputStart() override
Write the start of the file.
Definition WarpTwinPyConfigWriter.cpp:290
WarpTwinPyConfigWriter()
Definition WarpTwinPyConfigWriter.h:35
virtual void _writeOutputEnd() override
Write the end of the file output.
Definition WarpTwinPyConfigWriter.cpp:705
bool _is_run
Boolean to indicate whether this is a build or run. True indicates run.
Definition WarpTwinPyConfigWriter.h:124
std::vector< Connection * > _getConnectionsByName(ImNode *node, const std::string &name)
Return all connections matching set criteria in a node.
Definition WarpTwinPyConfigWriter.cpp:793
void resetRunStatus()
Reset the run status boolean.
Definition WarpTwinPyConfigWriter.h:53
virtual void _decomposeNodeInformation() override
Decompose all relevant strings from the provided node and connection information.
Definition WarpTwinPyConfigWriter.cpp:288
std::future< int > build()
Write the Python file and run with a zero step to show updates.
Definition WarpTwinPyConfigWriter.cpp:42
std::vector< int > stop(std::vector< std::string > &pids)
Stop the PIDs related to execution of the Python file.
Definition WarpTwinPyConfigWriter.cpp:82
Connection * _getConnectionByUid(int uid)
Get pointer to connection by uid.
Definition WarpTwinPyConfigWriter.cpp:774
Definition WarpTwinPyConfigWriter.h:23
const std::string TAB
Definition WarpTwinPyConfigWriter.h:26
const std::string LINE_ENDING
Definition WarpTwinPyConfigWriter.h:24
const std::vector< node_types_e > SEQUENCE_PRIORITY
Definition WarpTwinPyConfigWriter.h:29
const std::string CODE_ENDING
Definition WarpTwinPyConfigWriter.h:25
Class to propagate CR3BP dynamics in characteristic units.
Definition statistics.hpp:22
@ MODEL
Simplified dynamics model representing motion in the circular restricted 3 body problem.
Definition ImNode.h:31
@ CESIUM_VIZ
Definition ImNode.h:37
@ FRAME
Definition ImNode.h:34
@ STANDARD
Definition ImNode.h:30
@ LOGGER
Definition ImNode.h:35
@ VIZKIT
Definition ImNode.h:36
Hold all information related to a connection point in the ImGUI UX.
Definition Connection.h:57
Hold all data related to a visual node in the ImGUI UX.
Definition ImNode.h:43