00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044 #include "G4ElementData.hh"
00045
00046
00047
00048 G4ElementData::G4ElementData()
00049 {
00050 name = "";
00051 for(G4int i=0; i<maxNumElements; ++i) {
00052 elmData[i] = 0;
00053 compLength[i] = 0;
00054 }
00055 }
00056
00057
00058
00059 G4ElementData::~G4ElementData()
00060 {
00061 for(G4int i=0; i<maxNumElements; ++i) {
00062 delete elmData[i];
00063 if(compLength[i] > 0) {
00064 for(size_t j=0; j<compLength[i]; ++j) {
00065 delete (compData[i])[j];
00066 }
00067 }
00068 }
00069 }
00070
00071 void G4ElementData::InitialiseForElement(G4int Z, G4PhysicsVector* v)
00072 {
00073 if(Z < 1 || Z >= maxNumElements) {
00074 G4cout << "G4ElementData::InitialiseForElement ERROR for " << name
00075 << " Z = " << Z << " is out of range!" << G4endl;
00076 G4Exception("G4ElementData::InitialiseForElement()", "mat601",
00077 FatalException, "Wrong data handling");
00078 return;
00079 }
00080 if(elmData[Z]) { delete elmData[Z]; }
00081 elmData[Z] = v;
00082 }
00083
00084 void G4ElementData::InitialiseForComponent(G4int Z, G4int nComponents)
00085 {
00086 if(Z < 1 || Z >= maxNumElements) {
00087 G4cout << "G4ElementData::InitialiseForComponent ERROR for " << name
00088 << " Z = " << Z << " is out of range!" << G4endl;
00089 G4Exception("G4ElementData::InitialiseForComponent()", "mat602",
00090 FatalException, "Wrong data handling");
00091 return;
00092 }
00093
00094
00095 if(0 != compLength[Z]) { return; }
00096
00097
00098 (compData[Z]).reserve(nComponents);
00099 (compID[Z]).reserve(nComponents);
00100 }
00101
00102 void
00103 G4ElementData::AddComponent(G4int Z, G4int id, G4PhysicsVector* v)
00104 {
00105 if(Z < 1 || Z >= maxNumElements) {
00106 G4cout << "G4ElementData::AddComponent ERROR for " << name
00107 << " Z = " << Z << " is out of range!" << G4endl;
00108 G4Exception("G4ElementData::AddComponent()", "mat603",
00109 FatalException, "Wrong data handling");
00110 return;
00111 }
00112 (compData[Z]).push_back(v);
00113 (compID[Z]).push_back(id);
00114 ++compLength[Z];
00115 }