From b178939cfe93081b5317b8014f18bf15a7cb8e83 Mon Sep 17 00:00:00 2001 From: Sterling Harper Date: Sat, 29 Dec 2018 12:54:29 -0500 Subject: [PATCH] Address #1140 comments --- include/openmc/neighbor_list.h | 6 +++--- include/openmc/openmp_interface.h | 10 +++++----- src/geometry.cpp | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/include/openmc/neighbor_list.h b/include/openmc/neighbor_list.h index abf2fab866..f6142101d8 100644 --- a/include/openmc/neighbor_list.h +++ b/include/openmc/neighbor_list.h @@ -30,10 +30,10 @@ public: // function will return without actually modifying the data. It has been // found that returning the transport calculation and possibly re-adding the // element later is slightly faster than waiting on the lock to be released. - void push(int new_elem) + void push_back(int new_elem) { // Try to acquire the lock. - std::unique_lock lock(mutex_, std::try_to_lock); + std::unique_lock lock(mutex_, std::try_to_lock); if (lock) { // It is possible another thread already added this element to the list // while this thread was searching for a cell so make sure the given @@ -61,7 +61,7 @@ public: private: std::forward_list list_; - ThreadMutex mutex_; + OpenMPMutex mutex_; }; } // namespace openmc diff --git a/include/openmc/openmp_interface.h b/include/openmc/openmp_interface.h index ec2ef99465..076b19dc07 100644 --- a/include/openmc/openmp_interface.h +++ b/include/openmc/openmp_interface.h @@ -13,17 +13,17 @@ namespace openmc { //! This type meets the C++ "Lockable" requirements. //============================================================================== -class ThreadMutex +class OpenMPMutex { public: - ThreadMutex() + OpenMPMutex() { #ifdef _OPEMP omp_init_lock(&mutex_); #endif } - ~ThreadMutex() + ~OpenMPMutex() { #ifdef _OPEMP omp_destroy_lock(&mutex_); @@ -33,8 +33,8 @@ public: // Mutexes cannot be copied. We need to explicitly delete the copy // constructor and copy assignment operator to ensure the compiler doesn't // "help" us by implicitly trying to copy the underlying mutexes. - ThreadMutex(const ThreadMutex&) = delete; - ThreadMutex& operator= (const ThreadMutex&) = delete; + OpenMPMutex(const OpenMPMutex&) = delete; + OpenMPMutex& operator= (const OpenMPMutex&) = delete; //! Lock the mutex. // diff --git a/src/geometry.cpp b/src/geometry.cpp index a517d89881..2d3aca8c2f 100644 --- a/src/geometry.cpp +++ b/src/geometry.cpp @@ -297,7 +297,7 @@ find_cell(Particle* p, bool use_neighbor_lists) // cells in this universe, and update the neighbor list if we find a new // neighboring cell. found = find_cell_inner(p, nullptr); - if (found) c.neighbors_.push(p->coord[coord_lvl].cell); + if (found) c.neighbors_.push_back(p->coord[coord_lvl].cell); return found; } else {