Geant4 11.1.1
Toolkit for the simulation of the passage of particles through matter
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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//
27//---------------------------------------------------------------------------
28//
29// GEANT4 Class file
30//
31// Description: Data structure for cross sections, shell cross sections
32// isotope cross sections
33//
34// Author: V.Ivanchenko 10.03.2011
35//
36// Modifications:
37//
38//----------------------------------------------------------------------------
39//
40
41//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
42
43#include "G4ElementData.hh"
44
45//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
46
48{
49 for(G4int i=0; i<maxNumElm; ++i) {
50 elmData[i] = nullptr;
51 elm2Data[i] = nullptr;
52 compLength[i] = 0;
53 compData[i] = nullptr;
54 compID[i] = nullptr;
55 }
56}
57
58//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
59
61{
62 for(G4int i=0; i<maxNumElm; ++i) {
63 delete elmData[i];
64 delete elm2Data[i];
65 if(nullptr != compID[i]) {
66 for(size_t j=0; j<compID[i]->size(); ++j) {
67 delete (*(compData[i]))[j];
68 }
69 delete compID[i];
70 delete compData[i];
71 }
72 }
73}
74
76{
77 if(Z < 1 || Z >= maxNumElm) {
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(nullptr != elmData[Z]) { delete elmData[Z]; }
85 elmData[Z] = v;
86}
87
89{
90 if(Z < 1 || Z >= maxNumElm) {
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(nullptr != elm2Data[Z]) { delete elm2Data[Z]; }
98 elm2Data[Z] = v;
99}
100
102{
103 if(Z < 1 || Z >= maxNumElm || nComponents < 0) {
104 G4cout << "G4ElementData::InitialiseForComponent ERROR for " << name
105 << " Z= " << Z << " Ncomp= " << nComponents
106 << " is out of range!" << G4endl;
107 G4Exception("G4ElementData::InitialiseForComponent()", "mat602",
108 FatalException, "Wrong data handling");
109 return;
110 }
111
112 // reserve a new structure
113 if(nullptr == compID[Z]) {
114 compID[Z] = new std::vector<G4int>();
115 compData[Z] = new std::vector<G4PhysicsVector*>();
116 }
117 compID[Z]->resize(nComponents, -1);
118 compData[Z]->resize(nComponents, nullptr);
119 compLength[Z] = 0;
120}
121
123{
124 if(Z < 1 || Z >= maxNumElm ||
125 (G4int)compID[Z]->size() == compLength[Z]) {
126 G4cout << "G4ElementData::AddComponent ERROR for " << name
127 << " Z = " << Z << " is out of range!" << G4endl;
128 G4Exception("G4ElementData::AddComponent()", "mat603",
129 FatalException, "Wrong data handling");
130 return;
131 }
132 (*(compData[Z]))[compLength[Z]] = v;
133 (*(compID[Z]))[compLength[Z]] = id;
134 compLength[Z] = compLength[Z] + 1;
135}
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:59
int G4int
Definition: G4Types.hh:85
const G4int Z[17]
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
void InitialiseForComponent(G4int Z, G4int nComponents=0)
void InitialiseForElement(G4int Z, G4PhysicsVector *v)
void AddComponent(G4int Z, G4int id, G4PhysicsVector *v)