Optimizing the code by gouping a bunch of vectors into a single structured vector
In several places in the code you use a bunch of vectors to define properties, vectors from the same size that are always used together. So an important optimization should be to create structures and the a vector of that structures to optimize creation/deletion/insertion/extraction of elements. An example is the file GateSteppingVerbose, you have
/- std::vector<GateInfoForSteppingVerbose > theListOfTrack; /- /- std::vector<G4String> theListOfVolumeAtTrackLevel; /- std::vector<G4String> theListOfProcessAtTrackLevel; /- std::vector<G4String> theListOfParticleAtTrackLevel; /- std::vector<G4SliceTimer> theListOfTimerAtTrackLevel; /- std::vector<G4int> theListOfEnergyAtTrackLevel;
while you can have
/+ struct GateTrackLevel /+ { /+ G4SliceTimer* Timer; /+ G4String Particle; /+ G4String Process; /+ G4String Volume; /+ G4int Energy; /+ G4double Time; /+ }; /+ typedef std::vector<GateTrackLevel> GateTrackLevelVec;
and finally
/+ GateTrackLevelVec theListOfTrack;
this is used intensively in the code, so this issue require a lot of changes