SST  12.0.1
StructuralSimulationToolkit
jsonmodel.h
1 // -*- c++ -*-
2 
3 // Copyright 2009-2022 NTESS. Under the terms
4 // of Contract DE-NA0003525 with NTESS, the U.S.
5 // Government retains certain rights in this software.
6 //
7 // Copyright (c) 2009-2022, NTESS
8 // All rights reserved.
9 //
10 // This file is part of the SST software package. For license
11 // information, see the LICENSE file in the top level directory of the
12 // distribution.
13 
14 #ifndef SST_CORE_MODEL_JSON_JSONMODEL_H
15 #define SST_CORE_MODEL_JSON_JSONMODEL_H
16 
17 #include "sst/core/component.h"
18 #include "sst/core/config.h"
19 #include "sst/core/configGraph.h"
20 #include "sst/core/cputimer.h"
21 #include "sst/core/factory.h"
22 #include "sst/core/memuse.h"
23 #include "sst/core/model/sstmodel.h"
24 #include "sst/core/output.h"
25 #include "sst/core/rankInfo.h"
26 #include "sst/core/simulation.h"
27 #include "sst/core/sst_types.h"
28 #include "sst/core/warnmacros.h"
29 
30 #include "nlohmann/json.hpp"
31 
32 #include <fstream>
33 #include <string>
34 #include <tuple>
35 #include <vector>
36 
37 using namespace SST;
38 using json = nlohmann::json;
39 
40 namespace SST {
41 namespace Core {
42 
44 {
45 public:
46  SST_ELI_REGISTER_MODEL_DESCRIPTION(
48  "sst",
49  "model.json",
50  SST_ELI_ELEMENT_VERSION(1,0,0),
51  "JSON model for building SST simulation graphs",
52  true)
53 
54  SST_ELI_DOCUMENT_MODEL_SUPPORTED_EXTENSIONS(".json")
55 
56  SSTJSONModelDefinition(const std::string& script_file, int verbosity, Config* config, double start_time);
57  virtual ~SSTJSONModelDefinition();
58 
59  ConfigGraph* createConfigGraph() override;
60 
61 protected:
62  std::string scriptName;
63  Output* output;
64  Config* config;
65  ConfigGraph* graph;
66  ComponentId_t nextComponentId;
67  double start_time;
68 
69 private:
70  void recursiveSubcomponent(ConfigComponent* Parent, const nlohmann::basic_json<>& compArray);
71  void discoverProgramOptions(const json& jFile);
72  void discoverComponents(const json& jFile);
73  void discoverLinks(const json& jFile);
74  void discoverGlobalParams(const json& jFile);
75  ComponentId_t findComponentIdByName(const std::string& Name);
76 };
77 
78 } // namespace Core
79 } // namespace SST
80 
81 #endif // SST_CORE_MODEL_JSON_JSONMODEL_H
Output object provides consistent method for outputting data to stdout, stderr and/or sst debug file...
Definition: output.h:51
Class to contain SST Simulation Configuration variables.
Definition: config.h:29
Represents the configuration of a generic component.
Definition: configGraph.h:217
A Configuration Graph A graph representing Components and Links.
Definition: configGraph.h:389
Definition: jsonmodel.h:43
Base class for Model Generation.
Definition: sstmodel.h:25