comparator Struct Reference

#include <G4MolecularConfiguration.hh>


Public Member Functions

bool operator() (const G4ElectronOccupancy &occ1, const G4ElectronOccupancy &occ2) const


Detailed Description

Definition at line 194 of file G4MolecularConfiguration.hh.


Member Function Documentation

bool comparator::operator() ( const G4ElectronOccupancy occ1,
const G4ElectronOccupancy occ2 
) const [inline]

Definition at line 196 of file G4MolecularConfiguration.hh.

References G4ElectronOccupancy::GetOccupancy(), G4ElectronOccupancy::GetSizeOfOrbit(), and G4ElectronOccupancy::GetTotalOccupancy().

00197     {
00198         // Since this method is called a lot of time,
00199         // we retrieve only once the totOcc
00200         G4int totalOcc1 = occ1.GetTotalOccupancy() ;
00201         G4int totalOcc2 = occ2.GetTotalOccupancy() ;
00202         if ( totalOcc1!= totalOcc2)
00203         {
00204             return totalOcc1<totalOcc2;
00205         }
00206         else
00207         {
00208             G4int occupancy1 = -1 ;
00209             G4int occupancy2 = -1 ;
00210             const G4int sizeOrbit = occ1.GetSizeOfOrbit() ;
00211             for (G4int i=0; i<occ1.GetSizeOfOrbit();)
00212             {
00213                 // Since this method is called a lot of time,
00214                 // we retrieve only once the Occ
00215 
00216                 occupancy1 = occ1.GetOccupancy(i);
00217                 occupancy2 = occ2.GetOccupancy(i);
00218 
00219                 if (occupancy1 != occupancy2)
00220                 {
00221                     return occupancy1 < occupancy2;
00222                 }
00223                 else
00224                 {
00225                     i++;
00226                     if (i >= sizeOrbit) return false;
00227                 }
00228             }
00229         }
00230         return false;
00231     }


The documentation for this struct was generated from the following file:
Generated on Mon May 27 17:51:22 2013 for Geant4 by  doxygen 1.4.7