| 1 |
// Copyright(C) 1999-2020, 2022, 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" // for GetLongOption |
| 9 |
#include "Tolerance.h" // for Tolerance, etc |
| 10 |
#include "util.h" |
| 11 |
#include <cmath> |
| 12 |
#include <string> // for string |
| 13 |
#include <utility> // for pair |
| 14 |
#include <vector> // for vector |
| 15 |
|
| 16 |
class SystemInterface |
| 17 |
{ |
| 18 |
public: |
| 19 |
SystemInterface(); |
| 20 |
|
| 21 |
bool parse_options(int argc, char **argv); |
| 22 |
|
| 23 |
static void show_version(); |
| 24 |
|
| 25 |
void Parse_Command_File(); |
| 26 |
void Set_Max_Names(int size); |
| 27 |
|
| 28 |
// Program parameters. |
| 29 |
Tolerance coord_tol{ToleranceMode::ABSOLUTE_, 1.0e-6, 0.0}; |
| 30 |
Tolerance time_tol{ToleranceMode::RELATIVE_, 1.0e-6, 1.0e-15}; |
| 31 |
Tolerance final_time_tol{ToleranceMode::RELATIVE_, 0.0, 0.0}; |
| 32 |
Tolerance default_tol{ToleranceMode::RELATIVE_, 1.0e-6, 0.0}; |
| 33 |
Tolerance ss_df_tol{ToleranceMode::RELATIVE_, 1.0e-6, 0.0}; |
| 34 |
|
| 35 |
// These should correspond to the values specified during parsing of |
| 36 |
// coordinate tolerance. |
| 37 |
// Offset of timesteps between first and second databases. |
| 38 |
int time_step_offset{0}; |
| 39 |
int time_step_start{1}; // First step to compare (1-based) |
| 40 |
int time_step_stop{-1}; // Last step to compare |
| 41 |
int time_step_increment{1}; // Step increment |
| 42 |
|
| 43 |
// Offset/Scale time values on input database -- Time_mod = Scale * Time_db + Offset |
| 44 |
double time_value_offset{0.0}; // Add offset to time values on first database |
| 45 |
double time_value_scale{1.0}; // Scale time values on first database |
| 46 |
|
| 47 |
std::pair<int, int> explicit_steps{}; // Only compare these two steps (db1:db2) if nonzero. |
| 48 |
|
| 49 |
int max_warnings{100}; |
| 50 |
|
| 51 |
NameList glob_var_names{}; |
| 52 |
Tolerance glob_var_default{ToleranceMode::RELATIVE_, 1.0e-6, 0.0}; |
| 53 |
std::vector<Tolerance> glob_var{}; |
| 54 |
|
| 55 |
NameList node_var_names{}; |
| 56 |
Tolerance node_var_default{ToleranceMode::RELATIVE_, 1.0e-6, 0.0}; |
| 57 |
std::vector<Tolerance> node_var{}; |
| 58 |
|
| 59 |
NameList elmt_var_names{}; |
| 60 |
Tolerance elmt_var_default{ToleranceMode::RELATIVE_, 1.0e-6, 0.0}; |
| 61 |
std::vector<Tolerance> elmt_var{}; |
| 62 |
|
| 63 |
NameList elmt_att_names{}; |
| 64 |
Tolerance elmt_att_default{ToleranceMode::RELATIVE_, 1.0e-6, 0.0}; |
| 65 |
std::vector<Tolerance> elmt_att{}; |
| 66 |
|
| 67 |
NameList ns_var_names{}; |
| 68 |
Tolerance ns_var_default{ToleranceMode::RELATIVE_, 1.0e-6, 0.0}; |
| 69 |
std::vector<Tolerance> ns_var{}; |
| 70 |
|
| 71 |
NameList ss_var_names{}; |
| 72 |
Tolerance ss_var_default{ToleranceMode::RELATIVE_, 1.0e-6, 0.0}; |
| 73 |
std::vector<Tolerance> ss_var{}; |
| 74 |
|
| 75 |
NameList eb_var_names{}; |
| 76 |
Tolerance eb_var_default{ToleranceMode::RELATIVE_, 1.0e-6, 0.0}; |
| 77 |
std::vector<Tolerance> eb_var{}; |
| 78 |
|
| 79 |
NameList fb_var_names{}; |
| 80 |
Tolerance fb_var_default{ToleranceMode::RELATIVE_, 1.0e-6, 0.0}; |
| 81 |
std::vector<Tolerance> fb_var{}; |
| 82 |
|
| 83 |
// time step exclusion data |
| 84 |
std::vector<int> exclude_steps{}; |
| 85 |
|
| 86 |
std::string file1{}; |
| 87 |
std::string file2{}; |
| 88 |
std::string diff_file{}; |
| 89 |
std::string command_file{}; |
| 90 |
std::string change_sets{}; |
| 91 |
|
| 92 |
bool quiet_flag{false}; // By default, warnings and other info is produced |
| 93 |
bool show_all_diffs{false}; // Be default, show only maximum diff for each variable; |
| 94 |
// if set, show all diff that exceeds tolerance. |
| 95 |
ToleranceMode output_type{ |
| 96 |
ToleranceMode::ABSOLUTE_}; // By default, output file diffs are absolute. |
| 97 |
MapType map_flag{MapType::USE_FILE_IDS}; // By default, no searching is done to match |
| 98 |
// nodes & elements. |
| 99 |
bool nsmap_flag{true}; // By default, nodeset nodelist match is off |
| 100 |
bool ssmap_flag{true}; // By default, sideset elem/side match is off |
| 101 |
bool short_block_check{true}; // By default, element block compares are |
| 102 |
// case in-sensitive and full. This switch |
| 103 |
// checks only up to the shortest string length. |
| 104 |
bool nocase_var_names{true}; // By default, variable name compares are |
| 105 |
// case sensitive and full. This switch |
| 106 |
// ignores case when comparing. |
| 107 |
bool summary_flag{false}; // By default, summary mode is not in effect. |
| 108 |
bool ignore_maps{false}; // By default, use the node and element number |
| 109 |
// maps to report node and element ids. |
| 110 |
bool ignore_nans{false}; // Don't check for NaNs |
| 111 |
bool ignore_dups{false}; // If two elements/nodes in same location in map or partial map |
| 112 |
// case, just return first match instead of aborting. |
| 113 |
bool ignore_steps{false}; |
| 114 |
bool ignore_attributes{false}; // Don't compare attributes... |
| 115 |
bool ignore_sideset_df{false}; // Don't compare sideset df |
| 116 |
|
| 117 |
bool ints_64_bits{false}; |
| 118 |
|
| 119 |
bool coord_sep{false}; |
| 120 |
bool exit_status_switch{true}; |
| 121 |
bool dump_mapping{false}; // By default, mappings are not printed. |
| 122 |
bool show_unmatched{false}; // Show elements not matched in partial mode |
| 123 |
bool noSymmetricNameCheck{false}; // By default, the second file's variable |
| 124 |
bool allowNameMismatch{false}; // By default, name in 1st db must be in second also. |
| 125 |
bool doL1Norm{false}; |
| 126 |
bool doL2Norm{false}; |
| 127 |
bool pedantic{false}; // Be most picky on what is different (not fully picky yet) |
| 128 |
|
| 129 |
bool interpolating{false}; // Interpolate times on file2 to match times on file1; |
| 130 |
bool by_name{false}; // Match entities by name instead of by id. |
| 131 |
|
| 132 |
bool glob_var_do_all_flag{false}; |
| 133 |
bool node_var_do_all_flag{false}; |
| 134 |
bool elmt_var_do_all_flag{false}; |
| 135 |
bool elmt_att_do_all_flag{false}; |
| 136 |
bool ns_var_do_all_flag{false}; |
| 137 |
bool ss_var_do_all_flag{false}; |
| 138 |
bool eb_var_do_all_flag{false}; |
| 139 |
bool fb_var_do_all_flag{false}; |
| 140 |
|
| 141 |
bool has_change_sets{false}; |
| 142 |
|
| 143 |
private: |
| 144 |
void enroll_options(); |
| 145 |
GetLongOption options_{}; //!< Options parsing |
| 146 |
}; |
| 147 |
|
| 148 |
extern SystemInterface interFace; |