Commit fb43f673 authored by Michael Kuron's avatar Michael Kuron
Browse files

Remove boost regex, chrono, thread

parent eaf49972
......@@ -574,23 +574,7 @@ endif()
#############################################################################################################################
set ( waLBerla_REQUIRED_MIN_BOOST_VERSION "1.48")
option ( WALBERLA_BUILD_WITH_BOOST_THREAD "Build with boost thread library support" ON )
# There have been problems with the IBM compiler and boost thread, so WALBERLA_BUILD_WITH_BOOST_THREAD is disabled by default for this compiler
if( WALBERLA_CXX_COMPILER_IS_IBM )
set ( WALBERLA_BUILD_WITH_BOOST_THREAD OFF CACHE BOOL "Build with boost thread library support" FORCE )
endif()
if ( WALBERLA_BUILD_WITH_BOOST_THREAD )
list ( APPEND waLBerla_REQUIRED_BOOST_COMPONENTS chrono filesystem system thread )
else ()
list ( APPEND waLBerla_REQUIRED_BOOST_COMPONENTS chrono filesystem system )
endif ()
if (( WALBERLA_CXX_COMPILER_IS_IBM ) OR
( WALBERLA_CXX_COMPILER_IS_GNU AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9 ) OR
( WALBERLA_CXX_COMPILER_IS_CLANG AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.5 ) )
list ( APPEND waLBerla_REQUIRED_BOOST_COMPONENTS regex)
endif()
list ( APPEND waLBerla_REQUIRED_BOOST_COMPONENTS filesystem system )
if ( WALBERLA_BUILD_WITH_PYTHON AND WALBERLA_CXX_COMPILER_IS_MSVC )
list( APPEND waLBerla_REQUIRED_BOOST_COMPONENTS python3 )
......@@ -699,11 +683,11 @@ endif()
############################################################################################################################
##
## PThread is required in Linux environments by boost::thread
## PThread is required in Linux environments by std::thread
##
############################################################################################################################
if ( NOT WIN32 AND WALBERLA_BUILD_WITH_BOOST_THREAD )
if ( NOT WIN32 )
add_flag( CMAKE_CXX_FLAGS "-pthread" )
endif()
......
......@@ -22,43 +22,15 @@
#pragma once
#if ( defined WALBERLA_CXX_COMPILER_IS_IBM )
#include <boost/regex.hpp>
#elif ( defined WALBERLA_CXX_COMPILER_IS_CLANG ) && ( ( __clang_major__ == 3 ) && ( __clang_minor__ <= 4 ) )
#include <boost/regex.hpp>
#elif ( defined WALBERLA_CXX_COMPILER_IS_GNU ) && ( ( __GNUC__ == 4 ) && ( __GNUC_MINOR__ <= 8 ) )
#include <boost/regex.hpp>
#else
#include <regex>
#endif
namespace walberla {
#if ( defined WALBERLA_CXX_COMPILER_IS_IBM )
using boost::regex;
using boost::regex_match;
using boost::regex_error;
using boost::regex_search;
using boost::regex_replace;
#elif ( defined WALBERLA_CXX_COMPILER_IS_CLANG ) && ( ( __clang_major__ == 3 ) && ( __clang_minor__ <= 4 ) )
using boost::regex;
using boost::regex_match;
using boost::regex_error;
using boost::regex_search;
using boost::regex_replace;
#elif ( defined WALBERLA_CXX_COMPILER_IS_GNU ) && ( ( __GNUC__ == 4 ) && ( __GNUC_MINOR__ <= 8 ) )
using boost::regex;
using boost::regex_match;
using boost::regex_error;
using boost::regex_search;
using boost::regex_replace;
#else
using std::regex;
using std::regex_match;
using std::regex_error;
using std::regex_search;
using std::regex_replace;
#endif
}
\ No newline at end of file
......@@ -27,9 +27,7 @@
#include "core/DataTypes.h"
#include "core/NonCopyable.h"
#ifdef WALBERLA_BUILD_WITH_BOOST_THREAD
#include <boost/thread/mutex.hpp>
#endif
#include <mutex>
/// \cond internal
......@@ -41,14 +39,11 @@ namespace singleton {
#ifdef WALBERLA_CXX_COMPILER_IS_GNU
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunknown-pragmas"
#pragma GCC diagnostic ignored "-Wpragmas"
#pragma GCC diagnostic ignored "-Wunused-local-typedefs"
#endif
#ifdef WALBERLA_CXX_COMPILER_IS_CLANG
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunknown-pragmas"
#pragma clang diagnostic ignored "-Wunused-local-typedefs"
#endif
......@@ -495,9 +490,7 @@ public:
//@{
static const shared_ptr<T>& instance()
{
#ifdef WALBERLA_BUILD_WITH_BOOST_THREAD
boost::mutex::scoped_lock lock( instanceMutex_ );
#endif
std::lock_guard<std::mutex> lock( instanceMutex_ );
static shared_ptr<T> object( new T() );
isInstantiated_ = true;
return object;
......@@ -520,9 +513,7 @@ private:
shared_ptr<D7> dependency7_; //!< Handle to the seventh lifetime dependency.
shared_ptr<D8> dependency8_; //!< Handle to the eighth lifetime dependency.
#ifdef WALBERLA_BUILD_WITH_BOOST_THREAD
static boost::mutex instanceMutex_; //!< Synchronization mutex for access to the singleton.
#endif
static std::mutex instanceMutex_; //!< Synchronization mutex for access to the singleton.
static bool isInstantiated_;
//@}
......@@ -592,9 +583,7 @@ public:
//@{
static const shared_ptr<T>& instance()
{
#ifdef WALBERLA_BUILD_WITH_BOOST_THREAD
boost::mutex::scoped_lock lock( instanceMutex_ );
#endif
std::lock_guard<std::mutex> lock( instanceMutex_ );
static shared_ptr<T> object( new T() );
isInstantiated_ = true;
return object;
......@@ -616,9 +605,7 @@ private:
shared_ptr<D6> dependency6_; //!< Handle to the sixth lifetime dependency.
shared_ptr<D7> dependency7_; //!< Handle to the seventh lifetime dependency.
#ifdef WALBERLA_BUILD_WITH_BOOST_THREAD
static boost::mutex instanceMutex_; //!< Synchronization mutex for access to the singleton.
#endif
static std::mutex instanceMutex_; //!< Synchronization mutex for access to the singleton.
static bool isInstantiated_;
//@}
......@@ -686,9 +673,7 @@ public:
//@{
static const shared_ptr<T>& instance()
{
#ifdef WALBERLA_BUILD_WITH_BOOST_THREAD
boost::mutex::scoped_lock lock( instanceMutex_ );
#endif
std::lock_guard<std::mutex> lock( instanceMutex_ );
static shared_ptr<T> object( new T() );
isInstantiated_ = true;
return object;
......@@ -709,9 +694,7 @@ private:
shared_ptr<D5> dependency5_; //!< Handle to the fifth lifetime dependency.
shared_ptr<D6> dependency6_; //!< Handle to the sixth lifetime dependency.
#ifdef WALBERLA_BUILD_WITH_BOOST_THREAD
static boost::mutex instanceMutex_; //!< Synchronization mutex for access to the singleton.
#endif
static std::mutex instanceMutex_; //!< Synchronization mutex for access to the singleton.
static bool isInstantiated_;
//@}
......@@ -776,9 +759,7 @@ public:
//@{
static const shared_ptr<T>& instance()
{
#ifdef WALBERLA_BUILD_WITH_BOOST_THREAD
boost::mutex::scoped_lock lock( instanceMutex_ );
#endif
std::lock_guard<std::mutex> lock( instanceMutex_ );
static shared_ptr<T> object( new T() );
isInstantiated_ = true;
return object;
......@@ -798,9 +779,7 @@ private:
shared_ptr<D4> dependency4_; //!< Handle to the fourth lifetime dependency.
shared_ptr<D5> dependency5_; //!< Handle to the fifth lifetime dependency.
#ifdef WALBERLA_BUILD_WITH_BOOST_THREAD
static boost::mutex instanceMutex_; //!< Synchronization mutex for access to the singleton.
#endif
static std::mutex instanceMutex_; //!< Synchronization mutex for access to the singleton.
static bool isInstantiated_;
//@}
......@@ -862,9 +841,7 @@ public:
//@{
static const shared_ptr<T>& instance()
{
#ifdef WALBERLA_BUILD_WITH_BOOST_THREAD
boost::mutex::scoped_lock lock( instanceMutex_ );
#endif
std::lock_guard<std::mutex> lock( instanceMutex_ );
static shared_ptr<T> object( new T() );
isInstantiated_ = true;
return object;
......@@ -883,9 +860,7 @@ private:
shared_ptr<D3> dependency3_; //!< Handle to the third lifetime dependency.
shared_ptr<D4> dependency4_; //!< Handle to the fourth lifetime dependency.
#ifdef WALBERLA_BUILD_WITH_BOOST_THREAD
static boost::mutex instanceMutex_; //!< Synchronization mutex for access to the singleton.
#endif
static std::mutex instanceMutex_; //!< Synchronization mutex for access to the singleton.
static bool isInstantiated_;
//@}
......@@ -944,9 +919,7 @@ public:
//@{
static const shared_ptr<T>& instance()
{
#ifdef WALBERLA_BUILD_WITH_BOOST_THREAD
boost::mutex::scoped_lock lock( instanceMutex_ );
#endif
std::lock_guard<std::mutex> lock( instanceMutex_ );
static shared_ptr<T> object( new T() );
isInstantiated_ = true;
return object;
......@@ -964,9 +937,7 @@ private:
shared_ptr<D2> dependency2_; //!< Handle to the second lifetime dependency.
shared_ptr<D3> dependency3_; //!< Handle to the third lifetime dependency.
#ifdef WALBERLA_BUILD_WITH_BOOST_THREAD
static boost::mutex instanceMutex_; //!< Synchronization mutex for access to the singleton.
#endif
static std::mutex instanceMutex_; //!< Synchronization mutex for access to the singleton.
static bool isInstantiated_;
//@}
......@@ -1022,9 +993,7 @@ public:
//@{
static const shared_ptr<T>& instance()
{
#ifdef WALBERLA_BUILD_WITH_BOOST_THREAD
boost::mutex::scoped_lock lock( instanceMutex_ );
#endif
std::lock_guard<std::mutex> lock( instanceMutex_ );
static shared_ptr<T> object( new T() );
isInstantiated_ = true;
return object;
......@@ -1041,9 +1010,7 @@ private:
shared_ptr<D1> dependency1_; //!< Handle to the first lifetime dependency.
shared_ptr<D2> dependency2_; //!< Handle to the second lifetime dependency.
#ifdef WALBERLA_BUILD_WITH_BOOST_THREAD
static boost::mutex instanceMutex_; //!< Synchronization mutex for access to the singleton.
#endif
static std::mutex instanceMutex_; //!< Synchronization mutex for access to the singleton.
static bool isInstantiated_;
//@}
......@@ -1096,9 +1063,7 @@ public:
//@{
static const shared_ptr<T>& instance()
{
#ifdef WALBERLA_BUILD_WITH_BOOST_THREAD
boost::mutex::scoped_lock lock( instanceMutex_ );
#endif
std::lock_guard<std::mutex> lock( instanceMutex_ );
static shared_ptr<T> object( new T() );
isInstantiated_ = true;
return object;
......@@ -1114,9 +1079,7 @@ private:
//@{
shared_ptr<D1> dependency1_; //!< Handle to the lifetime dependency.
#ifdef WALBERLA_BUILD_WITH_BOOST_THREAD
static boost::mutex instanceMutex_; //!< Synchronization mutex for access to the singleton.
#endif
static std::mutex instanceMutex_; //!< Synchronization mutex for access to the singleton.
static bool isInstantiated_;
//@}
......@@ -1165,9 +1128,7 @@ public:
//@{
static const shared_ptr<T>& instance()
{
#ifdef WALBERLA_BUILD_WITH_BOOST_THREAD
boost::mutex::scoped_lock lock( instanceMutex_ );
#endif
std::lock_guard<std::mutex> lock( instanceMutex_ );
static shared_ptr<T> object( new T() );
isInstantiated_ = true;
return object;
......@@ -1181,9 +1142,7 @@ private:
//**Member variables****************************************************************************
/*!\name Member variables */
//@{
#ifdef WALBERLA_BUILD_WITH_BOOST_THREAD
static boost::mutex instanceMutex_; //!< Synchronization mutex for access to the singleton.
#endif
static std::mutex instanceMutex_; //!< Synchronization mutex for access to the singleton.
static bool isInstantiated_;
//@}
......@@ -1199,82 +1158,56 @@ private:
//
//======================================================================================================================
#ifdef WALBERLA_BUILD_WITH_BOOST_THREAD
template< typename T, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H >
boost::mutex Singleton<T,A,B,C,D,E,F,G,H>::instanceMutex_;
#endif
std::mutex Singleton<T,A,B,C,D,E,F,G,H>::instanceMutex_;
template< typename T, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H >
bool Singleton<T,A,B,C,D,E,F,G,H>::isInstantiated_ = false;
#ifdef WALBERLA_BUILD_WITH_BOOST_THREAD
template< typename T, typename A, typename B, typename C, typename D, typename E, typename F, typename G >
boost::mutex Singleton<T,A,B,C,D,E,F,G,NullType>::instanceMutex_;
#endif
std::mutex Singleton<T,A,B,C,D,E,F,G,NullType>::instanceMutex_;
template< typename T, typename A, typename B, typename C, typename D, typename E, typename F, typename G >
bool Singleton<T,A,B,C,D,E,F,G,NullType>::isInstantiated_ = false;
#ifdef WALBERLA_BUILD_WITH_BOOST_THREAD
template< typename T, typename A, typename B, typename C, typename D, typename E, typename F >
boost::mutex Singleton<T,A,B,C,D,E,F,NullType,NullType>::instanceMutex_;
#endif
std::mutex Singleton<T,A,B,C,D,E,F,NullType,NullType>::instanceMutex_;
template< typename T, typename A, typename B, typename C, typename D, typename E, typename F >
bool Singleton<T,A,B,C,D,E,F,NullType,NullType>::isInstantiated_ = false;
#ifdef WALBERLA_BUILD_WITH_BOOST_THREAD
template< typename T, typename A, typename B, typename C, typename D, typename E >
boost::mutex Singleton<T,A,B,C,D,E,NullType,NullType,NullType>::instanceMutex_;
#endif
std::mutex Singleton<T,A,B,C,D,E,NullType,NullType,NullType>::instanceMutex_;
template< typename T, typename A, typename B, typename C, typename D, typename E >
bool Singleton<T,A,B,C,D,E,NullType,NullType,NullType>::isInstantiated_ = false;
#ifdef WALBERLA_BUILD_WITH_BOOST_THREAD
template< typename T, typename A, typename B, typename C, typename D >
boost::mutex Singleton<T,A,B,C,D,NullType,NullType,NullType,NullType>::instanceMutex_;
#endif
std::mutex Singleton<T,A,B,C,D,NullType,NullType,NullType,NullType>::instanceMutex_;
template< typename T, typename A, typename B, typename C, typename D >
bool Singleton<T,A,B,C,D,NullType,NullType,NullType,NullType>::isInstantiated_ = false;
#ifdef WALBERLA_BUILD_WITH_BOOST_THREAD
template< typename T, typename A, typename B, typename C >
boost::mutex Singleton<T,A,B,C,NullType,NullType,NullType,NullType,NullType>::instanceMutex_;
#endif
std::mutex Singleton<T,A,B,C,NullType,NullType,NullType,NullType,NullType>::instanceMutex_;
template< typename T, typename A, typename B, typename C >
bool Singleton<T,A,B,C,NullType,NullType,NullType,NullType,NullType>::isInstantiated_ = false;
#ifdef WALBERLA_BUILD_WITH_BOOST_THREAD
template< typename T, typename A, typename B >
boost::mutex Singleton<T,A,B,NullType,NullType,NullType,NullType,NullType,NullType>::instanceMutex_;
#endif
std::mutex Singleton<T,A,B,NullType,NullType,NullType,NullType,NullType,NullType>::instanceMutex_;
template< typename T, typename A, typename B >
bool Singleton<T,A,B,NullType,NullType,NullType,NullType,NullType,NullType>::isInstantiated_ = false;
#ifdef WALBERLA_BUILD_WITH_BOOST_THREAD
template< typename T, typename A >
boost::mutex Singleton<T,A,NullType,NullType,NullType,NullType,NullType,NullType,NullType>::instanceMutex_;
#endif
std::mutex Singleton<T,A,NullType,NullType,NullType,NullType,NullType,NullType,NullType>::instanceMutex_;
template< typename T, typename A >
bool Singleton<T,A,NullType,NullType,NullType,NullType,NullType,NullType,NullType>::isInstantiated_ = false;
#ifdef WALBERLA_BUILD_WITH_BOOST_THREAD
template< typename T >
boost::mutex Singleton<T,NullType,NullType,NullType,NullType,NullType,NullType,NullType,NullType>::instanceMutex_;
#endif
std::mutex Singleton<T,NullType,NullType,NullType,NullType,NullType,NullType,NullType,NullType>::instanceMutex_;
template< typename T >
bool Singleton<T,NullType,NullType,NullType,NullType,NullType,NullType,NullType,NullType>::isInstantiated_ = false;
......
......@@ -31,7 +31,7 @@
#include <sstream>
#include <string>
#include <boost/chrono/chrono.hpp>
#include <chrono>
#if defined(_MSC_VER)
# ifndef NOMINMAX
......@@ -75,18 +75,7 @@ inline double getCpuTime();
*/
inline double getWcTime()
{
#ifdef WIN32
LARGE_INTEGER perfCounter, perfFrequency;
QueryPerformanceCounter( &perfCounter );
QueryPerformanceFrequency( &perfFrequency );
return static_cast<double>(perfCounter.QuadPart) / static_cast<double>(perfFrequency.QuadPart);
#elif defined __bg__ // boost::chrono seems broken on BG/Q
struct timeval tp;
gettimeofday( &tp, NULL );
return ( static_cast<double>( tp.tv_sec ) + static_cast<double>( tp.tv_usec )/1E6 );
#else
return static_cast<double>(boost::chrono::duration_cast<boost::chrono::nanoseconds>(boost::chrono::high_resolution_clock::now().time_since_epoch()).count()) * 1e-9;
#endif
return static_cast<double>(std::chrono::duration_cast<std::chrono::nanoseconds>(std::chrono::high_resolution_clock::now().time_since_epoch()).count()) * 1e-9;
}
//**********************************************************************************************************************
......
......@@ -34,9 +34,8 @@
#include <sstream>
#include <string>
#ifdef WALBERLA_BUILD_WITH_BOOST_THREAD
#include <boost/thread.hpp>
#endif
#include <mutex>
#include <shared_mutex>
namespace walberla {
......@@ -69,8 +68,7 @@ namespace uid {
* translates the numerical UID representations into a bit mask. For further information see the documentation of the
* two member functions "toIndex()" and "toBitMask()" of this class.
*
* If 'WALBERLA_BUILD_WITH_BOOST_THREAD' is defined, the class UID is thread safe and follows
* a multiple-readers / single-writer pattern.
* The class UID is thread safe and follows a multiple-readers / single-writer pattern.
*/
//**********************************************************************************************************************
......@@ -129,10 +127,8 @@ private:
static std::map< uint_type, std::string >& uidToString() { static std::map< uint_type, std::string > map; return map; }
static std::map< std::string, uint_type >& stringToUid() { static std::map< std::string, uint_type > map; return map; }
#ifdef WALBERLA_BUILD_WITH_BOOST_THREAD
static boost::shared_mutex& uidToStringMutex() { static boost::shared_mutex mutex; return mutex; }
static boost::shared_mutex& stringToUidMutex() { static boost::shared_mutex mutex; return mutex; }
#endif
static std::shared_timed_mutex& uidToStringMutex() { static std::shared_timed_mutex mutex; return mutex; }
static std::shared_timed_mutex& stringToUidMutex() { static std::shared_timed_mutex mutex; return mutex; }
uint_type uid_;
......@@ -197,9 +193,7 @@ inline UID<T>::UID( const std::string& identifier, const bool newUid, const bool
template< typename T >
void UID<T>::init( const std::string& identifier, const bool newUid, const bool appendUIDtoIdentifier ) {
#ifdef WALBERLA_BUILD_WITH_BOOST_THREAD
boost::unique_lock< boost::shared_mutex > stringToUid_lock( stringToUidMutex() );
#endif
std::unique_lock< std::shared_timed_mutex > stringToUid_lock( stringToUidMutex() );
WALBERLA_ASSERT( !identifier.empty() );
......@@ -211,9 +205,7 @@ void UID<T>::init( const std::string& identifier, const bool newUid, const bool
WALBERLA_ASSERT( stringToUid().find( idString ) == stringToUid().end() ); // 'idString' must not exist
#ifdef WALBERLA_BUILD_WITH_BOOST_THREAD
boost::unique_lock< boost::shared_mutex > uidToString_lock( uidToStringMutex() );
#endif
std::unique_lock< std::shared_timed_mutex > uidToString_lock( uidToStringMutex() );
uidToString()[ uid_ ] = idString;
stringToUid()[ idString ] = uid_;
......@@ -226,9 +218,7 @@ void UID<T>::init( const std::string& identifier, const bool newUid, const bool
uid_ = T::generateUID();
#ifdef WALBERLA_BUILD_WITH_BOOST_THREAD
boost::unique_lock< boost::shared_mutex > uidToString_lock( uidToStringMutex() );
#endif
std::unique_lock< std::shared_timed_mutex > uidToString_lock( uidToStringMutex() );
uidToString()[ uid_ ] = identifier;
stringToUid()[ identifier ] = uid_;
}
......@@ -256,10 +246,7 @@ UID<T>::UID( const bool createAnonymousUID ) : uid_( 0 ) {
#endif
}
else {
#ifdef WALBERLA_BUILD_WITH_BOOST_THREAD
boost::unique_lock< boost::shared_mutex > stringToUid_lock( stringToUidMutex() );
#endif
std::unique_lock< std::shared_timed_mutex > stringToUid_lock( stringToUidMutex() );
uid_ = T::generateUID();
......@@ -267,9 +254,7 @@ UID<T>::UID( const bool createAnonymousUID ) : uid_( 0 ) {
WALBERLA_ASSERT( stringToUid().find( identifier ) == stringToUid().end() ); // 'identifier' must not exist
#ifdef WALBERLA_BUILD_WITH_BOOST_THREAD
boost::unique_lock< boost::shared_mutex > uidToString_lock( uidToStringMutex() );
#endif
std::unique_lock< std::shared_timed_mutex > uidToString_lock( uidToStringMutex() );
uidToString()[ uid_ ] = identifier;
stringToUid()[ identifier ] = uid_;
......@@ -304,10 +289,7 @@ inline UID<T>::UID( const uint_type uid ) : uid_( uid )
//**********************************************************************************************************************
template< typename T >
UID<T> UID<T>::getOrConstruct( const std::string& identifier ) {
#ifdef WALBERLA_BUILD_WITH_BOOST_THREAD
boost::unique_lock< boost::shared_mutex > stringToUid_lock( stringToUidMutex() );
#endif
std::unique_lock< std::shared_timed_mutex > stringToUid_lock( stringToUidMutex() );
WALBERLA_ASSERT( !identifier.empty() );
......@@ -317,9 +299,7 @@ UID<T> UID<T>::getOrConstruct( const std::string& identifier ) {
uint_type uid = T::generateUID();
#ifdef WALBERLA_BUILD_WITH_BOOST_THREAD
boost::unique_lock< boost::shared_mutex > uidToString_lock( uidToStringMutex() );
#endif
std::unique_lock< std::shared_timed_mutex > uidToString_lock( uidToStringMutex() );
uidToString()[ uid ] = identifier;
stringToUid()[ identifier ] = uid;
......@@ -340,10 +320,7 @@ UID<T> UID<T>::getOrConstruct( const std::string& identifier ) {
//**********************************************************************************************************************
template< typename T >
inline UID<T> UID<T>::get( const std::string& identifier ) {
#ifdef WALBERLA_BUILD_WITH_BOOST_THREAD
boost::shared_lock< boost::shared_mutex > lock( stringToUidMutex() );
#endif
std::shared_lock< std::shared_timed_mutex > lock( stringToUidMutex() );
WALBERLA_ASSERT( stringToUid().find( identifier ) != stringToUid().end() ); // 'identifier' must exist
......@@ -354,10 +331,7 @@ inline UID<T> UID<T>::get( const std::string& identifier ) {
template< typename T >
inline const std::string& UID<T>::getIdentifier() const {
#ifdef WALBERLA_BUILD_WITH_BOOST_THREAD
boost::shared_lock< boost::shared_mutex > lock( uidToStringMutex() );
#endif
std::shared_lock< std::shared_timed_mutex > lock( uidToStringMutex() );
WALBERLA_ASSERT( valid_ );
WALBERLA_ASSERT( uidToString().find( uid_ ) != uidToString().end() );
......
......@@ -26,6 +26,8 @@
#include "GPUCopy.h"
#include "ErrorChecking.h"
#include <cstring>
namespace walberla {
namespace cuda {
......@@ -56,7 +58,7 @@ void copyDevToDevFZYX( const cudaPitchedPtr& dst, const cudaPitchedPtr& src,
WALBERLA_ASSERT( fIntervalSize == 1 || ( Nz == dstAllocSizeZ && Nz == srcAllocSizeZ ) );
cudaMemcpy3DParms p;
memset( &p, 0, sizeof(p) );
std::memset( &p, 0, sizeof(p) );
p.srcPos = make_cudaPos( srcX * typeSize, srcY, srcCoordF * srcAllocSizeZ + srcZ );
p.srcPtr = make_cudaPitchedPtr( src.ptr, src.pitch, src.xsize, src.ysize );
......@@ -115,7 +117,7 @@ void copyDevToDevZYXF( const cudaPitchedPtr& dst, const cudaPitchedPtr& src,
auto copyFunctor = [&](uint_t dstCoordZ, uint_t srcCoordZ, uint_t zIntervalSize) {
cudaMemcpy3DParms p;
memset( &p, 0, sizeof(p) );
std::memset( &p, 0, sizeof(p) );
p.srcPos = make_cudaPos( srcF * typeSize, srcX, srcCoordZ * srcAllocSizeY + srcY );
p.srcPtr = make_cudaPitchedPtr( src.ptr, src.pitch, src.xsize, src.ysize );
......@@ -174,7 +176,7 @@ void copyHostToDevFZYX( const cudaPitchedPtr& dst, unsigned char* src,
auto copyFunctor = [&](uint_t dstCoordF, uint_t srcCoordF, uint_t fIntervalSize) {
cudaMemcpy3DParms p;
memset( &p, 0, sizeof(p) );
std::memset( &p, 0, sizeof(p) );
p.srcPos = make_cudaPos( srcX * typeSize, srcY, srcCoordF * srcAllocSizeZ + srcZ );
p.srcPtr = make_cudaPitchedPtr( src, Nx * typeSize, Nx * typeSize, Ny );
......@@ -233,7 +235,7 @@ void copyHostToDevZYXF( const cudaPitchedPtr& dst, unsigned char* src,
auto copyFunctor = [&](uint_t dstCoordZ, uint_t srcCoordZ, uint_t zIntervalSize) {
cudaMemcpy3DParms p;
memset( &p, 0, sizeof(p) );
std::memset( &p, 0, sizeof(p) );
p.srcPos = make_cudaPos( srcF * typeSize, srcX, srcCoordZ * srcAllocSizeY + srcY );
p.srcPtr = make_cudaPitchedPtr( src, Nf * typeSize, Nf * typeSize, Nx );
......@@ -293,7 +295,7 @@ void copyDevToHostFZYX( unsigned char* dst, const cudaPitchedPtr& src,
auto copyFunctor = [&](uint_t dstCoordF, uint_t srcCoordF, uint_t fIntervalSize) {
cudaMemcpy3DParms p;
memset( &p, 0, sizeof(p) );
std::memset( &p, 0, sizeof(p) );
p.srcPos = make_cudaPos( srcX * typeSize, srcY, srcCoordF * srcAllocSizeZ + srcZ );
p.srcPtr = make_cudaPitchedPtr( src.ptr, src.pitch, src.xsize, src.ysize );
......@@ -353,7 +355,7 @@ void copyDevToHostZYXF( unsigned char* dst, const cudaPitchedPtr& src,
auto copyFunctor = [&](uint_t dstCoordZ, uint_t srcCoordZ, uint_t zIntervalSize) {
cudaMemcpy3DParms p;
memset( &p, 0, sizeof(p) );
std::memset( &p, 0, sizeof(p) );
p.srcPos = make_cudaPos( srcF * typeSize, srcX, srcCoordZ * srcAllocSizeY + srcY );
p.srcPtr = make_cudaPitchedPtr( src.ptr, src.pitch, src.xsize, src.ysize );
......