34 Foam::scalar Foam::readScalar(Istream& is)
43 Foam::scalar Foam::readScalarOrDefault(Istream& is,
const scalar defaultValue)
51 return tok.scalarToken();
61 Foam::scalar Foam::readRawScalar(Istream& is)
64 readRawScalar(is, &val, 1);
69 void Foam::readRawScalar(Istream& is, scalar* data,
size_t nElem)
73 #if defined(WM_SP) || defined(WM_SPDP) 78 typedef double nonNative;
80 if (is.checkScalarSize<nonNative>())
84 for (
const scalar* endData = data + nElem; data != endData; ++data)
86 is.readRaw(reinterpret_cast<char*>(&other),
sizeof(nonNative));
95 else if (other > VGREAT)
99 else if (other > -VSMALL && other < VSMALL)
106 *data = scalar(other);
113 is.readRaw(reinterpret_cast<char*>(data), nElem*
sizeof(scalar));
120 typedef float nonNative;
122 if (is.checkScalarSize<nonNative>())
126 for (
const scalar* endData = data + nElem; data != endData; ++data)
128 is.readRaw(reinterpret_cast<char*>(&other),
sizeof(nonNative));
130 *data = scalar(other);
136 is.readRaw(reinterpret_cast<char*>(data), nElem*
sizeof(scalar));
Useful combination of include files which define Sin, Sout and Serr and the use of IO streams general...