Import Geant4 1.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-08 15:28:20 +02:00
parent aaa409b6ee
commit ca1c8cb059
2995 changed files with 106830 additions and 299600 deletions
@@ -1,12 +1,12 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4MaterialPropertiesTable.cc,v 1.2 1999/04/14 12:49:03 maire Exp $
// GEANT4 tag $Name: geant4-00-01 $
// $Id: G4MaterialPropertiesTable.cc,v 1.5.2.1 1999/11/11 14:30:15 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
//
////////////////////////////////////////////////////////////////////////
@@ -17,20 +17,22 @@
// Version: 1.0
// Created: 1996-02-08
// Author: Juliet Armstrong
// Updated: 1997-03-26 by Peter Gumplinger
// Updated: 1999-11-05 Migration from G4RWTPtrHashDictionary to STL
// by John Allison
// 1997-03-26 by Peter Gumplinger
// > cosmetics (only)
// mail: gum@triumf.ca
//
////////////////////////////////////////////////////////////////////////
#include "globals.hh"
#include "G4MaterialPropertiesTable.hh"
unsigned hashString(const G4String &str) { return str.hash(); }
//////////////
// Operators
//////////////
/**************
G4MaterialPropertiesTable&
G4MaterialPropertiesTable::operator =(const G4MaterialPropertiesTable& right)
{
@@ -43,28 +45,29 @@ G4MaterialPropertiesTable::operator =(const G4MaterialPropertiesTable& right)
// want to make an actual copy -- not a shallow copy which is
// the default for RWTPrtHashDictionary's assignment operator
RWTPtrHashDictionary<G4String, G4MaterialPropertyVector>
G4RWTPtrHashDictionary<G4String, G4MaterialPropertyVector>
rightMPT(right.MPT);
RWTPtrHashDictionaryIterator<G4String, G4MaterialPropertyVector>
G4RWTPtrHashDictionaryIterator<G4String, G4MaterialPropertyVector>
rightIterator(rightMPT);
rightIterator.reset();
while (++rightIterator) {
G4MaterialPropertyVector *newProp =
new G4MaterialPropertyVector(*(rightIterator.value()));
RWCString *newKey =
new RWCString(*(rightIterator.key()));
G4String *newKey =
new G4String(*(rightIterator.key()));
MPT.insertKeyAndValue(newKey, newProp);
}
return *this;
}
**********/
/////////////////
// Constructors
/////////////////
G4MaterialPropertiesTable::G4MaterialPropertiesTable() : MPT(hashString),
MPTiterator(MPT) {}
G4MaterialPropertiesTable::G4MaterialPropertiesTable() {}
/*********
G4MaterialPropertiesTable::G4MaterialPropertiesTable
(const G4MaterialPropertiesTable &right) :
MPT(hashString), MPTiterator(MPT)
@@ -72,9 +75,9 @@ G4MaterialPropertiesTable::G4MaterialPropertiesTable
// want to make an actual copy -- not a shallow copy which is
// the default for RWTPrtHashDictionary's assignment operator
RWTPtrHashDictionary<G4String, G4MaterialPropertyVector>
G4RWTPtrHashDictionary<G4String, G4MaterialPropertyVector>
rightMPT(right.MPT);
RWTPtrHashDictionaryIterator<G4String, G4MaterialPropertyVector>
G4RWTPtrHashDictionaryIterator<G4String, G4MaterialPropertyVector>
rightIterator(rightMPT);
rightIterator.reset();
@@ -82,11 +85,12 @@ G4MaterialPropertiesTable::G4MaterialPropertiesTable
while (++rightIterator) {
G4MaterialPropertyVector *newProp =
new G4MaterialPropertyVector(*(rightIterator.value()));
RWCString *newKey =
new RWCString(*(rightIterator.key()));
G4String *newKey =
new G4String(*(rightIterator.key()));
MPT.insertKeyAndValue(newKey, newProp);
}
}
*******/
////////////////
// Destructors
@@ -94,7 +98,12 @@ G4MaterialPropertiesTable::G4MaterialPropertiesTable
G4MaterialPropertiesTable::~G4MaterialPropertiesTable()
{
MPT.clearAndDestroy();
// MPT.clearAndDestroy();
MPTiterator i;
for (i = MPT.begin(); i != MPT.end(); ++i) {
delete (*i).second;
}
MPT.clear();
}
////////////
@@ -110,8 +119,7 @@ void G4MaterialPropertiesTable::AddProperty(char *key,
new G4MaterialPropertyVector(PhotonMomenta,
PropertyValues,
NumEntries);
G4String *newKey = new G4String(key);
MPT.insertKeyAndValue(newKey, mpv);
MPT [G4String(key)] = mpv;
}
void G4MaterialPropertiesTable::AddProperty(char *key,
@@ -120,29 +128,24 @@ void G4MaterialPropertiesTable::AddProperty(char *key,
// Provides a way of adding a property to the Material Properties
// Table given an G4MaterialPropertyVector Reference and a key
G4String *theKey = new G4String(key);
MPT.insertKeyAndValue(theKey, mpv);
MPT [G4String(key)] = mpv;
}
void G4MaterialPropertiesTable::RemoveProperty(char *key)
{
G4String target(key);
MPT.remove(&target);
MPT.erase(G4String(key));
}
G4MaterialPropertyVector* G4MaterialPropertiesTable::GetProperty(char *key)
{
G4String target(key);
return MPT.findValue(&target);
return MPT [G4String(key)];
}
void G4MaterialPropertiesTable::AddEntry(char *key,
G4double aPhotonMomentum,
G4double aPropertyValue)
{
G4String target(key);
G4MaterialPropertyVector *targetVector=MPT.findValue(&target);
G4MaterialPropertyVector *targetVector=MPT [G4String(key)];
if (targetVector != NULL) {
targetVector->AddElement(aPhotonMomentum, aPropertyValue);
}
@@ -152,11 +155,10 @@ void G4MaterialPropertiesTable::AddEntry(char *key,
}
}
void G4MaterialPropertiesTable::RemoveEntry(char *key,
void G4MaterialPropertiesTable::RemoveEntry(char *key,
G4double aPhotonMomentum)
{
G4String target(key);
G4MaterialPropertyVector *targetVector=MPT.findValue(&target);
G4MaterialPropertyVector *targetVector=MPT [G4String(key)];
if (targetVector) {
targetVector->RemoveElement(aPhotonMomentum);
}
@@ -167,9 +169,9 @@ void G4MaterialPropertiesTable::RemoveEntry(char *key,
}
void G4MaterialPropertiesTable::DumpTable()
{
MPTiterator.reset();
while(++MPTiterator) {
G4cout << *MPTiterator.key() << endl;
MPTiterator.value()->DumpVector();
}
MPTiterator i;
for (i = MPT.begin(); i != MPT.end(); ++i) {
G4cout << *(*i).first << endl;
(*i).second->DumpVector();
}
}