181 lines
4.8 KiB
Plaintext
181 lines
4.8 KiB
Plaintext
//
|
|
// ********************************************************************
|
|
// * License and Disclaimer *
|
|
// * *
|
|
// * The Geant4 software is copyright of the Copyright Holders of *
|
|
// * the Geant4 Collaboration. It is provided under the terms and *
|
|
// * conditions of the Geant4 Software License, included in the file *
|
|
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
|
// * include a list of copyright holders. *
|
|
// * *
|
|
// * Neither the authors of this software system, nor their employing *
|
|
// * institutes,nor the agencies providing financial support for this *
|
|
// * work make any representation or warranty, express or implied, *
|
|
// * regarding this software system or assume any liability for its *
|
|
// * use. Please see the license in the file LICENSE and URL above *
|
|
// * for the full disclaimer and the limitation of liability. *
|
|
// * *
|
|
// * This code implementation is the result of the scientific and *
|
|
// * technical work of the GEANT4 collaboration. *
|
|
// * By using, copying, modifying or distributing the software (or *
|
|
// * any work based on the software) you agree to acknowledge its *
|
|
// * use in resulting scientific publications, and indicate your *
|
|
// * acceptance of all terms of the Geant4 Software license. *
|
|
// ********************************************************************
|
|
//
|
|
//
|
|
// $Id:$
|
|
// GEANT4 tag $Name: not supported by cvs2svn $
|
|
//
|
|
//
|
|
//---------------------------------------------------------------
|
|
// GEANT 4 class inline source file
|
|
//
|
|
// G4Physics2DVector.icc
|
|
|
|
//---------------------------------------------------------------
|
|
|
|
inline G4double G4Physics2DVector::Value(G4double x, G4double y)
|
|
{
|
|
if(x != cache->lastX || y != cache->lastY) { ComputeValue(x, y); }
|
|
return cache->lastValue;
|
|
}
|
|
|
|
inline void G4Physics2DVector::PutX(size_t idx, G4double val)
|
|
{
|
|
xVector[idx] = val;
|
|
}
|
|
|
|
inline void G4Physics2DVector::PutY(size_t idy, G4double val)
|
|
{
|
|
yVector[idy] = val;
|
|
}
|
|
|
|
inline void
|
|
G4Physics2DVector::PutValue(size_t idx, size_t idy, G4double val)
|
|
{
|
|
(*(value[idy]))[idx] = val;
|
|
}
|
|
|
|
inline G4double G4Physics2DVector::GetX(size_t index) const
|
|
{
|
|
return xVector[index];
|
|
}
|
|
|
|
inline G4double G4Physics2DVector::GetY(size_t index) const
|
|
{
|
|
return yVector[index];
|
|
}
|
|
|
|
inline
|
|
G4double G4Physics2DVector::GetValue(size_t idx, size_t idy) const
|
|
{
|
|
return (*(value[idy]))[idx];
|
|
}
|
|
|
|
inline size_t G4Physics2DVector::GetLengthX() const
|
|
{
|
|
return numberOfXNodes;
|
|
}
|
|
|
|
inline size_t G4Physics2DVector::GetLengthY() const
|
|
{
|
|
return numberOfYNodes;
|
|
}
|
|
|
|
inline G4PhysicsVectorType G4Physics2DVector::GetType() const
|
|
{
|
|
return type;
|
|
}
|
|
|
|
inline void G4Physics2DVector::SetBicubicInterpolation(G4bool val)
|
|
{
|
|
useBicubic = val;
|
|
}
|
|
|
|
inline G4double G4Physics2DVector::GetLastX() const
|
|
{
|
|
return cache->lastX;
|
|
}
|
|
|
|
inline G4double G4Physics2DVector::GetLastY() const
|
|
{
|
|
return cache->lastY;
|
|
}
|
|
|
|
inline G4double G4Physics2DVector::GetLastValue() const
|
|
{
|
|
return cache->lastValue;
|
|
}
|
|
|
|
inline size_t G4Physics2DVector::GetLastBinX() const
|
|
{
|
|
return cache->lastBinX;
|
|
}
|
|
|
|
inline size_t G4Physics2DVector::GetLastBinY() const
|
|
{
|
|
return cache->lastBinY;
|
|
}
|
|
|
|
inline void
|
|
G4Physics2DVector::FindBin(G4double z, const G4PV2DDataVector& v, size_t& idz)
|
|
{
|
|
if(z < v[idz] || z >= v[idz]) { idz = FindBinLocation(z, v); }
|
|
}
|
|
|
|
inline void G4Physics2DVector::FindBinLocationX(G4double x)
|
|
{
|
|
FindBin(x, xVector, cache->lastBinX);
|
|
}
|
|
|
|
inline void G4Physics2DVector::FindBinLocationY(G4double y)
|
|
{
|
|
FindBin(y, yVector, cache->lastBinY);
|
|
}
|
|
|
|
inline void G4Physics2DVector::SetVerboseLevel(G4int val)
|
|
{
|
|
verboseLevel = val;
|
|
}
|
|
|
|
inline G4int G4Physics2DVector::GetVerboseLevel() const
|
|
{
|
|
return verboseLevel;
|
|
}
|
|
|
|
inline G4double
|
|
G4Physics2DVector::DerivativeX(size_t idx, size_t idy, G4double fac)
|
|
{
|
|
size_t i1 = idx;
|
|
if(i1 > 0) { --i1; }
|
|
size_t i2 = idx;
|
|
if(i2+1 < numberOfXNodes) { ++i2; }
|
|
return fac*(GetValue(i2, idy) - GetValue(i1, idy))/(GetX(i2) - GetX(i1));
|
|
}
|
|
|
|
inline G4double
|
|
G4Physics2DVector::DerivativeY(size_t idx, size_t idy, G4double fac)
|
|
{
|
|
size_t i1 = idy;
|
|
if(i1 > 0) { --i1; }
|
|
size_t i2 = idy;
|
|
if(i2+1 < numberOfYNodes) { ++i2; }
|
|
return fac*(GetValue(idx, i2) - GetValue(idx, i1))/(GetY(i2) - GetY(i1));
|
|
}
|
|
|
|
inline G4double
|
|
G4Physics2DVector::DerivativeXY(size_t idx, size_t idy, G4double fac)
|
|
{
|
|
size_t i1 = idx;
|
|
if(i1 > 0) { --i1; }
|
|
size_t i2 = idx;
|
|
if(i2+1 < numberOfXNodes) { ++i2; }
|
|
size_t j1 = idy;
|
|
if(j1 > 0) { --j1; }
|
|
size_t j2 = idy;
|
|
if(j2+1 < numberOfYNodes) { ++j2; }
|
|
return fac*(GetValue(i2, j2) - GetValue(i1, j2) - GetValue(i2, j1)
|
|
+ GetValue(i1, j1))/((GetX(i2) - GetX(i1))*(GetY(j2) - GetY(j1)));
|
|
}
|