mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-26 13:15:39 -04:00
Making the point locator a thread private variable.
This commit is contained in:
parent
16e05739a9
commit
69de477bb5
2 changed files with 9 additions and 21 deletions
|
|
@ -538,7 +538,8 @@ private:
|
|||
|
||||
// Data members
|
||||
std::unique_ptr<libMesh::Mesh> m_; //!< pointer to the libMesh mesh instance
|
||||
std::vector<std::unique_ptr<libMesh::PointLocatorBase>> point_locators_; //!< pointers to locators for each thread
|
||||
static std::unique_ptr<libMesh::PointLocatorBase> PL_; //!< per-thread point locators
|
||||
#pragma omp threadprivate(PL_)
|
||||
std::unique_ptr<libMesh::EquationSystems> equation_systems_; //!< pointer to the equation systems of the mesh
|
||||
std::string eq_system_name_; //!< name of the equation system holding OpenMC results
|
||||
std::map<std::string, unsigned int> variable_map_; //!< mapping of variable names (tally scores) to libMesh variable numbers
|
||||
|
|
|
|||
27
src/mesh.cpp
27
src/mesh.cpp
|
|
@ -2088,6 +2088,9 @@ MOABMesh::write(std::string base_filename) const {
|
|||
#endif
|
||||
|
||||
#ifdef LIBMESH
|
||||
|
||||
std::unique_ptr<libMesh::PointLocatorBase> LibMesh::PL_ = nullptr;
|
||||
|
||||
LibMesh::LibMesh(pugi::xml_node node) : UnstructuredMesh(node) {
|
||||
initialize();
|
||||
}
|
||||
|
|
@ -2118,19 +2121,9 @@ void LibMesh::initialize() {
|
|||
libMesh::ExplicitSystem& eq_sys =
|
||||
equation_systems_->add_system<libMesh::ExplicitSystem>(eq_system_name_);
|
||||
|
||||
// setup the point locator
|
||||
#ifdef _OPENMP
|
||||
int n_threads = omp_get_max_threads();
|
||||
#else
|
||||
int n_threads = 1;
|
||||
#endif
|
||||
|
||||
point_locators_ = std::vector<std::unique_ptr<libMesh::PointLocatorBase>>(n_threads);
|
||||
for (int i = 0; i < n_threads; i++) {
|
||||
point_locators_[i] = m_->sub_point_locator();
|
||||
point_locators_[i]->set_contains_point_tol(FP_COINCIDENT);
|
||||
point_locators_[i]->enable_out_of_mesh_mode();
|
||||
}
|
||||
PL_ = m_->sub_point_locator();
|
||||
PL_->set_contains_point_tol(FP_COINCIDENT);
|
||||
PL_->enable_out_of_mesh_mode();
|
||||
|
||||
first_element_ = *m_->elements_begin();
|
||||
|
||||
|
|
@ -2242,13 +2235,7 @@ LibMesh::get_bin(Position r) const
|
|||
// quick rejection check
|
||||
if (!bbox_.contains_point(p)) { return -1; }
|
||||
|
||||
#ifdef _OPENMP
|
||||
int thread = omp_get_thread_num();
|
||||
#else
|
||||
int thread = 0;
|
||||
#endif
|
||||
|
||||
auto e = (*point_locators_[thread])(p);
|
||||
auto e = (*LibMesh::PL_)(p);
|
||||
if (!e) {
|
||||
return -1;
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue