SST  11.1.0
StructuralSimulationToolkit
sstmodel.h
1 // Copyright 2009-2021 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-2021, 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_MODEL_SSTMODEL_H
13 #define SST_CORE_MODEL_SSTMODEL_H
14 
15 #include "sst/core/eli/elementinfo.h"
16 #include "sst/core/warnmacros.h"
17 
18 namespace SST {
19 
20 class Config;
21 class ConfigGraph;
22 
23 /** Base class for Model Generation
24  */
26 {
27 
28 public:
29  SST_ELI_DECLARE_BASE(SSTModelDescription)
30  // declare extern to limit compile times
31  SST_ELI_DECLARE_CTOR_EXTERN(const std::string&, int, Config*, double)
32  SST_ELI_DECLARE_INFO_EXTERN(
34  ELI::ProvidesSimpleInfo<1,std::vector<std::string>>)
35 
37  virtual ~SSTModelDescription() {};
38  /** Create the ConfigGraph
39  *
40  * This function should be overridden by subclasses.
41  *
42  * This function is responsible for reading any configuration
43  * files and generating a ConfigGraph object.
44  */
45  virtual ConfigGraph* createConfigGraph() = 0;
46 
47  // Helper functions to pull out ELI data for an element
48  static bool isElementParallelCapable(const std::string& type);
49  static const std::vector<std::string>& getElementSupportedExtensions(const std::string& type);
50 };
51 
52 } // namespace SST
53 
54 
55 // Use this macro to register a model description. Parallel_capable
56 // indicates whether this model is able to be use when loading in
57 // parallel. The final arguments are optional and are a list of file
58 // extensions handled by the model. These are only useful for the
59 // built-in models as external models will have to use the command
60 // line option to load them and then the extension will be ignored.
61 #define SST_ELI_REGISTER_MODEL_DESCRIPTION(cls, lib, name, version, desc, parallel_capable) \
62  SST_ELI_REGISTER_DERIVED(SST::SSTModelDescription, ::cls,lib,name,ELI_FORWARD_AS_ONE(version),desc) \
63  SST_ELI_DOCUMENT_SIMPLE_INFO(bool,0,parallel_capable)
64 
65 #define SST_ELI_DOCUMENT_MODEL_SUPPORTED_EXTENSIONS(...) \
66  SST_ELI_DOCUMENT_SIMPLE_INFO(std::vector<std::string>,1,__VA_ARGS__)
67 
68 #endif // SST_CORE_MODEL_SSTMODEL_H
virtual ConfigGraph * createConfigGraph()=0
Create the ConfigGraph.
Class to contain SST Simulation Configuration variables.
Definition: config.h:29
A Configuration Graph A graph representing Components and Links.
Definition: configGraph.h:375
Definition: simpleInfo.h:82
Base class for Model Generation.
Definition: sstmodel.h:25