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

Method readIntData

Src/Base/AMReX_VectorIO.cpp:34–60  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32}
33
34void amrex::readIntData (int* data, std::size_t size, std::istream& is,
35 const IntDescriptor& id)
36{
37 if (id == FPC::NativeIntDescriptor())
38 {
39 if (!is.read(reinterpret_cast<char*>(data),
40 static_cast<std::streamsize>(size * id.numBytes())))
41 {
42 amrex::Error("Failed to read integer data.");
43 }
44 }
45 else if (id.numBytes() == 2)
46 {
47 readIntData<int, std::int16_t>(data, size, is, id);
48 }
49 else if (id.numBytes() == 4)
50 {
51 readIntData<int, std::int32_t>(data, size, is, id);
52 }
53 else if (id.numBytes() == 8)
54 {
55 readIntData<int, std::int64_t>(data, size, is, id);
56 }
57 else {
58 amrex::Error("Don't know how to work with this integer type.");
59 }
60}
61
62void amrex::writeLongData (const Long* data, std::size_t size, std::ostream& os,
63 const IntDescriptor& id)

Callers

nothing calls this directly

Calls 2

numBytesMethod · 0.80
readMethod · 0.45

Tested by

no test coverage detected