| 1 |
/* |
| 2 |
* Copyright(C) 1999-2021, 2023, 2024, 2025 National Technology & Engineering Solutions |
| 3 |
* of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with |
| 4 |
* NTESS, the U.S. Government retains certain rights in this software. |
| 5 |
* |
| 6 |
* See packages/seacas/LICENSE for details |
| 7 |
*/ |
| 8 |
#include "exodusII.h" // for ex_close, etc |
| 9 |
#include "fmt/ostream.h" |
| 10 |
#include "nem_spread.h" // for NemSpread, etc |
| 11 |
#include "open_file_limit.h" |
| 12 |
#include "ps_pario_const.h" // for PIO_Info, etc |
| 13 |
#include "rf_allo.h" // for array_alloc, safe_free |
| 14 |
#include "rf_io_const.h" // for Exo_Res_File, ExoFile, etc |
| 15 |
#include "vector_data.h" |
| 16 |
#include <cassert> // for assert |
| 17 |
#include <climits> // for INT_MAX |
| 18 |
#include <cstddef> // for size_t |
| 19 |
#include <cstdio> // for stderr, nullptr, etc |
| 20 |
#include <cstdlib> // for exit, free, malloc |
| 21 |
#include <string> |
| 22 |
#include <vector> // for vector |
| 23 |
|
| 24 |
/*****************************************************************************/ |
| 25 |
/*****************************************************************************/ |
| 26 |
template void NemSpread<double, int>::read_restart_params(); |
| 27 |
template void NemSpread<float, int>::read_restart_params(); |
| 28 |
|
| 29 |
template void NemSpread<double, int64_t>::read_restart_params(); |
| 30 |
template void NemSpread<float, int64_t>::read_restart_params(); |
| 31 |
|
| 32 |
template <typename T, typename INT> void NemSpread<T, INT>::read_restart_params() |
| 33 |
|
| 34 |
/* Function which reads the restart variable parameters for the EXODUS II |
| 35 |
* database which contains the results information. Allocate necessary |
| 36 |
* memory on each processor. |
| 37 |
* |
| 38 |
*---------------------------------------------------------------------------- |
| 39 |
* |
| 40 |
* Functions called: |
| 41 |
* |
| 42 |
* compare_mesh_param -- function which checks that parameters in |
| 43 |
* the restart EXODUS II file are the same as in |
| 44 |
* the mesh EXODUS II file |
| 45 |
* read_var_param -- function which reads the time indices, number |
| 46 |
* of variables, and their names from the restart file |
| 47 |
* |
| 48 |
*---------------------------------------------------------------------------- |
| 49 |
*/ |
| 50 |
|
| 51 |
{ |
| 52 |
/* Open the ExodusII file */ |
| 53 |
int exoid; |
| 54 |
float vers; |
| 55 |
int cpu_ws = io_ws; |
| 56 |
int mode = EX_READ | int64api; |
| 57 |
if ((exoid = ex_open(Exo_Res_File.c_str(), mode, &cpu_ws, &io_ws, &vers)) < 0) { |
| 58 |
fmt::print(stderr, "{}: Could not open file {} for restart info\n", __func__, Exo_Res_File); |
| 59 |
exit(1); |
| 60 |
} |
| 61 |
exoid += selected_change_set; |
| 62 |
|
| 63 |
int max_name_length = ex_inquire_int(exoid, EX_INQ_DB_MAX_USED_NAME_LENGTH); |
| 64 |
ex_set_max_name_length(exoid, max_name_length); |
| 65 |
|
| 66 |
/* |
| 67 |
* Just do a rudimentary check to figure out if the mesh parameters |
| 68 |
* in the results file are the same as the mesh parameters in the |
| 69 |
* mesh file. |
| 70 |
*/ |
| 71 |
if (ExoFile != Exo_Res_File) { |
| 72 |
if (!compare_mesh_param(exoid)) { |
| 73 |
fmt::print(stderr, |
| 74 |
"{}: Mesh parameters in mesh and result files" |
| 75 |
" differ\n", |
| 76 |
__func__); |
| 77 |
exit(1); |
| 78 |
} |
| 79 |
} |
| 80 |
|
| 81 |
/* get the time, and the variable names */ |
| 82 |
if (read_var_param(exoid, max_name_length) < 0) { |
| 83 |
fmt::print(stderr, "{}: Error occurred while reading variable parameters\n", __func__); |
| 84 |
exit(1); |
| 85 |
} |
| 86 |
|
| 87 |
/* Close the ExodusII file */ |
| 88 |
ex_close(exoid); |
| 89 |
} |
| 90 |
|
| 91 |
template void NemSpread<double, int>::read_restart_data(); |
| 92 |
template void NemSpread<float, int>::read_restart_data(); |
| 93 |
|
| 94 |
template void NemSpread<double, int64_t>::read_restart_data(); |
| 95 |
template void NemSpread<float, int64_t>::read_restart_data(); |
| 96 |
|
| 97 |
/* Function which reads the restart variable data from the EXODUS II |
| 98 |
* database which contains the results information. Then distribute |
| 99 |
* it to the processors, and write it to the parallel exodus files. |
| 100 |
* |
| 101 |
*---------------------------------------------------------------------------- |
| 102 |
* |
| 103 |
* Functions called: |
| 104 |
* |
| 105 |
* read_vars -- function which reads the variable values from the restart |
| 106 |
* file, and then distributes them to the processors |
| 107 |
* |
| 108 |
* write_var_timestep -- function which writes out the variables for a |
| 109 |
* to a parallel ExodusII file. |
| 110 |
* |
| 111 |
*---------------------------------------------------------------------------- |
| 112 |
*/ |
| 113 |
template <typename T, typename INT> void NemSpread<T, INT>::read_restart_data() |
| 114 |
{ |
| 115 |
/* need to get the element block ids and counts */ |
| 116 |
std::vector<INT> eb_ids_global(globals.Num_Elem_Blk); |
| 117 |
std::vector<INT> eb_cnts_global(globals.Num_Elem_Blk); |
| 118 |
std::vector<INT> ss_ids_global(globals.Num_Side_Set); |
| 119 |
std::vector<INT> ss_cnts_global(globals.Num_Side_Set); |
| 120 |
std::vector<INT> ns_ids_global(globals.Num_Node_Set); |
| 121 |
std::vector<INT> ns_cnts_global(globals.Num_Node_Set); |
| 122 |
|
| 123 |
INT ***eb_map_ptr = nullptr; |
| 124 |
INT **eb_cnts_local = nullptr; |
| 125 |
int exoid = 0; |
| 126 |
|
| 127 |
float vers; |
| 128 |
std::string cTemp; |
| 129 |
|
| 130 |
/* computing precision should be the same as the database precision |
| 131 |
* |
| 132 |
* EXCEPTION: if the io_ws is smaller than the machine precision, |
| 133 |
* ie - database with io_ws == 4 on a Cray (sizeof(float) == 8), |
| 134 |
* then the cpu_ws must be the machine precision. |
| 135 |
*/ |
| 136 |
int cpu_ws; |
| 137 |
if (io_ws < static_cast<int>(sizeof(float))) { |
| 138 |
cpu_ws = sizeof(float); |
| 139 |
} |
| 140 |
else { |
| 141 |
cpu_ws = io_ws; |
| 142 |
} |
| 143 |
|
| 144 |
/* Open the ExodusII file */ |
| 145 |
{ |
| 146 |
int mode = EX_READ | int64api; |
| 147 |
if ((exoid = ex_open(Exo_Res_File.c_str(), mode, &cpu_ws, &io_ws, &vers)) < 0) { |
| 148 |
fmt::print(stderr, "{}: Could not open file {} for restart info\n", __func__, Exo_Res_File); |
| 149 |
exit(1); |
| 150 |
} |
| 151 |
exoid += selected_change_set; |
| 152 |
} |
| 153 |
|
| 154 |
/* allocate space for the global variables */ |
| 155 |
Restart_Info.Glob_Vals.resize(Restart_Info.NVar_Glob); |
| 156 |
|
| 157 |
if (Restart_Info.NVar_Elem > 0) { |
| 158 |
|
| 159 |
/* allocate storage space */ |
| 160 |
Restart_Info.Elem_Vals.resize(Proc_Info[2]); |
| 161 |
|
| 162 |
/* now allocate storage for the values */ |
| 163 |
for (int iproc = 0; iproc < Proc_Info[2]; iproc++) { |
| 164 |
size_t array_size = Restart_Info.NVar_Elem * |
| 165 |
(globals.Num_Internal_Elems[iproc] + globals.Num_Border_Elems[iproc]); |
| 166 |
Restart_Info.Elem_Vals[iproc].resize(array_size); |
| 167 |
} |
| 168 |
|
| 169 |
/* Get the Element Block IDs from the input file */ |
| 170 |
if (ex_get_ids(exoid, EX_ELEM_BLOCK, Data(eb_ids_global)) < 0) { |
| 171 |
fmt::print(stderr, "{}: unable to get element block IDs", __func__); |
| 172 |
exit(1); |
| 173 |
} |
| 174 |
|
| 175 |
/* Get the count of elements in each element block */ |
| 176 |
for (int cnt = 0; cnt < globals.Num_Elem_Blk; cnt++) { |
| 177 |
char blk_name[MAX_STR_LENGTH]; |
| 178 |
if (ex_get_block(exoid, EX_ELEM_BLOCK, eb_ids_global[cnt], blk_name, &(eb_cnts_global[cnt]), |
| 179 |
nullptr, nullptr, nullptr, nullptr) < 0) { |
| 180 |
fmt::print(stderr, "{}: unable to get element count for block id {}", __func__, |
| 181 |
(size_t)eb_ids_global[cnt]); |
| 182 |
exit(1); |
| 183 |
} |
| 184 |
} |
| 185 |
|
| 186 |
/* |
| 187 |
* in order to speed up finding matches in the global element |
| 188 |
* number map, set up an array of pointers to the start of |
| 189 |
* each element block's global element number map. That way |
| 190 |
* only entries for the current element block have to be searched |
| 191 |
*/ |
| 192 |
eb_map_ptr = (INT ***)array_alloc(__FILE__, __LINE__, 2, Proc_Info[2], globals.Num_Elem_Blk, |
| 193 |
sizeof(INT *)); |
| 194 |
if (!eb_map_ptr) { |
| 195 |
fmt::print(stderr, "[{}]: ERROR, insufficient memory!\n", __func__); |
| 196 |
exit(1); |
| 197 |
} |
| 198 |
eb_cnts_local = |
| 199 |
(INT **)array_alloc(__FILE__, __LINE__, 2, Proc_Info[2], globals.Num_Elem_Blk, sizeof(INT)); |
| 200 |
if (!eb_cnts_local) { |
| 201 |
fmt::print(stderr, "[{}]: ERROR, insufficient memory!\n", __func__); |
| 202 |
exit(1); |
| 203 |
} |
| 204 |
|
| 205 |
/* |
| 206 |
* for now, assume that element blocks have been |
| 207 |
* stored in the same order as the global blocks |
| 208 |
*/ |
| 209 |
for (int iproc = 0; iproc < Proc_Info[2]; iproc++) { |
| 210 |
int ifound = 0; |
| 211 |
size_t offset = 0; |
| 212 |
int ilocal; |
| 213 |
for (int cnt = 0; cnt < globals.Num_Elem_Blk; cnt++) { |
| 214 |
for (ilocal = ifound; ilocal < globals.Proc_Num_Elem_Blk[iproc]; ilocal++) { |
| 215 |
if (globals.Proc_Elem_Blk_Ids[iproc][ilocal] == eb_ids_global[cnt]) { |
| 216 |
break; |
| 217 |
} |
| 218 |
} |
| 219 |
|
| 220 |
if (ilocal < globals.Proc_Num_Elem_Blk[iproc]) { |
| 221 |
eb_map_ptr[iproc][cnt] = &globals.GElems[iproc][offset]; |
| 222 |
eb_cnts_local[iproc][cnt] = globals.Proc_Num_Elem_In_Blk[iproc][ilocal]; |
| 223 |
offset += globals.Proc_Num_Elem_In_Blk[iproc][ilocal]; |
| 224 |
ifound = ilocal; /* don't search the same part of the list over */ |
| 225 |
} |
| 226 |
else { |
| 227 |
eb_map_ptr[iproc][cnt] = nullptr; |
| 228 |
eb_cnts_local[iproc][cnt] = 0; |
| 229 |
} |
| 230 |
} |
| 231 |
} |
| 232 |
|
| 233 |
} /* End: "if (Restart_Info.NVar_Elem > 0 )" */ |
| 234 |
|
| 235 |
if (Restart_Info.NVar_Node > 0) { |
| 236 |
/* allocate storage space */ |
| 237 |
Restart_Info.Node_Vals.resize(Proc_Info[2]); |
| 238 |
|
| 239 |
/* now allocate storage for the values */ |
| 240 |
for (int iproc = 0; iproc < Proc_Info[2]; iproc++) { |
| 241 |
size_t array_size = Restart_Info.NVar_Node * |
| 242 |
(globals.Num_Internal_Nodes[iproc] + globals.Num_Border_Nodes[iproc] + |
| 243 |
globals.Num_External_Nodes[iproc]); |
| 244 |
Restart_Info.Node_Vals[iproc].resize(array_size); |
| 245 |
} |
| 246 |
} |
| 247 |
|
| 248 |
if (Restart_Info.NVar_Sset > 0) { |
| 249 |
|
| 250 |
/* allocate storage space */ |
| 251 |
Restart_Info.Sset_Vals.resize(Proc_Info[2]); |
| 252 |
|
| 253 |
/* now allocate storage for the values */ |
| 254 |
for (int iproc = 0; iproc < Proc_Info[2]; iproc++) { |
| 255 |
size_t array_size = Restart_Info.NVar_Sset * globals.Proc_SS_Elem_List_Length[iproc]; |
| 256 |
|
| 257 |
Restart_Info.Sset_Vals[iproc].resize(array_size); |
| 258 |
} |
| 259 |
|
| 260 |
/* Get the Sideset IDs from the input file */ |
| 261 |
if (ex_get_ids(exoid, EX_SIDE_SET, Data(ss_ids_global)) < 0) { |
| 262 |
fmt::print(stderr, "{}: unable to get sideset IDs", __func__); |
| 263 |
exit(1); |
| 264 |
} |
| 265 |
|
| 266 |
/* Get the count of elements in each sideset */ |
| 267 |
for (int cnt = 0; cnt < globals.Num_Side_Set; cnt++) { |
| 268 |
if (ex_get_set_param(exoid, EX_SIDE_SET, ss_ids_global[cnt], &(ss_cnts_global[cnt]), |
| 269 |
nullptr) < 0) { |
| 270 |
fmt::print(stderr, "{}: unable to get element count for sideset id {}", __func__, |
| 271 |
(size_t)ss_ids_global[cnt]); |
| 272 |
exit(1); |
| 273 |
} |
| 274 |
} |
| 275 |
} /* End: "if (Restart_Info.NVar_Sset > 0 )" */ |
| 276 |
|
| 277 |
if (Restart_Info.NVar_Nset > 0) { |
| 278 |
|
| 279 |
/* allocate storage space */ |
| 280 |
Restart_Info.Nset_Vals.resize(Proc_Info[2]); |
| 281 |
|
| 282 |
/* now allocate storage for the values */ |
| 283 |
for (int iproc = 0; iproc < Proc_Info[2]; iproc++) { |
| 284 |
size_t array_size = Restart_Info.NVar_Nset * globals.Proc_NS_List_Length[iproc]; |
| 285 |
Restart_Info.Nset_Vals[iproc].resize(array_size); |
| 286 |
} |
| 287 |
|
| 288 |
/* Get the Nodeset IDs from the input file */ |
| 289 |
if (ex_get_ids(exoid, EX_NODE_SET, Data(ns_ids_global)) < 0) { |
| 290 |
fmt::print(stderr, "{}: unable to get nodeset IDs", __func__); |
| 291 |
exit(1); |
| 292 |
} |
| 293 |
|
| 294 |
/* Get the count of elements in each nodeset */ |
| 295 |
for (int cnt = 0; cnt < globals.Num_Node_Set; cnt++) { |
| 296 |
if (ex_get_set_param(exoid, EX_NODE_SET, ns_ids_global[cnt], &(ns_cnts_global[cnt]), |
| 297 |
nullptr) < 0) { |
| 298 |
fmt::print(stderr, "{}: unable to get element count for nodeset id {}", __func__, |
| 299 |
(size_t)ns_ids_global[cnt]); |
| 300 |
exit(1); |
| 301 |
} |
| 302 |
} |
| 303 |
} /* End: "if (Restart_Info.NVar_Nset > 0 )" */ |
| 304 |
|
| 305 |
std::vector<int> par_exoid(Proc_Info[2]); |
| 306 |
|
| 307 |
/* See if any '/' in the name. IF present, isolate the basename of the file */ |
| 308 |
size_t found = Output_File_Base_Name.find_last_of('/'); |
| 309 |
if (found != std::string::npos) { |
| 310 |
/* There is a path separator. Get the portion after the |
| 311 |
* separator |
| 312 |
*/ |
| 313 |
cTemp = Output_File_Base_Name.substr(found + 1); |
| 314 |
} |
| 315 |
else { |
| 316 |
/* No separator; this is already just the basename... */ |
| 317 |
cTemp = Output_File_Base_Name; |
| 318 |
} |
| 319 |
|
| 320 |
if (PIO_Info.Exo_Extension.empty()) { |
| 321 |
cTemp += ".par"; |
| 322 |
} |
| 323 |
else { |
| 324 |
cTemp += PIO_Info.Exo_Extension; |
| 325 |
} |
| 326 |
|
| 327 |
int open_file_count = open_file_limit() - 1; |
| 328 |
if (open_file_count > Proc_Info[5]) { |
| 329 |
fmt::print("All output files opened simultaneously.\n"); |
| 330 |
for (int iproc = Proc_Info[4]; iproc < Proc_Info[4] + Proc_Info[5]; iproc++) { |
| 331 |
std::string Parallel_File_Name = gen_par_filename(cTemp, Proc_Ids[iproc], Proc_Info[0]); |
| 332 |
|
| 333 |
/* Open the parallel Exodus II file for writing */ |
| 334 |
cpu_ws = io_ws; |
| 335 |
int mode = EX_WRITE | int64api | int64db; |
| 336 |
if ((par_exoid[iproc] = ex_open(Parallel_File_Name.c_str(), mode, &cpu_ws, &io_ws, &vers)) < |
| 337 |
0) { |
| 338 |
fmt::print(stderr, "[{}] {} Could not open parallel Exodus II file: {}\n", iproc, __func__, |
| 339 |
Parallel_File_Name); |
| 340 |
exit(1); |
| 341 |
} |
| 342 |
} |
| 343 |
} |
| 344 |
else { |
| 345 |
fmt::print("All output files opened one-at-a-time.\n"); |
| 346 |
} |
| 347 |
|
| 348 |
/* Now loop over the number of time steps */ |
| 349 |
for (int time_idx = 0; time_idx < Restart_Info.Num_Times; time_idx++) { |
| 350 |
|
| 351 |
double start_t = second(); |
| 352 |
|
| 353 |
/* read and distribute the variables for this time step */ |
| 354 |
if (read_vars(exoid, Restart_Info.Time_Idx[time_idx], Data(eb_ids_global), Data(eb_cnts_global), |
| 355 |
eb_map_ptr, eb_cnts_local, Data(ss_ids_global), Data(ss_cnts_global), |
| 356 |
Data(ns_ids_global), Data(ns_cnts_global)) < 0) { |
| 357 |
fmt::print(stderr, "{}: Error occurred while reading variables\n", __func__); |
| 358 |
exit(1); |
| 359 |
} |
| 360 |
double end_t = second() - start_t; |
| 361 |
fmt::print("\tTime to read vars for timestep {}: {} (sec.)\n", (time_idx + 1), end_t); |
| 362 |
|
| 363 |
start_t = second(); |
| 364 |
for (int iproc = Proc_Info[4]; iproc < Proc_Info[4] + Proc_Info[5]; iproc++) { |
| 365 |
|
| 366 |
if (open_file_count < Proc_Info[5]) { |
| 367 |
std::string Parallel_File_Name = gen_par_filename(cTemp, Proc_Ids[iproc], Proc_Info[0]); |
| 368 |
|
| 369 |
/* Open the parallel Exodus II file for writing */ |
| 370 |
cpu_ws = io_ws; |
| 371 |
int mode = EX_WRITE | int64api | int64db; |
| 372 |
if ((par_exoid[iproc] = ex_open(Parallel_File_Name.c_str(), mode, &cpu_ws, &io_ws, &vers)) < |
| 373 |
0) { |
| 374 |
fmt::print(stderr, "[{}] {} Could not open parallel Exodus II file: {}\n", iproc, |
| 375 |
__func__, Parallel_File_Name); |
| 376 |
exit(1); |
| 377 |
} |
| 378 |
} |
| 379 |
|
| 380 |
/* |
| 381 |
* Write out the variable data for the time steps in this |
| 382 |
* block to each parallel file. |
| 383 |
*/ |
| 384 |
write_var_timestep(par_exoid[iproc], iproc, (time_idx + 1), Data(eb_ids_global), |
| 385 |
Data(ss_ids_global), Data(ns_ids_global)); |
| 386 |
|
| 387 |
if (iproc % 10 == 0 || iproc == Proc_Info[2] - 1) { |
| 388 |
fmt::print("{}", iproc); |
| 389 |
} |
| 390 |
else { |
| 391 |
fmt::print("."); |
| 392 |
} |
| 393 |
|
| 394 |
if (open_file_count < Proc_Info[5]) { |
| 395 |
if (ex_close(par_exoid[iproc]) == -1) { |
| 396 |
fmt::print(stderr, "[{}] {} Could not close the parallel Exodus II file.\n", iproc, |
| 397 |
__func__); |
| 398 |
exit(1); |
| 399 |
} |
| 400 |
} |
| 401 |
} /* End "for (iproc=0; iproc <Proc_Info[2]; iproc++)" */ |
| 402 |
|
| 403 |
end_t = second() - start_t; |
| 404 |
fmt::print("\n\tTime to write vars for timestep {}: {} (sec.)\n", (time_idx + 1), end_t); |
| 405 |
} |
| 406 |
if (Restart_Info.NVar_Elem > 0) { |
| 407 |
safe_free((void **)&eb_map_ptr); |
| 408 |
safe_free((void **)&eb_cnts_local); |
| 409 |
} |
| 410 |
|
| 411 |
/* Close the restart exodus II file */ |
| 412 |
if (ex_close(exoid) == -1) { |
| 413 |
fmt::print(stderr, "{}Could not close the restart Exodus II file\n", __func__); |
| 414 |
exit(1); |
| 415 |
} |
| 416 |
|
| 417 |
if (open_file_count > Proc_Info[5]) { |
| 418 |
for (int iproc = Proc_Info[4]; iproc < Proc_Info[4] + Proc_Info[5]; iproc++) { |
| 419 |
/* Close the parallel exodus II file */ |
| 420 |
if (ex_close(par_exoid[iproc]) == -1) { |
| 421 |
fmt::print(stderr, "[{}] {} Could not close the parallel Exodus II file.\n", iproc, |
| 422 |
__func__); |
| 423 |
exit(1); |
| 424 |
} |
| 425 |
} |
| 426 |
} |
| 427 |
} |
| 428 |
|
| 429 |
template <typename T, typename INT> |
| 430 |
int NemSpread<T, INT>::read_var_param(int exoid, int max_name_length) |
| 431 |
{ |
| 432 |
/* Get the number of time indices contained in the file */ |
| 433 |
int num_times = ex_inquire_int(exoid, EX_INQ_TIME); |
| 434 |
|
| 435 |
/* see if the user want to get all of the time indices */ |
| 436 |
if (Restart_Info.Num_Times == -1) { |
| 437 |
|
| 438 |
Restart_Info.Num_Times = num_times; |
| 439 |
|
| 440 |
if (num_times > 0) { |
| 441 |
/* allocate array space */ |
| 442 |
Restart_Info.Time_Idx.resize(Restart_Info.Num_Times); |
| 443 |
|
| 444 |
for (int cnt = 0; cnt < Restart_Info.Num_Times; cnt++) { |
| 445 |
Restart_Info.Time_Idx[cnt] = cnt + 1; |
| 446 |
} |
| 447 |
} |
| 448 |
} |
| 449 |
else { |
| 450 |
/* Check to see if the requested indices are valid */ |
| 451 |
for (int cnt = 0; cnt < Restart_Info.Num_Times; cnt++) { |
| 452 |
|
| 453 |
/* if the user wants the last time, then set it */ |
| 454 |
if (Restart_Info.Time_Idx[cnt] == 0) { |
| 455 |
Restart_Info.Time_Idx[cnt] = num_times; |
| 456 |
} |
| 457 |
|
| 458 |
if (Restart_Info.Time_Idx[cnt] > num_times) { |
| 459 |
fmt::print(stderr, "{}: Requested time index, {}, out of range.\n", __func__, |
| 460 |
Restart_Info.Time_Idx[cnt]); |
| 461 |
fmt::print(stderr, "{}: Valid time indices in {} are from 1 to {}.\n", __func__, |
| 462 |
Exo_Res_File, num_times); |
| 463 |
return -1; |
| 464 |
} |
| 465 |
} |
| 466 |
} |
| 467 |
|
| 468 |
/* if there are not any time steps, then return here without an error */ |
| 469 |
if (Restart_Info.Num_Times == 0) { |
| 470 |
Restart_Info.Flag = 0; |
| 471 |
Restart_Info.NVar_Glob = 0; |
| 472 |
Restart_Info.NVar_Node = 0; |
| 473 |
Restart_Info.NVar_Elem = 0; |
| 474 |
return 0; |
| 475 |
} |
| 476 |
|
| 477 |
/***************** Global Variables ********************/ |
| 478 |
if (ex_get_variable_param(exoid, EX_GLOBAL, &(Restart_Info.NVar_Glob)) < 0) { |
| 479 |
fmt::print(stderr, "{}: Could not get global variable parameter from file\n", __func__); |
| 480 |
return -1; |
| 481 |
} |
| 482 |
|
| 483 |
/* allocate space for the global variable names */ |
| 484 |
if (Restart_Info.NVar_Glob > 0) { |
| 485 |
Restart_Info.GV_Name = (char **)array_alloc(__FILE__, __LINE__, 2, Restart_Info.NVar_Glob, |
| 486 |
max_name_length + 1, sizeof(char)); |
| 487 |
|
| 488 |
/* get the global variable names */ |
| 489 |
if (ex_get_variable_names(exoid, EX_GLOBAL, Restart_Info.NVar_Glob, Restart_Info.GV_Name) < 0) { |
| 490 |
fmt::print(stderr, "{}: Could not get global variable names from file\n", __func__); |
| 491 |
return -1; |
| 492 |
} |
| 493 |
} |
| 494 |
|
| 495 |
/***************** Elemental Variables ********************/ |
| 496 |
if (ex_get_variable_param(exoid, EX_ELEM_BLOCK, &(Restart_Info.NVar_Elem)) < 0) { |
| 497 |
fmt::print(stderr, "{}: Could not get elemental variable param from file\n", __func__); |
| 498 |
return -1; |
| 499 |
} |
| 500 |
|
| 501 |
/* allocate space for the elemental variable names */ |
| 502 |
if (Restart_Info.NVar_Elem > 0) { |
| 503 |
Restart_Info.EV_Name = (char **)array_alloc(__FILE__, __LINE__, 2, Restart_Info.NVar_Elem, |
| 504 |
max_name_length + 1, sizeof(char)); |
| 505 |
|
| 506 |
/* get the elemental variable names */ |
| 507 |
if (ex_get_variable_names(exoid, EX_ELEM_BLOCK, Restart_Info.NVar_Elem, Restart_Info.EV_Name) < |
| 508 |
0) { |
| 509 |
fmt::print(stderr, "{}: Could not get elemental variable names from file\n", __func__); |
| 510 |
return -1; |
| 511 |
} |
| 512 |
|
| 513 |
/* and get the truth table */ |
| 514 |
Restart_Info.GElem_TT.resize(globals.Num_Elem_Blk * Restart_Info.NVar_Elem); |
| 515 |
|
| 516 |
check_exodus_error(ex_get_truth_table(exoid, EX_ELEM_BLOCK, globals.Num_Elem_Blk, |
| 517 |
Restart_Info.NVar_Elem, Data(Restart_Info.GElem_TT)), |
| 518 |
"ex_get_truth_table"); |
| 519 |
} |
| 520 |
|
| 521 |
/******************* Nodal Variables **********************/ |
| 522 |
if (ex_get_variable_param(exoid, EX_NODAL, &(Restart_Info.NVar_Node)) < 0) { |
| 523 |
fmt::print(stderr, "{}: Could not get nodal variable param from file\n", __func__); |
| 524 |
return -1; |
| 525 |
} |
| 526 |
|
| 527 |
/* allocate space for the nodal variable names */ |
| 528 |
if (Restart_Info.NVar_Node > 0) { |
| 529 |
Restart_Info.NV_Name = (char **)array_alloc(__FILE__, __LINE__, 2, Restart_Info.NVar_Node, |
| 530 |
max_name_length + 1, sizeof(char)); |
| 531 |
|
| 532 |
/* get the nodal variable names */ |
| 533 |
if (ex_get_variable_names(exoid, EX_NODAL, Restart_Info.NVar_Node, Restart_Info.NV_Name) < 0) { |
| 534 |
fmt::print(stderr, "{}: Could not get nodal variable names from file\n", __func__); |
| 535 |
return -1; |
| 536 |
} |
| 537 |
} |
| 538 |
|
| 539 |
/******************* Sideset Variables **********************/ |
| 540 |
if (ex_get_variable_param(exoid, EX_SIDE_SET, &(Restart_Info.NVar_Sset)) < 0) { |
| 541 |
fmt::print(stderr, "{}: Could not get sideset variable param from file\n", __func__); |
| 542 |
return -1; |
| 543 |
} |
| 544 |
|
| 545 |
/* allocate space for the variable names */ |
| 546 |
if (Restart_Info.NVar_Sset > 0) { |
| 547 |
Restart_Info.SSV_Name = (char **)array_alloc(__FILE__, __LINE__, 2, Restart_Info.NVar_Sset, |
| 548 |
max_name_length + 1, sizeof(char)); |
| 549 |
|
| 550 |
/* get the variable names */ |
| 551 |
if (ex_get_variable_names(exoid, EX_SIDE_SET, Restart_Info.NVar_Sset, Restart_Info.SSV_Name) < |
| 552 |
0) { |
| 553 |
fmt::print(stderr, "{}: Could not get sideset variable names from file\n", __func__); |
| 554 |
return -1; |
| 555 |
} |
| 556 |
|
| 557 |
/* and get the truth table */ |
| 558 |
Restart_Info.GSset_TT.resize(globals.Num_Side_Set * Restart_Info.NVar_Sset); |
| 559 |
|
| 560 |
check_exodus_error(ex_get_truth_table(exoid, EX_SIDE_SET, globals.Num_Side_Set, |
| 561 |
Restart_Info.NVar_Sset, Data(Restart_Info.GSset_TT)), |
| 562 |
"ex_get_truth_table"); |
| 563 |
} |
| 564 |
|
| 565 |
/******************* Nodeset Variables **********************/ |
| 566 |
if (ex_get_variable_param(exoid, EX_NODE_SET, &(Restart_Info.NVar_Nset)) < 0) { |
| 567 |
fmt::print(stderr, "{}: Could not get nodeset variable param from file\n", __func__); |
| 568 |
return -1; |
| 569 |
} |
| 570 |
|
| 571 |
/* allocate space for the variable names */ |
| 572 |
if (Restart_Info.NVar_Nset > 0) { |
| 573 |
Restart_Info.NSV_Name = (char **)array_alloc(__FILE__, __LINE__, 2, Restart_Info.NVar_Nset, |
| 574 |
max_name_length + 1, sizeof(char)); |
| 575 |
|
| 576 |
/* get the variable names */ |
| 577 |
if (ex_get_variable_names(exoid, EX_NODE_SET, Restart_Info.NVar_Nset, Restart_Info.NSV_Name) < |
| 578 |
0) { |
| 579 |
fmt::print(stderr, "{}: Could not get nodeset variable names from file\n", __func__); |
| 580 |
return -1; |
| 581 |
} |
| 582 |
|
| 583 |
/* and get the truth table */ |
| 584 |
Restart_Info.GNset_TT.resize(globals.Num_Node_Set * Restart_Info.NVar_Nset); |
| 585 |
|
| 586 |
check_exodus_error(ex_get_truth_table(exoid, EX_NODE_SET, globals.Num_Node_Set, |
| 587 |
Restart_Info.NVar_Nset, Data(Restart_Info.GNset_TT)), |
| 588 |
"ex_get_var_tab"); |
| 589 |
} |
| 590 |
|
| 591 |
#ifdef DEBUG |
| 592 |
if (Debug_Flag >= 2) { |
| 593 |
fmt::print("\n\nRestart Parameters:\n"); |
| 594 |
fmt::print("\tNumber of time indices: {}\n", Restart_Info.Num_Times); |
| 595 |
for (int cnt = 0; cnt < Restart_Info.Num_Times; cnt++) |
| 596 |
fmt::print("\t\tTime index: {}\n", Restart_Info.Time_Idx[cnt]); |
| 597 |
fmt::print("\tNumber of global variables: {}\n", Restart_Info.NVar_Glob); |
| 598 |
for (int cnt = 0; cnt < Restart_Info.NVar_Glob; cnt++) |
| 599 |
fmt::print("\t\tGlobal variable {}: {}\n", (cnt + 1), Restart_Info.GV_Name[cnt]); |
| 600 |
fmt::print("\tNumber of elental variables: {}\n", Restart_Info.NVar_Elem); |
| 601 |
for (int cnt = 0; cnt < Restart_Info.NVar_Elem; cnt++) |
| 602 |
fmt::print("\t\tElemental variable {}: {}\n", (cnt + 1), Restart_Info.EV_Name[cnt]); |
| 603 |
fmt::print("\tNumber of nodal variables: {}\n", Restart_Info.NVar_Node); |
| 604 |
for (int cnt = 0; cnt < Restart_Info.NVar_Node; cnt++) |
| 605 |
fmt::print("\t\tNodal variable {}: {}\n", (cnt + 1), Restart_Info.NV_Name[cnt]); |
| 606 |
} |
| 607 |
#endif |
| 608 |
|
| 609 |
return 0; |
| 610 |
} |
| 611 |
|
| 612 |
template <typename T, typename INT> |
| 613 |
int NemSpread<T, INT>::read_vars(int exoid, int index, INT *eb_ids, INT *eb_cnts, INT ***eb_map_ptr, |
| 614 |
INT **eb_cnts_local, INT *ss_ids, INT *ss_cnts, INT *ns_ids, |
| 615 |
INT *ns_cnts) |
| 616 |
{ |
| 617 |
/* first read the time */ |
| 618 |
if (ex_get_time(exoid, index, &Restart_Info.Time) < 0) { |
| 619 |
fmt::print(stderr, "{}: ERROR, unable to get time for restart index {}!\n", __func__, index); |
| 620 |
return -1; |
| 621 |
} |
| 622 |
|
| 623 |
/***************** Global Variables ********************/ |
| 624 |
/* allocate space for the global variables */ |
| 625 |
if (Restart_Info.NVar_Glob > 0) { |
| 626 |
/* get the global variables */ |
| 627 |
if (ex_get_var(exoid, index, EX_GLOBAL, 1, 1, Restart_Info.NVar_Glob, |
| 628 |
Data(Restart_Info.Glob_Vals)) < 0) { |
| 629 |
fmt::print(stderr, "{}: Could not get global variables from file\n", __func__); |
| 630 |
return -1; |
| 631 |
} |
| 632 |
} |
| 633 |
|
| 634 |
if (Restart_Info.NVar_Elem > 0) { |
| 635 |
fmt::print("Reading {} element variables...\n", Restart_Info.NVar_Elem); |
| 636 |
read_elem_vars(exoid, index, eb_ids, eb_cnts, eb_map_ptr, eb_cnts_local); |
| 637 |
} |
| 638 |
|
| 639 |
if (Restart_Info.NVar_Node > 0) { |
| 640 |
fmt::print("Reading {} nodal variables...\n", Restart_Info.NVar_Node); |
| 641 |
read_nodal_vars(exoid, index); |
| 642 |
} |
| 643 |
|
| 644 |
if (Restart_Info.NVar_Sset > 0) { |
| 645 |
fmt::print("Reading {} sideset variables...\n", Restart_Info.NVar_Sset); |
| 646 |
read_sset_vars(exoid, index, ss_ids, ss_cnts); |
| 647 |
} |
| 648 |
|
| 649 |
if (Restart_Info.NVar_Nset > 0) { |
| 650 |
fmt::print("Reading {} nodeset variables...\n", Restart_Info.NVar_Nset); |
| 651 |
read_nset_vars(exoid, index, ns_ids, ns_cnts); |
| 652 |
} |
| 653 |
|
| 654 |
return 0; |
| 655 |
} |
| 656 |
|
| 657 |
template <typename T, typename INT> |
| 658 |
int NemSpread<T, INT>::read_elem_vars(int exoid, int index, INT *eb_ids, INT *eb_cnts, |
| 659 |
INT ***eb_map_ptr, INT **eb_cnts_local) |
| 660 |
{ |
| 661 |
|
| 662 |
/* to speed up searches, keep track of element blocks offset on each proc */ |
| 663 |
std::vector<INT> local_offset(Proc_Info[2]); |
| 664 |
|
| 665 |
/* loop over the number of element blocks */ |
| 666 |
INT eb_offset = 0; |
| 667 |
for (int iblk = 0; iblk < globals.Num_Elem_Blk; iblk++) { |
| 668 |
read_elem_vars_1(exoid, index, eb_ids, eb_cnts, eb_map_ptr, eb_cnts_local, iblk, eb_offset, |
| 669 |
Data(local_offset)); |
| 670 |
|
| 671 |
/* need to keep track of this for the element number map */ |
| 672 |
eb_offset += eb_cnts[iblk]; |
| 673 |
|
| 674 |
/* need to set up local offsets for next block */ |
| 675 |
for (int iproc = 0; iproc < Proc_Info[2]; iproc++) { |
| 676 |
local_offset[iproc] += eb_cnts_local[iproc][iblk]; |
| 677 |
} |
| 678 |
|
| 679 |
} /* End "for (iblk = 0; iblk < globals.Num_Elem_Blk; iblk++)" */ |
| 680 |
|
| 681 |
return 0; |
| 682 |
} |
| 683 |
|
| 684 |
template <typename T, typename INT> |
| 685 |
int NemSpread<T, INT>::read_elem_vars_1(int exoid, int index, INT *eb_ids, INT *eb_cnts, |
| 686 |
INT ***eb_map_ptr, INT **eb_cnts_local, int iblk, |
| 687 |
int eb_offset, INT *local_offset) |
| 688 |
{ |
| 689 |
/* Allocate memory for temporary storage */ |
| 690 |
std::vector<T> vals(eb_cnts[iblk]); |
| 691 |
|
| 692 |
/* now loop over each variable */ |
| 693 |
for (int ivar = 0; ivar < Restart_Info.NVar_Elem; ivar++) { |
| 694 |
|
| 695 |
/* check if this variable exists for this element block */ |
| 696 |
if (Restart_Info.GElem_TT[iblk * Restart_Info.NVar_Elem + ivar]) { |
| 697 |
|
| 698 |
/* |
| 699 |
* Read in the specified element variable values and their associated |
| 700 |
* global FEM element numbers. |
| 701 |
*/ |
| 702 |
|
| 703 |
check_exodus_error(ex_get_var(exoid, index, EX_ELEM_BLOCK, (ivar + 1), eb_ids[iblk], |
| 704 |
eb_cnts[iblk], Data(vals)), |
| 705 |
"ex_get_var"); |
| 706 |
|
| 707 |
/* |
| 708 |
* Find out which FEM elements belong on this processor and copy |
| 709 |
* them to the restart vector. |
| 710 |
*/ |
| 711 |
for (int iproc = 0; iproc < Proc_Info[2]; iproc++) { |
| 712 |
|
| 713 |
/* check to see if this element block needs this variable */ |
| 714 |
if (Restart_Info.GElem_TT[iblk * Restart_Info.NVar_Elem + ivar]) { |
| 715 |
|
| 716 |
/* calculate the offset for this variable */ |
| 717 |
size_t var_offset = |
| 718 |
ivar * (globals.Num_Internal_Elems[iproc] + globals.Num_Border_Elems[iproc]); |
| 719 |
|
| 720 |
INT *elem_map = eb_map_ptr[iproc][iblk]; |
| 721 |
size_t num_elem = eb_cnts_local[iproc][iblk]; |
| 722 |
|
| 723 |
for (size_t i1 = 0; i1 < num_elem; i1++) { |
| 724 |
size_t elem_loc = var_offset + i1 + local_offset[iproc]; |
| 725 |
|
| 726 |
Restart_Info.Elem_Vals[iproc][elem_loc] = vals[elem_map[i1] - eb_offset]; |
| 727 |
} |
| 728 |
} |
| 729 |
} |
| 730 |
} /* End "if (Restart_Info.GElem_TT[...])" */ |
| 731 |
} |
| 732 |
return 0; |
| 733 |
} |
| 734 |
|
| 735 |
template <typename T, typename INT> |
| 736 |
int NemSpread<T, INT>::read_sset_vars(int exoid, int index, INT *ss_ids, INT *ss_cnts) |
| 737 |
{ |
| 738 |
/* loop over the number of side sets */ |
| 739 |
for (int iset = 0; iset < globals.Num_Side_Set; iset++) { |
| 740 |
read_sset_vars_1(exoid, index, ss_ids, ss_cnts, iset); |
| 741 |
} |
| 742 |
return 0; |
| 743 |
} |
| 744 |
|
| 745 |
template <typename T, typename INT> |
| 746 |
int NemSpread<T, INT>::read_sset_vars_1(int exoid, int index, INT *ss_ids, INT *ss_cnts, int iset) |
| 747 |
{ |
| 748 |
/* Allocate memory for temporary storage */ |
| 749 |
std::vector<T> vals(ss_cnts[iset]); |
| 750 |
|
| 751 |
/* now loop over each variable */ |
| 752 |
for (int ivar = 0; ivar < Restart_Info.NVar_Sset; ivar++) { |
| 753 |
|
| 754 |
/* check if this variable exists for this set */ |
| 755 |
if (Restart_Info.GSset_TT[iset * Restart_Info.NVar_Sset + ivar]) { |
| 756 |
|
| 757 |
/* Read in the specified variable values */ |
| 758 |
check_exodus_error(ex_get_var(exoid, index, EX_SIDE_SET, (ivar + 1), ss_ids[iset], |
| 759 |
ss_cnts[iset], Data(vals)), |
| 760 |
"ex_get_var"); |
| 761 |
|
| 762 |
for (int iproc = 0; iproc < Proc_Info[2]; iproc++) { |
| 763 |
size_t ss_offset = 0; |
| 764 |
size_t var_offset = ivar * globals.Proc_SS_Elem_List_Length[iproc]; |
| 765 |
for (int i = 0; i < globals.Proc_Num_Side_Sets[iproc]; i++) { |
| 766 |
if (globals.Proc_SS_Ids[iproc][i] == ss_ids[iset]) { |
| 767 |
|
| 768 |
size_t num_elem = globals.Proc_SS_Elem_Count[iproc][i]; |
| 769 |
for (size_t i1 = 0; i1 < num_elem; i1++) { |
| 770 |
INT gelem_loc = globals.Proc_SS_GEMap_List[iproc][i1 + ss_offset]; |
| 771 |
assert(gelem_loc < ss_cnts[iset]); |
| 772 |
Restart_Info.Sset_Vals[iproc][i1 + ss_offset + var_offset] = vals[gelem_loc]; |
| 773 |
} |
| 774 |
break; |
| 775 |
} |
| 776 |
ss_offset += globals.Proc_SS_Elem_Count[iproc][i]; |
| 777 |
} |
| 778 |
} |
| 779 |
} |
| 780 |
} |
| 781 |
return 0; |
| 782 |
} |
| 783 |
|
| 784 |
template <typename T, typename INT> |
| 785 |
int NemSpread<T, INT>::read_nset_vars(int exoid, int index, INT *ns_ids, INT *ns_cnts) |
| 786 |
{ |
| 787 |
/* loop over the number of node sets */ |
| 788 |
for (int iset = 0; iset < globals.Num_Node_Set; iset++) { |
| 789 |
read_nset_vars_1(exoid, index, ns_ids, ns_cnts, iset); |
| 790 |
} |
| 791 |
return 0; |
| 792 |
} |
| 793 |
|
| 794 |
template <typename T, typename INT> |
| 795 |
int NemSpread<T, INT>::read_nset_vars_1(int exoid, int index, INT *ns_ids, INT *ns_cnts, int iset) |
| 796 |
{ |
| 797 |
/* Allocate memory for temporary storage */ |
| 798 |
std::vector<T> vals(ns_cnts[iset]); |
| 799 |
|
| 800 |
/* now loop over each variable */ |
| 801 |
for (int ivar = 0; ivar < Restart_Info.NVar_Nset; ivar++) { |
| 802 |
|
| 803 |
/* check if this variable exists for this set */ |
| 804 |
if (Restart_Info.GNset_TT[iset * Restart_Info.NVar_Nset + ivar]) { |
| 805 |
|
| 806 |
/* Read in the specified variable values */ |
| 807 |
check_exodus_error(ex_get_var(exoid, index, EX_NODE_SET, (ivar + 1), ns_ids[iset], |
| 808 |
ns_cnts[iset], Data(vals)), |
| 809 |
"ex_get_nset_var"); |
| 810 |
|
| 811 |
for (int iproc = 0; iproc < Proc_Info[2]; iproc++) { |
| 812 |
size_t ns_offset = 0; |
| 813 |
size_t var_offset = ivar * globals.Proc_NS_List_Length[iproc]; |
| 814 |
for (int i = 0; i < globals.Proc_Num_Node_Sets[iproc]; i++) { |
| 815 |
if (globals.Proc_NS_Ids[iproc][i] == ns_ids[iset]) { |
| 816 |
|
| 817 |
size_t num_elem = globals.Proc_NS_Count[iproc][i]; |
| 818 |
for (size_t i1 = 0; i1 < num_elem; i1++) { |
| 819 |
INT gelem_loc = globals.Proc_NS_GNMap_List[iproc][i1 + ns_offset]; |
| 820 |
assert(gelem_loc < ns_cnts[iset]); |
| 821 |
Restart_Info.Nset_Vals[iproc][i1 + ns_offset + var_offset] = vals[gelem_loc]; |
| 822 |
} |
| 823 |
break; |
| 824 |
} |
| 825 |
ns_offset += globals.Proc_NS_Count[iproc][i]; |
| 826 |
} |
| 827 |
} |
| 828 |
} |
| 829 |
} |
| 830 |
return 0; |
| 831 |
} |
| 832 |
|
| 833 |
template <typename T, typename INT> int NemSpread<T, INT>::read_nodal_vars(int exoid, int index) |
| 834 |
{ |
| 835 |
/* Allocate memory for temporary storage */ |
| 836 |
std::vector<T> vals(globals.Num_Node); |
| 837 |
|
| 838 |
/* Loop over each auxiliary variable */ |
| 839 |
for (int var_num = 0; var_num < Restart_Info.NVar_Node; var_num++) { |
| 840 |
/* |
| 841 |
* Read in the specified nodal variable values and their associated |
| 842 |
* global FEM node numbers. |
| 843 |
*/ |
| 844 |
check_exodus_error( |
| 845 |
ex_get_var(exoid, index, EX_NODAL, (var_num + 1), 1, globals.Num_Node, Data(vals)), |
| 846 |
"ex_get_var"); |
| 847 |
|
| 848 |
/* |
| 849 |
* Find out which FEM nodes belong on this processor and copy |
| 850 |
* them to the restart vector. |
| 851 |
*/ |
| 852 |
for (int iproc = 0; iproc < Proc_Info[2]; iproc++) { |
| 853 |
|
| 854 |
/* calculate the offset for this variable */ |
| 855 |
size_t loc_count = globals.Num_Internal_Nodes[iproc] + globals.Num_Border_Nodes[iproc] + |
| 856 |
globals.Num_External_Nodes[iproc]; |
| 857 |
|
| 858 |
size_t var_offset = var_num * loc_count; |
| 859 |
|
| 860 |
for (size_t i2 = 0; i2 < loc_count; i2++) { |
| 861 |
size_t node_loc = var_offset + i2; |
| 862 |
Restart_Info.Node_Vals[iproc][node_loc] = vals[globals.GNodes[iproc][i2] - 1]; |
| 863 |
} |
| 864 |
} |
| 865 |
|
| 866 |
} /* End "for (var_num = 0; var_num < Restart_Info.NVar_Node; var_num++)" */ |
| 867 |
return 0; |
| 868 |
} |
| 869 |
|
| 870 |
template <typename T, typename INT> int NemSpread<T, INT>::compare_mesh_param(int exoid) |
| 871 |
{ |
| 872 |
int ret = 1; |
| 873 |
|
| 874 |
ex_init_params info{}; |
| 875 |
info.title[0] = '\0'; |
| 876 |
int error = ex_get_init_ext(exoid, &info); |
| 877 |
check_exodus_error(error, "ex_get_init"); |
| 878 |
|
| 879 |
/* now check that the parameters match those retrieved from the mesh file */ |
| 880 |
if (info.num_dim != globals.Num_Dim) { |
| 881 |
ret = 0; |
| 882 |
} |
| 883 |
else if (static_cast<size_t>(info.num_nodes) != globals.Num_Node) { |
| 884 |
ret = 0; |
| 885 |
} |
| 886 |
else if (static_cast<size_t>(info.num_elem) != globals.Num_Elem) { |
| 887 |
ret = 0; |
| 888 |
} |
| 889 |
else if (info.num_elem_blk != globals.Num_Elem_Blk) { |
| 890 |
ret = 0; |
| 891 |
} |
| 892 |
else if (info.num_node_sets != globals.Num_Node_Set) { |
| 893 |
ret = 0; |
| 894 |
} |
| 895 |
else if (info.num_side_sets != globals.Num_Side_Set) { |
| 896 |
ret = 0; |
| 897 |
} |
| 898 |
|
| 899 |
return (ret); |
| 900 |
} |