G4ElementData.cc

Go to the documentation of this file.
00001 //
00002 // ********************************************************************
00003 // * License and Disclaimer                                           *
00004 // *                                                                  *
00005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
00006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
00007 // * conditions of the Geant4 Software License,  included in the file *
00008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
00009 // * include a list of copyright holders.                             *
00010 // *                                                                  *
00011 // * Neither the authors of this software system, nor their employing *
00012 // * institutes,nor the agencies providing financial support for this *
00013 // * work  make  any representation or  warranty, express or implied, *
00014 // * regarding  this  software system or assume any liability for its *
00015 // * use.  Please see the license in the file  LICENSE  and URL above *
00016 // * for the full disclaimer and the limitation of liability.         *
00017 // *                                                                  *
00018 // * This  code  implementation is the result of  the  scientific and *
00019 // * technical work of the GEANT4 collaboration.                      *
00020 // * By using,  copying,  modifying or  distributing the software (or *
00021 // * any work based  on the software)  you  agree  to acknowledge its *
00022 // * use  in  resulting  scientific  publications,  and indicate your *
00023 // * acceptance of all terms of the Geant4 Software license.          *
00024 // ********************************************************************
00025 //
00026 // $Id: G4ElementData.cc 67044 2013-01-30 08:50:06Z gcosmo $
00027 //
00028 //---------------------------------------------------------------------------
00029 //
00030 // GEANT4 Class file
00031 //
00032 // Description: Data structure for cross sections, shell cross sections
00033 //              isotope cross sections
00034 //
00035 // Author:      V.Ivanchenko 10.03.2011
00036 //
00037 // Modifications:
00038 //
00039 //----------------------------------------------------------------------------
00040 //
00041 
00042 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
00043 
00044 #include "G4ElementData.hh"
00045 
00046 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
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 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
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   // only one initialisation is allowed
00095   if(0 != compLength[Z]) { return; }
00096 
00097   // reserve a new structure
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 }

Generated on Mon May 27 17:48:07 2013 for Geant4 by  doxygen 1.4.7