84
84
// Read mesh topology
85
85
MeshTopology& t = mesh._topology;
86
std::size_t D = read_uint();
87
87
t.num_entities.resize(D + 1);
88
88
read_array(D + 1, t.num_entities.data());
89
89
t.connectivity.resize(D + 1);
90
for (uint i = 0; i <= D; i++)
90
for (std::size_t i = 0; i <= D; i++)
92
for (uint j = 0; j <= D; j++)
92
for (std::size_t j = 0; j <= D; j++)
94
94
t.connectivity[i].push_back(MeshConnectivity(i, j));
95
95
MeshConnectivity& c = t.connectivity[i][j];
96
const uint size = read_uint();
96
const std::size_t size = read_uint();
99
const uint num_entities = read_uint();
100
c.connections = std::vector<uint>(size);
99
const std::size_t num_entities = read_uint();
100
c.connections = std::vector<std::size_t>(size);
101
101
read_array(size, &(c.connections)[0]);
102
102
c.index_to_position.resize(num_entities + 1);
103
103
read_array(c.index_to_position.size(), &(c.index_to_position[0]));
271
271
//-----------------------------------------------------------------------------
272
dolfin::uint BinaryFile::read_uint()
272
std::size_t BinaryFile::read_uint()
275
boost::iostreams::read(ifilter, (char*) &value, (std::streamsize) sizeof(uint));
274
std::size_t value = 0;
275
boost::iostreams::read(ifilter, (char*) &value, (std::streamsize) sizeof(std::size_t));
278
278
//-----------------------------------------------------------------------------
279
void BinaryFile::read_array(uint n, uint* values)
279
void BinaryFile::read_array(std::size_t n, std::size_t* values)
281
for (uint i = 0; i < n; ++i)
282
boost::iostreams::read(ifilter, (char*) (values + i), (std::streamsize) sizeof(uint));
281
for (std::size_t i = 0; i < n; ++i)
282
boost::iostreams::read(ifilter, (char*) (values + i), (std::streamsize) sizeof(std::size_t));
284
284
//-----------------------------------------------------------------------------
285
void BinaryFile::read_array(uint n, double* values)
285
void BinaryFile::read_array(std::size_t n, double* values)
287
for (uint i = 0; i < n; ++i)
287
for (std::size_t i = 0; i < n; ++i)
288
288
boost::iostreams::read(ifilter, (char*) (values + i), (std::streamsize) sizeof(double));
290
290
//-----------------------------------------------------------------------------
291
void BinaryFile::write_uint(uint value)
293
boost::iostreams::write(ofilter, (char*) &value, (std::streamsize) sizeof(uint));
295
//-----------------------------------------------------------------------------
296
void BinaryFile::write_array(uint n, const uint* values)
298
for (uint i = 0; i < n; ++i)
299
boost::iostreams::write(ofilter, (char*) &values[i], (std::streamsize) sizeof(uint));
301
//-----------------------------------------------------------------------------
302
void BinaryFile::write_array(uint n, const double* values)
304
for (uint i = 0; i < n; ++i)
291
void BinaryFile::write_uint(std::size_t value)
293
boost::iostreams::write(ofilter, (char*) &value, (std::streamsize) sizeof(std::size_t));
295
//-----------------------------------------------------------------------------
296
void BinaryFile::write_array(std::size_t n, const std::size_t* values)
298
for (std::size_t i = 0; i < n; ++i)
299
boost::iostreams::write(ofilter, (char*) &values[i], (std::streamsize) sizeof(std::size_t));
301
//-----------------------------------------------------------------------------
302
void BinaryFile::write_array(std::size_t n, const double* values)
304
for (std::size_t i = 0; i < n; ++i)
305
305
boost::iostreams::write(ofilter, (char*) &values[i], (std::streamsize) sizeof(double));
307
307
//-----------------------------------------------------------------------------