SST  10.1.0
StructuralSimulationToolkit
coreTest_DistribComponent.h
1 // Copyright 2009-2020 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-2020, NTESS
6 // All rights reserved.
7 //
8 // Portions are copyright of other developers:
9 // See the file CONTRIBUTORS.TXT in the top level directory
10 // the distribution for more information.
11 //
12 // This file is part of the SST software package. For license
13 // information, see the LICENSE file in the top level directory of the
14 // distribution.
15 
16 #ifndef _CORETESTDISTRIBCOMPONENT_H
17 #define _CORETESTDISTRIBCOMPONENT_H
18 
19 #include <sst/core/component.h>
20 #include <sst/core/rng/distrib.h>
21 
22 using namespace SST;
23 using namespace SST::RNG;
24 
25 namespace SST {
26 namespace CoreTestDistribComponent {
27 
29 {
30 public:
31 
32  // REGISTER THIS COMPONENT INTO THE ELEMENT LIBRARY
33  SST_ELI_REGISTER_COMPONENT(
35  "coreTestElement",
36  "coreTestDistribComponent",
37  SST_ELI_ELEMENT_VERSION(1,0,0),
38  "Random Number Distribution Component",
39  COMPONENT_CATEGORY_UNCATEGORIZED
40  )
41 
42  SST_ELI_DOCUMENT_PARAMS(
43  { "count", "Number of random values to generate from the distribution", "1000"},
44  { "distrib", "Random distribution to use - \"gaussian\" (or \"normal\"), or \"exponential\"", "gaussian"},
45  { "mean", "Mean value to use if we are sampling from the Gaussian/Normal distribution", "1.0"},
46  { "stddev", "Standard deviation to use for the distribution", "0.2"},
47  { "lambda", "Lambda value to use for the exponential distribution", "1.0"},
48  { "binresults", "Print the results, only if value is \"1\"", "1"},
49  { "probcount", "Number of probabilities in discrete distribution", "1"},
50  { "prob%(probcount)d", "Probability values for discrete distribution", "1"}
51  )
52 
53  // Optional since there is nothing to document
54  SST_ELI_DOCUMENT_STATISTICS(
55  )
56 
57  // Optional since there is nothing to document
58  SST_ELI_DOCUMENT_PORTS(
59  )
60 
61  // Optional since there is nothing to document
62  SST_ELI_DOCUMENT_SUBCOMPONENT_SLOTS(
63  )
64 
65  coreTestDistribComponent(SST::ComponentId_t id, SST::Params& params);
66  void finish();
67  void setup() { }
68 
69 private:
70  coreTestDistribComponent(); // for serialization only
71  coreTestDistribComponent(const coreTestDistribComponent&); // do not implement
72  void operator=(const coreTestDistribComponent&); // do not implement
73 
74  virtual bool tick( SST::Cycle_t );
75 
76  SSTRandomDistribution* comp_distrib;
77 
78  int rng_max_count;
79  int rng_count;
80  bool bin_results;
81  std::string dist_type;
82 
83  std::map<int64_t, uint64_t>* bins;
84 };
85 
86 } // namespace CoreTestDistribComponent
87 } // namespace SST
88 
89 #endif /* _CORETESTDISTRIBCOMPONENT_H */
Base class of statistical distributions in SST.
Definition: distrib.h:24
void setup()
Called after all components have been constructed and initialization has completed, but before simulation time has begun.
Definition: coreTest_DistribComponent.h:67
Main component object for the simulation.
Definition: component.h:31
Definition: coreTest_DistribComponent.h:28
Parameter store.
Definition: params.h:44