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3 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /processes/electromagnetic/dna/molecules/management/src/G4MoleculeTable.cc (Version 11.3.0) and /processes/electromagnetic/dna/molecules/management/src/G4MoleculeTable.cc (Version 10.3.p3)


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