G4Physics2DVector.icc

Go to the documentation of this file.
00001 //
00002 // ********************************************************************
00003 // * License and Disclaimer                                           *
00004 // *                                                                  *
00005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
00006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
00007 // * conditions of the Geant4 Software License,  included in the file *
00008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
00009 // * include a list of copyright holders.                             *
00010 // *                                                                  *
00011 // * Neither the authors of this software system, nor their employing *
00012 // * institutes,nor the agencies providing financial support for this *
00013 // * work  make  any representation or  warranty, express or implied, *
00014 // * regarding  this  software system or assume any liability for its *
00015 // * use.  Please see the license in the file  LICENSE  and URL above *
00016 // * for the full disclaimer and the limitation of liability.         *
00017 // *                                                                  *
00018 // * This  code  implementation is the result of  the  scientific and *
00019 // * technical work of the GEANT4 collaboration.                      *
00020 // * By using,  copying,  modifying or  distributing the software (or *
00021 // * any work based  on the software)  you  agree  to acknowledge its *
00022 // * use  in  resulting  scientific  publications,  and indicate your *
00023 // * acceptance of all terms of the Geant4 Software license.          *
00024 // ********************************************************************
00025 //
00026 //
00027 // $Id:$
00028 // GEANT4 tag $Name: not supported by cvs2svn $
00029 //
00030 // 
00031 //---------------------------------------------------------------
00032 //      GEANT 4 class inline source file
00033 //
00034 //  G4Physics2DVector.icc
00035 
00036 //---------------------------------------------------------------
00037 
00038 inline G4double G4Physics2DVector::Value(G4double x, G4double y)
00039 {
00040   if(x != cache->lastX || y != cache->lastY) { ComputeValue(x, y); }
00041   return cache->lastValue;
00042 }
00043 
00044 inline void G4Physics2DVector::PutX(size_t idx, G4double val)
00045 {
00046   xVector[idx] = val;
00047 }
00048 
00049 inline void G4Physics2DVector::PutY(size_t idy, G4double val)
00050 {
00051   yVector[idy] = val;
00052 }
00053 
00054 inline void 
00055  G4Physics2DVector::PutValue(size_t idx, size_t idy, G4double val)
00056 {
00057   (*(value[idy]))[idx] = val;
00058 }
00059 
00060 inline G4double G4Physics2DVector::GetX(size_t index) const
00061 {
00062   return xVector[index];
00063 }
00064 
00065 inline G4double G4Physics2DVector::GetY(size_t index) const
00066 {
00067   return yVector[index];
00068 }
00069 
00070 inline
00071  G4double G4Physics2DVector::GetValue(size_t idx, size_t idy) const
00072 {
00073   return (*(value[idy]))[idx];
00074 }
00075 
00076 inline size_t G4Physics2DVector::GetLengthX() const
00077 {
00078   return numberOfXNodes;
00079 }
00080 
00081 inline size_t G4Physics2DVector::GetLengthY() const
00082 {
00083   return numberOfYNodes;
00084 }
00085 
00086 inline G4PhysicsVectorType G4Physics2DVector::GetType() const
00087 {
00088   return type;
00089 }
00090 
00091 inline void G4Physics2DVector::SetBicubicInterpolation(G4bool val)
00092 {
00093   useBicubic = val;
00094 }
00095 
00096 inline G4double G4Physics2DVector::GetLastX() const
00097 {
00098   return cache->lastX;
00099 }
00100 
00101 inline G4double G4Physics2DVector::GetLastY() const
00102 {
00103   return cache->lastY;
00104 }
00105 
00106 inline G4double G4Physics2DVector::GetLastValue() const
00107 {
00108   return cache->lastValue;
00109 }
00110 
00111 inline size_t G4Physics2DVector::GetLastBinX() const
00112 {
00113    return cache->lastBinX;
00114 }
00115 
00116 inline size_t G4Physics2DVector::GetLastBinY() const
00117 {
00118    return cache->lastBinY;
00119 }
00120  
00121 inline void 
00122 G4Physics2DVector::FindBin(G4double z, const G4PV2DDataVector& v, size_t& idz)
00123 {
00124   if(z < v[idz] || z >=  v[idz]) { idz = FindBinLocation(z, v); }
00125 }
00126 
00127 inline void G4Physics2DVector::FindBinLocationX(G4double x)
00128 {
00129   FindBin(x, xVector, cache->lastBinX);
00130 }
00131 
00132 inline void G4Physics2DVector::FindBinLocationY(G4double y)
00133 {
00134   FindBin(y, yVector, cache->lastBinY);
00135 }
00136 
00137 inline void G4Physics2DVector::SetVerboseLevel(G4int val)
00138 {
00139    verboseLevel = val;
00140 }
00141 
00142 inline G4int G4Physics2DVector::GetVerboseLevel() const
00143 {
00144    return verboseLevel;
00145 }
00146 
00147 inline G4double 
00148 G4Physics2DVector::DerivativeX(size_t idx, size_t idy, G4double fac)
00149 {
00150   size_t i1 = idx;
00151   if(i1 > 0) { --i1; }
00152   size_t i2 = idx;
00153   if(i2+1 < numberOfXNodes) { ++i2; }
00154   return fac*(GetValue(i2, idy) - GetValue(i1, idy))/(GetX(i2) - GetX(i1));
00155 }
00156 
00157 inline G4double 
00158 G4Physics2DVector::DerivativeY(size_t idx, size_t idy, G4double fac)
00159 {
00160   size_t i1 = idy;
00161   if(i1 > 0) { --i1; }
00162   size_t i2 = idy;
00163   if(i2+1 < numberOfYNodes) { ++i2; }
00164   return fac*(GetValue(idx, i2) - GetValue(idx, i1))/(GetY(i2) - GetY(i1));
00165 }
00166 
00167 inline G4double 
00168 G4Physics2DVector::DerivativeXY(size_t idx, size_t idy, G4double fac)
00169 {
00170   size_t i1 = idx;
00171   if(i1 > 0) { --i1; }
00172   size_t i2 = idx;
00173   if(i2+1 < numberOfXNodes) { ++i2; }
00174   size_t j1 = idy;
00175   if(j1 > 0) { --j1; }
00176   size_t j2 = idy;
00177   if(j2+1 < numberOfYNodes) { ++j2; }
00178   return fac*(GetValue(i2, j2) - GetValue(i1, j2) - GetValue(i2, j1) 
00179         + GetValue(i1, j1))/((GetX(i2) - GetX(i1))*(GetY(j2) - GetY(j1)));
00180 }

Generated on Mon May 27 17:49:19 2013 for Geant4 by  doxygen 1.4.7