From 524b5344ebe4cf91fea89c08d8a9d5652378b4c9 Mon Sep 17 00:00:00 2001 From: Adam G Nelson Date: Sat, 9 Nov 2019 09:08:56 -0600 Subject: [PATCH] removed MGXS C interface methods (calculate_xs_c, get_name_c, and get_awr_c) that are no longer necessary now that the code is full C++ --- include/openmc/mgxs_interface.h | 14 ------------ src/mgxs_interface.cpp | 39 +-------------------------------- src/particle.cpp | 14 ++++++------ 3 files changed, 8 insertions(+), 59 deletions(-) diff --git a/include/openmc/mgxs_interface.h b/include/openmc/mgxs_interface.h index afd183e87..2cbe5f21d 100644 --- a/include/openmc/mgxs_interface.h +++ b/include/openmc/mgxs_interface.h @@ -82,10 +82,6 @@ void mark_fissionable_mgxs_materials(); // Mgxs tracking/transport/tallying interface methods //============================================================================== -extern "C" void -calculate_xs_c(int i_mat, int gin, double sqrtkT, Direction u, - double& total_xs, double& abs_xs, double& nu_fiss_xs); - double get_nuclide_xs(int index, int xstype, int gin, const int* gout, const double* mu, const int* dg); @@ -102,15 +98,5 @@ inline double get_macro_xs(int index, int xstype, int gin) {return get_macro_xs(index, xstype, gin, nullptr, nullptr, nullptr);} -//============================================================================== -// General Mgxs methods -//============================================================================== - -extern "C" void -get_name_c(int index, int name_len, char* name); - -extern "C" double -get_awr_c(int index); - } // namespace openmc #endif // OPENMC_MGXS_INTERFACE_H diff --git a/src/mgxs_interface.cpp b/src/mgxs_interface.cpp index 1b0f2675a..0bc61fa00 100644 --- a/src/mgxs_interface.cpp +++ b/src/mgxs_interface.cpp @@ -38,7 +38,7 @@ MgxsInterface::MgxsInterface(const std::string& path_cross_sections, void MgxsInterface::set_nuclides_and_temperatures( std::vector xs_to_read, std::vector> xs_temps) -{ +{ // Check to remove all duplicates xs_to_read_ = xs_to_read; xs_temps_to_read_ = xs_temps; @@ -291,16 +291,6 @@ void mark_fissionable_mgxs_materials() // Mgxs tracking/transport/tallying interface methods //============================================================================== -void -calculate_xs_c(int i_mat, int gin, double sqrtkT, Direction u, - double& total_xs, double& abs_xs, double& nu_fiss_xs) -{ - data::mg.macro_xs_[i_mat].calculate_xs(gin - 1, sqrtkT, u, total_xs, abs_xs, - nu_fiss_xs); -} - -//============================================================================== - double get_nuclide_xs(int index, int xstype, int gin, const int* gout, const double* mu, const int* dg) @@ -333,31 +323,4 @@ get_macro_xs(int index, int xstype, int gin, const int* gout, return data::mg.macro_xs_[index].get_xs(xstype, gin - 1, gout_c_p, mu, dg); } -//============================================================================== -// General Mgxs methods -//============================================================================== - -void -get_name_c(int index, int name_len, char* name) -{ - // First blank out our input string - std::string str(name_len - 1, ' '); - std::strcpy(name, str.c_str()); - - // Now get the data and copy to the C-string - str = data::mg.nuclides_[index - 1].name; - std::strcpy(name, str.c_str()); - - // Finally, remove the null terminator - name[std::strlen(name)] = ' '; -} - -//============================================================================== - -double -get_awr_c(int index) -{ - return data::mg.nuclides_[index - 1].awr; -} - } // namespace openmc diff --git a/src/particle.cpp b/src/particle.cpp index 030c8dc63..3ce3cf84c 100644 --- a/src/particle.cpp +++ b/src/particle.cpp @@ -203,11 +203,11 @@ Particle::transport() } } else { // Get the MG data - calculate_xs_c(material_, g_, sqrtkT_, this->u_local(), - macro_xs_.total, macro_xs_.absorption, macro_xs_.nu_fission); + data::mg.macro_xs_[material_].calculate_xs(g_ - 1, sqrtkT_, + this->u_local(), macro_xs_.total, macro_xs_.absorption, + macro_xs_.nu_fission); - // Finally, update the particle group while we have already checked - // for if multi-group + // Finally, update the particle group since we know we are multi-group g_last_ = g_; } } else { @@ -428,7 +428,7 @@ Particle::cross_surface() } return; - } else if ((surf->bc_ == BC_REFLECT || surf->bc_ == BC_WHITE) + } else if ((surf->bc_ == BC_REFLECT || surf->bc_ == BC_WHITE) && (settings::run_mode != RUN_MODE_PLOTTING)) { // ======================================================================= // PARTICLE REFLECTS FROM SURFACE @@ -458,11 +458,11 @@ Particle::cross_surface() score_surface_tally(this, model::active_meshsurf_tallies); this->r() = r; } - + Direction u = (surf->bc_ == BC_REFLECT) ? surf->reflect(this->r(), this->u()) : surf->diffuse_reflect(this->r(), this->u()); - + // Make sure new particle direction is normalized this->u() = u / u.norm();