Import Geant4 10.7.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2020-06-26 10:23:25 +02:00
parent c02c370437
commit 67ba86d073
1871 changed files with 174422 additions and 131884 deletions
+97 -120
View File
@@ -23,17 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
//
// -----------------------------------------------------------------
//
// ------------------- class G4UnitsTable -----------------
//
// 17-05-98: first version, M.Maire
// 13-10-98: Units and symbols printed in fixed length, M.Maire
// 18-01-00: BestUnit for three vector, M.Maire
// 06-03-01: Migrated to STL vectors, G.Cosmo
// G4UnitsTable
//
// Class description:
//
@@ -43,167 +33,154 @@
// The Units are grouped by category. The TableOfUnits is a list of categories.
// The class G4BestUnit allows to convert automaticaly a physical quantity
// from its internal value into the most appropriate Unit of the same category.
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
// Author: M.Maire, 17.05.1998 - First version
// Revisions: G.Cosmo, 06.03.2001 - Migrated to STL vectors
// --------------------------------------------------------------------
#ifndef G4UnitsTable_hh
#define G4UnitsTable_hh 1
#ifndef G4UnitsTable_HH
#define G4UnitsTable_HH
#include "globals.hh"
#include <vector>
#include "G4ThreeVector.hh"
#include "globals.hh"
class G4UnitsCategory;
class G4UnitDefinition;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
// --------------------------------------------------------------------
#ifdef G4MULTITHREADED
class G4UnitsTable : public std::vector<G4UnitsCategory*>
{
public:
using std::vector<G4UnitsCategory*>::vector;
G4UnitsTable();
~G4UnitsTable();
public:
using std::vector<G4UnitsCategory*>::vector;
G4UnitsTable();
~G4UnitsTable();
public:
void Synchronize();
G4bool Contains(const G4UnitDefinition*,const G4String&);
public:
void Synchronize();
G4bool Contains(const G4UnitDefinition*, const G4String&);
};
#else
typedef std::vector<G4UnitsCategory*> G4UnitsTable;
using G4UnitsTable = std::vector<G4UnitsCategory*>;
#endif
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
// --------------------------------------------------------------------
class G4UnitDefinition
{
public: // with description
public:
G4UnitDefinition(const G4String& name, const G4String& symbol,
const G4String& category, G4double value);
G4UnitDefinition(const G4String& name, const G4String& symbol,
const G4String& category, G4double value);
~G4UnitDefinition();
G4bool operator==(const G4UnitDefinition&) const;
G4bool operator!=(const G4UnitDefinition&) const;
public: // without description
inline const G4String& GetName() const;
inline const G4String& GetSymbol() const;
inline G4double GetValue() const;
~G4UnitDefinition();
G4bool operator==(const G4UnitDefinition&) const;
G4bool operator!=(const G4UnitDefinition&) const;
void PrintDefinition();
public: // with description
static void BuildUnitsTable();
static void PrintUnitsTable();
static void ClearUnitsTable();
inline const G4String& GetName() const;
inline const G4String& GetSymbol() const;
inline G4double GetValue() const;
static G4UnitsTable& GetUnitsTable();
void PrintDefinition();
static G4bool IsUnitDefined(const G4String&);
static G4double GetValueOf(const G4String&);
static G4String GetCategory(const G4String&);
static void BuildUnitsTable();
static void PrintUnitsTable();
static void ClearUnitsTable();
private:
G4UnitDefinition(const G4UnitDefinition&);
G4UnitDefinition& operator=(const G4UnitDefinition&);
static G4UnitsTable& GetUnitsTable();
private:
G4String Name; // SI name
G4String SymbolName; // SI symbol
G4double Value = 0.0; // value in the internal system of units
static G4bool IsUnitDefined(const G4String&);
static G4double GetValueOf (const G4String&);
static G4String GetCategory(const G4String&);
static G4ThreadLocal G4UnitsTable* pUnitsTable; // table of Units
static G4ThreadLocal G4bool unitsTableDestroyed;
private:
G4UnitDefinition(const G4UnitDefinition&);
G4UnitDefinition& operator=(const G4UnitDefinition&);
private:
G4String Name; // SI name
G4String SymbolName; // SI symbol
G4double Value; // value in the internal system of units
static G4ThreadLocal G4UnitsTable *pUnitsTable; // table of Units
static G4ThreadLocal G4bool unitsTableDestroyed;
size_t CategoryIndex; // category index of this unit
std::size_t CategoryIndex = 0; // category index of this unit
#ifdef G4MULTITHREADED
static G4UnitsTable *pUnitsTableShadow; // shadow of table of Units
public:
inline static G4UnitsTable& GetUnitsTableShadow()
{return *pUnitsTableShadow;}
static G4UnitsTable* pUnitsTableShadow; // shadow of table of Units
public:
inline static G4UnitsTable& GetUnitsTableShadow()
{
return *pUnitsTableShadow;
}
#endif
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
// --------------------------------------------------------------------
typedef std::vector<G4UnitDefinition*> G4UnitsContainer;
using G4UnitsContainer = std::vector<G4UnitDefinition*>;
class G4UnitsCategory
{
public: // without description
public:
explicit G4UnitsCategory(const G4String& name);
~G4UnitsCategory();
G4bool operator==(const G4UnitsCategory&) const;
G4bool operator!=(const G4UnitsCategory&) const;
explicit G4UnitsCategory(const G4String& name);
~G4UnitsCategory();
G4bool operator==(const G4UnitsCategory&) const;
G4bool operator!=(const G4UnitsCategory&) const;
inline const G4String& GetName() const;
inline G4UnitsContainer& GetUnitsList();
inline G4int GetNameMxLen() const;
inline G4int GetSymbMxLen() const;
inline void UpdateNameMxLen(G4int len);
inline void UpdateSymbMxLen(G4int len);
void PrintCategory();
public: // without description
private:
G4UnitsCategory(const G4UnitsCategory&);
G4UnitsCategory& operator=(const G4UnitsCategory&);
inline const G4String& GetName() const;
inline G4UnitsContainer& GetUnitsList();
inline G4int GetNameMxLen() const;
inline G4int GetSymbMxLen() const;
inline void UpdateNameMxLen(G4int len);
inline void UpdateSymbMxLen(G4int len);
void PrintCategory();
private:
G4UnitsCategory(const G4UnitsCategory&);
G4UnitsCategory& operator=(const G4UnitsCategory&);
private:
G4String Name; // dimensional family: Length,Volume,Energy
G4UnitsContainer UnitsList; // List of units in this family
G4int NameMxLen; // max length of the units name
G4int SymbMxLen; // max length of the units symbol
private:
G4String Name; // dimensional family: Length,Volume,Energy
G4UnitsContainer UnitsList; // List of units in this family
G4int NameMxLen = 0; // max length of the units name
G4int SymbMxLen = 0; // max length of the units symbol
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
// --------------------------------------------------------------------
class G4BestUnit
{
public: // with description
public:
G4BestUnit(G4double internalValue, const G4String& category);
G4BestUnit(const G4ThreeVector& internalValue, const G4String& category);
// These constructors convert a physical quantity from its internalValue
// into the most appropriate unit of the same category.
// In practice it builds an object VU = (newValue, newUnit)
G4BestUnit(G4double internalValue, const G4String& category);
G4BestUnit(const G4ThreeVector& internalValue, const G4String& category);
// These constructors convert a physical quantity from its internalValue
// into the most appropriate unit of the same category.
// In practice it builds an object VU = (newValue, newUnit)
~G4BestUnit();
~G4BestUnit();
inline G4double* GetValue();
inline const G4String& GetCategory() const;
inline std::size_t GetIndexOfCategory() const;
operator G4String() const; // Conversion to best string.
public: // without description
friend std::ostream& operator<<(std::ostream&, G4BestUnit VU);
// Default format to print the objet VU above.
inline G4double* GetValue();
inline const G4String& GetCategory() const;
inline size_t GetIndexOfCategory() const;
operator G4String () const; // Conversion to best string.
public: // with description
friend std::ostream& operator<<(std::ostream&,G4BestUnit VU);
// Default format to print the objet VU above.
private:
G4double Value[3]; // value in the internal system of units
G4int nbOfVals; // G4double=1; G4ThreeVector=3
G4String Category; // dimensional family: Length,Volume,Energy ...
size_t IndexOfCategory; // position of Category in UnitsTable
private:
G4double Value[3]; // value in the internal system of units
G4int nbOfVals = 0; // G4double=1; G4ThreeVector=3
G4String Category; // dimensional family: Length,Volume,Energy ...
std::size_t IndexOfCategory = 0; // position of Category in UnitsTable
};
#include "G4UnitsTable.icc"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#endif