SST  13.1.0
Structural Simulation Toolkit
jsonmodel.h
1 // -*- c++ -*-
2 
3 // Copyright 2009-2023 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-2023, 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/sst_types.h"
27 #include "sst/core/warnmacros.h"
28 
29 #include "nlohmann/json.hpp"
30 
31 #include <fstream>
32 #include <string>
33 #include <tuple>
34 #include <vector>
35 
36 using namespace SST;
37 using json = nlohmann::json;
38 
39 namespace SST {
40 namespace Core {
41 
43 {
44 public:
45  SST_ELI_REGISTER_MODEL_DESCRIPTION(
47  "sst",
48  "model.json",
49  SST_ELI_ELEMENT_VERSION(1,0,0),
50  "JSON model for building SST simulation graphs",
51  true)
52 
53  SST_ELI_DOCUMENT_MODEL_SUPPORTED_EXTENSIONS(".json")
54 
55  SSTJSONModelDefinition(const std::string& script_file, int verbosity, Config* config, double start_time);
56  virtual ~SSTJSONModelDefinition();
57 
58  ConfigGraph* createConfigGraph() override;
59 
60 protected:
61  std::string scriptName;
62  Output* output;
63  Config* config;
64  ConfigGraph* graph;
65  ComponentId_t nextComponentId;
66  double start_time;
67 
68 private:
69  void recursiveSubcomponent(ConfigComponent* Parent, const nlohmann::basic_json<>& compArray);
70  void discoverProgramOptions(const json& jFile);
71  void discoverComponents(const json& jFile);
72  void discoverLinks(const json& jFile);
73  void discoverGlobalParams(const json& jFile);
74  ComponentId_t findComponentIdByName(const std::string& Name);
75 };
76 
77 } // namespace Core
78 } // namespace SST
79 
80 #endif // SST_CORE_MODEL_JSON_JSONMODEL_H
Represents the configuration of a generic component.
Definition: configGraph.h:218
A Configuration Graph A graph representing Components and Links.
Definition: configGraph.h:390
Class to contain SST Simulation Configuration variables.
Definition: config.h:39
Definition: jsonmodel.h:43
ConfigGraph * createConfigGraph() override
Create the ConfigGraph.
Definition: jsonmodel.cc:298
Output object provides consistent method for outputting data to stdout, stderr and/or sst debug file.
Definition: output.h:52
Base class for Model Generation.
Definition: sstmodel.h:26