mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-29 06:35:48 -04:00
Addressing comments from @makeclean.
This commit is contained in:
parent
d1a24339da
commit
9ffbf02f40
5 changed files with 20 additions and 12 deletions
|
|
@ -91,7 +91,9 @@ public:
|
|||
void legacy_assign_material(std::string mat_string,
|
||||
std::unique_ptr<DAGCell>& c) const;
|
||||
|
||||
//! Generate a string representing the ranges of IDs present in the DAGMC model
|
||||
//! Generate a string representing the ranges of IDs present in the DAGMC model.
|
||||
//! Contiguous chunks of IDs are represented as a range (i.e. 1-10). If there is
|
||||
//! a single ID a chunk, it will be represented as a single number (i.e. 2, 4, 6, 8).
|
||||
//! \param[in] dim Dimension of the entities
|
||||
//! \return A string of the ID ranges for entities of dimension \p dim
|
||||
std::string dagmc_ids_for_dim(int dim) const;
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ namespace model {
|
|||
} // namespace model
|
||||
|
||||
//==============================================================================
|
||||
//! Coordinates for an axis-aligned cube that bounds a geometric object.
|
||||
//! Coordinates for an axis-aligned cuboid that bounds a geometric object.
|
||||
//==============================================================================
|
||||
|
||||
struct BoundingBox
|
||||
|
|
|
|||
|
|
@ -720,7 +720,6 @@ class DAGMCUniverse(UniverseBase):
|
|||
return OrderedDict()
|
||||
|
||||
def create_xml_subelement(self, xml_element, memo=None):
|
||||
|
||||
if memo and self in memo:
|
||||
return
|
||||
|
||||
|
|
|
|||
|
|
@ -328,7 +328,6 @@ Cell::to_hdf5(hid_t cell_group) const {
|
|||
|
||||
write_dataset(group, "universe", model::universes[universe_]->id_);
|
||||
|
||||
|
||||
to_hdf5_inner(group);
|
||||
|
||||
// Write fill information.
|
||||
|
|
|
|||
|
|
@ -296,8 +296,8 @@ DAGUniverse::dagmc_ids_for_dim(int dim) const
|
|||
{
|
||||
// generate a vector of ids
|
||||
std::vector<int> id_vec;
|
||||
int n_cells = dagmc_instance_->num_entities(dim);
|
||||
for (int i = 1; i <= n_cells; i++) {
|
||||
int n_ents = dagmc_instance_->num_entities(dim);
|
||||
for (int i = 1; i <= n_ents; i++) {
|
||||
id_vec.push_back(dagmc_instance_->id_by_index(dim, i));
|
||||
}
|
||||
|
||||
|
|
@ -308,22 +308,30 @@ DAGUniverse::dagmc_ids_for_dim(int dim) const
|
|||
std::stringstream out;
|
||||
|
||||
int i = 0;
|
||||
int start_id = id_vec[0];
|
||||
int start_id = id_vec[0]; // initialize with first ID
|
||||
int stop_id;
|
||||
while (i < n_cells) {
|
||||
// loop over all cells in the universe
|
||||
while (i < n_ents) {
|
||||
|
||||
stop_id = id_vec[i];
|
||||
|
||||
// if the next ID is not in this contiguous set of IDS,
|
||||
// figure out how to write the string representing this set
|
||||
if (id_vec[i + 1] > stop_id + 1) {
|
||||
|
||||
if (start_id != stop_id) {
|
||||
// there are several IDs in a row, print condensed version
|
||||
// there are several IDs in a row, print condensed version (i.e. 1-10, 12-20)
|
||||
out << start_id << "-" << stop_id;
|
||||
} else {
|
||||
// only one ID in this contiguous block
|
||||
// only one ID in this contiguous block (i.e. 3, 5, 7, 9)
|
||||
out << start_id;
|
||||
}
|
||||
if (i < n_cells - 1) { out << ", "; }
|
||||
// insert a comma as long as we aren't in the last ID set
|
||||
if (i < n_ents - 1) { out << ", "; }
|
||||
|
||||
// if we are at the end of a set, set the start ID to the first value
|
||||
// in the next set.
|
||||
start_id = id_vec[++i];
|
||||
stop_id = start_id;
|
||||
}
|
||||
|
||||
i++;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue