mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-27 05:35:49 -04:00
Updating attribute name and placing below methods.
This commit is contained in:
parent
c20e942f1c
commit
d37c416308
2 changed files with 94 additions and 91 deletions
|
|
@ -18,10 +18,9 @@ namespace openmc {
|
|||
|
||||
static UniverseCellCounter* instance_;
|
||||
|
||||
std::map<int32_t, std::map<int32_t, int>> counts;
|
||||
|
||||
public:
|
||||
|
||||
// Methods
|
||||
static UniverseCellCounter* instance() {
|
||||
if (instance_ == nullptr)
|
||||
instance_ = new UniverseCellCounter;
|
||||
|
|
@ -29,8 +28,6 @@ namespace openmc {
|
|||
return instance_;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void clear();
|
||||
|
||||
void set_cell_count_for_univ(int32_t univ, int32_t cell, int count);
|
||||
|
|
@ -44,6 +41,9 @@ namespace openmc {
|
|||
void absorb_b_into_a(int32_t a, int32_t b);
|
||||
|
||||
auto get_count(int32_t univ);
|
||||
|
||||
// Members
|
||||
std::map<int32_t, std::map<int32_t, int>> counts_;
|
||||
};
|
||||
|
||||
struct UniverseLevelCounter {
|
||||
|
|
@ -54,10 +54,10 @@ namespace openmc {
|
|||
|
||||
static UniverseLevelCounter* instance_;
|
||||
|
||||
std::map<int32_t, int> counts;
|
||||
|
||||
public:
|
||||
|
||||
//Methods
|
||||
|
||||
static UniverseLevelCounter* instance() {
|
||||
if (instance_ == nullptr)
|
||||
instance_ = new UniverseLevelCounter;
|
||||
|
|
@ -78,6 +78,9 @@ namespace openmc {
|
|||
void set_count(int32_t univ, int count);
|
||||
|
||||
int get_count(int32_t univ);
|
||||
|
||||
// Members
|
||||
std::map<int32_t, int> counts_;
|
||||
};
|
||||
|
||||
void read_geometry_xml();
|
||||
|
|
|
|||
|
|
@ -23,6 +23,91 @@
|
|||
|
||||
namespace openmc {
|
||||
|
||||
void UniverseCellCounter::clear() {
|
||||
if (instance_ != nullptr) {
|
||||
delete instance_;
|
||||
instance_ = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void UniverseCellCounter::set_cell_count_for_univ(int32_t univ, int32_t cell, int count) {
|
||||
counts_[univ][cell] = count;
|
||||
}
|
||||
|
||||
void UniverseCellCounter::increment_count_for_univ(int32_t univ, int32_t cell) {
|
||||
if (has_count(univ,cell)) {
|
||||
counts_[univ][cell] += 1;
|
||||
} else {
|
||||
counts_[univ][cell] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
bool UniverseCellCounter::has_count(int32_t univ, int32_t cell) {
|
||||
return counts_.count(univ) && counts_[univ].count(cell);
|
||||
}
|
||||
|
||||
bool UniverseCellCounter::has_count(int32_t univ) {
|
||||
return counts_.count(univ);
|
||||
}
|
||||
|
||||
void UniverseCellCounter::absorb_b_into_a(int32_t a, int32_t b) {
|
||||
std::map<int32_t, int> b_map = counts_[b];
|
||||
|
||||
for (auto it : b_map) {
|
||||
if (has_count(a, it.first)) {
|
||||
counts_[a][it.first] += it.second;
|
||||
} else {
|
||||
counts_[a][it.first] = it.second;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
auto UniverseCellCounter::get_count(int32_t univ) {
|
||||
return counts_[univ];
|
||||
}
|
||||
|
||||
void UniverseLevelCounter::clear() {
|
||||
if (instance_ != nullptr) {
|
||||
delete instance_;
|
||||
instance_ = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void UniverseLevelCounter::set_cell_count_for_univ(int32_t univ, int count) {
|
||||
counts_[univ] = count;
|
||||
}
|
||||
|
||||
void UniverseLevelCounter::increment_count_for_univ(int32_t univ) {
|
||||
if (has_count(univ)) {
|
||||
counts_[univ] += 1;
|
||||
} else {
|
||||
counts_[univ] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
bool UniverseLevelCounter::has_count(int32_t univ) {
|
||||
return counts_.count(univ);
|
||||
}
|
||||
|
||||
void UniverseLevelCounter::absorb_b_into_a(int32_t a, int32_t b) {
|
||||
if (has_count(a)) {
|
||||
counts_[a] += counts_[b];
|
||||
} else {
|
||||
counts_[a] = counts_[b];
|
||||
}
|
||||
}
|
||||
|
||||
void UniverseLevelCounter::set_count(int32_t univ, int count) {
|
||||
counts_[univ] = count;
|
||||
}
|
||||
|
||||
int UniverseLevelCounter::get_count(int32_t univ) {
|
||||
return counts_[univ];
|
||||
}
|
||||
|
||||
UniverseCellCounter* UniverseCellCounter::instance_ = nullptr;
|
||||
UniverseLevelCounter* UniverseLevelCounter::instance_ = nullptr;
|
||||
|
||||
void read_geometry_xml()
|
||||
{
|
||||
#ifdef DAGMC
|
||||
|
|
@ -60,91 +145,6 @@ void read_geometry_xml()
|
|||
model::root_universe = find_root_universe();
|
||||
}
|
||||
|
||||
void UniverseCellCounter::clear() {
|
||||
if (instance_ != nullptr) {
|
||||
delete instance_;
|
||||
instance_ = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void UniverseCellCounter::set_cell_count_for_univ(int32_t univ, int32_t cell, int count) {
|
||||
counts[univ][cell] = count;
|
||||
}
|
||||
|
||||
void UniverseCellCounter::increment_count_for_univ(int32_t univ, int32_t cell) {
|
||||
if (has_count(univ,cell)) {
|
||||
counts[univ][cell] += 1;
|
||||
} else {
|
||||
counts[univ][cell] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
bool UniverseCellCounter::has_count(int32_t univ, int32_t cell) {
|
||||
return counts.count(univ) && counts[univ].count(cell);
|
||||
}
|
||||
|
||||
bool UniverseCellCounter::has_count(int32_t univ) {
|
||||
return counts.count(univ);
|
||||
}
|
||||
|
||||
void UniverseCellCounter::absorb_b_into_a(int32_t a, int32_t b) {
|
||||
std::map<int32_t, int> b_map = counts[b];
|
||||
|
||||
for (auto it : b_map) {
|
||||
if (has_count(a, it.first)) {
|
||||
counts[a][it.first] += it.second;
|
||||
} else {
|
||||
counts[a][it.first] = it.second;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
auto UniverseCellCounter::get_count(int32_t univ) {
|
||||
return counts[univ];
|
||||
}
|
||||
|
||||
void UniverseLevelCounter::clear() {
|
||||
if (instance_ != nullptr) {
|
||||
delete instance_;
|
||||
instance_ = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void UniverseLevelCounter::set_cell_count_for_univ(int32_t univ, int count) {
|
||||
counts[univ] = count;
|
||||
}
|
||||
|
||||
void UniverseLevelCounter::increment_count_for_univ(int32_t univ) {
|
||||
if (has_count(univ)) {
|
||||
counts[univ] += 1;
|
||||
} else {
|
||||
counts[univ] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
bool UniverseLevelCounter::has_count(int32_t univ) {
|
||||
return counts.count(univ);
|
||||
}
|
||||
|
||||
void UniverseLevelCounter::absorb_b_into_a(int32_t a, int32_t b) {
|
||||
if (has_count(a)) {
|
||||
counts[a] += counts[b];
|
||||
} else {
|
||||
counts[a] = counts[b];
|
||||
}
|
||||
}
|
||||
|
||||
void UniverseLevelCounter::set_count(int32_t univ, int count) {
|
||||
counts[univ] = count;
|
||||
}
|
||||
|
||||
int UniverseLevelCounter::get_count(int32_t univ) {
|
||||
return counts[univ];
|
||||
}
|
||||
|
||||
UniverseCellCounter* UniverseCellCounter::instance_ = nullptr;
|
||||
UniverseLevelCounter* UniverseLevelCounter::instance_ = nullptr;
|
||||
|
||||
//==============================================================================
|
||||
|
||||
void
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue