Import Geant4 11.1.0.beta source tree
This commit is contained in:
@@ -48,7 +48,7 @@ class G4AllocatorBase
|
||||
{
|
||||
public:
|
||||
G4AllocatorBase();
|
||||
virtual ~G4AllocatorBase();
|
||||
virtual ~G4AllocatorBase() = default;
|
||||
virtual void ResetStorage() = 0;
|
||||
virtual std::size_t GetAllocatedSize() const = 0;
|
||||
virtual int GetNoPages() const = 0;
|
||||
|
||||
@@ -52,7 +52,7 @@ class G4AllocatorList
|
||||
G4int Size() const;
|
||||
|
||||
private:
|
||||
G4AllocatorList();
|
||||
G4AllocatorList() = default;
|
||||
|
||||
private:
|
||||
static G4ThreadLocal G4AllocatorList* fAllocatorList;
|
||||
|
||||
@@ -49,7 +49,7 @@ class G4AllocatorPool
|
||||
~G4AllocatorPool();
|
||||
// Destructor. Return storage to the free store
|
||||
|
||||
G4AllocatorPool(const G4AllocatorPool& right);
|
||||
G4AllocatorPool(const G4AllocatorPool& right) = default;
|
||||
// Copy constructor
|
||||
G4AllocatorPool& operator=(const G4AllocatorPool& right);
|
||||
// Equality operator
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
class G4DataVector : public std::vector<G4double>
|
||||
{
|
||||
public:
|
||||
G4DataVector();
|
||||
G4DataVector() = default;
|
||||
// Default constructor.
|
||||
|
||||
G4DataVector(const G4DataVector&) = default;
|
||||
@@ -60,7 +60,7 @@ class G4DataVector : public std::vector<G4double>
|
||||
// Constructor given a 'capacity' defining the initial number of elements
|
||||
// and initialising them to 'value'.
|
||||
|
||||
virtual ~G4DataVector();
|
||||
virtual ~G4DataVector() = default;
|
||||
// Empty destructor
|
||||
|
||||
G4DataVector& operator=(const G4DataVector&) = default;
|
||||
|
||||
@@ -220,6 +220,8 @@ inline G4String G4GetDataEnv(const std::string& env_id,
|
||||
return "";
|
||||
}
|
||||
|
||||
const char* G4FindDataDir(const char*);
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Use this function to print the environment
|
||||
//
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
|
||||
#ifndef G4FINDDATADIR_HH
|
||||
#define G4FINDDATADIR_HH
|
||||
|
||||
#cmakedefine CMAKE_INSTALL_PREFIX "@CMAKE_INSTALL_PREFIX@"
|
||||
#cmakedefine CMAKE_INSTALL_DATADIR "@CMAKE_INSTALL_DATADIR@"
|
||||
#cmakedefine GEANT4_INSTALL_DATADIR "@GEANT4_INSTALL_DATADIR@"
|
||||
#cmakedefine GEANT4_INSTALL_FULL_DATADIR "@GEANT4_INSTALL_FULL_DATADIR@"
|
||||
|
||||
struct dataset {
|
||||
const char * const env;
|
||||
const char * const dir;
|
||||
};
|
||||
|
||||
static const struct dataset dataset_definitions[] = {@GEANT4_DATASET_LIST@};
|
||||
|
||||
#endif
|
||||
@@ -64,7 +64,7 @@ class G4GeometryTolerance
|
||||
// Returns the current radial tolerance.
|
||||
|
||||
public: // without description
|
||||
~G4GeometryTolerance();
|
||||
~G4GeometryTolerance() = default;
|
||||
// Destructor.
|
||||
|
||||
protected:
|
||||
|
||||
@@ -43,7 +43,7 @@ class G4LockcoutDestination : public G4coutDestination
|
||||
{
|
||||
public:
|
||||
G4LockcoutDestination() = default;
|
||||
virtual ~G4LockcoutDestination();
|
||||
virtual ~G4LockcoutDestination() = default;
|
||||
virtual G4int ReceiveG4cout(const G4String& msg) override;
|
||||
virtual G4int ReceiveG4cerr(const G4String& msg) override;
|
||||
};
|
||||
|
||||
@@ -79,9 +79,9 @@ class G4MTcoutDestination : public G4MulticoutDestination
|
||||
|
||||
protected:
|
||||
void AddMasterOutput(G4bool formatAlsoMaster);
|
||||
void HandleFileCout(G4String fileN, G4bool appendFlag,
|
||||
void HandleFileCout(const G4String& fileN, G4bool appendFlag,
|
||||
G4bool suppressDefault);
|
||||
void HandleFileCerr(G4String fileN, G4bool appendFlag,
|
||||
void HandleFileCerr(const G4String& fileN, G4bool appendFlag,
|
||||
G4bool suppressDefault);
|
||||
|
||||
private:
|
||||
|
||||
@@ -46,7 +46,7 @@ class G4MasterForwardcoutDestination : public G4coutDestination
|
||||
public:
|
||||
G4MasterForwardcoutDestination() = default;
|
||||
|
||||
virtual ~G4MasterForwardcoutDestination();
|
||||
virtual ~G4MasterForwardcoutDestination() = default;
|
||||
virtual G4int ReceiveG4cout(const G4String& msg) override;
|
||||
virtual G4int ReceiveG4cerr(const G4String& msg) override;
|
||||
};
|
||||
|
||||
@@ -43,14 +43,14 @@
|
||||
class G4OrderedTable : public std::vector<G4DataVector*>
|
||||
{
|
||||
public:
|
||||
G4OrderedTable();
|
||||
G4OrderedTable() = default;
|
||||
// Default constructor
|
||||
|
||||
explicit G4OrderedTable(std::size_t cap);
|
||||
// Constructor given a 'capacity' defining the initial
|
||||
// number of elements (NULL pointers are filled up)
|
||||
|
||||
virtual ~G4OrderedTable();
|
||||
virtual ~G4OrderedTable() = default;
|
||||
// Empty Destructor
|
||||
|
||||
void clearAndDestroy();
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
class G4PhysicsModelCatalog {
|
||||
public:
|
||||
static void Initialize();
|
||||
~G4PhysicsModelCatalog();
|
||||
~G4PhysicsModelCatalog() = default;
|
||||
G4PhysicsModelCatalog( const G4PhysicsModelCatalog& ) = delete;
|
||||
G4PhysicsModelCatalog& operator=( const G4PhysicsModelCatalog& ) = delete;
|
||||
|
||||
@@ -84,7 +84,7 @@ class G4PhysicsModelCatalog {
|
||||
// Returns the two limits, min and max respectively, that the modelID value can have.
|
||||
|
||||
private:
|
||||
G4PhysicsModelCatalog();
|
||||
G4PhysicsModelCatalog() = default;
|
||||
|
||||
static void SanityCheck();
|
||||
// Check that the two vectors (of model IDs and model names) have the same size,
|
||||
|
||||
@@ -49,7 +49,7 @@ class G4Pow
|
||||
{
|
||||
public:
|
||||
static G4Pow* GetInstance();
|
||||
~G4Pow();
|
||||
~G4Pow() = default;
|
||||
|
||||
// Fast computation of Z^1/3
|
||||
//
|
||||
|
||||
@@ -139,7 +139,7 @@ class G4String : public std::string
|
||||
/// @brief Deprecated function
|
||||
/// @deprecated Use `G4StrUtil` functions instead
|
||||
[[deprecated("Use G4StrUtil::{lstrip,rstrip,strip}_copy instead")]]
|
||||
[[nodiscard]] inline G4String strip(stripType strip_Type = trailing, char c = ' ');
|
||||
[[nodiscard]] inline G4String strip(stripType strip_Type = trailing, char ch = ' ');
|
||||
|
||||
/// @brief Deprecated function
|
||||
/// @deprecated Use `G4StrUtil` functions instead
|
||||
@@ -180,39 +180,39 @@ namespace G4StrUtil
|
||||
|
||||
/// @brief Remove leading characters from string
|
||||
/// @param[in,out] str string to strip
|
||||
/// @param[in] c character to remove
|
||||
/// @post `str` has any leading sequence of `c` removed
|
||||
void lstrip(G4String& str, char c = ' ');
|
||||
/// @param[in] ch character to remove
|
||||
/// @post `str` has any leading sequence of `ch` removed
|
||||
void lstrip(G4String& str, char ch = ' ');
|
||||
|
||||
/// @brief Remove trailing characters from string
|
||||
/// @param[in,out] str string to strip
|
||||
/// @param[in] c character to remove
|
||||
/// @post `str` has any trailing sequence of `c` removed
|
||||
void rstrip(G4String& str, char c = ' ');
|
||||
/// @param[in] ch character to remove
|
||||
/// @post `str` has any trailing sequence of `ch` removed
|
||||
void rstrip(G4String& str, char ch = ' ');
|
||||
|
||||
/// @brief Remove leading and trailing characters from string
|
||||
/// @param[in,out] str string to strip
|
||||
/// @param[in] c character to remove
|
||||
/// @post `str` has any leading and trailing sequence of `c` removed
|
||||
void strip(G4String& str, char c = ' ');
|
||||
/// @param[in] ch character to remove
|
||||
/// @post `str` has any leading and trailing sequence of `ch` removed
|
||||
void strip(G4String& str, char ch = ' ');
|
||||
|
||||
/// @brief Return copy of string with leading characters removed
|
||||
/// @param[in] str string to copy and strip
|
||||
/// @param[in] c character to remove
|
||||
/// @return copy of `str` with any leading sequence of `c` removed
|
||||
G4String lstrip_copy(G4String str, char c = ' ');
|
||||
/// @param[in] ch character to remove
|
||||
/// @return copy of `str` with any leading sequence of `ch` removed
|
||||
G4String lstrip_copy(G4String str, char ch = ' ');
|
||||
|
||||
/// @brief Return copy of string with trailing characters removed
|
||||
/// @param[in] str string to copy and strip
|
||||
/// @param[in] c character to remove
|
||||
/// @return copy of `str` with any trailing sequence of `c` removed
|
||||
G4String rstrip_copy(G4String str, char c = ' ');
|
||||
/// @param[in] ch character to remove
|
||||
/// @return copy of `str` with any trailing sequence of `ch` removed
|
||||
G4String rstrip_copy(G4String str, char ch = ' ');
|
||||
|
||||
/// @brief Return copy of string with leading and trailing characters removed
|
||||
/// @param[in] str string to copy and strip
|
||||
/// @param[in] c character to remove
|
||||
/// @return copy of `str` with any leading and trailing sequence of `c` removed
|
||||
G4String strip_copy(G4String str, char c = ' ');
|
||||
/// @param[in] ch character to remove
|
||||
/// @return copy of `str` with any leading and trailing sequence of `ch` removed
|
||||
G4String strip_copy(G4String str, char ch = ' ');
|
||||
|
||||
/// @brief Check if a string contains a given substring
|
||||
/// @param[in] str string to be checked
|
||||
|
||||
@@ -140,7 +140,7 @@ namespace G4StrUtil
|
||||
inline void to_lower(G4String& str)
|
||||
{
|
||||
std::transform(str.begin(), str.end(), str.begin(),
|
||||
[](unsigned char c) { return std::tolower(c); });
|
||||
[](unsigned char ch) { return std::tolower(ch); });
|
||||
}
|
||||
|
||||
inline G4String to_lower_copy(G4String str)
|
||||
@@ -152,7 +152,7 @@ namespace G4StrUtil
|
||||
inline void to_upper(G4String& str)
|
||||
{
|
||||
std::transform(str.begin(), str.end(), str.begin(),
|
||||
[](unsigned char c) { return std::toupper(c); });
|
||||
[](unsigned char ch) { return std::toupper(ch); });
|
||||
}
|
||||
|
||||
inline G4String to_upper_copy(G4String str)
|
||||
@@ -161,52 +161,52 @@ namespace G4StrUtil
|
||||
return str;
|
||||
}
|
||||
|
||||
inline void lstrip(G4String& s, char c)
|
||||
inline void lstrip(G4String& str, char ch)
|
||||
{
|
||||
auto startIndex = s.find_first_not_of(c);
|
||||
s.erase(0, startIndex);
|
||||
auto startIndex = str.find_first_not_of(ch);
|
||||
str.erase(0, startIndex);
|
||||
}
|
||||
|
||||
inline void rstrip(G4String& s, char c)
|
||||
inline void rstrip(G4String& str, char ch)
|
||||
{
|
||||
auto endIndex = s.find_last_not_of(c);
|
||||
auto endIndex = str.find_last_not_of(ch);
|
||||
if(endIndex == G4String::npos)
|
||||
{
|
||||
s = "";
|
||||
str = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
s.erase(endIndex + 1);
|
||||
str.erase(endIndex + 1);
|
||||
}
|
||||
}
|
||||
|
||||
inline void strip(G4String& s, char c)
|
||||
inline void strip(G4String& str, char ch)
|
||||
{
|
||||
if(s.empty())
|
||||
if(str.empty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
lstrip(s, c);
|
||||
rstrip(s, c);
|
||||
lstrip(str, ch);
|
||||
rstrip(str, ch);
|
||||
}
|
||||
|
||||
inline G4String lstrip_copy(G4String s, char c)
|
||||
inline G4String lstrip_copy(G4String str, char ch)
|
||||
{
|
||||
lstrip(s, c);
|
||||
return s;
|
||||
lstrip(str, ch);
|
||||
return str;
|
||||
}
|
||||
|
||||
inline G4String rstrip_copy(G4String s, char c)
|
||||
inline G4String rstrip_copy(G4String str, char ch)
|
||||
{
|
||||
rstrip(s, c);
|
||||
return s;
|
||||
rstrip(str, ch);
|
||||
return str;
|
||||
}
|
||||
|
||||
inline G4String strip_copy(G4String s, char c)
|
||||
inline G4String strip_copy(G4String str, char ch)
|
||||
{
|
||||
strip(s, c);
|
||||
return s;
|
||||
strip(str, ch);
|
||||
return str;
|
||||
}
|
||||
|
||||
inline G4bool contains(const G4String& str, std::string_view ss)
|
||||
@@ -304,4 +304,4 @@ namespace G4StrUtil
|
||||
|
||||
return is;
|
||||
}
|
||||
} // namespace G4StrUtil
|
||||
} // namespace G4StrUtil
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
// ---------------------------------------------------------------
|
||||
// GEANT 4 class header file
|
||||
//
|
||||
// Class Description:
|
||||
//
|
||||
// This file wraps a TBB task_group into a G4TaskGroup
|
||||
//
|
||||
// ---------------------------------------------------------------
|
||||
// Author: Jonathan Madsen (May 28st 2020)
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef G4GMAKE
|
||||
# include "G4GlobalConfig.hh"
|
||||
#endif
|
||||
|
||||
#if defined(GEANT4_USE_TBB)
|
||||
# include "PTL/TBBTaskGroup.hh"
|
||||
#else
|
||||
# include "PTL/TaskGroup.hh"
|
||||
#endif
|
||||
|
||||
#if defined(GEANT4_USE_TBB)
|
||||
template <typename Tp, typename Arg = Tp>
|
||||
using G4TBBTaskGroup = PTL::TBBTaskGroup<Tp, Arg>;
|
||||
#else
|
||||
template <typename Tp, typename Arg = Tp>
|
||||
using G4TBBTaskGroup = PTL::TaskGroup<Tp, Arg>;
|
||||
#endif
|
||||
@@ -0,0 +1,44 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
// ---------------------------------------------------------------
|
||||
// GEANT 4 class header file
|
||||
//
|
||||
// Class Description:
|
||||
//
|
||||
// This file defines the task types for G4TaskManager and G4ThreadPool
|
||||
//
|
||||
// ---------------------------------------------------------------
|
||||
// Author: Jonathan Madsen (May 28th 2020)
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "PTL/Task.hh"
|
||||
|
||||
template <typename _Ret, typename _Arg, typename... _Args>
|
||||
using G4Task = PTL::Task<_Ret, _Arg, _Args...>;
|
||||
@@ -0,0 +1,45 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
// ---------------------------------------------------------------
|
||||
// GEANT 4 class header file
|
||||
//
|
||||
// Class Description:
|
||||
//
|
||||
// This file creates the a class for handling a group of tasks that
|
||||
// can be independently joined
|
||||
//
|
||||
// ---------------------------------------------------------------
|
||||
// Author: Jonathan Madsen (May 28th 2020)
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "PTL/TaskGroup.hh"
|
||||
|
||||
template <typename _Tp, typename _Arg = _Tp>
|
||||
using G4TaskGroup = PTL::TaskGroup<_Tp, _Arg>;
|
||||
@@ -0,0 +1,44 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
// ---------------------------------------------------------------
|
||||
// GEANT 4 class header file
|
||||
//
|
||||
// Class Description:
|
||||
//
|
||||
// This file creates a class for handling the wrapping of functions
|
||||
// into task objects and submitting to thread pool
|
||||
//
|
||||
// ---------------------------------------------------------------
|
||||
// Author: Jonathan Madsen (May 28th 2020)
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "PTL/TaskManager.hh"
|
||||
|
||||
using G4TaskManager = PTL::TaskManager;
|
||||
@@ -0,0 +1,130 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// ---------------------------------------------------------------
|
||||
// GEANT4 template class header
|
||||
// Class Description:
|
||||
// This class delegates which singletons a task references
|
||||
// ---------------------------------------------------------------
|
||||
// Author: Jonathan Madsen
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
#include "G4AutoLock.hh"
|
||||
#include "G4Threading.hh"
|
||||
|
||||
#include <functional>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <set>
|
||||
#include <thread>
|
||||
#include <tuple>
|
||||
#include <type_traits>
|
||||
#include <vector>
|
||||
|
||||
namespace G4Traits
|
||||
{
|
||||
template <typename T>
|
||||
struct TaskSingletonKey
|
||||
{
|
||||
using type = G4int;
|
||||
using compare_type = std::less<type>;
|
||||
};
|
||||
} // namespace G4Traits
|
||||
|
||||
//----------------------------------------------------------------------------//
|
||||
|
||||
/// \class G4TaskSingletonEvaluator
|
||||
/// \brief This structure must be specialized and use overloads to the
|
||||
/// constructor
|
||||
///
|
||||
template <typename T>
|
||||
struct G4TaskSingletonEvaluator;
|
||||
|
||||
//----------------------------------------------------------------------------//
|
||||
|
||||
template <typename T>
|
||||
class G4TaskSingletonDelegator;
|
||||
|
||||
//----------------------------------------------------------------------------//
|
||||
|
||||
template <typename T>
|
||||
class G4TaskSingletonData
|
||||
{
|
||||
using key_type = typename G4Traits::TaskSingletonKey<T>::type;
|
||||
using compare_type = typename G4Traits::TaskSingletonKey<T>::compare_type;
|
||||
|
||||
friend struct G4TaskSingletonEvaluator<T>;
|
||||
friend class G4TaskSingletonDelegator<T>;
|
||||
using this_type = G4TaskSingletonData<T>;
|
||||
|
||||
private:
|
||||
static std::unique_ptr<this_type>& GetInstance()
|
||||
{
|
||||
static auto _instance = std::unique_ptr<this_type>(new this_type);
|
||||
return _instance;
|
||||
}
|
||||
|
||||
private:
|
||||
std::map<key_type, T*, compare_type> m_data;
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------//
|
||||
|
||||
template <typename T>
|
||||
struct G4TaskSingletonEvaluator
|
||||
{
|
||||
using key_type = typename G4Traits::TaskSingletonKey<T>::type;
|
||||
using data_type = G4TaskSingletonData<T>;
|
||||
|
||||
template <typename... Args>
|
||||
G4TaskSingletonEvaluator(key_type&, Args&&...)
|
||||
{
|
||||
throw std::runtime_error("Not specialized!");
|
||||
}
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------//
|
||||
|
||||
template <typename T>
|
||||
class G4TaskSingletonDelegator
|
||||
{
|
||||
public:
|
||||
using pointer = T*;
|
||||
using evaluator_type = G4TaskSingletonEvaluator<T>;
|
||||
using data_type = G4TaskSingletonData<T>;
|
||||
using key_type = typename G4Traits::TaskSingletonKey<T>;
|
||||
|
||||
template <typename... Args>
|
||||
static void Configure(Args&&... args)
|
||||
{
|
||||
auto& _data = data_type::GetInstance();
|
||||
evaluator_type _eval(std::forward<Args>(args)...);
|
||||
auto _ptr = _data->m_data.at(_eval.index);
|
||||
_eval.modifier(_ptr);
|
||||
T::SetInstance(_data->m_data.at(_key));
|
||||
}
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------//
|
||||
@@ -0,0 +1,37 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// ---------------------------------------------------------------
|
||||
// GEANT4 class header
|
||||
// Class Description:
|
||||
// ---------------------------------------------------------------
|
||||
// Author: Jonathan Madsen (May 28th 2020)
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "PTL/ThreadData.hh"
|
||||
|
||||
using G4ThreadData = PTL::ThreadData;
|
||||
@@ -193,8 +193,8 @@ G4ThreadLocalSingleton<T>::G4ThreadLocalSingleton()
|
||||
}
|
||||
*/
|
||||
G4ThreadLocalSingleton<void>::Insert([&]() {
|
||||
printf("Deleting G4ThreadLocalSingletons for type %s ...\n",
|
||||
G4Demangle<T>().c_str());
|
||||
// printf("Deleting G4ThreadLocalSingletons for type %s ...\n",
|
||||
// G4Demangle<T>().c_str());
|
||||
this->Clear();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
// ---------------------------------------------------------------
|
||||
// GEANT 4 class header file
|
||||
//
|
||||
// Class Description:
|
||||
//
|
||||
// This file creates a class for an efficient thread-pool that
|
||||
// accepts work in the form of tasks.
|
||||
//
|
||||
// ---------------------------------------------------------------
|
||||
// Author: Jonathan Madsen (May 28th 2020)
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "PTL/ThreadPool.hh"
|
||||
|
||||
using G4ThreadPool = PTL::ThreadPool;
|
||||
@@ -56,7 +56,7 @@ class G4UnitsTable : public std::vector<G4UnitsCategory*>
|
||||
{
|
||||
public:
|
||||
using std::vector<G4UnitsCategory*>::vector;
|
||||
G4UnitsTable();
|
||||
G4UnitsTable() = default;
|
||||
~G4UnitsTable();
|
||||
|
||||
public:
|
||||
@@ -77,7 +77,7 @@ class G4UnitDefinition
|
||||
G4UnitDefinition(const G4String& name, const G4String& symbol,
|
||||
const G4String& category, G4double value);
|
||||
|
||||
~G4UnitDefinition();
|
||||
~G4UnitDefinition() = default;
|
||||
G4bool operator==(const G4UnitDefinition&) const;
|
||||
G4bool operator!=(const G4UnitDefinition&) const;
|
||||
|
||||
@@ -164,14 +164,14 @@ class G4BestUnit
|
||||
// into the most appropriate unit of the same category.
|
||||
// In practice it builds an object VU = (newValue, newUnit)
|
||||
|
||||
~G4BestUnit();
|
||||
~G4BestUnit() = default;
|
||||
|
||||
inline G4double* GetValue();
|
||||
inline const G4String& GetCategory() const;
|
||||
inline std::size_t GetIndexOfCategory() const;
|
||||
operator G4String() const; // Conversion to best string.
|
||||
|
||||
friend std::ostream& operator<<(std::ostream&, G4BestUnit VU);
|
||||
friend std::ostream& operator<<(std::ostream&, const G4BestUnit& VU);
|
||||
// Default format to print the objet VU above.
|
||||
|
||||
private:
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// ---------------------------------------------------------------
|
||||
// GEANT4 class header
|
||||
// Class Description:
|
||||
// ---------------------------------------------------------------
|
||||
// Author: Jonathan Madsen (May 28st 2020)
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "PTL/UserTaskQueue.hh"
|
||||
|
||||
using G4UserTaskQueue = PTL::UserTaskQueue;
|
||||
@@ -44,7 +44,7 @@ class G4VExceptionHandler
|
||||
{
|
||||
public:
|
||||
G4VExceptionHandler();
|
||||
virtual ~G4VExceptionHandler();
|
||||
virtual ~G4VExceptionHandler() = default;
|
||||
G4bool operator==(const G4VExceptionHandler& right) const;
|
||||
G4bool operator!=(const G4VExceptionHandler& right) const;
|
||||
|
||||
|
||||
@@ -39,8 +39,8 @@
|
||||
class G4VNotifier
|
||||
{
|
||||
public:
|
||||
G4VNotifier();
|
||||
virtual ~G4VNotifier();
|
||||
G4VNotifier() = default;
|
||||
virtual ~G4VNotifier() = default;
|
||||
// Constructor and destructor
|
||||
|
||||
virtual void NotifyRegistration() = 0;
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
// ---------------------------------------------------------------
|
||||
// GEANT 4 class header file
|
||||
//
|
||||
// Class Description:
|
||||
//
|
||||
// This file creates an abstract base class for the thread-pool tasking
|
||||
// system
|
||||
//
|
||||
// ---------------------------------------------------------------
|
||||
// Author: Jonathan Madsen (May 28th 2020)
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "PTL/VTask.hh"
|
||||
|
||||
using G4VTask = PTL::VTask;
|
||||
@@ -0,0 +1,39 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// ---------------------------------------------------------------
|
||||
// GEANT4 class header
|
||||
// Class Description:
|
||||
// Abstract base class for creating a task queue used by
|
||||
// G4ThreadPool
|
||||
// ---------------------------------------------------------------
|
||||
// Author: Jonathan Madsen (May 28st 2020)
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "PTL/VUserTaskQueue.hh"
|
||||
|
||||
using G4VUserTaskQueue = PTL::VUserTaskQueue;
|
||||
@@ -40,11 +40,11 @@
|
||||
// |--> patch number
|
||||
|
||||
#ifndef G4VERSION_NUMBER
|
||||
#define G4VERSION_NUMBER 1102
|
||||
#define G4VERSION_NUMBER 1110
|
||||
#endif
|
||||
|
||||
#ifndef G4VERSION_TAG
|
||||
#define G4VERSION_TAG "$Name: geant4-11-00-patch-02 $"
|
||||
#define G4VERSION_TAG "$Name: geant4-11-01-beta-01 $"
|
||||
#endif
|
||||
|
||||
// as variables
|
||||
@@ -53,10 +53,10 @@
|
||||
#include "G4Types.hh"
|
||||
|
||||
#ifdef G4MULTITHREADED
|
||||
static const G4String G4Version = "$Name: geant4-11-00-patch-02 [MT]$";
|
||||
static const G4String G4Version = "$Name: geant4-11-01-beta-01 [MT]$";
|
||||
#else
|
||||
static const G4String G4Version = "$Name: geant4-11-00-patch-02 $";
|
||||
static const G4String G4Version = "$Name: geant4-11-01-beta-01 $";
|
||||
#endif
|
||||
static const G4String G4Date = "(25-May-2022)";
|
||||
static const G4String G4Date = "(30-June-2022)";
|
||||
|
||||
#endif
|
||||
|
||||
@@ -46,8 +46,7 @@ class G4coutDestination
|
||||
public:
|
||||
|
||||
G4coutDestination() = default;
|
||||
virtual ~G4coutDestination();
|
||||
// Note: limitation on ICC for MIC cannot use 'default'
|
||||
virtual ~G4coutDestination() = default;
|
||||
|
||||
// The type of the functions defining a transformation of the message.
|
||||
// The function manipulates the input message, for example, to add a
|
||||
|
||||
@@ -133,17 +133,7 @@ inline T sqr(const T& x)
|
||||
|
||||
inline int G4lrint(double ad)
|
||||
{
|
||||
return (ad > 0) ? static_cast<int>(ad + .5) : static_cast<int>(ad - .5);
|
||||
}
|
||||
|
||||
inline int G4lint(double ad)
|
||||
{
|
||||
return (ad > 0) ? static_cast<int>(ad) : static_cast<int>(ad - 1.);
|
||||
}
|
||||
|
||||
inline int G4rint(double ad)
|
||||
{
|
||||
return (ad > 0) ? static_cast<int>(ad + 1) : static_cast<int>(ad);
|
||||
return std::lrint(ad);
|
||||
}
|
||||
|
||||
//-----------------------------
|
||||
|
||||
Reference in New Issue
Block a user