Skip to content

Commit

Permalink
Committing clang-format changes
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Oct 16, 2024
1 parent 4626efd commit a37070b
Show file tree
Hide file tree
Showing 10 changed files with 680 additions and 683 deletions.
144 changes: 72 additions & 72 deletions packages/seacas/libraries/ioss/src/Ioss_DynamicTopologyBroker.C
Original file line number Diff line number Diff line change
Expand Up @@ -7,105 +7,105 @@
#include "Ioss_DynamicTopologyBroker.h"
#include "Ioss_Region.h"

#include <assert.h>
#include <algorithm>
#include <assert.h>
#include <climits>
#include <cstddef>
#include <functional>

namespace Ioss {

DynamicTopologyBroker* DynamicTopologyBroker::broker()
{
static DynamicTopologyBroker broker_;
return &broker_;
}

void DynamicTopologyBroker::register_model(const std::string& model_name)
{
auto iter = m_notifiers.find(model_name);
if(iter != m_notifiers.end()) {
return;
DynamicTopologyBroker *DynamicTopologyBroker::broker()
{
static DynamicTopologyBroker broker_;
return &broker_;
}

m_notifiers[model_name] = std::make_shared<DynamicTopologyNotifier>(model_name);
}
void DynamicTopologyBroker::register_model(const std::string &model_name)
{
auto iter = m_notifiers.find(model_name);
if (iter != m_notifiers.end()) {
return;
}

std::shared_ptr<DynamicTopologyNotifier>
DynamicTopologyBroker::get_notifier(const std::string& model_name) const
{
auto iter = m_notifiers.find(model_name);
if(iter != m_notifiers.end()) {
return iter->second;
m_notifiers[model_name] = std::make_shared<DynamicTopologyNotifier>(model_name);
}

return {};
}
std::shared_ptr<DynamicTopologyNotifier>
DynamicTopologyBroker::get_notifier(const std::string &model_name) const
{
auto iter = m_notifiers.find(model_name);
if (iter != m_notifiers.end()) {
return iter->second;
}

std::vector<std::shared_ptr<DynamicTopologyObserver>>
DynamicTopologyBroker::get_observers(const std::string& model_name) const
{
std::vector<std::shared_ptr<DynamicTopologyObserver>> observers;
return {};
}

auto notifier = get_notifier(model_name);
std::vector<std::shared_ptr<DynamicTopologyObserver>>
DynamicTopologyBroker::get_observers(const std::string &model_name) const
{
std::vector<std::shared_ptr<DynamicTopologyObserver>> observers;

if(notifier) {
return notifier->get_observers();
}
auto notifier = get_notifier(model_name);

return observers;
}
if (notifier) {
return notifier->get_observers();
}

void DynamicTopologyBroker::remove_model(const std::string& model_name)
{
auto iter = m_notifiers.find(model_name);
if(iter != m_notifiers.end()) {
m_notifiers.erase(iter);
return observers;
}
}

void DynamicTopologyBroker::clear_models()
{
m_notifiers.clear();
}
void DynamicTopologyBroker::remove_model(const std::string &model_name)
{
auto iter = m_notifiers.find(model_name);
if (iter != m_notifiers.end()) {
m_notifiers.erase(iter);
}
}

void DynamicTopologyBroker::register_observer(const std::string& model_name,
std::shared_ptr<DynamicTopologyObserver> observer)
{
auto notifier = get_notifier(model_name);
void DynamicTopologyBroker::clear_models() { m_notifiers.clear(); }

if(!notifier) {
register_model(model_name);
notifier = get_notifier(model_name);
}
void DynamicTopologyBroker::register_observer(const std::string &model_name,
std::shared_ptr<DynamicTopologyObserver> observer)
{
auto notifier = get_notifier(model_name);

notifier->register_observer(observer);
}
if (!notifier) {
register_model(model_name);
notifier = get_notifier(model_name);
}

void DynamicTopologyBroker::register_observer(const std::string& model_name,
std::shared_ptr<DynamicTopologyObserver> observer,
Region& region)
{
region.register_mesh_modification_observer(observer);
register_observer(model_name, observer);
}
notifier->register_observer(observer);
}

void DynamicTopologyBroker::reset_topology_modification(const std::string& model_name)
{
auto notifier = get_notifier(model_name);
void DynamicTopologyBroker::register_observer(const std::string &model_name,
std::shared_ptr<DynamicTopologyObserver> observer,
Region &region)
{
region.register_mesh_modification_observer(observer);
register_observer(model_name, observer);
}

if(!notifier) return;
void DynamicTopologyBroker::reset_topology_modification(const std::string &model_name)
{
auto notifier = get_notifier(model_name);

notifier->reset_topology_modification();
}
if (!notifier)
return;

void DynamicTopologyBroker::set_topology_modification(const std::string& model_name, unsigned int type)
{
auto notifier = get_notifier(model_name);
notifier->reset_topology_modification();
}

if(!notifier) return;
void DynamicTopologyBroker::set_topology_modification(const std::string &model_name,
unsigned int type)
{
auto notifier = get_notifier(model_name);

notifier->set_topology_modification(type);
}
if (!notifier)
return;

notifier->set_topology_modification(type);
}

}
} // namespace Ioss
46 changes: 23 additions & 23 deletions packages/seacas/libraries/ioss/src/Ioss_DynamicTopologyBroker.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,34 +25,34 @@
#include <string> // for string, operator<

namespace Ioss {
class Region;
class Region;

class IOSS_EXPORT DynamicTopologyBroker
{
public:
static DynamicTopologyBroker *broker();
class IOSS_EXPORT DynamicTopologyBroker
{
public:
static DynamicTopologyBroker *broker();

void register_model(const std::string &model_name);
void remove_model(const std::string &model_name);
void clear_models();
void register_model(const std::string &model_name);
void remove_model(const std::string &model_name);
void clear_models();

std::shared_ptr<DynamicTopologyNotifier> get_notifier(const std::string &model_name) const;
std::vector<std::shared_ptr<DynamicTopologyObserver>>
get_observers(const std::string &model_name) const;
std::shared_ptr<DynamicTopologyNotifier> get_notifier(const std::string &model_name) const;
std::vector<std::shared_ptr<DynamicTopologyObserver>>
get_observers(const std::string &model_name) const;

void register_observer(const std::string &model_name,
std::shared_ptr<DynamicTopologyObserver> observer);
void register_observer(const std::string &model_name,
std::shared_ptr<DynamicTopologyObserver> observer, Region &region);
void register_observer(const std::string &model_name,
std::shared_ptr<DynamicTopologyObserver> observer);
void register_observer(const std::string &model_name,
std::shared_ptr<DynamicTopologyObserver> observer, Region &region);

void reset_topology_modification(const std::string &model_name);
void set_topology_modification(const std::string &model_name, unsigned int type);
void reset_topology_modification(const std::string &model_name);
void set_topology_modification(const std::string &model_name, unsigned int type);

private:
DynamicTopologyBroker() {};
DynamicTopologyBroker(DynamicTopologyBroker &);
private:
DynamicTopologyBroker() {};
DynamicTopologyBroker(DynamicTopologyBroker &);

std::map<std::string, std::shared_ptr<DynamicTopologyNotifier>> m_notifiers;
};
std::map<std::string, std::shared_ptr<DynamicTopologyNotifier>> m_notifiers;
};

}
} // namespace Ioss
146 changes: 73 additions & 73 deletions packages/seacas/libraries/ioss/src/Ioss_DynamicTopologyFileControl.C
Original file line number Diff line number Diff line change
Expand Up @@ -91,81 +91,81 @@ namespace {

namespace Ioss {

DynamicTopologyFileControl::DynamicTopologyFileControl(Region *region)
: m_region(region)
, m_fileCyclicCount(region->get_file_cyclic_count())
, m_ifDatabaseExists(region->get_if_database_exists_behavior())
, m_dbChangeCount(region->get_topology_change_count())
{
if(nullptr == region) {
std::ostringstream errmsg;
fmt::print(errmsg, "ERROR: null region passed in as argument to DynamicTopologyFileControl");
IOSS_ERROR(errmsg);
DynamicTopologyFileControl::DynamicTopologyFileControl(Region *region)
: m_region(region), m_fileCyclicCount(region->get_file_cyclic_count()),
m_ifDatabaseExists(region->get_if_database_exists_behavior()),
m_dbChangeCount(region->get_topology_change_count())
{
if (nullptr == region) {
std::ostringstream errmsg;
fmt::print(errmsg, "ERROR: null region passed in as argument to DynamicTopologyFileControl");
IOSS_ERROR(errmsg);
}

m_ioDB = region->get_property("base_filename").get_string();
m_dbType = region->get_property("database_type").get_string();
}

m_ioDB = region->get_property("base_filename").get_string();
m_dbType = region->get_property("database_type").get_string();
}

const ParallelUtils &DynamicTopologyFileControl::util() const
{
return m_region->get_database()->util();
}

bool DynamicTopologyFileControl::file_exists(const std::string &filename,
const std::string &db_type,
Ioss::DatabaseUsage db_usage)
{
return ::file_exists(util(), filename, db_type, db_usage);
}

std::string DynamicTopologyFileControl::get_unique_linear_filename(Ioss::DatabaseUsage db_usage)
{
std::string filename = m_ioDB;

do {
// Run this loop at least once for all files. If this is an automatic
// restart, then make sure that the generated file does not already exist,
// so keep running the loop until we generate a filename that doesn't exist...
std::ostringstream tmp_filename;
tmp_filename << m_ioDB;

// Don't append the "-s000X" the first time in case the base filename doesn't
// exist -- we want write to the name specified by the user if at all possible and
// once that exists, then start adding on the suffix...
if (m_dbChangeCount > 1) {
tmp_filename << "-s" << std::setw(4) << std::setfill('0') << m_dbChangeCount;
}
filename = tmp_filename.str();
++m_dbChangeCount;
} while(file_exists(filename, m_dbType, db_usage));
--m_dbChangeCount;
return filename;
}

std::string DynamicTopologyFileControl::get_internal_file_change_set_name(unsigned int step)
{
std::ostringstream change_setname;
change_setname << change_set_prefix();
change_setname << step;
return change_setname.str();
}

std::string DynamicTopologyFileControl::get_cyclic_database_filename(const std::string& baseFileName,
unsigned int fileCyclicCount,
unsigned int step)
{
return ChangeSet::get_cyclic_database_filename(baseFileName, fileCyclicCount, step);
}

std::string DynamicTopologyFileControl::get_linear_database_filename(const std::string& baseFileName,
unsigned int step)
{
return ChangeSet::get_linear_database_filename(baseFileName, step);
}

std::string DynamicTopologyFileControl::construct_database_filename(int& step, Ioss::DatabaseUsage db_usage)
{
const ParallelUtils &DynamicTopologyFileControl::util() const
{
return m_region->get_database()->util();
}

bool DynamicTopologyFileControl::file_exists(const std::string &filename,
const std::string &db_type,
Ioss::DatabaseUsage db_usage)
{
return ::file_exists(util(), filename, db_type, db_usage);
}

std::string DynamicTopologyFileControl::get_unique_linear_filename(Ioss::DatabaseUsage db_usage)
{
std::string filename = m_ioDB;

do {
// Run this loop at least once for all files. If this is an automatic
// restart, then make sure that the generated file does not already exist,
// so keep running the loop until we generate a filename that doesn't exist...
std::ostringstream tmp_filename;
tmp_filename << m_ioDB;

// Don't append the "-s000X" the first time in case the base filename doesn't
// exist -- we want write to the name specified by the user if at all possible and
// once that exists, then start adding on the suffix...
if (m_dbChangeCount > 1) {
tmp_filename << "-s" << std::setw(4) << std::setfill('0') << m_dbChangeCount;
}
filename = tmp_filename.str();
++m_dbChangeCount;
} while (file_exists(filename, m_dbType, db_usage));
--m_dbChangeCount;
return filename;
}

std::string DynamicTopologyFileControl::get_internal_file_change_set_name(unsigned int step)
{
std::ostringstream change_setname;
change_setname << change_set_prefix();
change_setname << step;
return change_setname.str();
}

std::string DynamicTopologyFileControl::get_cyclic_database_filename(
const std::string &baseFileName, unsigned int fileCyclicCount, unsigned int step)
{
return ChangeSet::get_cyclic_database_filename(baseFileName, fileCyclicCount, step);
}

std::string
DynamicTopologyFileControl::get_linear_database_filename(const std::string &baseFileName,
unsigned int step)
{
return ChangeSet::get_linear_database_filename(baseFileName, step);
}

std::string DynamicTopologyFileControl::construct_database_filename(int &step,
Ioss::DatabaseUsage db_usage)
{
// Filename will be of the form -- ioDB-sxxxx where xxxx is step
// number. Assume maximum of 9999 steps (will do more, but won't have
// good lineup of step numbers.
Expand Down
Loading

0 comments on commit a37070b

Please sign in to comment.