Size overlap check counter vec to fix plotting with DAGMC geoms.

This commit is contained in:
Patrick Shriwise 2018-10-02 20:10:09 -05:00
parent 3e0a891bb8
commit f0e3461dfd

View file

@ -4,13 +4,15 @@
#include "openmc/dagmc.h"
#include "openmc/error.h"
#include "openmc/string_functions.h"
#include "openmc/settings.h"
#include "openmc/geometry.h"
#include <string>
#include <sstream>
#include <algorithm>
namespace openmc {
moab::DagMC* DAG;
void load_dagmc_geometry()
@ -37,19 +39,23 @@ void load_dagmc_geometry()
// initialize cell objects
n_cells = DAG->num_entities(3);
// Allocate the cell overlap count if necessary.
if (settings::check_overlaps) overlap_check_count.resize(n_cells, 0);
for (int i = 0; i < n_cells; i++) {
moab::EntityHandle vol_handle = DAG->entity_by_index(3, i+1);
// set cell ids using global IDs
DAGCell* c = new DAGCell();
c->id_ = DAG->id_by_index(3, i+1);
c->dagmc_ptr_ = DAG;
c->universe_ = dagmc_univ_id; // set to zero for now
c->fill_ = C_NONE; // no fill, single universe
cells.push_back(c);
cell_map[c->id_] = c->id_;
// Populate the Universe vector and dict
auto it = universe_map.find(dagmc_univ_id);
if (it == universe_map.end()) {
@ -60,19 +66,19 @@ void load_dagmc_geometry()
} else {
universes[it->second]->cells_.push_back(i);
}
if (DAG->is_implicit_complement(vol_handle)) {
// assuming implicit complement is void for now
c->material_.push_back(MATERIAL_VOID);
continue;
}
if (DAG->has_prop(vol_handle, "mat")){
std::string mat_value;
rval = DAG->prop_value(vol_handle, "mat", mat_value);
MB_CHK_ERR_CONT(rval);
to_lower(mat_value);
if (mat_value == "void" || mat_value == "vacuum") {
c->material_.push_back(MATERIAL_VOID);
} else {
@ -84,25 +90,25 @@ void load_dagmc_geometry()
fatal_error(err_msg.str());
}
}
// initialize surface objects
n_surfaces = DAG->num_entities(2);
surfaces.resize(n_surfaces);
for (int i = 0; i < n_surfaces; i++) {
moab::EntityHandle surf_handle = DAG->entity_by_index(2, i+1);
// set cell ids using global IDs
DAGSurface* s = new DAGSurface();
s->id_ = DAG->id_by_index(2, i+1);
s->dagmc_ptr_ = DAG;
if (DAG->has_prop(surf_handle, "boundary")) {
std::string bc_value;
rval = DAG->prop_value(surf_handle, "boundary", bc_value);
MB_CHK_ERR_CONT(rval);
to_lower(bc_value);
if (bc_value == "transmit" || bc_value == "transmission") {
s->bc_ = BC_TRANSMIT;
} else if (bc_value == "vacuum") {
@ -120,12 +126,12 @@ void load_dagmc_geometry()
} else { // if no BC property is found, set to transmit
s->bc_ = BC_TRANSMIT;
}
// add to global array and map
surfaces[i] = s;
surface_map[s->id_] = s->id_;
}
return;
}