Skip to content

Commit 9a9f376

Browse files
committed
I don't need adaptive_ check for an Adaptive class
1 parent 161bfd0 commit 9a9f376

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

include/openmc/mesh.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1063,8 +1063,9 @@ class AdaptiveLibMesh : public LibMesh {
10631063
bool amalgamation_ = false; //!< whether we are doing mesh and tally
10641064
//!< amalgamation by default it's turned off.
10651065

1066-
int clustering_element_integer_index_ = -1; //!< extra element integer index for
1067-
// element clustering
1066+
int clustering_element_integer_index_ =
1067+
-1; //!< extra element integer index for
1068+
// element clustering
10681069

10691070
/*create a hash map where every element in a cluster would map to the first
10701071
* element of in that cluster if the element isn't part of a cluster then it

src/mesh.cpp

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3540,20 +3540,20 @@ AdaptiveLibMesh::AdaptiveLibMesh(
35403540
void AdaptiveLibMesh::set_mesh_tally_amalgamation(
35413541
std::string cluster_element_integer_name)
35423542
{
3543-
3543+
35443544
clustering_element_integer_index_ =
35453545
m_->has_elem_integer(cluster_element_integer_name)
35463546
? m_->get_elem_integer_index(cluster_element_integer_name)
35473547
: -1;
35483548
amalgamation_ = (clustering_element_integer_index_ != -1);
3549-
3549+
35503550
if (amalgamation_) {
35513551
// reseve the hash map for cluster elements
35523552
clustering_element_mapping_.reserve(m_->n_active_elem());
35533553

35543554
// adding clustering map
35553555
for (auto it = m_->active_elements_begin(); it != m_->active_elements_end();
3556-
it++) {
3556+
it++) {
35573557

35583558
auto elem = *it;
35593559
auto cluster_elem = elem;
@@ -3568,10 +3568,10 @@ void AdaptiveLibMesh::set_mesh_tally_amalgamation(
35683568
}
35693569
clustering_element_mapping_.insert(std::make_pair(elem, cluster_elem));
35703570
}
3571-
}
3572-
else{
3571+
} else {
35733572
fatal_error(fmt::format("No extra element integer named: {} found in the "
3574-
"mesh", cluster_element_integer_name));
3573+
"mesh",
3574+
cluster_element_integer_name));
35753575
}
35763576
}
35773577

@@ -3605,9 +3605,10 @@ void AdaptiveLibMesh::write(const std::string& filename) const
36053605
int AdaptiveLibMesh::get_bin_from_element(const libMesh::Elem* elem) const
36063606
{
36073607
auto tally_elem = amalgamation_ ? clustering_element_mapping_.at(elem) : elem;
3608-
int bin = adaptive_ ? elem_to_bin_map_[tally_elem->id()]
3609-
: tally_elem->id() - first_element_id_;
3610-
if (bin >= n_bins() || bin < 0) {
3608+
int bin = elem_to_bin_map_[tally_elem->id()]
3609+
3610+
if (bin >= n_bins() || bin < 0)
3611+
{
36113612
fatal_error(fmt::format("Invalid bin: {}", bin));
36123613
}
36133614
return bin;

0 commit comments

Comments
 (0)