Skip to content

Commit

Permalink
Dtio update (#539)
Browse files Browse the repository at this point in the history
* DTIO: minor updates based on code review

* Committing clang-format changes

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
tokusanya and github-actions[bot] authored Nov 4, 2024
1 parent 41e98f8 commit 47620c1
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,13 @@ namespace Ioss {

std::string name() const { return m_modelName; }

std::vector<std::shared_ptr<DynamicTopologyObserver>> get_observers() const
const std::vector<std::shared_ptr<DynamicTopologyObserver>> &get_observers() const
{
return m_observers;
}

std::vector<std::shared_ptr<DynamicTopologyObserver>> &get_observers() { return m_observers; }

void register_observer(std::shared_ptr<DynamicTopologyObserver> observer);

void unregister_observer(std::shared_ptr<DynamicTopologyObserver> observer);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ namespace Ioss {
set_topology_modification_nl(type);

if (nullptr != m_notifier) {
for (auto observer : m_notifier->get_observers()) {
for (auto &observer : m_notifier->get_observers()) {
observer->set_topology_modification_nl(type);
}
}
Expand All @@ -134,7 +134,7 @@ namespace Ioss {
reset_topology_modification();

if (nullptr != m_notifier) {
for (auto observer : m_notifier->get_observers()) {
for (auto &observer : m_notifier->get_observers()) {
observer->reset_topology_modification();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,18 +98,18 @@ namespace Ioss {
DatabaseState &loc) const
{
std::vector<double> timesteps = db->get_db_step_times();
int stepCount = timesteps.size();
size_t stepCount = timesteps.size();

double minTimeDiff =
loc.state < 0 ? std::numeric_limits<double>::max() : std::fabs(loc.time - targetTime);

for (int istep = 1; istep <= stepCount; istep++) {
for (size_t istep = 1; istep <= stepCount; istep++) {
double stateTime = timesteps[istep - 1];
double stepTimeDiff = std::fabs(stateTime - targetTime);
if (comparator(stepTimeDiff, minTimeDiff)) {
minTimeDiff = stepTimeDiff;
loc.time = stateTime;
loc.state = istep;
loc.state = static_cast<int>(istep);
loc.changeSet = db->supports_internal_change_set() ? db->get_internal_change_set_name()
: db->get_filename();
}
Expand Down
29 changes: 16 additions & 13 deletions packages/seacas/libraries/ioss/src/Ioss_Region.h
Original file line number Diff line number Diff line change
Expand Up @@ -294,34 +294,37 @@ namespace Ioss {
std::vector<U> &field_data) const;

void register_mesh_modification_observer(std::shared_ptr<DynamicTopologyObserver> observer);
std::shared_ptr<DynamicTopologyObserver> get_mesh_modification_observer() const
IOSS_NODISCARD std::shared_ptr<DynamicTopologyObserver> get_mesh_modification_observer() const
{
return topologyObserver;
}

void reset_topology_modification();
void set_topology_modification(unsigned int type);
unsigned int get_topology_modification() const;
void reset_topology_modification();
void set_topology_modification(unsigned int type);
IOSS_NODISCARD unsigned int get_topology_modification() const;

void start_new_output_database_entry(int steps = 0);

void set_topology_change_count(unsigned int new_count) { dbChangeCount = new_count; }
unsigned int get_topology_change_count() const { return dbChangeCount; }
void set_topology_change_count(unsigned int new_count) { dbChangeCount = new_count; }
IOSS_NODISCARD unsigned int get_topology_change_count() const { return dbChangeCount; }

void set_file_cyclic_count(unsigned int new_count) { fileCyclicCount = new_count; }
unsigned int get_file_cyclic_count() const { return fileCyclicCount; }
void set_file_cyclic_count(unsigned int new_count) { fileCyclicCount = new_count; }
IOSS_NODISCARD unsigned int get_file_cyclic_count() const { return fileCyclicCount; }

void set_if_database_exists_behavior(IfDatabaseExistsBehavior if_exists)
{
ifDatabaseExists = if_exists;
}
IfDatabaseExistsBehavior get_if_database_exists_behavior() const { return ifDatabaseExists; }
IOSS_NODISCARD IfDatabaseExistsBehavior get_if_database_exists_behavior() const
{
return ifDatabaseExists;
}

bool model_is_written() const { return modelWritten; }
bool transient_is_written() const { return transientWritten; }
IOSS_NODISCARD bool model_is_written() const { return modelWritten; }
IOSS_NODISCARD bool transient_is_written() const { return transientWritten; }

bool load_internal_change_set_mesh(const std::string &set_name);
bool load_internal_change_set_mesh(const int set_index);
IOSS_NODISCARD bool load_internal_change_set_mesh(const std::string &set_name);
IOSS_NODISCARD bool load_internal_change_set_mesh(const int set_index);

IOSS_NODISCARD std::tuple<std::string, int, double> locate_db_state(double targetTime) const;

Expand Down

0 comments on commit 47620c1

Please sign in to comment.