void Build_Variable_Names(ExoII_Read& file1, ExoII_Read& file2, bool *diff_found) { // Build (and compare) global variable names. build_variable_names("global", specs.glob_var_names, specs.glob_var, specs.glob_var_default, specs.glob_var_do_all_flag, file1.Global_Var_Names(), file2.Global_Var_Names(), diff_found); // Build (and compare) nodal variable names. build_variable_names("nodal", specs.node_var_names, specs.node_var, specs.node_var_default, specs.node_var_do_all_flag, file1.Nodal_Var_Names(), file2.Nodal_Var_Names(), diff_found); // Build (and compare) element variable names. build_variable_names("element", specs.elmt_var_names, specs.elmt_var, specs.elmt_var_default, specs.elmt_var_do_all_flag, file1.Elmt_Var_Names(), file2.Elmt_Var_Names(), diff_found); // Build (and compare) element variable names. if (!specs.ignore_attributes) { build_variable_names("element attribute", specs.elmt_att_names, specs.elmt_att, specs.elmt_att_default, specs.elmt_att_do_all_flag, file1.Elmt_Att_Names(), file2.Elmt_Att_Names(), diff_found); } // Build (and compare) nodeset variable names. build_variable_names("nodeset", specs.ns_var_names, specs.ns_var, specs.ns_var_default, specs.ns_var_do_all_flag, file1.NS_Var_Names(), file2.NS_Var_Names(), diff_found); // Build (and compare) sideset variable names. build_variable_names("sideset", specs.ss_var_names, specs.ss_var, specs.ss_var_default, specs.ss_var_do_all_flag, file1.SS_Var_Names(), file2.SS_Var_Names(), diff_found); }
int Create_File(ExoII_Read& file1, ExoII_Read& file2, const string& diffile_name, bool *diff_found) { // Multiple modes: // summary_flag == true --> Single file, output summary and variable names, return // diffile_name == "" --> Dual file, output summary, variable names, check compatability, // diffile_name != "" --> Three files (2 in, 1 out) // create output file which is diff of input. // output summary, variable names, check compatability // quiet_flag == true --> don't output summary information SMART_ASSERT(!specs.summary_flag); //======================================================================== // From here on down, have two input files and possibly 1 output file... // Create output file. int out_file_id = -1; if (!diffile_name.empty()) { // Take minimum word size for output file. int iows = file1.IO_Word_Size() < file2.IO_Word_Size() ? file1.IO_Word_Size() : file2.IO_Word_Size(); int compws = sizeof(double); out_file_id = ex_create(diffile_name.c_str(), EX_CLOBBER, &compws, &iows); SMART_ASSERT(out_file_id >= 0); ex_copy(file1.File_ID(), out_file_id); } if (!specs.quiet_flag) { if (out_file_id >= 0) { // The files are to be differenced .. just list names. if (specs.coord_tol.type != IGNORE) { SMART_ASSERT(specs.coord_tol.type == RELATIVE || specs.coord_tol.type == ABSOLUTE || specs.coord_tol.type == COMBINED || specs.coord_tol.type == EIGEN_REL || specs.coord_tol.type == EIGEN_ABS || specs.coord_tol.type == EIGEN_COM); sprintf(buf, "Coordinates: tol: %8g %s, floor: %8g", specs.coord_tol.value, specs.coord_tol.typestr(), specs.coord_tol.floor); std::cout << buf << std::endl; } else std::cout << "Locations of nodes will not be considered.\n"; if (specs.time_tol.type != IGNORE) { SMART_ASSERT(specs.time_tol.type == RELATIVE || specs.time_tol.type == ABSOLUTE || specs.time_tol.type == COMBINED || specs.time_tol.type == EIGEN_REL || specs.time_tol.type == EIGEN_ABS || specs.time_tol.type == EIGEN_COM); sprintf(buf, "Time step values: tol: %8g %s, floor: %8g", specs.time_tol.value, specs.time_tol.typestr(), specs.time_tol.floor); std::cout << buf << std::endl; } else std::cout << "Time step time values will not be differenced.\n"; output_diff_names("Global", specs.glob_var_names); output_diff_names("Nodal", specs.node_var_names); output_diff_names("Element", specs.elmt_var_names); output_diff_names("Element Attribute", specs.elmt_att_names); output_diff_names("Nodeset", specs.ns_var_names); output_diff_names("Sideset", specs.ss_var_names); } else { // The files are to be compared .. echo additional info. if (Tolerance::use_old_floor) { std::cout << "WARNING: Using old definition of floor tolerance. |a-b|<floor.\n\n"; } if (specs.coord_tol.type != IGNORE) { SMART_ASSERT(specs.coord_tol.type == RELATIVE || specs.coord_tol.type == ABSOLUTE || specs.coord_tol.type == COMBINED || specs.coord_tol.type == EIGEN_REL || specs.coord_tol.type == EIGEN_ABS || specs.coord_tol.type == EIGEN_COM); sprintf(buf, "Coordinates will be compared .. tol: %8g (%s), floor: %8g", specs.coord_tol.value, specs.coord_tol.typestr(), specs.coord_tol.floor); std::cout << buf << std::endl; } else { std::cout << "Locations of nodes will not be compared." << std::endl; } if (specs.time_tol.type != IGNORE) { SMART_ASSERT(specs.time_tol.type == RELATIVE || specs.time_tol.type == ABSOLUTE || specs.time_tol.type == COMBINED || specs.time_tol.type == EIGEN_REL || specs.time_tol.type == EIGEN_ABS || specs.time_tol.type == EIGEN_COM); sprintf(buf, "Time step values will be compared .. tol: %8g (%s), floor: %8g", specs.time_tol.value, specs.time_tol.typestr(), specs.time_tol.floor); std::cout << buf << std::endl; } else { std::cout << "Time step time values will not be compared." << std::endl; } output_compare_names("Global", specs.glob_var_names, specs.glob_var, file1.Num_Global_Vars(), file2.Num_Global_Vars()); output_compare_names("Nodal", specs.node_var_names, specs.node_var, file1.Num_Nodal_Vars(), file2.Num_Nodal_Vars()); output_compare_names("Element", specs.elmt_var_names, specs.elmt_var, file1.Num_Elmt_Vars(), file2.Num_Elmt_Vars()); output_compare_names("Element Attribute", specs.elmt_att_names, specs.elmt_att, file1.Num_Elmt_Atts(), file2.Num_Elmt_Atts()); output_compare_names("Nodeset", specs.ns_var_names, specs.ns_var, file1.Num_NS_Vars(), file2.Num_NS_Vars()); output_compare_names("Sideset", specs.ss_var_names, specs.ss_var, file1.Num_SS_Vars(), file2.Num_SS_Vars()); } } std::vector<int> truth_tab; build_truth_table(EX_ELEM_BLOCK, "Element Block", specs.elmt_var_names, file1.Num_Elmt_Blocks(), file1, file2, file1.Elmt_Var_Names(), file2.Elmt_Var_Names(), truth_tab, specs.quiet_flag, diff_found); std::vector<int> ns_truth_tab; build_truth_table(EX_NODE_SET, "Nodeset", specs.ns_var_names, file1.Num_Node_Sets(), file1, file2, file1.NS_Var_Names(), file2.NS_Var_Names(), ns_truth_tab, specs.quiet_flag, diff_found); std::vector<int> ss_truth_tab; build_truth_table(EX_SIDE_SET, "Sideset", specs.ss_var_names, file1.Num_Side_Sets(), file1, file2, file1.SS_Var_Names(), file2.SS_Var_Names(), ss_truth_tab, specs.quiet_flag, diff_found); // Put out the concatenated variable parameters here and then // put out the names.... if (out_file_id >= 0) { ex_put_all_var_param(out_file_id, specs.glob_var_names->size(), specs.node_var_names->size(), specs.elmt_var_names->size(), &truth_tab[0], specs.ns_var_names->size(), &ns_truth_tab[0], specs.ss_var_names->size(), &ss_truth_tab[0]); output_exodus_names(out_file_id, EX_GLOBAL, specs.glob_var_names); output_exodus_names(out_file_id, EX_NODAL, specs.node_var_names); output_exodus_names(out_file_id, EX_ELEM_BLOCK, specs.elmt_var_names); output_exodus_names(out_file_id, EX_NODE_SET, specs.ns_var_names); output_exodus_names(out_file_id, EX_SIDE_SET, specs.ss_var_names); } return out_file_id; }