72 fOut.write((
char*) (&size),
sizeof size);
75 for(std::size_t i = 0; i < size; ++i)
80 fOut.write((
char*) (value), 2 * size * (
sizeof(
G4double)));
115 for(
G4int i = 0; i < siz; ++i)
119 fIn >> vBin >> vData;
139 fIn.read((
char*) (&size),
sizeof size);
142 fIn.read((
char*) (value), 2 * size * (
sizeof(
G4double)));
151 for(std::size_t i = 0; i < size; ++i)
174 std::size_t idx)
const
189 return GetBin(energy);
209 if(!useSpline) {
return; }
211 const std::size_t nmin = (stype == G4SplineType::Base) ? 5 : 4;
216 G4cout <<
"### G4PhysicsVector: spline cannot be used for "
227 for(std::size_t i=0; i<=
idxmax; ++i)
233 G4cout <<
"### G4PhysicsVector: spline cannot be used, because "
235 <<
" >= E[" << i+1 <<
"]=" <<
binVector[i + 1]
251 G4cout <<
"### G4PhysicsVector:: FillSecondDerivatives N="
258 case G4SplineType::Base:
259 ComputeSecDerivative1();
262 case G4SplineType::FixedEdges:
263 ComputeSecDerivative2(dir1, dir2);
267 ComputeSecDerivative0();
272void G4PhysicsVector::ComputeSecDerivative0()
277 for(std::size_t i = 1; i < n; ++i)
290void G4PhysicsVector::ComputeSecDerivative1()
310 for(std::size_t i = 2; i <
n - 1; ++i)
331 (2.0 * sig - 1.0) * u[
n - 2] / p;
339 for(std::size_t k = n - 2; k > 1; --k)
355void G4PhysicsVector::ComputeSecDerivative2(
G4double firstPointDerivative,
368 firstPointDerivative);
375 for(std::size_t i = 1; i <
n; ++i)
400 for(std::size_t k = n - 1; k > 0; --k)
415 G4long prec = out.precision();
416 out << std::setprecision(12) << pv.
edgeMin <<
" " << pv.
edgeMax <<
" "
421 for(std::size_t i = 0; i < pv.
dataVector.size(); ++i)
464 <<
"; an attempt to put data at index= " << index
465 <<
" value= " << val <<
" in " << text;
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
std::ostream & operator<<(std::ostream &out, const G4PhysicsVector &pv)
G4GLOB_DLL std::ostream G4cout
G4double GetEnergy(const G4double value) const
void PrintPutValueError(std::size_t index, G4double value, const G4String &text)
void ScaleVector(const G4double factorE, const G4double factorV)
G4bool Store(std::ofstream &fOut, G4bool ascii=false) const
std::size_t numberOfNodes
std::vector< G4double > secDerivative
G4PhysicsVector(G4bool spline=false)
G4bool Retrieve(std::ifstream &fIn, G4bool ascii=false)
std::vector< G4double > dataVector
std::vector< G4double > binVector
virtual void Initialise()
void FillSecondDerivatives(const G4SplineType=G4SplineType::Base, const G4double dir1=0.0, const G4double dir2=0.0)
void DumpValues(G4double unitE=1.0, G4double unitV=1.0) const
std::size_t FindBin(const G4double energy, std::size_t idx) const