Ignore:
Timestamp:
Sep 10, 2008, 5:40:37 PM (16 years ago)
Author:
garnier
Message:

geant4.8.2 beta

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/materials/src/G4MaterialPropertyVector.cc

    r822 r850  
    2525//
    2626//
    27 // $Id: G4MaterialPropertyVector.cc,v 1.15 2006/06/29 19:12:56 gunter Exp $
    28 // GEANT4 tag $Name: $
     27// $Id: G4MaterialPropertyVector.cc,v 1.16 2008/06/05 23:38:51 gum Exp $
     28// GEANT4 tag $Name: HEAD $
    2929//
    3030//
     
    9898        /////////////////
    9999
    100 G4MaterialPropertyVector::G4MaterialPropertyVector(G4double *PhotonMomenta,
     100G4MaterialPropertyVector::G4MaterialPropertyVector(G4double *PhotonEnergies,
    101101                                                   G4double *PropertyValues,
    102102                                                   G4int     NumElements)
     
    106106
    107107        // create a vector filling it with the values
    108         // from PhotonMomenta[] and PropertyValues[]
     108        // from PhotonEnergies[] and PropertyValues[]
    109109
    110110        for(G4int i = 0; i < NumElements; i++) {
    111                 AddElement(PhotonMomenta[i], PropertyValues[i]);
     111                AddElement(PhotonEnergies[i], PropertyValues[i]);
    112112        }
    113113}
     
    141141        // Methods
    142142        ////////////
    143 void G4MaterialPropertyVector::AddElement(G4double aPhotonMomentum,
     143void G4MaterialPropertyVector::AddElement(G4double aPhotonEnergy,
    144144                                          G4double aPropertyValue)
    145145{
    146146        G4MPVEntry *newElement;
    147147       
    148         newElement = new G4MPVEntry(aPhotonMomentum, aPropertyValue);
     148        newElement = new G4MPVEntry(aPhotonEnergy, aPropertyValue);
    149149        MPV.push_back(newElement);
    150150        std::sort(MPV.begin(), MPV.end(), MPVEntry_less());
     
    152152}
    153153
    154 void G4MaterialPropertyVector::RemoveElement(G4double aPhotonMomentum)
     154void G4MaterialPropertyVector::RemoveElement(G4double aPhotonEnergy)
    155155{
    156156        G4MPVEntry *newElement;
    157157        G4MPVEntry *success=0;
    158158
    159         newElement = new G4MPVEntry(aPhotonMomentum, DBL_MAX);
     159        newElement = new G4MPVEntry(aPhotonEnergy, DBL_MAX);
    160160
    161161        std::vector<G4MPVEntry*>::iterator i;
     
    179179
    180180G4double
    181 G4MaterialPropertyVector::GetProperty(G4double aPhotonMomentum) const
     181G4MaterialPropertyVector::GetProperty(G4double aPhotonEnergy) const
    182182{
    183183        G4MPVEntry *target, *temp;
     
    189189        /////////////////////////
    190190
    191         G4double PMmin   = MPV.front()->GetPhotonMomentum();
     191        G4double PMmin   = MPV.front()->GetPhotonEnergy();
    192192        G4double minProp = MPV.front()->GetProperty();
    193         G4double PMmax   = MPV.back() ->GetPhotonMomentum();
     193        G4double PMmax   = MPV.back() ->GetPhotonEnergy();
    194194        G4double maxProp = MPV.back() ->GetProperty();
    195195
     
    198198        ///////////////////////////////////////////
    199199
    200         if (aPhotonMomentum < PMmin)
     200        if (aPhotonEnergy < PMmin)
    201201        {
    202202                G4cout << "\nWarning: G4MaterialPropertyVector::GetProperty";
     
    206206        }
    207207
    208         if (aPhotonMomentum > PMmax)
     208        if (aPhotonEnergy > PMmax)
    209209        {
    210210                G4cout << "\nWarning: G4MaterialPropertyVector::GetProperty";
     
    214214        }
    215215       
    216         target = new G4MPVEntry(aPhotonMomentum, 0.0);
     216        target = new G4MPVEntry(aPhotonEnergy, 0.0);
    217217
    218218        temp = 0;
     
    236236                //////////////////////////////
    237237
    238                 GetAdjacentBins(aPhotonMomentum, &left, &right);
    239 
    240                 pmleft = MPV[left]->GetPhotonMomentum();
    241                 pmright = MPV[right]->GetPhotonMomentum();
    242                 ratio1 = (aPhotonMomentum-pmleft)/(pmright-pmleft);
     238                GetAdjacentBins(aPhotonEnergy, &left, &right);
     239
     240                pmleft = MPV[left]->GetPhotonEnergy();
     241                pmright = MPV[right]->GetPhotonEnergy();
     242                ratio1 = (aPhotonEnergy-pmleft)/(pmright-pmleft);
    243243                ratio2 = 1 - ratio1;
    244244                InterpolatedValue = MPV[left]->GetProperty()*ratio2 +
     
    264264}
    265265
    266 G4double G4MaterialPropertyVector::GetPhotonMomentum() const
     266G4double G4MaterialPropertyVector::GetPhotonEnergy() const
    267267{
    268268//      For use with G4MaterialPropertyVector iterator
    269269
    270270        if(CurrentEntry == -1 || CurrentEntry >= NumEntries) {
    271                 G4Exception("G4MaterialPropertyVector::GetPhotonMomentum ==>"
    272                 "Iterator attempted to Retrieve Photon Momentum out of range");
     271                G4Exception("G4MaterialPropertyVector::GetPhotonEnergy ==>"
     272                "Iterator attempted to Retrieve Photon Energy out of range");
    273273                return DBL_MAX;
    274274        }
    275275        else {
    276                 return MPV[CurrentEntry]->GetPhotonMomentum();
     276                return MPV[CurrentEntry]->GetPhotonEnergy();
    277277        }
    278278}
    279279
    280280G4double
    281 G4MaterialPropertyVector::GetPhotonMomentum(G4double aProperty) const
     281G4MaterialPropertyVector::GetPhotonEnergy(G4double aProperty) const
    282282{
    283283//                              ***NB***
    284 // Assumes that the property is an increasing function of photon momentum (e.g.
     284// Assumes that the property is an increasing function of photon energy (e.g.
    285285// refraction index)
    286286//                              ***NB***
    287287//
    288 // Returns the photon momentum corresponding to the property value passed in.
    289 // If several photon momentum values correspond to the value passed in, the
    290 // function returns the first photon momentum in the vector that corresponds
     288// Returns the photon energy corresponding to the property value passed in.
     289// If several photon energy values correspond to the value passed in, the
     290// function returns the first photon energy in the vector that corresponds
    291291// to that value.
    292292
     
    299299
    300300        G4double PropMin = MPV.front()->GetProperty();
    301         G4double PMmin   = MPV.front()->GetPhotonMomentum();
     301        G4double PMmin   = MPV.front()->GetPhotonEnergy();
    302302        G4double PropMax = MPV.back() ->GetProperty();
    303         G4double PMmax   = MPV.back() ->GetPhotonMomentum();
     303        G4double PMmax   = MPV.back() ->GetPhotonEnergy();
    304304
    305305        ///////////////////////////////////////////
     
    309309        if (aProperty < PropMin)
    310310        {
    311           G4cout << "\nWarning: G4MaterialPropertyVector::GetPhotonMomentum";
    312           G4cout << "\n==> attempt to Retrieve Photon Momentum out of range"
     311          G4cout << "\nWarning: G4MaterialPropertyVector::GetPhotonEnergy";
     312          G4cout << "\n==> attempt to Retrieve Photon Energy out of range"
    313313               << G4endl;
    314314          return PMmin;
     
    316316
    317317        if (aProperty > PropMax) {
    318           G4cout << "\nWarning: G4MaterialPropertyVector::GetPhotonMomentum";
    319           G4cout << "\n==> attempt to Retrieve Photon Momentum out of range"
     318          G4cout << "\nWarning: G4MaterialPropertyVector::GetPhotonEnergy";
     319          G4cout << "\n==> attempt to Retrieve Photon Energy out of range"
    320320               << G4endl;
    321321          return PMmax;
     
    335335                if (MPV[mid]->GetProperty() == aProperty) {
    336336
    337                         // Get first photon momentum value in vector that
     337                        // Get first photon energy value in vector that
    338338                        // corresponds to property value 
    339339
     
    343343                        }
    344344
    345                         InterpolatedValue = MPV[mid]->GetPhotonMomentum();
    346                         goto end_GetPhotonMomentum;     
     345                        InterpolatedValue = MPV[mid]->GetPhotonEnergy();
     346                        goto end_GetPhotonEnergy;       
    347347                }
    348348                if (MPV[mid]->GetProperty() < aProperty)
     
    357357        ratio1 = (aProperty - pleft) / (pright - pleft);
    358358        ratio2 = 1 - ratio1;
    359         InterpolatedValue = MPV[left]->GetPhotonMomentum()*ratio2 +
    360                             MPV[right]->GetPhotonMomentum()*ratio1;
    361 
    362 end_GetPhotonMomentum:
     359        InterpolatedValue = MPV[left]->GetPhotonEnergy()*ratio2 +
     360                            MPV[right]->GetPhotonEnergy()*ratio1;
     361
     362end_GetPhotonEnergy:
    363363
    364364        return InterpolatedValue;
     
    392392
    393393void
    394 G4MaterialPropertyVector::GetAdjacentBins(G4double aPhotonMomentum,
     394G4MaterialPropertyVector::GetAdjacentBins(G4double aPhotonEnergy,
    395395                                          G4int *left,
    396396                                          G4int *right) const
     
    401401        *right = (MPV.size() - 1); // was .entries()
    402402
    403         // find values in bins on either side of aPhotonMomentum
     403        // find values in bins on either side of aPhotonEnergy
    404404
    405405        do {
    406406                mid = (*left + *right)/2;
    407407
    408                 if (MPV[mid]->GetPhotonMomentum() < aPhotonMomentum)
     408                if (MPV[mid]->GetPhotonEnergy() < aPhotonEnergy)
    409409                {
    410410                        *left = mid;
Note: See TracChangeset for help on using the changeset viewer.