MCPcopy Create free account
hub / github.com/AMReX-Codes/amrex / convertToNativeFloatFormat

Method convertToNativeFloatFormat

Src/Base/AMReX_FabConv.cpp:1185–1221  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1183//
1184
1185void
1186RealDescriptor::convertToNativeFloatFormat (float* out,
1187 Long nitems,
1188 std::istream& is,
1189 const RealDescriptor& id)
1190{
1191// BL_PROFILE("RD:convertToNativeFloatFormat");
1192
1193 Long buffSize(std::min(Long(readBufferSize), nitems));
1194 char *bufr = new char[buffSize * id.numBytes()];
1195
1196 while (nitems > 0)
1197 {
1198 Long get = std::min(static_cast<Long>(readBufferSize), nitems);
1199 is.read(bufr, id.numBytes()*get);
1200 PD_convert(out,
1201 bufr,
1202 get,
1203 0,
1204 FPC::Native32RealDescriptor(),
1205 id,
1206 FPC::NativeLongDescriptor());
1207
1208 if(bAlwaysFixDenormals) {
1209 PD_fixdenormals(out, get, FPC::Native32RealDescriptor().format(),
1210 FPC::Native32RealDescriptor().order());
1211 }
1212 nitems -= get;
1213 out += get;
1214 }
1215
1216 if(is.fail()) {
1217 amrex::Error("convert(Real*,Long,istream&,RealDescriptor&) failed");
1218 }
1219
1220 delete [] bufr;
1221}
1222
1223//
1224// Read nitems from istream in RealDescriptor format to native double format.

Callers

nothing calls this directly

Calls 7

LongFunction · 0.85
PD_convertFunction · 0.85
PD_fixdenormalsFunction · 0.85
numBytesMethod · 0.80
readMethod · 0.45
formatMethod · 0.45
orderMethod · 0.45

Tested by

no test coverage detected