Commit 6334aebc authored by Praetorius, Simon's avatar Praetorius, Simon
Browse files

read cell offset and connectivity with flexible index type

parent 7a18a879
......@@ -418,19 +418,33 @@ void VtkReader<Grid,Creator>::readCellsAppended (std::ifstream& input)
{
assert(numberOfCells_ > 0);
auto types_data = dataArray_["types"];
auto dataArray_data = dataArray_["offsets"];
auto offsets_data = dataArray_["offsets"];
auto connectivity_data = dataArray_["connectivity"];
assert(types_data.type == Vtk::UINT8);
readAppended(input, vec_types, types_data.offset);
assert(vec_types.size() == numberOfCells_);
assert(dataArray_data.type == Vtk::INT64);
readAppended(input, vec_offsets, dataArray_data.offset);
if (offsets_data.type == Vtk::INT64)
readAppended(input, vec_offsets, offsets_data.offset);
else if (offsets_data.type == Vtk::INT32) {
std::vector<std::int32_t> offsets;
readAppended(input, offsets, offsets_data.offset);
vec_offsets.resize(offsets.size());
std::copy(offsets.begin(), offsets.end(), vec_offsets.begin());
}
else { DUNE_THROW(Dune::NotImplemented, "Unsupported DataType in Cell offsets."); }
assert(vec_offsets.size() == numberOfCells_);
assert(connectivity_data.type == Vtk::INT64);
readAppended(input, vec_connectivity, connectivity_data.offset);
if (connectivity_data.type == Vtk::INT64)
readAppended(input, vec_connectivity, connectivity_data.offset);
else if (connectivity_data.type == Vtk::INT32) {
std::vector<std::int32_t> connectivity;
readAppended(input, connectivity, connectivity_data.offset);
vec_connectivity.resize(connectivity.size());
std::copy(connectivity.begin(), connectivity.end(), vec_connectivity.begin());
}
else { DUNE_THROW(Dune::NotImplemented, "Unsupported DataType in Cell connectivity."); }
assert(vec_connectivity.size() == std::size_t(vec_offsets.back()));
if (dataArray_.count("global_point_ids") > 0) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment