Creating a new data member for auto-assigning material IDs.

This commit is contained in:
Patrick Shriwise 2021-03-13 00:05:41 -06:00
parent 9fca1f690d
commit fdcc1ddb7b
2 changed files with 9 additions and 9 deletions

View file

@ -24,7 +24,7 @@ class DAGUniverse : public Universe {
public:
explicit DAGUniverse(pugi::xml_node node);
explicit DAGUniverse(const std::string& filename, bool auto_ids = false);
explicit DAGUniverse(const std::string& filename, bool auto_geom_ids = false);
void initialize(); //!< Sets up the DAGMC instance and OpenMC internals
@ -35,8 +35,8 @@ public:
std::shared_ptr<moab::DagMC> dagmc_instance_; //! DAGMC Instance for this universe
int32_t cell_idx_offset_;
int32_t surf_idx_offset_;
bool adjust_ids_;
bool adjust_geometry_ids_;
bool adjust_material_ids_;
};
void load_dagmc_geometry();

View file

@ -222,15 +222,15 @@ DAGUniverse::DAGUniverse(pugi::xml_node node) {
fatal_error("Must specify a file for the DAGMC universe");
}
adjust_ids_ = false;
adjust_geometry_ids_ = false;
if (check_for_node(node, "auto_ids")) {
adjust_ids_ = get_node_value_bool(node, "auto_ids");
adjust_geometry_ids_ = get_node_value_bool(node, "auto_ids");
}
initialize();
}
DAGUniverse::DAGUniverse(const std::string& filename, bool auto_ids)
: filename_(filename), adjust_ids_(auto_ids) {
DAGUniverse::DAGUniverse(const std::string& filename, bool auto_geom_ids)
: filename_(filename), adjust_geometry_ids_(auto_geom_ids) {
// determine the next universe id
int32_t next_univ_id = 0;
for (const auto& u : model::universes) {
@ -313,7 +313,7 @@ void DAGUniverse::initialize() {
// set cell ids using global IDs
DAGCell* c = new DAGCell();
c->dag_index_ = i + 1;
c->id_ = adjust_ids_ ? next_cell_id++ : dagmc_instance_->id_by_index(3, c->dag_index_);
c->id_ = adjust_geometry_ids_ ? next_cell_id++ : dagmc_instance_->id_by_index(3, c->dag_index_);
c->dagmc_ptr_ = dagmc_instance_;
c->universe_ = id_; // set to zero for now
c->fill_ = C_NONE; // no fill, single universe
@ -404,7 +404,7 @@ void DAGUniverse::initialize() {
// set cell ids using global IDs
DAGSurface* s = new DAGSurface();
s->dag_index_ = i+1;
s->id_ = adjust_ids_ ? next_surf_id++ : dagmc_instance_->id_by_index(2, i+1);
s->id_ = adjust_geometry_ids_ ? next_surf_id++ : dagmc_instance_->id_by_index(2, i+1);
s->dagmc_ptr_ = dagmc_instance_;
// set BCs