Geant4
9.6.p02
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
geant4_9_6_p02
source
materials
src
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 67044 2013-01-30 08:50:06Z 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
48
G4ElementData::G4ElementData
()
49
{
50
name
=
""
;
51
for
(
G4int
i=0; i<
maxNumElements
; ++i) {
52
elmData[i] = 0;
53
compLength[i] = 0;
54
}
55
}
56
57
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
58
59
G4ElementData::~G4ElementData
()
60
{
61
for
(
G4int
i=0; i<
maxNumElements
; ++i) {
62
delete
elmData[i];
63
if
(compLength[i] > 0) {
64
for
(
size_t
j=0; j<compLength[i]; ++j) {
65
delete
(compData[i])[j];
66
}
67
}
68
}
69
}
70
71
void
G4ElementData::InitialiseForElement
(
G4int
Z
,
G4PhysicsVector
*
v
)
72
{
73
if
(Z < 1 || Z >=
maxNumElements
) {
74
G4cout
<<
"G4ElementData::InitialiseForElement ERROR for "
<<
name
75
<<
" Z = "
<< Z <<
" is out of range!"
<<
G4endl
;
76
G4Exception
(
"G4ElementData::InitialiseForElement()"
,
"mat601"
,
77
FatalException
,
"Wrong data handling"
);
78
return
;
79
}
80
if
(elmData[Z]) {
delete
elmData[
Z
]; }
81
elmData[
Z
] =
v
;
82
}
83
84
void
G4ElementData::InitialiseForComponent
(
G4int
Z
,
G4int
nComponents
)
85
{
86
if
(Z < 1 || Z >=
maxNumElements
) {
87
G4cout
<<
"G4ElementData::InitialiseForComponent ERROR for "
<<
name
88
<<
" Z = "
<< Z <<
" is out of range!"
<<
G4endl
;
89
G4Exception
(
"G4ElementData::InitialiseForComponent()"
,
"mat602"
,
90
FatalException
,
"Wrong data handling"
);
91
return
;
92
}
93
94
// only one initialisation is allowed
95
if
(0 != compLength[Z]) {
return
; }
96
97
// reserve a new structure
98
(compData[
Z
]).reserve(nComponents);
99
(compID[
Z
]).reserve(nComponents);
100
}
101
102
void
103
G4ElementData::AddComponent
(
G4int
Z
,
G4int
id
,
G4PhysicsVector
*
v
)
104
{
105
if
(Z < 1 || Z >=
maxNumElements
) {
106
G4cout
<<
"G4ElementData::AddComponent ERROR for "
<<
name
107
<<
" Z = "
<< Z <<
" is out of range!"
<<
G4endl
;
108
G4Exception
(
"G4ElementData::AddComponent()"
,
"mat603"
,
109
FatalException
,
"Wrong data handling"
);
110
return
;
111
}
112
(compData[
Z
]).push_back(v);
113
(compID[
Z
]).push_back(
id
);
114
++compLength[
Z
];
115
}
Generated on Sat May 25 2013 14:33:20 for Geant4 by
1.8.4