diff --git a/packages/seacas/libraries/ioss/src/exodus/Ioex_BaseDatabaseIO.C b/packages/seacas/libraries/ioss/src/exodus/Ioex_BaseDatabaseIO.C index 90dba8e278..f50d9c5011 100644 --- a/packages/seacas/libraries/ioss/src/exodus/Ioex_BaseDatabaseIO.C +++ b/packages/seacas/libraries/ioss/src/exodus/Ioex_BaseDatabaseIO.C @@ -1586,9 +1586,7 @@ namespace Ioex { // common int64_t BaseDatabaseIO::add_results_fields(Ioss::GroupingEntity *entity, int64_t position) { - auto timestep_count = get_region()->get_optional_property("state_count", 0); - if (timestep_count == 0) return 0; - + if (m_timestepCount == 0) return 0; ex_entity_type type = Ioex::map_exodus_type(entity->type()); return internal_add_results_fields(type, entity, position, m_groupCount[type], m_truthTable[type], m_variables[type]); diff --git a/packages/seacas/libraries/ioss/src/exodus/Ioex_BaseDatabaseIO.h b/packages/seacas/libraries/ioss/src/exodus/Ioex_BaseDatabaseIO.h index 1d05234f8a..9521e11cd6 100644 --- a/packages/seacas/libraries/ioss/src/exodus/Ioex_BaseDatabaseIO.h +++ b/packages/seacas/libraries/ioss/src/exodus/Ioex_BaseDatabaseIO.h @@ -320,6 +320,7 @@ namespace Ioex { time_t timeLastFlush{0}; int flushInterval{-1}; + int m_timestepCount{0}; mutable bool fileExists{false}; // False if file has never been opened/created mutable bool minimizeOpenFiles{false}; diff --git a/packages/seacas/libraries/ioss/src/exodus/Ioex_DatabaseIO.C b/packages/seacas/libraries/ioss/src/exodus/Ioex_DatabaseIO.C index 83ac5b8419..fb3f0ac6c0 100644 --- a/packages/seacas/libraries/ioss/src/exodus/Ioex_DatabaseIO.C +++ b/packages/seacas/libraries/ioss/src/exodus/Ioex_DatabaseIO.C @@ -642,13 +642,12 @@ namespace Ioex { { bool exists = false; double last_time = DBL_MAX; - int timestep_count = 0; std::vector tsteps(0); if (dbUsage == Ioss::WRITE_HISTORY) { if (myProcessor == 0) { - timestep_count = ex_inquire_int(get_file_pointer(), EX_INQ_TIME); - if (timestep_count <= 0) { + m_timestepCount = ex_inquire_int(get_file_pointer(), EX_INQ_TIME); + if (m_timestepCount <= 0) { return; } @@ -657,15 +656,15 @@ namespace Ioex { // Read the timesteps and add them to the region. // Since we can't access the Region's stateCount directly, we just add // all of the steps and assume the Region is dealing with them directly... - tsteps.resize(timestep_count); + tsteps.resize(m_timestepCount); int error = ex_get_all_times(get_file_pointer(), Data(tsteps)); if (error < 0) { Ioex::exodus_error(get_file_pointer(), __LINE__, __func__, __FILE__); } - int max_step = properties.get_optional("APPEND_OUTPUT_AFTER_STEP", timestep_count); - max_step = std::min(max_step, timestep_count); + int max_step = properties.get_optional("APPEND_OUTPUT_AFTER_STEP", m_timestepCount); + max_step = std::min(max_step, m_timestepCount); double max_time = properties.get_optional("APPEND_OUTPUT_AFTER_TIME", std::numeric_limits::max()); @@ -681,12 +680,12 @@ namespace Ioex { else { { Ioss::SerializeIO serializeIO_(this); - timestep_count = ex_inquire_int(get_file_pointer(), EX_INQ_TIME); + m_timestepCount = ex_inquire_int(get_file_pointer(), EX_INQ_TIME); // Need to sync timestep count across ranks if parallel... if (isParallel) { - auto min_timestep_count = util().global_minmax(timestep_count, Ioss::ParallelUtils::DO_MIN); + auto min_timestep_count = util().global_minmax(m_timestepCount, Ioss::ParallelUtils::DO_MIN); if (min_timestep_count == 0) { - auto max_timestep_count = util().global_minmax(timestep_count, Ioss::ParallelUtils::DO_MAX); + auto max_timestep_count = util().global_minmax(m_timestepCount, Ioss::ParallelUtils::DO_MAX); if (max_timestep_count != 0) { if (myProcessor == 0) { // NOTE: Don't want to warn on all processors if the @@ -697,16 +696,16 @@ namespace Ioex { } } } - timestep_count = min_timestep_count; + m_timestepCount = min_timestep_count; } - if (timestep_count <= 0) { + if (m_timestepCount <= 0) { return; } // For an exodus file, timesteps are global and are stored in the region. // Read the timesteps and add to the region - tsteps.resize(timestep_count, -std::numeric_limits::max()); + tsteps.resize(m_timestepCount, -std::numeric_limits::max()); // The `EXODUS_CALL_GET_ALL_TIMES=NO` is typically only used in // isSerialParallel mode and the client is responsible for @@ -752,8 +751,8 @@ namespace Ioex { // One use case is that job is restarting at a time prior to what has been // written to the results file, so want to start appending after // restart time instead of at end time on database. - int max_step = properties.get_optional("APPEND_OUTPUT_AFTER_STEP", timestep_count); - max_step = std::min(max_step, timestep_count); + int max_step = properties.get_optional("APPEND_OUTPUT_AFTER_STEP", m_timestepCount); + max_step = std::min(max_step, m_timestepCount); double max_time = properties.get_optional("APPEND_OUTPUT_AFTER_TIME", std::numeric_limits::max()); diff --git a/packages/seacas/libraries/ioss/src/exodus/Ioex_ParallelDatabaseIO.C b/packages/seacas/libraries/ioss/src/exodus/Ioex_ParallelDatabaseIO.C index b0d9f4304d..8ce9dd59b7 100644 --- a/packages/seacas/libraries/ioss/src/exodus/Ioex_ParallelDatabaseIO.C +++ b/packages/seacas/libraries/ioss/src/exodus/Ioex_ParallelDatabaseIO.C @@ -793,10 +793,9 @@ namespace Ioex { Ioex::read_exodus_basis(exoid); Ioex::read_exodus_quadrature(exoid); - get_elemblocks(); - get_step_times_nl(); + get_elemblocks(); get_nodeblocks(); get_edgeblocks(); get_faceblocks(); @@ -922,6 +921,7 @@ namespace Ioex { { timestep_count = ex_inquire_int(get_file_pointer(), EX_INQ_TIME); + m_timestepCount = timestep_count; if (timestep_count <= 0) { return; }