Consolidating number of threads and thread number queries into the openmp interface header (#2809)

This commit is contained in:
Patrick Shriwise 2023-12-18 21:31:29 -06:00 committed by GitHub
parent fb65dfd53c
commit 53363da3cc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 34 additions and 47 deletions

View file

@ -7,6 +7,27 @@
namespace openmc {
//==============================================================================
//! Accessor functions related to number of threads and thread number
//==============================================================================
inline int num_threads()
{
#ifdef _OPENMP
return omp_get_max_threads();
#else
return 1;
#endif
}
inline int thread_num()
{
#ifdef _OPENMP
return omp_get_thread_num();
#else
return 0;
#endif
}
//==============================================================================
//! An object used to prevent concurrent access to a piece of data.
//