| 1 |
// Copyright(C) 1999-2024 National Technology & Engineering Solutions |
| 2 |
// of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with |
| 3 |
// NTESS, the U.S. Government retains certain rights in this software. |
| 4 |
// |
| 5 |
// See packages/seacas/LICENSE for details |
| 6 |
#pragma once |
| 7 |
|
| 8 |
#include "GetLongOpt.h" |
| 9 |
|
| 10 |
#include <iosfwd> |
| 11 |
#include <string> |
| 12 |
#include <vector> |
| 13 |
using StringVector = std::vector<std::string>; |
| 14 |
using Omissions = std::vector<StringVector>; |
| 15 |
using StringIdVector = std::vector<std::pair<std::string, int>>; |
| 16 |
|
| 17 |
class SystemInterface |
| 18 |
{ |
| 19 |
public: |
| 20 |
SystemInterface(); |
| 21 |
|
| 22 |
bool parse_options(int argc, char **argv); |
| 23 |
|
| 24 |
size_t processor_count() const { return processorCount_; } |
| 25 |
const std::string &decomposition_method() const { return decompMethod_; } |
| 26 |
const std::string &decomposition_file() const { return decompFile_; } |
| 27 |
const std::string &decomposition_variable() const { return decompVariable_; } |
| 28 |
const std::string &output_path() const { return outputPath_; } |
| 29 |
|
| 30 |
int debug() const { return debugLevel_; } |
| 31 |
int screen_width() const { return screenWidth_; } |
| 32 |
|
| 33 |
int step_min() const { return stepMin_; } |
| 34 |
int step_max() const { return stepMax_; } |
| 35 |
int step_interval() const { return stepInterval_; } |
| 36 |
|
| 37 |
size_t max_files() const { return maxFiles_; } |
| 38 |
size_t partial() const { return partialReadCount_; } |
| 39 |
bool contiguous_decomposition() const { return contig_; } |
| 40 |
|
| 41 |
const StringIdVector &global_var_names() const { return globalVarNames_; } |
| 42 |
const StringIdVector &node_var_names() const { return nodeVarNames_; } |
| 43 |
const StringIdVector &elem_var_names() const { return elemVarNames_; } |
| 44 |
const StringIdVector &nset_var_names() const { return nsetVarNames_; } |
| 45 |
const StringIdVector &sset_var_names() const { return ssetVarNames_; } |
| 46 |
|
| 47 |
const Omissions &block_omissions() const { return blockOmissions_; } |
| 48 |
|
| 49 |
//! Dumps representation of data in this class to cerr |
| 50 |
void dump(std::ostream &str) const; |
| 51 |
|
| 52 |
static void show_version(); |
| 53 |
|
| 54 |
// Make this private eventually... |
| 55 |
std::string inputFile_; |
| 56 |
std::string inputFormat_; |
| 57 |
std::string nemesisFile_; |
| 58 |
|
| 59 |
private: |
| 60 |
void enroll_options(); |
| 61 |
void parse_exclude(const char *list); |
| 62 |
|
| 63 |
/*! The defined formats for the count attribute are:<br> |
| 64 |
- <missing> -- default -- 1 <= count <= oo (all steps) |
| 65 |
- "X" -- X <= count <= X (just step X) (if X == -1, do last step only) |
| 66 |
- "X:Y" -- X to Y by 1 |
| 67 |
- "X:" -- X to oo by 1 |
| 68 |
- ":Y" -- 1 to Y by 1 |
| 69 |
- "::Z" -- 1 to oo by Z |
| 70 |
|
| 71 |
The count and step must always be >= 0 |
| 72 |
*/ |
| 73 |
void parse_step_option(const char *tokens); |
| 74 |
|
| 75 |
GetLongOption options_; //!< Options parsing |
| 76 |
|
| 77 |
std::string decompMethod_{"linear"}; |
| 78 |
std::string decompFile_; |
| 79 |
std::string decompVariable_{"processor_id"}; |
| 80 |
std::string outputPath_; |
| 81 |
|
| 82 |
size_t partialReadCount_{1'000'000'000}; |
| 83 |
size_t maxFiles_{1'020}; |
| 84 |
int processorCount_{1}; |
| 85 |
int debugLevel_{0}; |
| 86 |
int screenWidth_{0}; |
| 87 |
int stepMin_{1}; |
| 88 |
int stepMax_{1 << 30}; |
| 89 |
int stepInterval_{1}; |
| 90 |
|
| 91 |
public: |
| 92 |
int compressionLevel_{0}; |
| 93 |
int quantizeNSD_{0}; |
| 94 |
bool shuffle_{false}; |
| 95 |
bool ints64Bit_{false}; |
| 96 |
bool netcdf4_{false}; |
| 97 |
bool netcdf5_{false}; |
| 98 |
bool disableFieldRecognition_{false}; |
| 99 |
bool zlib_{false}; |
| 100 |
bool szip_{false}; |
| 101 |
bool zstd_{false}; |
| 102 |
bool bz2_{false}; |
| 103 |
bool outputDecompMap_{false}; |
| 104 |
bool outputDecompField_{false}; |
| 105 |
bool ignore_x_{false}; |
| 106 |
bool ignore_y_{false}; |
| 107 |
bool ignore_z_{false}; |
| 108 |
bool lineDecomp_{false}; |
| 109 |
std::string lineSurfaceList_{}; |
| 110 |
|
| 111 |
private: |
| 112 |
bool contig_{false}; |
| 113 |
|
| 114 |
Omissions blockOmissions_; |
| 115 |
|
| 116 |
StringIdVector globalVarNames_; |
| 117 |
StringIdVector nodeVarNames_; |
| 118 |
StringIdVector elemVarNames_; |
| 119 |
StringIdVector nsetVarNames_; |
| 120 |
StringIdVector ssetVarNames_; |
| 121 |
}; |