FRIBParallelanalysis  1.0
FrameworkforMPIParalleldataanalysisatFRIB
AnalysisRingItems.h
Go to the documentation of this file.
1 /*/.
2  This software is Copyright by the Board of Trustees of Michigan
3  State University (c) Copyright 2017.
4 
5  You may use this software under the terms of the GNU public license
6  (GPL). The terms of this license are described at:
7 
8  http://www.gnu.org/licenses/gpl.txt
9 
10  Authors:
11  Ron Fox
12  Giordano Cerriza
13  FRIB
14  Michigan State University
15  East Lansing, MI 48824-1321
16 */
17 
23 #ifndef ANALYSISRINGITEMS_H
24 #define ANALYSISRINGITEMS_H
25 #include <cstdint>
26 namespace frib {
27  namespace analysis {
28 #pragma pack(push, 1) // We want structs packed tight.
29  static const unsigned MAX_UNITS_LENGTH(32);
30  static const unsigned MAX_IDENT(128);
34  typedef struct _RingItemHeader {
35  std::uint32_t s_size;
36  std::uint32_t s_type;
37  std::uint32_t s_unused; // must be sizeof(std::uint32_t).
39 
44  typedef struct _ParameterDefintion {
45  std::uint32_t s_parameterNumber;
46  char s_parameterName[0]; // Actually a cz string.
48 
53  typedef struct _ParameterDefinitions {
54  RingItemHeader s_header;
55  std::uint32_t s_numParameters;
56  ParameterDefinition s_parameters [0];
58 
62  typedef struct _ParameterValue {
63  std::uint32_t s_number;
64  double s_value;
66 
67  /*
68  * Ring item of parameter unpacked data.
69  * sizeof is worthless.
70  */
71  typedef struct _ParameterItem {
72  RingItemHeader s_header;
73  std::uint64_t s_triggerCount;
74  std::uint32_t s_parameterCount;
75  ParameterValue s_parameters[0];
77 
81  typedef struct _Variable {
82  double s_value;
83  char s_variableUnits[MAX_UNITS_LENGTH]; // Fixed length
84  char s_variableName[0]; // variable length
85  } Variable, *pVariable;
86 
87  typedef struct _VariableItem {
88  RingItemHeader s_header;
89  std::uint32_t s_numVars;
90  Variable s_variables[0];
91 
93 
94  /* Ring Item types - these begin at 32768 (0x8000). - the first user type
95  * documented in the NSCLDAQ ring item world:
96  *
97  * LAST_PASSTHROUGH - ring items with types <= are just passed through.
98  *
99  */
100 
101  static const std::uint32_t LAST_PASSTHROUGH = 32767;
102  static const std::uint32_t PARAMETER_DEFINITIONS = 32768;
103  static const std::uint32_t VARIABLE_VALUES = 32769;
104  static const std::uint32_t PARAMETER_DATA = 32770;
105  static const std::uint32_t TEST_DATA = 32771;
106 
107  // MPI Message tags
108 
109 
110  static const int MPI_HEADER_TAG = 1;
111  static const int MPI_END_TAG = 2;
112  static const int MPI_DATA_TAG = 3;
113  static const int MPI_REQUEST_TAG = 4;
114  static const int MPI_PASSTHROUGH_TAG = 5; // Header for passthrough
115  static const int MPI_PARAMDEF_TAG = 6;
116  static const int MPI_VARIABLES_TAG = 7;
117 
118 
119 
120 #pragma pack(pop)
121  // MPI Messages structures: must not be packed or MPI will pad them out
122  // in messages which causes all sorts of consternation on the
123  // receiving end.
124 
125 
126  // Request for data message:
127 
128  typedef struct _FRIB_MPI_Request_Data {
129  int s_requestor; // Rank of requestor.
130  int s_maxdata; // Max data I can get.
132 
133  // Data are sent with this header followed by a block of char data
134  // that must be re-interpreted by the receiver:
135 
136  typedef struct _FRIB_MPI_Message_Header {
137  unsigned s_nBytes; // Size of subsequent msg.
138  unsigned s_nBlockNum; // Work Item number.
139  bool s_end; // End data marker.
140 
142 
143  // These typedefs are message structs that send parameters around:
144 
146  std::uint64_t s_triggerNumber;
147  std::uint32_t s_numParameters;
148  bool s_end;
150 
151  typedef struct _FRIB_MPI_Parameter_Value {
152  std::uint32_t s_number;
153  double s_value;
155 
156  typedef struct _FRIB_MPI_ParameterDef {
157  char s_name[MAX_IDENT];
158  long s_parameterId;
160 
161  typedef struct _FRIB_MPI_VariableDef {
162  char s_name[MAX_IDENT];
163  char s_variableUnits[MAX_UNITS_LENGTH];
164  double s_value;
166  }
167 }
168 
169 
170 #endif
Definition: AnalysisRingItems.h:161
Definition: AnalysisRingItems.h:71
Definition: AnalysisRingItems.h:151
Definition: AnalysisRingItems.h:156
Definition: AnalysisRingItems.h:44
Definition: AnalysisRingItems.h:34
Definition: AnalysisRingItems.h:87
Definition: AnalysisRingItems.h:81
Definition: AnalysisRingItems.h:62
Definition: AnalysisRingItems.h:145
Definition: AnalysisRingItems.h:136
Definition: AnalysisRingItems.h:53
Definition: AnalysisRingItems.h:128
Definition: AbstractApplication.cpp:30