From d6d804600f9fee490ecfd63d75dee3f44aef11d1 Mon Sep 17 00:00:00 2001 From: John Tramm Date: Tue, 14 Jan 2020 19:30:18 +0000 Subject: [PATCH] formatting cleanup --- include/openmc/geometry.h | 1 + include/openmc/mesh.h | 2 +- include/openmc/tallies/derivative.h | 3 --- include/openmc/tallies/tally_scoring.h | 8 +++++--- src/bank.cpp | 3 --- src/geometry.cpp | 6 ------ src/mesh.cpp | 4 ++-- src/particle_restart.cpp | 2 +- src/simulation.cpp | 6 ------ src/tallies/derivative.cpp | 19 +++++++------------ 10 files changed, 17 insertions(+), 37 deletions(-) diff --git a/include/openmc/geometry.h b/include/openmc/geometry.h index 85fd53a7c..ef226db66 100644 --- a/include/openmc/geometry.h +++ b/include/openmc/geometry.h @@ -8,6 +8,7 @@ #include "openmc/particle.h" + namespace openmc { //============================================================================== diff --git a/include/openmc/mesh.h b/include/openmc/mesh.h index 974464d4e..bac4885ca 100644 --- a/include/openmc/mesh.h +++ b/include/openmc/mesh.h @@ -161,7 +161,7 @@ public: //! \param[in] bank Array of bank sites //! \param[out] Whether any bank sites are outside the mesh //! \return Array indicating number of sites in each mesh/energy bin - xt::xtensor count_sites(const Particle::Bank* bank, uint64_t length, + xt::xtensor count_sites(const Particle::Bank* bank, int64_t length, bool* outside) const; // Data members diff --git a/include/openmc/tallies/derivative.h b/include/openmc/tallies/derivative.h index a0db07da2..d36d69331 100644 --- a/include/openmc/tallies/derivative.h +++ b/include/openmc/tallies/derivative.h @@ -53,9 +53,6 @@ void score_collision_derivative(Particle* p); //! \param distance The distance in [cm] traveled by the particle void score_track_derivative(Particle* p, double distance); -//! Set the flux derivatives on differential tallies to zero. -void zero_flux_derivs(std::vector v); - } // namespace openmc //============================================================================== diff --git a/include/openmc/tallies/tally_scoring.h b/include/openmc/tallies/tally_scoring.h index 940bad488..f9d7558c5 100644 --- a/include/openmc/tallies/tally_scoring.h +++ b/include/openmc/tallies/tally_scoring.h @@ -2,8 +2,8 @@ #define OPENMC_TALLIES_TALLY_SCORING_H #include "openmc/particle.h" -#include "openmc/tallies/tally.h" #include "openmc/tallies/filter.h" +#include "openmc/tallies/tally.h" namespace openmc { @@ -23,12 +23,14 @@ class FilterBinIter public: //! Construct an iterator over bins that match a given particle's state. - FilterBinIter(const Tally& tally, const Particle* p, std::vector* particle_filter_matches); + FilterBinIter(const Tally& tally, const Particle* p, + std::vector* particle_filter_matches); //! Construct an iterator over all filter bin combinations. // //! \param end if true, the returned iterator indicates the end of a loop. - FilterBinIter(const Tally& tally, bool end, std::vector* particle_filter_matches); + FilterBinIter(const Tally& tally, bool end, + std::vector* particle_filter_matches); bool operator==(const FilterBinIter& other) const {return index_ == other.index_;} diff --git a/src/bank.cpp b/src/bank.cpp index 0d8cde5f1..2bf3ebf0a 100644 --- a/src/bank.cpp +++ b/src/bank.cpp @@ -1,12 +1,9 @@ #include "openmc/bank.h" - #include "openmc/capi.h" #include "openmc/error.h" #include -// Explicit template instantiation definition -//template class std::vector; namespace openmc { diff --git a/src/geometry.cpp b/src/geometry.cpp index 77d709841..e43432cf4 100644 --- a/src/geometry.cpp +++ b/src/geometry.cpp @@ -119,12 +119,6 @@ find_cell_inner(Particle* p, const NeighborList* neighbor_list) } // Announce the cell that the particle is entering. - if( p->trace_ ) - { - std::stringstream msg; - msg << "p->trace = " << p->trace_; - write_message(msg, 1); - } if (found && (settings::verbosity >= 10 || p->trace_)) { std::stringstream msg; msg << " Entering cell " << model::cells[i_cell]->id_; diff --git a/src/mesh.cpp b/src/mesh.cpp index 490596cd1..06487bea6 100644 --- a/src/mesh.cpp +++ b/src/mesh.cpp @@ -790,7 +790,7 @@ void RegularMesh::to_hdf5(hid_t group) const } xt::xtensor -RegularMesh::count_sites(const Particle::Bank* bank, uint64_t length, +RegularMesh::count_sites(const Particle::Bank* bank, int64_t length, bool* outside) const { // Determine shape of array for counts @@ -801,7 +801,7 @@ RegularMesh::count_sites(const Particle::Bank* bank, uint64_t length, xt::xarray cnt {shape, 0.0}; bool outside_ = false; - for (uint64_t i = 0; i < length; i++) { + for (int64_t i = 0; i < length; i++) { const auto& site = bank[i]; // determine scoring bin for entropy mesh diff --git a/src/particle_restart.cpp b/src/particle_restart.cpp index 7360ef5e4..075ae1146 100644 --- a/src/particle_restart.cpp +++ b/src/particle_restart.cpp @@ -10,8 +10,8 @@ #include "openmc/random_lcg.h" #include "openmc/settings.h" #include "openmc/simulation.h" -#include "openmc/tallies/tally.h" #include "openmc/tallies/derivative.h" +#include "openmc/tallies/tally.h" #include "openmc/track_output.h" #include // for copy diff --git a/src/simulation.cpp b/src/simulation.cpp index 7295f68c0..d0f7e387d 100644 --- a/src/simulation.cpp +++ b/src/simulation.cpp @@ -33,12 +33,7 @@ #include #include -#include -namespace openmc { - - -} // namespace openmc //============================================================================== // C API functions @@ -426,7 +421,6 @@ void finalize_generation() // For fixed-source mode, we need to sample the external source fill_source_bank_fixedsource(); } - } void initialize_history(Particle* p, int64_t index_source) diff --git a/src/tallies/derivative.cpp b/src/tallies/derivative.cpp index 8cf571afd..09662b679 100644 --- a/src/tallies/derivative.cpp +++ b/src/tallies/derivative.cpp @@ -115,8 +115,8 @@ apply_derivative_to_score(const Particle* p, int i_tally, int i_nuclide, // where (1/f * d_f/d_p) is the (logarithmic) flux derivative and p is the // perturbated variable. - const auto& deriv {model::tally_derivs[tally.deriv_]}; - const double& flux_deriv {p->flux_derivs_[tally.deriv_]}; + const auto& deriv = model::tally_derivs[tally.deriv_]; + const auto& flux_deriv = p->flux_derivs_[tally.deriv_]; // Handle special cases where we know that d_c/d_p must be zero. if (score_bin == SCORE_FLUX) { @@ -569,9 +569,9 @@ score_track_derivative(Particle* p, double distance) if (p->material_ == MATERIAL_VOID) return; const Material& material {*model::materials[p->material_]}; - for (int idx = 0; idx < model::tally_derivs.size(); idx++) { - const auto& deriv {model::tally_derivs[idx]}; - double& flux_deriv = p->flux_derivs_[idx]; + for (auto idx = 0; idx < model::tally_derivs.size(); idx++) { + const auto& deriv = model::tally_derivs[idx]; + auto& flux_deriv = p->flux_derivs_[idx]; if (deriv.diff_material != material.id_) continue; switch (deriv.variable) { @@ -620,8 +620,8 @@ void score_collision_derivative(Particle* p) //for (auto& deriv : model::tally_derivs) { for (int idx = 0; idx < model::tally_derivs.size(); idx++) { - const auto& deriv = model::tally_derivs[idx]; - double& flux_deriv = p->flux_derivs_[idx]; + const auto& deriv = model::tally_derivs[idx]; + auto& flux_deriv = p->flux_derivs_[idx]; if (deriv.diff_material != material.id_) continue; @@ -682,9 +682,4 @@ void score_collision_derivative(Particle* p) } } -void zero_flux_derivs(std::vector v) -{ - std::fill(v.begin(), v.end(), 0); -} - }// namespace openmc