Import Geant4 10.5.0 source tree
This commit is contained in:
@@ -24,7 +24,6 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4Allocator.hh 88444 2015-02-20 13:43:16Z gcosmo $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4AllocatorList.hh 66241 2012-12-13 18:34:42Z gunter $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4AllocatorPool.hh 67970 2013-03-13 10:10:06Z gcosmo $
|
||||
//
|
||||
//
|
||||
// -------------------------------------------------------------------
|
||||
@@ -56,6 +55,11 @@ class G4AllocatorPool
|
||||
~G4AllocatorPool();
|
||||
// Destructor. Return storage to the free store
|
||||
|
||||
G4AllocatorPool(const G4AllocatorPool& right);
|
||||
// Copy constructor
|
||||
G4AllocatorPool& operator= (const G4AllocatorPool& right);
|
||||
// Equality operator
|
||||
|
||||
inline void* Alloc();
|
||||
// Allocate one element
|
||||
inline void Free( void* b );
|
||||
@@ -75,11 +79,6 @@ class G4AllocatorPool
|
||||
|
||||
private:
|
||||
|
||||
G4AllocatorPool(const G4AllocatorPool& right);
|
||||
// Provate copy constructor
|
||||
G4AllocatorPool& operator= (const G4AllocatorPool& right);
|
||||
// Private equality operator
|
||||
|
||||
struct G4PoolLink
|
||||
{
|
||||
G4PoolLink* next;
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4ApplicationState.hh 67970 2013-03-13 10:10:06Z gcosmo $
|
||||
//
|
||||
|
||||
#ifndef G4APPLICATIONSTATE_H
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
// ---------------------------------------------------------------
|
||||
// GEANT 4 class header file
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
// ---------------------------------------------------------------
|
||||
// GEANT 4 class header file
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4BuffercoutDestination.hh 103582 2017-04-18 17:24:45Z adotti $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
// ---------------------------------------------------------------
|
||||
// GEANT 4 class header file
|
||||
@@ -31,66 +30,68 @@
|
||||
// Class Description:
|
||||
// Helper classes for Geant4 Multi-Threaded.
|
||||
// The classes defined in this header file provide a thread-private
|
||||
// cache to store, in a class instance shared among threads,
|
||||
// a thread-local variable V.
|
||||
// cache to store a thread-local variable V in a class instance
|
||||
// shared among threads.
|
||||
// These are templated classes on the to-be-stored object.
|
||||
//
|
||||
// Example:
|
||||
// Let's assume an instance myObject of class G4Shared is sharead between
|
||||
// threads. Still a data member of this class needs to be thread-private.
|
||||
// A typical example of this being a "cache" for a local calculation.
|
||||
// The helper here defined can be used to guarantee thread-safe operations
|
||||
// The helper defined here can be used to guarantee thread-safe operations
|
||||
// on the thread-private object.
|
||||
// Example:
|
||||
// class G4Shared {
|
||||
// G4double sharedData;
|
||||
// G4Cache<G4double> threadPrivate;
|
||||
// void foo() {
|
||||
// G4double priv = threadPrivate.Get();
|
||||
// if ( priv < 10 ) priv += sharedData;
|
||||
// threadPrivate.Put( priv );
|
||||
// }
|
||||
// };
|
||||
// class G4Shared
|
||||
// {
|
||||
// G4double sharedData;
|
||||
// G4Cache<G4double> threadPrivate;
|
||||
// void foo()
|
||||
// {
|
||||
// G4double priv = threadPrivate.Get();
|
||||
// if ( priv < 10 ) priv += sharedData;
|
||||
// threadPrivate.Put( priv );
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// Two variants of the base G4Cache exists. The first one being
|
||||
// G4VectorCache similar to std::vector
|
||||
// Two variants of the base G4Cache exist. The first one being
|
||||
// G4VectorCache similar to std::vector.
|
||||
// Example:
|
||||
// G4VectorCache<G4double> aVect;
|
||||
// aVect.Push_back( 3.2 );
|
||||
// aVect.Push_back( 4.1 );
|
||||
// cout<<aVect[0]<<endl;
|
||||
// G4VectorCache<G4double> aVect;
|
||||
// aVect.Push_back( 3.2 );
|
||||
// aVect.Push_back( 4.1 );
|
||||
// std::cout << aVect[0] << std::endl;
|
||||
// The second one being:
|
||||
// G4MapCache similar to std::map
|
||||
// G4MapCache, similar to std::map.
|
||||
// Example:
|
||||
// G4MapCache<G4int,G4double> aMap;
|
||||
// aMap[320]=1.234;
|
||||
// G4MapCache<G4int, G4double> aMap;
|
||||
// aMap[320]=1.234;
|
||||
//
|
||||
// See classes definition for details.
|
||||
// See testG4Cache unit test for details on usage
|
||||
//
|
||||
|
||||
// History:
|
||||
// 21 October 2013: A. Dotti - First implementation
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
#ifndef G4CACHE_HH
|
||||
#define G4CACHE_HH
|
||||
|
||||
//Debug this code
|
||||
//#define g4cdebug 1
|
||||
// Debug this code
|
||||
// #define g4cdebug 1
|
||||
|
||||
#include <system_error>
|
||||
#include <atomic>
|
||||
#include <map>
|
||||
|
||||
// also included in G4CacheDetails.hh
|
||||
#include "G4Threading.hh"
|
||||
#include "G4AutoLock.hh"
|
||||
|
||||
//Thread Local storage details are in this header file
|
||||
#include "G4CacheDetails.hh"
|
||||
#include "G4CacheDetails.hh" // Thread Local storage details are here
|
||||
|
||||
// A templated cache to store a thread-private data of type VALTYPE.
|
||||
//
|
||||
template<class VALTYPE>
|
||||
class G4Cache {
|
||||
public:
|
||||
class G4Cache
|
||||
{
|
||||
public:
|
||||
|
||||
typedef VALTYPE value_type;
|
||||
// The stored type
|
||||
|
||||
@@ -115,29 +116,35 @@ public:
|
||||
G4Cache(const G4Cache& rhs);
|
||||
G4Cache& operator=(const G4Cache& rhs);
|
||||
|
||||
protected:
|
||||
const int& GetId() const { return id; }
|
||||
protected:
|
||||
|
||||
private:
|
||||
int id;
|
||||
const G4int& GetId() const { return id; }
|
||||
|
||||
private:
|
||||
|
||||
G4int id;
|
||||
mutable G4CacheReference<value_type> theCache;
|
||||
static std::atomic<unsigned int> instancesctr;
|
||||
static std::atomic<unsigned int> dstrctr;
|
||||
|
||||
inline value_type& GetCache() const {
|
||||
theCache.Initialize(id);
|
||||
return theCache.GetCache(id);
|
||||
inline value_type& GetCache() const
|
||||
{
|
||||
theCache.Initialize(id);
|
||||
return theCache.GetCache(id);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
// A vector version of the cache. Implements vector interface.
|
||||
// Can be used directly as a std::vector would be used.
|
||||
//
|
||||
template<class VALTYPE>
|
||||
class G4VectorCache : public G4Cache< std::vector<VALTYPE> > {
|
||||
public:
|
||||
//Some useful defintions
|
||||
class G4VectorCache : public G4Cache< std::vector<VALTYPE> >
|
||||
{
|
||||
public:
|
||||
|
||||
// Some useful definitions
|
||||
//
|
||||
typedef VALTYPE value_type;
|
||||
typedef typename std::vector<value_type> vector_type;
|
||||
typedef typename vector_type::size_type size_type;
|
||||
@@ -156,25 +163,30 @@ public:
|
||||
virtual ~G4VectorCache();
|
||||
// Default destructor
|
||||
|
||||
// Interface with funxtionalities of similar name of std::vector
|
||||
// Interface with functionalities of similar name of std::vector
|
||||
//
|
||||
inline void Push_back( const value_type& val );
|
||||
inline value_type Pop_back();
|
||||
inline value_type& operator[](const G4int& idx);
|
||||
inline iterator Begin();
|
||||
inline iterator End();
|
||||
inline void Clear();
|
||||
inline size_type Size() { return G4Cache<vector_type>::Get().size(); } //Needs to be here for a VC9 compilation problem
|
||||
inline size_type Size() { return G4Cache<vector_type>::Get().size(); }
|
||||
// Needs to be here for a VC9 compilation problem
|
||||
};
|
||||
|
||||
|
||||
// a Map version of the cache. Implemetns std::map interface.
|
||||
// a Map version of the cache. Implements std::map interface.
|
||||
// Can be used directly as a std::map would be used.
|
||||
// KEYTYPE being the key type and VALTYPE the value type.
|
||||
#include <map>
|
||||
//
|
||||
template<class KEYTYPE, class VALTYPE>
|
||||
class G4MapCache : public G4Cache<std::map<KEYTYPE,VALTYPE> > {
|
||||
public:
|
||||
//Some useful definitions
|
||||
class G4MapCache : public G4Cache<std::map<KEYTYPE,VALTYPE> >
|
||||
{
|
||||
public:
|
||||
|
||||
// Some useful definitions
|
||||
//
|
||||
typedef KEYTYPE key_type;
|
||||
typedef VALTYPE value_type;
|
||||
typedef typename std::map<key_type,value_type> map_type;
|
||||
@@ -189,124 +201,123 @@ public:
|
||||
// Returns true if map contains element corresponding to key k
|
||||
|
||||
// Interface with functionalities of similar name of std::map
|
||||
inline std::pair<iterator,G4bool> Insert( const key_type& k , const value_type& v );
|
||||
//
|
||||
inline std::pair<iterator,G4bool> Insert( const key_type& k ,
|
||||
const value_type& v );
|
||||
inline iterator Begin();
|
||||
inline iterator End();
|
||||
inline iterator Find(const key_type& k );
|
||||
inline value_type& Get(const key_type& k );
|
||||
inline size_type Erase(const key_type& k );
|
||||
inline value_type& operator[](const key_type& k);
|
||||
inline size_type Size() { return G4Cache<map_type>::Get().size(); } //Needs to be here for a VC9 compilation problem
|
||||
inline size_type Size() { return G4Cache<map_type>::Get().size(); }
|
||||
// Needs to be here for a VC9 compilation problem
|
||||
};
|
||||
|
||||
|
||||
|
||||
//=============================================================
|
||||
// Implementation details follow
|
||||
//=============================================================
|
||||
|
||||
|
||||
|
||||
#ifdef g4cdebug
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
using std::cout;
|
||||
using std::endl;
|
||||
#endif
|
||||
|
||||
#include "G4AutoLock.hh"
|
||||
|
||||
|
||||
//========= Implementation: G4Cache<V>
|
||||
//========= Implementation: G4Cache<V> ====================================
|
||||
|
||||
template<class V>
|
||||
G4Cache<V>::G4Cache()
|
||||
{
|
||||
G4AutoLock l(G4TypeMutex<G4Cache<V>>());
|
||||
G4AutoLock l(G4TypeMutex<G4Cache<V>>());
|
||||
id = instancesctr++;
|
||||
#ifdef g4cdebug
|
||||
cout<<"G4Cache id: "<<id<<endl;
|
||||
std::cout << "G4Cache id: " << id << std::endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
template<class V>
|
||||
G4Cache<V>::G4Cache(const G4Cache<V>& rhs)
|
||||
{
|
||||
//Copy is special, we need to copy the content
|
||||
//of the cache, not the cache object
|
||||
if ( this == &rhs ) return;
|
||||
G4AutoLock l(G4TypeMutex<G4Cache<V>>());
|
||||
id = instancesctr++;
|
||||
//Force copy of cached data
|
||||
V aCopy = rhs.GetCache();
|
||||
Put( aCopy );
|
||||
// Copy is special, we need to copy the content
|
||||
// of the cache, not the cache object
|
||||
|
||||
if ( this == &rhs ) return;
|
||||
G4AutoLock l(G4TypeMutex<G4Cache<V>>());
|
||||
id = instancesctr++;
|
||||
|
||||
// Force copy of cached data
|
||||
//
|
||||
V aCopy = rhs.GetCache();
|
||||
Put( aCopy );
|
||||
|
||||
#ifdef g4cdebug
|
||||
cout<<"Copy constructor with id: "<<id<<endl;
|
||||
std::cout << "Copy constructor with id: " << id << std::endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
template<class V>
|
||||
G4Cache<V>& G4Cache<V>::operator=(const G4Cache<V>& rhs)
|
||||
{
|
||||
if (this == &rhs) return *this;
|
||||
//Force copy of cached data
|
||||
V aCopy = rhs.GetCache();
|
||||
Put(aCopy);
|
||||
if (this == &rhs) return *this;
|
||||
|
||||
// Force copy of cached data
|
||||
//
|
||||
V aCopy = rhs.GetCache();
|
||||
Put(aCopy);
|
||||
|
||||
#ifdef g4cdebug
|
||||
cout<<"Assignement operator with id: "<<id<<endl;
|
||||
std::cout << "Assignement operator with id: " << id << std::endl;
|
||||
#endif
|
||||
return *this;
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<class V>
|
||||
G4Cache<V>::G4Cache(const V& v)
|
||||
{
|
||||
G4AutoLock l(G4TypeMutex<G4Cache<V>>());
|
||||
id = instancesctr++;
|
||||
G4AutoLock l(G4TypeMutex<G4Cache<V>>());
|
||||
id = instancesctr++;
|
||||
Put(v);
|
||||
|
||||
#ifdef g4cdebug
|
||||
cout<<"G4Cache id: "<<id<<" "<<endl;
|
||||
std::cout << "G4Cache id: " << id << std::endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
template<class V>
|
||||
G4Cache<V>::~G4Cache()
|
||||
{ //Move base calss
|
||||
{
|
||||
#ifdef g4cdebug
|
||||
cout<<"~G4Cache id: "<<id<<" "<<endl;
|
||||
std::cout << "~G4Cache id: " << id << std::endl;
|
||||
#endif
|
||||
// don't automatically lock --> wait until we can catch an error
|
||||
// without scoping the G4AutoLock
|
||||
//
|
||||
G4AutoLock l(G4TypeMutex<G4Cache<V>>(), std::defer_lock);
|
||||
|
||||
// sometimes the mutex is unavailable in destructors so
|
||||
// try to lock the associated mutex, but catch if fails
|
||||
// try to lock the associated mutex, but catch if it fails
|
||||
try
|
||||
{
|
||||
// a system_error in lock means that the mutex is unavailable
|
||||
// we want to throw the error that comes from locking an unavailable
|
||||
// mutex so that we know there is a memory leak
|
||||
// if the mutex is valid, this will hold until the other thread finishes
|
||||
l.lock();
|
||||
// a system_error in lock means that the mutex is unavailable
|
||||
// we want to throw the error that comes from locking an unavailable
|
||||
// mutex so that we know there is a memory leak
|
||||
// if the mutex is valid, this will hold until the other thread finishes
|
||||
//
|
||||
l.lock();
|
||||
}
|
||||
catch (std::system_error& e)
|
||||
{
|
||||
// the error that comes from locking an unavailable mutex
|
||||
// the error that comes from locking an unavailable mutex
|
||||
#ifdef G4VERBOSE
|
||||
G4cout << "Non-critical error: mutex lock failure in ~G4Cache<"
|
||||
<< typeid(V).name() << ">. "
|
||||
<< "If the RunManagerKernel has been deleted, it failed to "
|
||||
<< "delete an allocated resource and this destructor is being "
|
||||
<< "called after the statics were destroyed." << G4endl;
|
||||
G4cout << "Exception: [code: " << e.code() << "] caught: "
|
||||
<< e.what() << G4endl;
|
||||
G4cout << "Non-critical error: mutex lock failure in ~G4Cache<"
|
||||
<< typeid(V).name() << ">. " << G4endl
|
||||
<< "If the RunManagerKernel has been deleted, it failed to "
|
||||
<< "delete an allocated resource" << G4endl
|
||||
<< "and this destructor is being called after the statics "
|
||||
<< "were destroyed." << G4endl;
|
||||
G4cout << "Exception: [code: " << e.code() << "] caught: "
|
||||
<< e.what() << G4endl;
|
||||
#endif
|
||||
}
|
||||
++dstrctr;
|
||||
++dstrctr;
|
||||
G4bool last = ( dstrctr == instancesctr );
|
||||
theCache.Destroy(id, last);
|
||||
if (last) {
|
||||
instancesctr.store(0);
|
||||
dstrctr.store(0);
|
||||
if (last)
|
||||
{
|
||||
instancesctr.store(0);
|
||||
dstrctr.store(0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -318,7 +329,7 @@ template<class V>
|
||||
void G4Cache<V>::Put( const V& val ) const
|
||||
{ GetCache() = val; }
|
||||
|
||||
//Should here remove from cache element?
|
||||
// Should here remove from cache element?
|
||||
template<class V>
|
||||
V G4Cache<V>::Pop()
|
||||
{ return GetCache(); }
|
||||
@@ -329,29 +340,36 @@ std::atomic<unsigned int> G4Cache<V>::instancesctr(0);
|
||||
template<class V>
|
||||
std::atomic<unsigned int> G4Cache<V>::dstrctr(0);
|
||||
|
||||
//========== Implementation: G4VectorCache<V>
|
||||
|
||||
//========== Implementation: G4VectorCache<V> ===========================
|
||||
|
||||
template<class V>
|
||||
G4VectorCache<V>::G4VectorCache()
|
||||
{ }
|
||||
|
||||
template<class V>
|
||||
G4VectorCache<V>::~G4VectorCache() {
|
||||
G4VectorCache<V>::~G4VectorCache()
|
||||
{
|
||||
#ifdef g4cdebug
|
||||
cout<<"~G4VectorCache "<<G4Cache<G4VectorCache<V>::vector_type>::GetId()<<" with size: "<<Size()<<"->";
|
||||
std::cout << "~G4VectorCache "
|
||||
<< G4Cache<G4VectorCache<V>::vector_type>::GetId()
|
||||
<< " with size: " << Size() << "->";
|
||||
for ( size_type i = 0 ; i < Size() ; ++i )
|
||||
cout<<operator[](i)<<",";
|
||||
cout<<"<-"<<endl;
|
||||
std::cout << operator[](i) << ",";
|
||||
std::cout << "<-" << std::endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
template<class V>
|
||||
G4VectorCache<V>::G4VectorCache(G4int nElems ) {
|
||||
G4VectorCache<V>::G4VectorCache(G4int nElems )
|
||||
{
|
||||
vector_type& cc = G4Cache<vector_type>::Get();
|
||||
cc.resize(nElems);
|
||||
}
|
||||
|
||||
template<class V>
|
||||
G4VectorCache<V>::G4VectorCache(G4int nElems , V* vals ) {
|
||||
G4VectorCache<V>::G4VectorCache(G4int nElems , V* vals )
|
||||
{
|
||||
vector_type& cc = G4Cache<vector_type>::Get();
|
||||
cc.resize(nElems);
|
||||
for ( G4int idx = 0 ; idx < nElems ; ++idx )
|
||||
@@ -404,15 +422,17 @@ void G4VectorCache<V>::Clear()
|
||||
// return G4Cache<vector_type>::Get().size();
|
||||
//}
|
||||
|
||||
//======== Implementation: G4MapType<K,V>
|
||||
//======== Implementation: G4MapType<K,V> ===========================
|
||||
|
||||
template<class K, class V>
|
||||
G4MapCache<K,V>::~G4MapCache()
|
||||
{
|
||||
#ifdef g4cdebug
|
||||
cout<<"~G4MacCache "<<G4Cache<map_type>::GetId()<<" with size: "<<Size()<<"->";
|
||||
std::cout << "~G4MacCache " << G4Cache<map_type>::GetId()
|
||||
<< " with size: " << Size() << "->";
|
||||
for ( iterator it = Begin() ; it != End() ; ++it )
|
||||
cout<<it->first<<":"<<it->second<<",";
|
||||
cout<<"<-"<<endl;
|
||||
std::cout<<it->first << ":" << it->second << ",";
|
||||
std::cout << "<-" << std::endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -420,7 +440,7 @@ template<class K, class V>
|
||||
std::pair<typename G4MapCache<K,V>::iterator,G4bool>
|
||||
G4MapCache<K,V>::Insert(const K& k, const V& v)
|
||||
{
|
||||
return G4Cache<map_type>::Get().insert( std::pair<key_type,value_type>(k,v) );
|
||||
return G4Cache<map_type>::Get().insert(std::pair<key_type,value_type>(k,v));
|
||||
}
|
||||
|
||||
//template<class K, class V>
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
// ---------------------------------------------------------------
|
||||
// GEANT 4 class header file
|
||||
@@ -36,17 +35,17 @@
|
||||
// are used by one of the G4Cache classes.
|
||||
//
|
||||
// G4Cache is a container of the cached value.
|
||||
// Not memory efficient, but CPU efficient (constant time access)
|
||||
// Not memory efficient, but CPU efficient (constant time access).
|
||||
// A different version with a map instead of a vector should be
|
||||
// memory efficient and less CPU efficient (log-time access).
|
||||
// If really a lot of these objects are used
|
||||
// we may want to consider the map version to save some memory
|
||||
// we may want to consider the map version to save some memory.
|
||||
//
|
||||
// These are simplified "split-classes" without any
|
||||
// copy-from-master logic. Each cached object is associated
|
||||
// a unique identified (an integer), that references an instance
|
||||
// of the cached value (of template type VALTYPE) in a
|
||||
// static TLS data structure
|
||||
// static TLS data structure.
|
||||
//
|
||||
// In case the cache is used for a cached object the object class
|
||||
// has to provide a default constructor. Alternatively pointers to
|
||||
@@ -58,8 +57,8 @@
|
||||
// 21 Oct 2013: A. Dotti - First implementation
|
||||
//
|
||||
// Todos: - Understand if map based class can be more efficent than
|
||||
// vector one
|
||||
// - Evaluate use of specialized allocator for TLS "new"
|
||||
// vector one.
|
||||
// - Evaluate use of specialized allocator for TLS "new".
|
||||
// ------------------------------------------------------------
|
||||
|
||||
#ifndef G4CacheDetails_hh
|
||||
@@ -69,13 +68,6 @@
|
||||
#include "G4Threading.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
#ifdef g4cdebug
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
using std::cout;
|
||||
using std::endl;
|
||||
#endif
|
||||
|
||||
// A TLS storage for a cache of type VALTYPE
|
||||
//
|
||||
template<class VALTYPE> class G4CacheReference
|
||||
@@ -141,28 +133,28 @@ template<> class G4CacheReference<G4double>
|
||||
};
|
||||
|
||||
|
||||
//================================
|
||||
// Implementation details follow
|
||||
//================================
|
||||
|
||||
//======= Implementation: G4CacheReference<V>
|
||||
//===========================================
|
||||
|
||||
template<class V>
|
||||
void G4CacheReference<V>::Initialize( unsigned int id )
|
||||
{
|
||||
#ifdef g4cdebug
|
||||
if ( cache() == 0 )
|
||||
cout<<"Generic template"<<endl;
|
||||
#endif
|
||||
|
||||
// Create cache container
|
||||
if ( cache() == 0 )
|
||||
{
|
||||
#ifdef g4cdebug
|
||||
std::cout << "Generic template container..." << std::endl;
|
||||
#endif
|
||||
cache() = new cache_container;
|
||||
}
|
||||
if ( cache()->size() <= id )
|
||||
{
|
||||
cache()->resize(id+1,static_cast<V*>(0));
|
||||
}
|
||||
if ( (*cache())[id] == 0 )
|
||||
{
|
||||
(*cache())[id]=new V;
|
||||
}
|
||||
}
|
||||
|
||||
template<class V>
|
||||
@@ -171,7 +163,8 @@ void G4CacheReference<V>::Destroy( unsigned int id, G4bool last )
|
||||
if ( cache() )
|
||||
{
|
||||
#ifdef g4cdebug
|
||||
cout<<"Destroying element"<<id<<" is last?"<<last<<endl;
|
||||
std::cout << "V: Destroying element "<< id
|
||||
<< " is last? " << last << std::endl;
|
||||
#endif
|
||||
if ( cache()->size() < id )
|
||||
{
|
||||
@@ -186,11 +179,18 @@ void G4CacheReference<V>::Destroy( unsigned int id, G4bool last )
|
||||
}
|
||||
if ( cache()->size() > id && (*cache())[id] )
|
||||
{
|
||||
#ifdef g4cdebug
|
||||
std::cout << "V: Destroying element " << id
|
||||
<< " size: " << cache()->size() << std::endl;
|
||||
#endif
|
||||
delete (*cache())[id];
|
||||
(*cache())[id]=0;
|
||||
}
|
||||
if (last)
|
||||
{
|
||||
#ifdef g4cdebug
|
||||
std::cout << "V: Destroying LAST element!" << std::endl;
|
||||
#endif
|
||||
delete cache();
|
||||
cache() = 0;
|
||||
}
|
||||
@@ -217,14 +217,17 @@ G4CacheReference<V>::cache()
|
||||
template<class V>
|
||||
void G4CacheReference<V*>::Initialize( unsigned int id )
|
||||
{
|
||||
if ( cache() == 0 )
|
||||
{
|
||||
#ifdef g4cdebug
|
||||
if ( cache() == 0 )
|
||||
cout<<"Pointer template"<<endl;
|
||||
std::cout << "Pointer template container..." << std::endl;
|
||||
#endif
|
||||
if ( cache() == 0 )
|
||||
cache() = new cache_container;
|
||||
}
|
||||
if ( cache()->size() <= id )
|
||||
{
|
||||
cache()->resize(id+1,static_cast<V*>(0));
|
||||
}
|
||||
}
|
||||
|
||||
template<class V>
|
||||
@@ -233,8 +236,8 @@ inline void G4CacheReference<V*>::Destroy( unsigned int id , G4bool last )
|
||||
if ( cache() )
|
||||
{
|
||||
#ifdef g4cdebug
|
||||
cout << "Destroying element" << id << " is last?" << last
|
||||
<< "-Pointer template specialization-" << endl;
|
||||
std::cout << "V*: Destroying element " << id << " is last? " << last
|
||||
<< std::endl;
|
||||
#endif
|
||||
if ( cache()->size() < id )
|
||||
{
|
||||
@@ -250,11 +253,18 @@ inline void G4CacheReference<V*>::Destroy( unsigned int id , G4bool last )
|
||||
if ( cache()->size() > id && (*cache())[id] )
|
||||
{
|
||||
// Ownership is for client
|
||||
// delete (*cache)[id];
|
||||
// delete (*cache())[id];
|
||||
#ifdef g4cdebug
|
||||
std::cout << "V*: Resetting element " << id
|
||||
<< " size: " << cache()->size() << std::endl;
|
||||
#endif
|
||||
(*cache())[id]=0;
|
||||
}
|
||||
if (last )
|
||||
{
|
||||
#ifdef g4cdebug
|
||||
std::cout << "V*: Deleting LAST element!" << std::endl;
|
||||
#endif
|
||||
delete cache();
|
||||
cache() = 0;
|
||||
}
|
||||
@@ -280,26 +290,26 @@ G4CacheReference<V*>::cache()
|
||||
|
||||
void G4CacheReference<G4double>::Initialize( unsigned int id )
|
||||
{
|
||||
#ifdef g4cdebug
|
||||
cout<<"Specialized template for G4double"<<endl;
|
||||
#endif
|
||||
if ( cache() == 0 )
|
||||
{
|
||||
#ifdef g4cdebug
|
||||
std::cout << "Specialized template for G4double container..." << std::endl;
|
||||
#endif
|
||||
cache() = new cache_container;
|
||||
}
|
||||
if ( cache()->size() <= id )
|
||||
{
|
||||
cache()->resize(id+1,static_cast<G4double>(0));
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef g4cdebug
|
||||
void G4CacheReference<G4double>::Destroy( unsigned int id , G4bool last)
|
||||
#else
|
||||
void G4CacheReference<G4double>::Destroy( unsigned int /*id*/ , G4bool last)
|
||||
#endif
|
||||
{
|
||||
if ( cache() && last )
|
||||
{
|
||||
#ifdef g4cdebug
|
||||
cout << "Destroying element" << id << " is last?" << last
|
||||
<< "-Pointer template specialization-" << endl;
|
||||
std::cout << "DB: Destroying LAST element! Is it last? " << last
|
||||
<< std::endl;
|
||||
#endif
|
||||
delete cache();
|
||||
cache() = 0;
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4DataVector.hh 67970 2013-03-13 10:10:06Z gcosmo $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4DataVector.icc 67970 2013-03-13 10:10:06Z gcosmo $
|
||||
//
|
||||
//
|
||||
// class G4DataVector inline implementation
|
||||
|
||||
@@ -0,0 +1,238 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// Global environment utility functions:
|
||||
//
|
||||
// G4GetEnv<T>
|
||||
// Simplifies getting environment variables
|
||||
// Automatic conversion to non-string types
|
||||
// Records the values used from the environment
|
||||
// G4GetDataEnv
|
||||
// For data library paths
|
||||
// Will issue a G4Exception if not set
|
||||
// G4PrintEnv
|
||||
// Provide a way for users to determine (and log) the environment
|
||||
// variables were used as settings in simulation
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
#ifndef G4ENVIRONMENTUTILS_HH_
|
||||
#define G4ENVIRONMENTUTILS_HH_
|
||||
|
||||
#include <cstdlib>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <map>
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <mutex>
|
||||
|
||||
#include "G4ios.hh"
|
||||
#include "G4String.hh"
|
||||
#include "G4Exception.hh"
|
||||
#include "G4ExceptionSeverity.hh"
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
class G4EnvSettings
|
||||
{
|
||||
// Static singleton class storing environment variables and
|
||||
// their values that were used by Geant4 in the simulation
|
||||
|
||||
public:
|
||||
typedef std::string string_t;
|
||||
typedef std::map<string_t, string_t> env_map_t;
|
||||
typedef std::pair<string_t, string_t> env_pair_t;
|
||||
|
||||
public:
|
||||
static G4EnvSettings* GetInstance()
|
||||
{
|
||||
static G4EnvSettings* _instance = new G4EnvSettings();
|
||||
return _instance;
|
||||
}
|
||||
|
||||
public:
|
||||
template <typename _Tp>
|
||||
void insert(const std::string& env_id, _Tp val)
|
||||
{
|
||||
std::stringstream ss;
|
||||
ss << val;
|
||||
// lock for MT mode, use C++ type not Geant4 because this file
|
||||
// is included by the those headers
|
||||
static std::mutex _mutex;
|
||||
_mutex.lock();
|
||||
m_env.insert(env_pair_t(env_id, ss.str()));
|
||||
_mutex.unlock();
|
||||
}
|
||||
|
||||
const env_map_t& get() const { return m_env; }
|
||||
|
||||
friend std::ostream& operator<<(std::ostream& os, const G4EnvSettings& env)
|
||||
{
|
||||
std::stringstream filler;
|
||||
filler.fill('#');
|
||||
filler << std::setw(90) << "";
|
||||
std::stringstream ss;
|
||||
ss << filler.str() << "\n# Environment settings:\n";
|
||||
for(const auto& itr : env.get())
|
||||
{
|
||||
ss << "# " << std::setw(35) << std::right << itr.first
|
||||
<< "\t = \t" << std::left << itr.second << "\n";
|
||||
}
|
||||
ss << filler.str();
|
||||
os << ss.str() << std::endl;
|
||||
return os;
|
||||
}
|
||||
|
||||
private:
|
||||
env_map_t m_env;
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Use this function to get an environment variable setting +
|
||||
// a default if not defined, e.g.
|
||||
// int num_threads =
|
||||
// G4GetEnv<int>("G4FORCENUMBEROFTHREADS",
|
||||
// std::thread::hardware_concurrency());
|
||||
template <typename _Tp>
|
||||
_Tp G4GetEnv(const std::string& env_id, _Tp _default = _Tp())
|
||||
{
|
||||
char* env_var = std::getenv(env_id.c_str());
|
||||
if(env_var)
|
||||
{
|
||||
std::string str_var = std::string(env_var);
|
||||
std::istringstream iss(str_var);
|
||||
_Tp var = _Tp();
|
||||
iss >> var;
|
||||
// record value defined by environment
|
||||
G4EnvSettings::GetInstance()->insert<_Tp>(env_id, var);
|
||||
return var;
|
||||
}
|
||||
// record default value
|
||||
G4EnvSettings::GetInstance()->insert<_Tp>(env_id, _default);
|
||||
|
||||
// return default if not specified in environment
|
||||
return _default;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Use this function to get an environment variable setting +
|
||||
// a default if not defined, e.g.
|
||||
// int num_threads =
|
||||
// GetEnv<int>("FORCENUMBEROFTHREADS",
|
||||
// std::thread::hardware_concurrency());
|
||||
template <> inline
|
||||
G4bool G4GetEnv(const std::string& env_id, bool _default)
|
||||
{
|
||||
char* env_var = std::getenv(env_id.c_str());
|
||||
if(env_var)
|
||||
{
|
||||
// record value defined by environment
|
||||
G4EnvSettings::GetInstance()->insert<bool>(env_id, true);
|
||||
return true;
|
||||
}
|
||||
// record default value
|
||||
G4EnvSettings::GetInstance()->insert<bool>(env_id, false);
|
||||
|
||||
// return default if not specified in environment
|
||||
return _default;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Use this function to get an environment variable setting +
|
||||
// a default if not defined and a message about the setting, e.g.
|
||||
// int num_threads =
|
||||
// G4GetEnv<int>("G4FORCENUMBEROFTHREADS",
|
||||
// std::thread::hardware_concurrency(),
|
||||
// "Forcing number of threads");
|
||||
template <typename _Tp>
|
||||
_Tp G4GetEnv(const std::string& env_id, _Tp _default, const std::string& msg)
|
||||
{
|
||||
char* env_var = std::getenv(env_id.c_str());
|
||||
if(env_var)
|
||||
{
|
||||
std::string str_var = std::string(env_var);
|
||||
std::istringstream iss(str_var);
|
||||
_Tp var = _Tp();
|
||||
iss >> var;
|
||||
G4cout << "Environment variable \"" << env_id << "\" enabled with "
|
||||
<< "value == " << var << ". " << msg << G4endl;
|
||||
// record value defined by environment
|
||||
G4EnvSettings::GetInstance()->insert<_Tp>(env_id, var);
|
||||
return var;
|
||||
}
|
||||
// record default value
|
||||
G4EnvSettings::GetInstance()->insert<_Tp>(env_id, _default);
|
||||
|
||||
// return default if not specified in environment
|
||||
return _default;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Use this function to get a data directory environment variable setting +
|
||||
// and raise a G4Exception if the value is not set, e.g.
|
||||
//
|
||||
// G4String filename = G4GetDataEnv("G4ENSDFSTATEDATA",
|
||||
// "G4NuclideTable", "PART70000",
|
||||
// FatalException,
|
||||
// "G4ENSDFSTATEDATA environment variable"
|
||||
// " must be set");
|
||||
inline G4String
|
||||
G4GetDataEnv(const std::string& env_id,
|
||||
const char* originOfException,
|
||||
const char* exceptionCode,
|
||||
G4ExceptionSeverity severity,
|
||||
const char* description)
|
||||
{
|
||||
char* env_var = std::getenv(env_id.c_str());
|
||||
if(env_var)
|
||||
{
|
||||
std::string str_var = std::string(env_var);
|
||||
std::istringstream iss(str_var);
|
||||
G4String var = "";
|
||||
iss >> var;
|
||||
// record value defined by environment
|
||||
G4EnvSettings::GetInstance()->insert<G4String>(env_id, var);
|
||||
return var;
|
||||
}
|
||||
|
||||
// issue an exception
|
||||
G4Exception(originOfException, exceptionCode, severity, description);
|
||||
|
||||
// return default initialized
|
||||
return "";
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Use this function to print the environment
|
||||
//
|
||||
inline void G4PrintEnv(std::ostream& os = G4cout)
|
||||
{
|
||||
os << (*G4EnvSettings::GetInstance());
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------//
|
||||
|
||||
#endif /* G4ENVIRONMENTUTILS_HH_ */
|
||||
@@ -24,7 +24,6 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4ErrorPropagatorData.hh 67970 2013-03-13 10:10:06Z gcosmo $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4ErrorPropagatorData.icc 67970 2013-03-13 10:10:06Z gcosmo $
|
||||
//
|
||||
//
|
||||
// Class G4ErrorPropagatorData inline implementation
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id:$
|
||||
//
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id:$
|
||||
//
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
@@ -39,7 +38,6 @@
|
||||
|
||||
#include "G4ios.hh"
|
||||
#include "G4String.hh"
|
||||
#include "G4StateManager.hh"
|
||||
#include "G4VExceptionHandler.hh"
|
||||
|
||||
typedef std::ostringstream G4ExceptionDescription;
|
||||
@@ -62,88 +60,20 @@ inline const G4String G4ExceptionWarnBannerEnd()
|
||||
return "\n-------- WWWW ------- G4Exception-END -------- WWWW -------\n";
|
||||
}
|
||||
|
||||
inline void G4Exception(const char* originOfException,
|
||||
extern void G4Exception(const char* originOfException,
|
||||
const char* exceptionCode,
|
||||
G4ExceptionSeverity severity,
|
||||
const char* description)
|
||||
{
|
||||
G4VExceptionHandler* exceptionHandler
|
||||
= G4StateManager::GetStateManager()->GetExceptionHandler();
|
||||
G4bool toBeAborted = true;
|
||||
if(exceptionHandler)
|
||||
{
|
||||
toBeAborted = exceptionHandler
|
||||
->Notify(originOfException,exceptionCode,severity,description);
|
||||
}
|
||||
else
|
||||
{
|
||||
static const G4String& es_banner = G4ExceptionErrBannerStart();
|
||||
static const G4String& ee_banner = G4ExceptionErrBannerEnd();
|
||||
static const G4String& ws_banner = G4ExceptionWarnBannerStart();
|
||||
static const G4String& we_banner = G4ExceptionWarnBannerEnd();
|
||||
std::ostringstream message;
|
||||
message << "\n*** ExceptionHandler is not defined ***\n"
|
||||
<< "*** G4Exception : " << exceptionCode << G4endl
|
||||
<< " issued by : " << originOfException << G4endl
|
||||
<< description << G4endl;
|
||||
switch(severity)
|
||||
{
|
||||
case FatalException:
|
||||
G4cerr << es_banner << message.str() << "*** Fatal Exception ***"
|
||||
<< ee_banner << G4endl;
|
||||
break;
|
||||
case FatalErrorInArgument:
|
||||
G4cerr << es_banner << message.str() << "*** Fatal Error In Argument ***"
|
||||
<< ee_banner << G4endl;
|
||||
break;
|
||||
case RunMustBeAborted:
|
||||
G4cerr << es_banner << message.str() << "*** Run Must Be Aborted ***"
|
||||
<< ee_banner << G4endl;
|
||||
break;
|
||||
case EventMustBeAborted:
|
||||
G4cerr << es_banner << message.str() << "*** Event Must Be Aborted ***"
|
||||
<< ee_banner << G4endl;
|
||||
break;
|
||||
default:
|
||||
G4cout << ws_banner << message.str()
|
||||
<< "*** This is just a warning message. ***"
|
||||
<< we_banner << G4endl;
|
||||
toBeAborted = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(toBeAborted)
|
||||
{
|
||||
if(G4StateManager::GetStateManager()->SetNewState(G4State_Abort))
|
||||
{
|
||||
G4cerr << G4endl << "*** G4Exception: Aborting execution ***" << G4endl;
|
||||
abort();
|
||||
}
|
||||
else
|
||||
{
|
||||
G4cerr << G4endl << "*** G4Exception: Abortion suppressed ***"
|
||||
<< G4endl << "*** No guarantee for further execution ***" << G4endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
const char* description);
|
||||
|
||||
inline void G4Exception(const char* originOfException,
|
||||
extern void G4Exception(const char* originOfException,
|
||||
const char* exceptionCode,
|
||||
G4ExceptionSeverity severity,
|
||||
G4ExceptionDescription & description)
|
||||
{
|
||||
G4String des = description.str();
|
||||
G4Exception(originOfException, exceptionCode, severity, des.c_str());
|
||||
}
|
||||
G4ExceptionDescription & description);
|
||||
|
||||
inline void G4Exception(const char* originOfException,
|
||||
extern void G4Exception(const char* originOfException,
|
||||
const char* exceptionCode,
|
||||
G4ExceptionSeverity severity,
|
||||
G4ExceptionDescription & description,
|
||||
const char* comments)
|
||||
{
|
||||
description << comments << G4endl;
|
||||
G4Exception(originOfException, exceptionCode, severity, description);
|
||||
}
|
||||
const char* comments);
|
||||
|
||||
#endif /* G4EXCEPTION_HH */
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4ExceptionSeverity.hh 67970 2013-03-13 10:10:06Z gcosmo $
|
||||
//
|
||||
// Class Description:
|
||||
//
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id:$
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4FPEDetection.hh 108434 2018-02-14 07:20:56Z gcosmo $
|
||||
//
|
||||
//
|
||||
// -*- C++ -*-
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4FastVector.hh 67970 2013-03-13 10:10:06Z gcosmo $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4FilecoutDestination.hh 103582 2017-04-18 17:24:45Z adotti $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4GeometryTolerance.hh 96427 2016-04-14 09:37:29Z gcosmo $
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// GEANT 4 class header file
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4LPhysicsFreeVector.hh 98864 2016-08-15 11:53:26Z gcosmo $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------------
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4LockcoutDestination.hh 103582 2017-04-18 17:24:45Z adotti $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id:$
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
// ---------------------------------------------------------------
|
||||
// GEANT 4 class header file
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4MTcoutDestination.hh 66241 2012-12-13 18:34:42Z gunter $
|
||||
//
|
||||
//
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4MasterForwardcoutDestination.hh 103582 2017-04-18 17:24:45Z adotti $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4MulticoutDestination.hh 103582 2017-04-18 17:24:45Z adotti $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4OrderedTable.hh 67970 2013-03-13 10:10:06Z gcosmo $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id:$
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id:$
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
@@ -111,7 +110,7 @@ inline size_t G4Physics2DVector::FindBin(G4double z,
|
||||
id = 0;
|
||||
} else if(z >= v[idxmax-2]) {
|
||||
id = idxmax - 2;
|
||||
} else if(z < v[idx] || z >= v[idx+1]) {
|
||||
} else if(idx > idxmax-2 || z < v[idx] || z >= v[idx+1]) {
|
||||
id = FindBinLocation(z, v);
|
||||
}
|
||||
return id;
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4PhysicsFreeVector.hh 98864 2016-08-15 11:53:26Z gcosmo $
|
||||
//
|
||||
//
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4PhysicsLinearVector.hh 98864 2016-08-15 11:53:26Z gcosmo $
|
||||
//
|
||||
//
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4PhysicsLnVector.hh 98864 2016-08-15 11:53:26Z gcosmo $
|
||||
//
|
||||
//
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4PhysicsLogVector.hh 98864 2016-08-15 11:53:26Z gcosmo $
|
||||
//
|
||||
//
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4PhysicsModelCatalog.hh 67281 2013-02-13 14:41:55Z gcosmo $
|
||||
//
|
||||
//
|
||||
// -----------------------------------------------------------------
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4PhysicsOrderedFreeVector.hh 98864 2016-08-15 11:53:26Z gcosmo $
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// PhysicsOrderedFreeVector Class Definition
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4PhysicsTable.hh 98864 2016-08-15 11:53:26Z gcosmo $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4PhysicsTable.icc 98864 2016-08-15 11:53:26Z gcosmo $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4PhysicsVector.hh 98864 2016-08-15 11:53:26Z gcosmo $
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4PhysicsVector.icc 98864 2016-08-15 11:53:26Z gcosmo $
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
@@ -219,7 +218,7 @@ inline size_t G4PhysicsVector::FindBin(G4double e, size_t idx) const
|
||||
id = 0;
|
||||
} else if(e >= binVector[numberOfNodes-2]) {
|
||||
id = numberOfNodes - 2;
|
||||
} else if(idx >= numberOfNodes || e < binVector[idx]
|
||||
} else if(idx >= numberOfNodes-2 || e < binVector[idx]
|
||||
|| e > binVector[idx+1]) {
|
||||
id = FindBinLocation(e);
|
||||
}
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4PhysicsVectorType.hh 67970 2013-03-13 10:10:06Z gcosmo $
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
//
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4Pow.hh 109086 2018-03-26 08:20:25Z gcosmo $
|
||||
//
|
||||
//
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4ReferenceCountedHandle.hh 110251 2018-05-17 14:09:28Z gcosmo $
|
||||
//
|
||||
//
|
||||
// Class G4ReferenceCountedHandle
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4RotationMatrix.hh 67970 2013-03-13 10:10:06Z gcosmo $
|
||||
//
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4SIunits.hh 96706 2016-05-02 09:31:38Z gcosmo $
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
//
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4SliceTimer.hh 110674 2018-06-07 10:30:11Z gcosmo $
|
||||
//
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4SliceTimer.icc 67970 2013-03-13 10:10:06Z gcosmo $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4StateManager.hh 110286 2018-05-18 09:40:01Z gcosmo $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
@@ -61,85 +60,69 @@
|
||||
class G4StateManager
|
||||
{
|
||||
|
||||
public: // with description
|
||||
public: // with description
|
||||
|
||||
static G4StateManager* GetStateManager();
|
||||
// The G4StateManager class is a singleton class and the pointer
|
||||
// to the only one existing object can be obtained by this static
|
||||
// method.
|
||||
static G4StateManager* GetStateManager();
|
||||
// The G4StateManager class is a singleton class and the pointer
|
||||
// to the only one existing object can be obtained by this static
|
||||
// method.
|
||||
|
||||
protected:
|
||||
~G4StateManager();
|
||||
|
||||
G4StateManager();
|
||||
const G4ApplicationState& GetCurrentState() const;
|
||||
// Returns the current state
|
||||
const G4ApplicationState& GetPreviousState() const;
|
||||
// Returns the previous state
|
||||
G4bool SetNewState(const G4ApplicationState& requestedState);
|
||||
// Set Geant4 to a new state.
|
||||
// In case the request is irregal, false will be returned
|
||||
// and the state of Geant4 will not be changed.
|
||||
G4bool SetNewState(const G4ApplicationState& requestedState,
|
||||
const char* msg);
|
||||
// Set Geant4 to a new state.
|
||||
// In case the request is irregal, false will be returned
|
||||
// and the state of Geant4 will not be changed.
|
||||
// "msg" is information associating to this state change
|
||||
G4bool RegisterDependent(G4VStateDependent* aDependent,G4bool bottom=false);
|
||||
// Register a concrete class of G4VStateDependent.
|
||||
// Registered concrete classes will be notified via
|
||||
// G4VStateDependent::Notify() method when the state of Geant4 changes.
|
||||
// False will be returned if registration fails.
|
||||
G4bool DeregisterDependent(G4VStateDependent* aDependent);
|
||||
// Remove the registration.
|
||||
// False will be returned if aDependent has not been registered.
|
||||
G4VStateDependent* RemoveDependent(const G4VStateDependent* aDependent);
|
||||
// Remove the registration.
|
||||
// Removed pointer is returned.
|
||||
G4String GetStateString(const G4ApplicationState& aState) const;
|
||||
// Utility method which returns a string of the state name.
|
||||
|
||||
public:
|
||||
inline void SetSuppressAbortion(G4int i);
|
||||
inline G4int GetSuppressAbortion() const;
|
||||
inline const char* GetMessage() const;
|
||||
inline void SetExceptionHandler(G4VExceptionHandler* eh);
|
||||
inline G4VExceptionHandler* GetExceptionHandler() const;
|
||||
static void SetVerboseLevel(G4int val);
|
||||
|
||||
~G4StateManager();
|
||||
private:
|
||||
|
||||
public: // with description
|
||||
G4StateManager();
|
||||
G4StateManager(const G4StateManager &right);
|
||||
G4StateManager& operator=(const G4StateManager &right);
|
||||
G4int operator==(const G4StateManager &right) const;
|
||||
G4int operator!=(const G4StateManager &right) const;
|
||||
|
||||
G4ApplicationState GetCurrentState() const;
|
||||
// Returns the current state
|
||||
G4ApplicationState GetPreviousState() const;
|
||||
// Returns the previous state
|
||||
G4bool SetNewState(G4ApplicationState requestedState);
|
||||
// Set Geant4 to a new state.
|
||||
// In case the request is irregal, false will be returned
|
||||
// and the state of Geant4 will not be changed.
|
||||
G4bool SetNewState(G4ApplicationState requestedState, const char* msg);
|
||||
// Set Geant4 to a new state.
|
||||
// In case the request is irregal, false will be returned
|
||||
// and the state of Geant4 will not be changed.
|
||||
// "msg" is information associating to this state change
|
||||
G4bool RegisterDependent(G4VStateDependent* aDependent,G4bool bottom=false);
|
||||
// Register a concrete class of G4VStateDependent.
|
||||
// Registered concrete classes will be notified via
|
||||
// G4VStateDependent::Notify() method when the state of Geant4 changes.
|
||||
// False will be returned if registration fails.
|
||||
G4bool DeregisterDependent(G4VStateDependent* aDependent);
|
||||
// Remove the registration.
|
||||
// False will be returned if aDependent has not been registered.
|
||||
G4VStateDependent* RemoveDependent(const G4VStateDependent* aDependent);
|
||||
// Remove the registration.
|
||||
// Removed pointer is returned.
|
||||
G4String GetStateString(G4ApplicationState aState) const;
|
||||
// Utility method which returns a string of the state name.
|
||||
private:
|
||||
|
||||
public:
|
||||
|
||||
inline void SetSuppressAbortion(G4int i);
|
||||
inline G4int GetSuppressAbortion() const;
|
||||
inline const char* GetMessage() const;
|
||||
inline void SetExceptionHandler(G4VExceptionHandler* eh);
|
||||
inline G4VExceptionHandler* GetExceptionHandler() const;
|
||||
static void SetVerboseLevel(G4int val);
|
||||
|
||||
//void Pause();
|
||||
//void Pause(const char* msg);
|
||||
//void Pause(G4String msg);
|
||||
//// G4UIsession::pauseSession() will be invoked. The argument string "msg"
|
||||
//// will be used as a prompt characters if the session is non-graphical.
|
||||
//// This method can be invoked by any user action class during the event
|
||||
//// loop. After the user's interactions, control goes back to the caller.
|
||||
|
||||
private:
|
||||
|
||||
G4StateManager(const G4StateManager &right);
|
||||
G4StateManager& operator=(const G4StateManager &right);
|
||||
G4int operator==(const G4StateManager &right) const;
|
||||
G4int operator!=(const G4StateManager &right) const;
|
||||
|
||||
private:
|
||||
|
||||
static G4ThreadLocal G4StateManager* theStateManager;
|
||||
G4ApplicationState theCurrentState;
|
||||
G4ApplicationState thePreviousState;
|
||||
std::vector<G4VStateDependent*> theDependentsList;
|
||||
G4VStateDependent* theBottomDependent;
|
||||
G4int suppressAbortion;
|
||||
const char* msgptr;
|
||||
G4VExceptionHandler* exceptionHandler;
|
||||
static G4int verboseLevel;
|
||||
static G4ThreadLocal G4StateManager* theStateManager;
|
||||
G4ApplicationState theCurrentState;
|
||||
G4ApplicationState thePreviousState;
|
||||
std::vector<G4VStateDependent*> theDependentsList;
|
||||
G4VStateDependent* theBottomDependent;
|
||||
G4int suppressAbortion;
|
||||
const char* msgptr;
|
||||
G4VExceptionHandler* exceptionHandler;
|
||||
static G4int verboseLevel;
|
||||
};
|
||||
|
||||
#include "G4StateManager.icc"
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4StateManager.icc 67970 2013-03-13 10:10:06Z gcosmo $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4String.hh 102049 2016-12-19 09:04:20Z gcosmo $
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4String.icc 102049 2016-12-19 09:04:20Z gcosmo $
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id:$
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
// GEANT 4 class header file
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
// ---------------------------------------------------------------
|
||||
// GEANT 4 class header file
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
// ---------------------------------------------------------------
|
||||
// GEANT 4 class header file
|
||||
@@ -38,6 +37,7 @@
|
||||
#ifndef G4Threading_hh
|
||||
#define G4Threading_hh
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4Types.hh"
|
||||
|
||||
#include <chrono>
|
||||
@@ -53,9 +53,9 @@
|
||||
std::this_thread::sleep_for(std::chrono::seconds( tick ))
|
||||
|
||||
// will be used in the future when migrating threading to task-based style
|
||||
//template <typename _Tp> using G4Future = std::future<_Tp>;
|
||||
//template <typename _Tp> using G4SharedFuture = std::shared_future<_Tp>;
|
||||
//template <typename _Tp> using G4Promise = std::promise<_Tp>;
|
||||
template <typename _Tp> using G4Future = std::future<_Tp>;
|
||||
template <typename _Tp> using G4SharedFuture = std::shared_future<_Tp>;
|
||||
template <typename _Tp> using G4Promise = std::promise<_Tp>;
|
||||
|
||||
//
|
||||
// NOTE ON GEANT4 SERIAL BUILDS AND MUTEX/UNIQUE_LOCK
|
||||
@@ -81,8 +81,8 @@
|
||||
//
|
||||
|
||||
// global mutex types
|
||||
typedef std::mutex G4Mutex;
|
||||
typedef std::recursive_mutex G4RecursiveMutex;
|
||||
using G4Mutex = std::mutex;
|
||||
using G4RecursiveMutex = std::recursive_mutex;
|
||||
|
||||
// mutex macros
|
||||
#define G4MUTEX_INITIALIZER {}
|
||||
@@ -99,10 +99,10 @@ template <typename _Tp> using G4Future = std::future<_Tp>;
|
||||
template <typename _Tp> using G4SharedFuture = std::shared_future<_Tp>;
|
||||
|
||||
// Some useful types
|
||||
typedef void* G4ThreadFunReturnType;
|
||||
typedef void* G4ThreadFunArgType;
|
||||
typedef G4int (*thread_lock)(G4Mutex*);
|
||||
typedef G4int (*thread_unlock)(G4Mutex*);
|
||||
using G4ThreadFunReturnType = void*;
|
||||
using G4ThreadFunArgType = void*;
|
||||
using thread_lock = G4int(*)(G4Mutex*); // typedef G4int (*thread_lock)(G4Mutex*);
|
||||
using thread_unlock = G4int(*)(G4Mutex*); // typedef G4int (*thread_unlock)(G4Mutex*);
|
||||
|
||||
// Helper function for getting a unique static mutex for a specific
|
||||
// class or type
|
||||
@@ -152,8 +152,8 @@ G4RecursiveMutex& G4TypeRecursiveMutex(const unsigned int& _n = 0)
|
||||
//==========================================
|
||||
|
||||
// global thread types
|
||||
typedef std::thread G4Thread;
|
||||
typedef std::thread::native_handle_type G4NativeThread;
|
||||
using G4Thread = std::thread;
|
||||
using G4NativeThread = std::thread::native_handle_type;
|
||||
|
||||
// mutex macros
|
||||
#define G4MUTEXLOCK(mutex) { (mutex)->lock(); }
|
||||
@@ -163,7 +163,7 @@ G4RecursiveMutex& G4TypeRecursiveMutex(const unsigned int& _n = 0)
|
||||
#define G4THREADJOIN(worker) (worker).join()
|
||||
|
||||
// std::thread::id does not cast to integer
|
||||
typedef std::thread::id G4Pid_t;
|
||||
using G4Pid_t = std::thread::id;
|
||||
|
||||
// Instead of previous macro taking one argument, define function taking
|
||||
// unlimited arguments
|
||||
@@ -177,10 +177,11 @@ G4RecursiveMutex& G4TypeRecursiveMutex(const unsigned int& _n = 0)
|
||||
//
|
||||
// See G4MTRunManager for example on how to use these
|
||||
//
|
||||
typedef std::condition_variable G4Condition;
|
||||
using G4Condition = std::condition_variable;
|
||||
#define G4CONDITION_INITIALIZER {}
|
||||
#define G4CONDITIONWAIT(cond, lock) (cond)->wait(*lock);
|
||||
#define G4CONDITIONWAITLAMBDA(cond, lock, lambda) (cond)->wait(*lock, lambda);
|
||||
#define G4CONDITIONNOTIFY(cond) (cond)->notify_one();
|
||||
#define G4CONDITIONBROADCAST(cond) (cond)->notify_all();
|
||||
//
|
||||
// we don't define above globally so single-threaded code does not get
|
||||
@@ -196,8 +197,8 @@ G4RecursiveMutex& G4TypeRecursiveMutex(const unsigned int& _n = 0)
|
||||
class G4DummyThread
|
||||
{
|
||||
public:
|
||||
typedef G4int native_handle_type;
|
||||
typedef std::thread::id id;
|
||||
using native_handle_type = G4int;
|
||||
using id = std::thread::id;
|
||||
|
||||
public:
|
||||
// does nothing
|
||||
@@ -226,8 +227,8 @@ G4RecursiveMutex& G4TypeRecursiveMutex(const unsigned int& _n = 0)
|
||||
};
|
||||
|
||||
// global thread types
|
||||
typedef G4DummyThread G4Thread;
|
||||
typedef G4DummyThread::native_handle_type G4NativeThread;
|
||||
using G4Thread = G4DummyThread;
|
||||
using G4NativeThread = G4DummyThread::native_handle_type;
|
||||
|
||||
// mutex macros
|
||||
#define G4MUTEXLOCK(mutex) ;;
|
||||
@@ -236,7 +237,7 @@ G4RecursiveMutex& G4TypeRecursiveMutex(const unsigned int& _n = 0)
|
||||
// Macro to join thread
|
||||
#define G4THREADJOIN(worker) ;;
|
||||
|
||||
typedef G4int G4Pid_t;
|
||||
using G4Pid_t = G4int;
|
||||
|
||||
// Instead of previous macro taking one argument, define function taking
|
||||
// unlimited arguments
|
||||
@@ -246,14 +247,22 @@ G4RecursiveMutex& G4TypeRecursiveMutex(const unsigned int& _n = 0)
|
||||
*worker = G4Thread(func, std::forward<_Args>(args)...);
|
||||
}
|
||||
|
||||
typedef G4int G4Condition;
|
||||
using G4Condition = G4int;
|
||||
#define G4CONDITION_INITIALIZER 1
|
||||
#define G4CONDITIONWAIT( cond, mutex ) { (*cond)++; }
|
||||
#define G4CONDITIONWAITLAMBDA( cond, mutex, lambda ) { (*cond)++; }
|
||||
#define G4CONDITIONBROADCAST( cond ) { (*cond)++; }
|
||||
#define G4CONDITIONWAIT(cond, mutex) G4ConsumeParameters(cond, mutex);
|
||||
#define G4CONDITIONWAITLAMBDA(cond, mutex, lambda) G4ConsumeParameters(cond, mutex, lambda);
|
||||
#define G4CONDITIONNOTIFY(cond) G4ConsumeParameters(cond);
|
||||
#define G4CONDITIONBROADCAST(cond) G4ConsumeParameters(cond);
|
||||
|
||||
#endif //G4MULTITHREADING
|
||||
|
||||
//============================================================================//
|
||||
|
||||
// Define here after G4Thread has been typedef
|
||||
using G4ThreadId = G4Thread::id;
|
||||
|
||||
//============================================================================//
|
||||
|
||||
namespace G4Threading
|
||||
{
|
||||
enum
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4ThreeVector.hh 67970 2013-03-13 10:10:06Z gcosmo $
|
||||
//
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id:$
|
||||
//
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4Timer.hh 110674 2018-06-07 10:30:11Z gcosmo $
|
||||
//
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4Timer.icc 108434 2018-02-14 07:20:56Z gcosmo $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4Tokenizer.hh 102049 2016-12-19 09:04:20Z gcosmo $
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4TwoVector.hh 67970 2013-03-13 10:10:06Z gcosmo $
|
||||
//
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4Types.hh 109033 2018-03-22 11:14:17Z gcosmo $
|
||||
//
|
||||
//
|
||||
// GEANT4 native types
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4UnitsTable.hh 98932 2016-08-18 13:26:49Z gcosmo $
|
||||
//
|
||||
//
|
||||
// -----------------------------------------------------------------
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4UnitsTable.icc 67970 2013-03-13 10:10:06Z gcosmo $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4UserLimits.hh 67970 2013-03-13 10:10:06Z gcosmo $
|
||||
//
|
||||
//
|
||||
// class G4UserLimits
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4UserLimits.icc 67970 2013-03-13 10:10:06Z gcosmo $
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4VExceptionHandler.hh 110286 2018-05-18 09:40:01Z gcosmo $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4VNotifier.hh 67970 2013-03-13 10:10:06Z gcosmo $
|
||||
//
|
||||
// class G4VNotifier
|
||||
//
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4VStateDependent.hh 110286 2018-05-18 09:40:01Z gcosmo $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
|
||||
@@ -24,8 +24,6 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4Version.hh 110902 2018-06-25 08:56:46Z gcosmo $
|
||||
// GEANT4 tag $Name:$
|
||||
//
|
||||
// Version information
|
||||
//
|
||||
@@ -50,7 +48,7 @@
|
||||
#endif
|
||||
|
||||
#ifndef G4VERSION_TAG
|
||||
#define G4VERSION_TAG "$Name: geant4-10-05-beta-01 $"
|
||||
#define G4VERSION_TAG "$Name: geant4-10-05 $"
|
||||
#endif
|
||||
|
||||
// as variables
|
||||
@@ -58,10 +56,10 @@
|
||||
#include "G4String.hh"
|
||||
|
||||
#ifdef G4MULTITHREADED
|
||||
static const G4String G4Version = "$Name: geant4-10-05-beta-01 [MT]$";
|
||||
static const G4String G4Version = "$Name: geant4-10-05 [MT]$";
|
||||
#else
|
||||
static const G4String G4Version = "$Name: geant4-10-05-beta-01 $";
|
||||
static const G4String G4Version = "$Name: geant4-10-05 $";
|
||||
#endif
|
||||
static const G4String G4Date = "(29-June-2018)";
|
||||
static const G4String G4Date = "(7-December-2018)";
|
||||
|
||||
#endif
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4coutDestination.hh 103661 2017-04-20 14:57:11Z gcosmo $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4coutFormatters.hh 103582 2017-04-18 17:24:45Z adotti $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4ios.hh 110251 2018-05-17 14:09:28Z gcosmo $
|
||||
//
|
||||
//
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4strstreambuf.hh 110251 2018-05-17 14:09:28Z gcosmo $
|
||||
//
|
||||
// ====================================================================
|
||||
//
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4strstreambuf.icc 103661 2017-04-20 14:57:11Z gcosmo $
|
||||
// ====================================================================
|
||||
// G4strstreambuf.icc
|
||||
//
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: globals.hh 110286 2018-05-18 09:40:01Z gcosmo $
|
||||
//
|
||||
//
|
||||
// Global Constants and typedefs
|
||||
@@ -69,4 +68,7 @@
|
||||
// Global error function
|
||||
#include "G4Exception.hh"
|
||||
|
||||
// Global utility functions
|
||||
#include "G4EnvironmentUtils.hh"
|
||||
|
||||
#endif /* GLOBALS_HH */
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: templates.hh 103661 2017-04-20 14:57:11Z gcosmo $
|
||||
//
|
||||
//
|
||||
// -*- C++ -*-
|
||||
@@ -163,4 +162,45 @@ inline int G4rint(double ad)
|
||||
return (ad>0) ? static_cast<int>(ad+1) : static_cast<int>(ad);
|
||||
}
|
||||
|
||||
//-----------------------------
|
||||
|
||||
// Use the following function to get rid of "unused parameter" warnings
|
||||
// Example:
|
||||
//
|
||||
// #ifdef SOME_CONDITION
|
||||
// void doSomething(int val)
|
||||
// {
|
||||
// something = val;
|
||||
// }
|
||||
// #else
|
||||
// void doSomething(int)
|
||||
// { }
|
||||
// #endif
|
||||
//
|
||||
// can be simplified to:
|
||||
//
|
||||
// void doSomething(int val)
|
||||
// {
|
||||
// #ifdef SOME_CONDITION
|
||||
// something = val;
|
||||
// #else
|
||||
// G4ConsumeParameters(val);
|
||||
// #endif
|
||||
// }
|
||||
//
|
||||
// or:
|
||||
//
|
||||
// void doSomething(int val)
|
||||
// {
|
||||
// #ifdef SOME_CONDITION
|
||||
// something = val;
|
||||
// #endif
|
||||
// // function call does nothing -- will be "optimized" out
|
||||
// G4ConsumeParameters(val);
|
||||
// }
|
||||
//
|
||||
template <typename _Tp, typename... _Args>
|
||||
inline void G4ConsumeParameters(_Tp, _Args...)
|
||||
{ }
|
||||
|
||||
#endif // templates_h
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
// Thread Local Storage typedefs
|
||||
|
||||
|
||||
Reference in New Issue
Block a user