Geant4  10.00.p03
G4ElementData.cc
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 // $Id: G4ElementData.cc 76289 2013-11-08 13:07:00Z gcosmo $
27 //
28 //---------------------------------------------------------------------------
29 //
30 // GEANT4 Class file
31 //
32 // Description: Data structure for cross sections, shell cross sections
33 // isotope cross sections
34 //
35 // Author: V.Ivanchenko 10.03.2011
36 //
37 // Modifications:
38 //
39 //----------------------------------------------------------------------------
40 //
41 
42 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
43 
44 #include "G4ElementData.hh"
45 
46 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
47 
49 {
50  name = "";
51  for(G4int i=0; i<maxNumElements; ++i) {
52  elmData[i] = 0;
53  elm2Data[i] = 0;
54  compLength[i] = 0;
55  }
56 }
57 
58 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
59 
61 {
62  for(G4int i=0; i<maxNumElements; ++i) {
63  //delete elmData[i];
64  delete elm2Data[i];
65  /*
66  if(compLength[i] > 0) {
67  for(size_t j=0; j<compLength[i]; ++j) {
68  delete (compData[i])[j];
69  }
70  }
71  */
72  }
73 }
74 
76 {
77  if(Z < 1 || Z >= maxNumElements) {
78  G4cout << "G4ElementData::InitialiseForElement ERROR for " << name
79  << " Z = " << Z << " is out of range!" << G4endl;
80  G4Exception("G4ElementData::InitialiseForElement()", "mat601",
81  FatalException, "Wrong data handling");
82  return;
83  }
84  if(elmData[Z]) { delete elmData[Z]; }
85  elmData[Z] = v;
86 }
87 
89 {
90  if(Z < 1 || Z >= maxNumElements) {
91  G4cout << "G4ElementData::InitialiseForElement ERROR for " << name
92  << " Z = " << Z << " is out of range!" << G4endl;
93  G4Exception("G4ElementData::InitialiseForElement()", "mat601",
94  FatalException, "Wrong data handling");
95  return;
96  }
97  if(elm2Data[Z]) { delete elm2Data[Z]; }
98  elm2Data[Z] = v;
99 }
100 
102 {
103  if(Z < 1 || Z >= maxNumElements) {
104  G4cout << "G4ElementData::InitialiseForComponent ERROR for " << name
105  << " Z = " << Z << " is out of range!" << G4endl;
106  G4Exception("G4ElementData::InitialiseForComponent()", "mat602",
107  FatalException, "Wrong data handling");
108  return;
109  }
110 
111  // only one initialisation is allowed
112  if(0 != compLength[Z]) { return; }
113 
114  // reserve a new structure
115  (compData[Z]).reserve(nComponents);
116  (compID[Z]).reserve(nComponents);
117 }
118 
119 void
121 {
122  if(Z < 1 || Z >= maxNumElements) {
123  G4cout << "G4ElementData::AddComponent ERROR for " << name
124  << " Z = " << Z << " is out of range!" << G4endl;
125  G4Exception("G4ElementData::AddComponent()", "mat603",
126  FatalException, "Wrong data handling");
127  return;
128  }
129  (compData[Z]).push_back(v);
130  (compID[Z]).push_back(id);
131  ++compLength[Z];
132 }
void AddComponent(G4int Z, G4int id, G4PhysicsVector *v)
std::vector< G4PhysicsVector * > compData[maxNumElements]
G4int nComponents
Definition: TRTMaterials.hh:41
int G4int
Definition: G4Types.hh:78
const G4int maxNumElements
void InitialiseForElement(G4int Z, G4PhysicsVector *v)
G4GLOB_DLL std::ostream G4cout
size_t compLength[maxNumElements]
G4PhysicsVector * elmData[maxNumElements]
std::vector< G4int > compID[maxNumElements]
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
G4Physics2DVector * elm2Data[maxNumElements]
#define G4endl
Definition: G4ios.hh:61
void InitialiseForComponent(G4int Z, G4int nComponents=0)