Geant4 Cross Reference |
1 // 1 2 // ******************************************* 3 // * License and Disclaimer 4 // * 5 // * The Geant4 software is copyright of th 6 // * the Geant4 Collaboration. It is provided 7 // * conditions of the Geant4 Software License 8 // * LICENSE and available at http://cern.ch/ 9 // * include a list of copyright holders. 10 // * 11 // * Neither the authors of this software syst 12 // * institutes,nor the agencies providing fin 13 // * work make any representation or warran 14 // * regarding this software system or assum 15 // * use. Please see the license in the file 16 // * for the full disclaimer and the limitatio 17 // * 18 // * This code implementation is the result 19 // * technical work of the GEANT4 collaboratio 20 // * By using, copying, modifying or distri 21 // * any work based on the software) you ag 22 // * use in resulting scientific publicati 23 // * acceptance of all terms of the Geant4 Sof 24 // ******************************************* 25 // 26 /* 27 * G4MoleculeTable.cc 28 * 29 * Created on: 23 oct. 2013 30 * Author: kara 31 */ 32 33 #include "G4MoleculeTable.hh" 34 #include "G4MolecularConfiguration.hh" 35 #include "G4MoleculeDefinition.hh" 36 #include "G4MoleculeTableMessenger.hh" 37 38 G4MoleculeTable* G4MoleculeTable::fpgMoleculeT 39 40 //-------------------------------------------- 41 42 G4MoleculeTable::G4MoleculeTable() 43 : fMoleculeDefTableMessenger(new G4MoleculeT 44 { 45 } 46 47 //-------------------------------------------- 48 49 G4MoleculeTable::~G4MoleculeTable() 50 = default; 51 52 //-------------------------------------------- 53 54 G4MoleculeTable* G4MoleculeTable::Instance() 55 { 56 if (fpgMoleculeTable == nullptr) fpgMolecule 57 return fpgMoleculeTable; 58 } 59 60 //-------------------------------------------- 61 62 G4MoleculeTable* G4MoleculeTable::GetMoleculeT 63 { 64 return Instance(); 65 } 66 67 //-------------------------------------------- 68 69 G4MoleculeDefinition* 70 G4MoleculeTable::CreateMoleculeDefinition(cons 71 doub 72 { 73 return new G4MoleculeDefinition(name, -1 /* 74 diffusion_co 75 } 76 77 //-------------------------------------------- 78 79 G4MoleculeDefinition* 80 G4MoleculeTable::GetMoleculeDefinition(const G 81 bool mu 82 { 83 auto it = fMoleculeDefTable.find(name); 84 G4MoleculeDefinition* definition(nullptr); 85 if (it != fMoleculeDefTable.end()) 86 { 87 definition = it->second; 88 } 89 else if(mustExist) 90 { 91 // exception 92 G4ExceptionDescription description; 93 description << "The molecule definition " 94 << " was NOT recorded in the t 95 G4Exception("G4MoleculeTable::CreateMolecu 96 "MOLECULE_DEFINITION_NOT_CREAT 97 FatalException, 98 description); 99 } 100 return definition; 101 } 102 103 //-------------------------------------------- 104 105 G4MolecularConfiguration* 106 G4MoleculeTable::GetConfiguration(const G4Stri 107 { 108 G4MolecularConfiguration* species = 109 G4MolecularConfiguration::GetMolecularCo 110 111 if(species == nullptr && mustExist) 112 { 113 // exception 114 G4ExceptionDescription description; 115 description << "The configuration " << nam 116 << " was not recorded in the t 117 G4Exception("G4MoleculeTable::GetConfigura 118 "CONF_NOT_CREATED", 119 FatalException, 120 description); 121 } 122 123 return species; 124 } 125 126 //-------------------------------------------- 127 128 G4MolecularConfiguration* 129 G4MoleculeTable::GetConfiguration(G4int id) 130 { 131 G4MolecularConfiguration* species = 132 G4MolecularConfiguration::GetMolecular 133 134 return species; 135 } 136 137 //-------------------------------------------- 138 139 void G4MoleculeTable::Insert(G4MoleculeDefinit 140 { 141 142 const G4String& name = moleculeDefinition->G 143 auto it = fMoleculeDefTable.find(name); 144 if (it == fMoleculeDefTable.end()) 145 { 146 fMoleculeDefTable[name] = moleculeDefiniti 147 } 148 else 149 { 150 // exception 151 G4ExceptionDescription description; 152 description << "The molecule definition " 153 << " was already recorded in t 154 G4Exception("G4MoleculeTable::CreateMolecu 155 "DEFINITION_ALREADY_CREATED", 156 } 157 } 158 159 //-------------------------------------------- 160 161 void G4MoleculeTable::PrepareMolecularConfigur 162 { 163 auto it = fMoleculeDefTable.begin(); 164 165 for(; it != fMoleculeDefTable.end() ; ++it) 166 { 167 G4MolecularConfiguration::GetOrCreateMolec 168 } 169 } 170 171 //-------------------------------------------- 172 173 G4MolecularConfiguration* 174 G4MoleculeTable::CreateConfiguration(const G4S 175 G4Molecul 176 { 177 bool alreadyCreated(false); 178 179 G4MolecularConfiguration* molConf = 180 G4MolecularConfiguration::CreateMolecula 181 182 183 184 return molConf; 185 } 186 187 //-------------------------------------------- 188 189 G4MolecularConfiguration* 190 G4MoleculeTable::CreateConfiguration(const G4S 191 G4Molecul 192 const G4S 193 int charg 194 { 195 bool alreadyCreated(false); 196 197 G4MolecularConfiguration* molConf = 198 G4MolecularConfiguration::CreateMolecula 199 200 201 202 203 204 return molConf; 205 } 206 207 //-------------------------------------------- 208 209 G4MolecularConfiguration* 210 G4MoleculeTable::CreateConfiguration(const G4S 211 G4Molecul 212 int charg 213 double di 214 { 215 bool alreadyCreated(false); 216 217 G4MolecularConfiguration* molConf = 218 G4MolecularConfiguration::CreateMolecu 219 220 221 222 223 224 if(diffusion_coefficient!=-1) // TODO 225 { 226 molConf->SetDiffusionCoefficient(diffusion 227 } 228 return molConf; 229 } 230 231 //-------------------------------------------- 232 233 G4MolecularConfiguration* 234 G4MoleculeTable::CreateConfiguration(const G4S 235 const G4M 236 const G4S 237 const G4E 238 { 239 bool alreadyCreated(false); 240 241 G4MolecularConfiguration* molConf = 242 G4MolecularConfiguration::CreateMolecula 243 244 245 246 247 248 return molConf; 249 } 250 251 //-------------------------------------------- 252 253 void G4MoleculeTable::Finalize() 254 { 255 G4MolecularConfiguration::FinalizeAll(); 256 } 257 258 //-------------------------------------------- 259 260 G4ConfigurationIterator G4MoleculeTable::GetCo 261 { 262 return G4ConfigurationIterator(G4MolecularCo 263 } 264 265 //-------------------------------------------- 266 267 int G4MoleculeTable::GetNumberOfDefinedSpecies 268 { 269 return G4MolecularConfiguration::GetNumberOf 270 } 271