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

Method writeLongData

Src/Base/AMReX_VectorIO.cpp:62–88  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

60}
61
62void amrex::writeLongData (const Long* data, std::size_t size, std::ostream& os,
63 const IntDescriptor& id)
64{
65 if (id == FPC::NativeLongDescriptor())
66 {
67 if (!os.write(reinterpret_cast<char const*>(data),
68 static_cast<std::streamsize>(size*sizeof(Long))))
69 {
70 amrex::Error("Failed to write long integer data.");
71 }
72 }
73 else if (id.numBytes() == 2)
74 {
75 writeIntData<std::int16_t, Long>(data, size, os, id);
76 }
77 else if (id.numBytes() == 4)
78 {
79 writeIntData<std::int32_t, Long>(data, size, os, id);
80 }
81 else if (id.numBytes() == 8)
82 {
83 writeIntData<std::int64_t, Long>(data, size, os, id);
84 }
85 else {
86 amrex::Error("Don't know how to work with this long type.");
87 }
88}
89
90void amrex::readLongData (Long* data, std::size_t size, std::istream& is,
91 const IntDescriptor& id)

Callers

nothing calls this directly

Calls 2

numBytesMethod · 0.80
writeMethod · 0.45

Tested by

no test coverage detected