STORMM Source Documentation
Loading...
Searching...
No Matches
nml_report.h
1// -*-c++-*-
2#ifndef STORMM_NML_OUTPUT_H
3#define STORMM_NML_OUTPUT_H
4
5#include <cstring>
6#include <string>
7#include <vector>
8#include <cstdio>
9#include <sys/time.h>
10#include "copyright.h"
11#include "Constants/behavior.h"
12#include "DataTypes/common_types.h"
13#include "MoleculeFormat/mdlmol_dataitem.h"
14#include "Parsing/textfile.h"
15#include "Potential/energy_enumerators.h"
16#include "Reporting/reporting_enumerators.h"
17#include "input.h"
18#include "namelist_element.h"
19#include "namelist_emulator.h"
20
21namespace stormm {
22namespace namelist {
23
24using energy::EnergySample;
25using energy::StateVariable;
26using parse::TextFile;
27using parse::WrapTextSearch;
28using review::OutputScope;
29using review::OutputSyntax;
30using structure::MdlMolDataRequest;
31
34constexpr int default_common_path_limit = 8;
35constexpr int default_common_path_threshold = 4;
36constexpr int default_energy_decimal_places = 4;
37constexpr double default_energy_outlier_sigmas = 3.0;
38constexpr int default_outlier_limit = 4;
39constexpr char default_report_variable_name[] = "stormm";
41
47public:
48
60 ReportControls(ExceptionResponse policy_in = ExceptionResponse::DIE,
61 WrapTextSearch wrap = WrapTextSearch::NO);
62 ReportControls(const TextFile &tf, int *start_line, bool *found_nml,
63 ExceptionResponse policy_in = ExceptionResponse::DIE,
64 WrapTextSearch wrap = WrapTextSearch::NO);
66
70 ReportControls(const ReportControls &original) = default;
71 ReportControls(ReportControls &&original) = default;
72 ReportControls& operator=(const ReportControls &original) = default;
73 ReportControls& operator=(ReportControls &&original) = default;
75
77 OutputSyntax getOutputSyntax() const;
78
81 OutputScope getOutputScope() const;
82
84 EnergySample getEnergySamplingMethod() const;
85
87
89 const std::string& getUsername() const;
90
92 const std::string& getReportVariable() const;
93
96 timeval getStartDate() const;
97
99 const NamelistEmulator& getTranscript() const;
100
102 bool printWallTimeData() const;
103
105 int getReportFileWidth() const;
106
108 int getReportedQuantityCount() const;
109
114 const std::vector<StateVariable>& getReportedQuantities() const;
115
117 int getSDFileDataRequestCount() const;
118
123 const std::vector<MdlMolDataRequest>& getSDFileDataRequests() const;
124
129
131 int getCommonPathLimit() const;
132
135 int getCommonPathThreshold() const;
136
139 int getEnergyDecimalPlaces() const;
140
143 double getOutlierSigmaFactor() const;
144
148 int getOutlierCount() const;
149
159 void setOutputSyntax(OutputSyntax report_layout_in);
160 void setOutputSyntax(const std::string &report_layout_in);
162
172 void setOutputScope(OutputScope report_scope_in);
173 void setOutputScope(const std::string &report_scope_in);
175
184 void setStateSampling(EnergySample state_sampling_in);
185 void setStateSampling(const std::string &state_sampling_in);
187
192 void setUsername(const std::string &username_in);
193
198 void setReportVariable(const std::string &report_variable_in);
199
208 void setWallTimeData(bool preference);
209 void setWallTimeData(const std::string &preference);
211
215 void setReportFileWidth(int report_file_width_in);
216
233 void setReportedQuantities(const std::string &quantity_in);
234 void setReportedQuantities(StateVariable quantities_in);
235 void setReportedQuantities(const std::vector<StateVariable> &quantities_in);
237
241 void addDataItem(const MdlMolDataRequest &ask);
242
246 void setCommonPathLimit(int common_path_limit_in);
247
252 void setCommonPathThreshold(int common_path_threshold);
253
257 void setEnergyDecimalPlaces(int energy_decimal_places_in);
258
259private:
260 ExceptionResponse policy;
261 OutputSyntax report_layout;
263 OutputScope report_scope;
264 EnergySample state_sampling;
266 std::string username;
267 std::string report_variable;
270 timeval start_date;
273 bool print_walltime_data;
275 int report_file_width;
278 int common_path_limit;
280 int common_path_threshold;
283 int energy_decimal_places;
285 double outlier_sigma_factor;
287 int outlier_count;
289
291 std::vector<StateVariable> reported_quantities;
292
294 std::vector<MdlMolDataRequest> sdf_addons;
295
297 NamelistEmulator nml_transcript;
298
303 std::vector<StateVariable> translateEnergyComponent(const std::string &inpstr);
304
309 std::vector<StateVariable> translateStateQuantity(const std::string &inpstr);
310
317 std::vector<MdlMolDataRequest> translateSdfKeywordInput(const NamelistEmulator &t_nml,
318 int index);
319
323 void validateEnergyDecimalPlaces();
324
326 void validateOutlierMetrics();
327};
328
343NamelistEmulator reportInput(const TextFile &tf, int *start_line, bool *found,
344 ExceptionResponse policy = ExceptionResponse::DIE,
345 WrapTextSearch wrap = WrapTextSearch::NO);
346
347} // namespace namelist
348} // namespace stormm
349
350#endif
Collection of variables to transcribe information contained within a namelist.
Definition namelist_emulator.h:30
void setOutputSyntax(OutputSyntax report_layout_in)
Set the output format.
Definition nml_report.cpp:218
void setWallTimeData(bool preference)
Set the preference for printing wall clock timings.
Definition nml_report.cpp:322
void addDataItem(const MdlMolDataRequest &ask)
Add a request for a data item in an output SD file.
Definition nml_report.cpp:397
void setCommonPathLimit(int common_path_limit_in)
Set the upper limit on the number of common paths used to condense output files.
Definition nml_report.cpp:411
int getReportedQuantityCount() const
Get the number of reported quantities.
Definition nml_report.cpp:163
ReportControls(const ReportControls &original)=default
As with other control objects, copy and move constructors, plus copy and move assignment operators,...
const std::string & getUsername() const
Get the method for grouping systems.
Definition nml_report.cpp:138
EnergySample getEnergySamplingMethod() const
Get the type of energy or state variable sampling (mean, time series, final value).
Definition nml_report.cpp:128
ReportControls(ExceptionResponse policy_in=ExceptionResponse::DIE, WrapTextSearch wrap=WrapTextSearch::NO)
The constructor can prepare an object with default settings or read the corresponding namelist to acc...
Definition nml_report.cpp:28
MdlMolDataRequest getSDFileDataRequest(int index) const
Get a specific data request to be displayed in an SD file.
Definition nml_report.cpp:183
void setOutputScope(OutputScope report_scope_in)
Set the scope of the output.
Definition nml_report.cpp:258
int getReportFileWidth() const
Get the requested width for the output file.
Definition nml_report.cpp:158
void setReportVariable(const std::string &report_variable_in)
Set the name of the matrix variable for reporting state quantities (volume, temperature,...
Definition nml_report.cpp:317
void setReportFileWidth(int report_file_width_in)
Set the report file width.
Definition nml_report.cpp:351
const std::vector< StateVariable > & getReportedQuantities() const
Get a list of the energy components to display. The actual results will depend on whether each energy...
Definition nml_report.cpp:168
int getCommonPathLimit() const
Get the maximum number of common paths to be permitted in system output.
Definition nml_report.cpp:193
void setUsername(const std::string &username_in)
Set the username.
Definition nml_report.cpp:312
const std::string & getReportVariable() const
Get the (base) name of the matrix variable under which to store results.
Definition nml_report.cpp:133
int getEnergyDecimalPlaces() const
Get the number of decimal places with which to express energetic quantities in output tables....
Definition nml_report.cpp:203
const NamelistEmulator & getTranscript() const
Get the original namelist emulator object as a transcript of the user input.
Definition nml_report.cpp:148
int getSDFileDataRequestCount() const
Get the number of data item requests for printing to an SD file.
Definition nml_report.cpp:173
void setEnergyDecimalPlaces(int energy_decimal_places_in)
Set the number of digits after the decimal with which to express energetic quantities.
Definition nml_report.cpp:421
void setCommonPathThreshold(int common_path_threshold)
Set the number of instances that a common root path must appear in order for it to be declared a comm...
Definition nml_report.cpp:416
void setStateSampling(EnergySample state_sampling_in)
Set the method for reporting samples of system state variables.
Definition nml_report.cpp:285
int getOutlierCount() const
Get the maximum number of outliers to report (per group, or per the whole synthesis if there is no gr...
Definition nml_report.cpp:213
bool printWallTimeData() const
Indicate whether to print timings data from the calculations.
Definition nml_report.cpp:153
timeval getStartDate() const
Get the date on which the program began to run, taken as the time that this ReportControls object was...
Definition nml_report.cpp:143
OutputScope getOutputScope() const
Get the scope of results: will all systems' results be displayed, or some statistical reduction?
Definition nml_report.cpp:123
OutputSyntax getOutputSyntax() const
Get the output format–what program will be able to read the results?
Definition nml_report.cpp:118
int getCommonPathThreshold() const
Get the required number of times a root path must be repeated in order to become one of the common pa...
Definition nml_report.cpp:198
void setReportedQuantities(const std::string &quantity_in)
Set the reported quantities that will be reported. Some quantities are obligatory: Total,...
Definition nml_report.cpp:356
const std::vector< MdlMolDataRequest > & getSDFileDataRequests() const
Get a list of data items to be displayed in an SD file. Reported quantities can include topological p...
Definition nml_report.cpp:178
double getOutlierSigmaFactor() const
Get the multiplier for the number of standard deviations from the mean that defines an outlier among ...
Definition nml_report.cpp:208
Structure for translating a text file into a compact, rapidly parsable vector of characters in CPU RA...
Definition textfile.h:45
A request for one of a sanctioned list of information types to be included in a data item of an SD fi...
Definition mdlmol_request.h:20