File indexing completed on 2026-04-10 07:50:31
0001 #pragma once
0002
0003 #include <string>
0004 #include <vector>
0005 #include "G4MaterialTable.hh"
0006
0007 struct U4MaterialTable
0008 {
0009 static void GetMaterialNames(std::vector<std::string>& names );
0010 };
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020 inline void U4MaterialTable::GetMaterialNames(std::vector<std::string>& names )
0021 {
0022 const G4MaterialTable* theMaterialTable = G4Material::GetMaterialTable();
0023 const G4int numOfMaterials = G4Material::GetNumberOfMaterials();
0024 for( G4int iMaterial = 0; iMaterial < numOfMaterials; iMaterial++ )
0025 {
0026 G4Material* material = (*theMaterialTable)[iMaterial];
0027 const G4String& _name = material->GetName() ;
0028 const char* name = _name.c_str() ;
0029 names.push_back(name) ;
0030 }
0031 }
0032