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

Method convertFromNativeDoubleFormat

Src/Base/AMReX_FabConv.cpp:1144–1179  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1142//
1143
1144void
1145RealDescriptor::convertFromNativeDoubleFormat (std::ostream& os,
1146 Long nitems,
1147 const double* in,
1148 const RealDescriptor& od)
1149{
1150// BL_PROFILE("RD:convertFromNativeDoubleFormat");
1151 Long nitemsSave(nitems);
1152 Long buffSize(std::min(Long(writeBufferSize), nitems));
1153 const double *inSave(in);
1154 amrex::StreamRetry sr(os, "RD_cFNF", 4);
1155
1156 while(sr.TryOutput()) {
1157 nitems = nitemsSave;
1158 in = inSave;
1159
1160 char *bufr = new char[buffSize * od.numBytes()];
1161
1162 while (nitems > 0)
1163 {
1164 Long put = std::min(static_cast<Long>(writeBufferSize), nitems);
1165 PD_convert(bufr,
1166 in,
1167 put,
1168 0,
1169 od,
1170 FPC::Native64RealDescriptor(),
1171 FPC::NativeLongDescriptor());
1172 os.write(bufr, od.numBytes()*put);
1173 nitems -= put;
1174 in += put;
1175 }
1176
1177 delete [] bufr;
1178 }
1179}
1180
1181//
1182// Read nitems from istream in RealDescriptor format to native float format.

Callers

nothing calls this directly

Calls 5

LongFunction · 0.85
PD_convertFunction · 0.85
TryOutputMethod · 0.80
numBytesMethod · 0.80
writeMethod · 0.45

Tested by

no test coverage detected