65 G4cout <<
"### G4PhysicsVector::SetDataLength length="
66 << dlength <<
" is ignored." <<
G4endl;
93 fOut.write((
char*) (&size),
sizeof size);
96 for (std::size_t i = 0; i < size; ++i)
101 fOut.write((
char*) (value), 2 * size * (
sizeof(
G4double)));
127 if (siz0 < 2) {
return false; }
128 auto siz =
static_cast<std::size_t
>(siz0);
138 for (std::size_t i = 0; i < siz; ++i)
142 fIn >> vBin >> vData;
162 fIn.read((
char*) (&size),
sizeof size);
164 auto value =
new G4double[2 * size];
165 fIn.read((
char*) (value), 2 * size * (
sizeof(
G4double)));
166 if (
static_cast<G4int>(fIn.gcount()) !=
static_cast<G4int>(2 * size * (
sizeof(
G4double))))
174 for (std::size_t i = 0; i < size; ++i)
197 std::size_t idx)
const
212 return GetBin(energy);
232 if (!useSpline) {
return; }
239 G4cout <<
"### G4PhysicsVector: spline cannot be used for "
250 for (std::size_t i=0; i<=
idxmax; ++i)
256 G4cout <<
"### G4PhysicsVector: spline cannot be used, because "
273 G4cout <<
"### G4PhysicsVector:: FillSecondDerivatives N="
281 ComputeSecDerivative1();
285 ComputeSecDerivative2(dir1, dir2);
289 ComputeSecDerivative0();
294void G4PhysicsVector::ComputeSecDerivative0()
299 for (std::size_t i = 1; i < n; ++i)
312void G4PhysicsVector::ComputeSecDerivative1()
332 for(std::size_t i = 2; i <
n - 1; ++i)
353 (2.0 * sig - 1.0) * u[
n - 2] / p;
361 for (std::size_t k = n - 2; k > 1; --k)
377void G4PhysicsVector::ComputeSecDerivative2(
G4double firstPointDerivative,
390 firstPointDerivative);
397 for (std::size_t i = 1; i <
n; ++i)
422 for (std::size_t k = n - 1; k > 0; --k)
437 G4long prec = out.precision();
438 out << std::setprecision(12) << pv.
edgeMin <<
" " << pv.
edgeMax <<
" "
443 for (std::size_t i = 0; i < pv.
dataVector.size(); ++i)
486 <<
"; an attempt to put data at index= " << index
487 <<
" 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
void SetDataLength(G4int dlength)
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