diff --git a/packages/seacas/libraries/ioss/src/Ioss_DynamicTopologyObserver.C b/packages/seacas/libraries/ioss/src/Ioss_DynamicTopologyObserver.C index abd55e68a4..9e3bf53936 100644 --- a/packages/seacas/libraries/ioss/src/Ioss_DynamicTopologyObserver.C +++ b/packages/seacas/libraries/ioss/src/Ioss_DynamicTopologyObserver.C @@ -212,4 +212,11 @@ namespace Ioss { void DynamicTopologyObserver::define_transient() {} + void DynamicTopologyObserver::initialize_region() + { + if (nullptr != m_region) { + m_region->reset_region(); + } + } + } // namespace Ioss diff --git a/packages/seacas/libraries/ioss/src/Ioss_DynamicTopologyObserver.h b/packages/seacas/libraries/ioss/src/Ioss_DynamicTopologyObserver.h index 65530994bc..90e4f12d93 100644 --- a/packages/seacas/libraries/ioss/src/Ioss_DynamicTopologyObserver.h +++ b/packages/seacas/libraries/ioss/src/Ioss_DynamicTopologyObserver.h @@ -70,6 +70,8 @@ namespace Ioss { virtual bool needs_new_output_file() const; + virtual void initialize_region(); + protected: Region *m_region{nullptr}; unsigned int m_topologyModification{TOPOLOGY_SAME}; diff --git a/packages/seacas/libraries/ioss/src/Ioss_Region.C b/packages/seacas/libraries/ioss/src/Ioss_Region.C index 536608ee66..c6327ecf98 100644 --- a/packages/seacas/libraries/ioss/src/Ioss_Region.C +++ b/packages/seacas/libraries/ioss/src/Ioss_Region.C @@ -2897,7 +2897,8 @@ namespace Ioss { state++; // For the state we are going to write. - reset_region(); + topologyObserver->initialize_region(); + DynamicTopologyFileControl fileControl(this); fileControl.add_output_database_change_set(state); @@ -2939,7 +2940,8 @@ namespace Ioss { state++; // For the state we are going to write. - reset_region(); + topologyObserver->initialize_region(); + DynamicTopologyFileControl fileControl(this); fileControl.clone_and_replace_output_database(state); @@ -2982,7 +2984,13 @@ namespace Ioss { if (!iodatabase->open_internal_change_set(set_name)) return false; - reset_region(); + if (topologyObserver) { + topologyObserver->initialize_region(); + } + else { + reset_region(); + } + iodatabase->release_memory(); Region::set_state(STATE_CLOSED); @@ -3012,7 +3020,13 @@ namespace Ioss { if (!iodatabase->open_internal_change_set(child_group_index)) return false; - reset_region(); + if (topologyObserver) { + topologyObserver->initialize_region(); + } + else { + reset_region(); + } + iodatabase->release_memory(); Region::set_state(STATE_CLOSED); diff --git a/packages/seacas/libraries/ioss/src/Ioss_Region.h b/packages/seacas/libraries/ioss/src/Ioss_Region.h index a17b12ae47..c924ec1f93 100644 --- a/packages/seacas/libraries/ioss/src/Ioss_Region.h +++ b/packages/seacas/libraries/ioss/src/Ioss_Region.h @@ -328,6 +328,7 @@ namespace Ioss { IOSS_NODISCARD std::tuple locate_db_state(double targetTime) const; + // Reinitialize region data structures void reset_region(); protected: