mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 22:26:08 -04:00
Consolidating number of threads and thread number queries into the openmp interface header (#2809)
This commit is contained in:
parent
fb65dfd53c
commit
53363da3cc
5 changed files with 34 additions and 47 deletions
|
|
@ -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.
|
||||
//
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue