Commit c7e99f56 authored by Praetorius, Simon's avatar Praetorius, Simon
Browse files

Simplify data_id creation

parent 8b76686c
...@@ -43,7 +43,7 @@ void VtkReader<Grid,Creator,Field>::readSerialFileFromStream (std::ifstream& inp ...@@ -43,7 +43,7 @@ void VtkReader<Grid,Creator,Field>::readSerialFileFromStream (std::ifstream& inp
{ {
clear(); clear();
std::string compressor = ""; std::string compressor = "";
std::string data_name = "", data_format = ""; std::string data_id = "", data_format = "";
Vtk::DataTypes data_type = Vtk::UNKNOWN; Vtk::DataTypes data_type = Vtk::UNKNOWN;
unsigned int data_components = 0; unsigned int data_components = 0;
std::uint64_t data_offset = 0; std::uint64_t data_offset = 0;
...@@ -110,17 +110,12 @@ void VtkReader<Grid,Creator,Field>::readSerialFileFromStream (std::ifstream& inp ...@@ -110,17 +110,12 @@ void VtkReader<Grid,Creator,Field>::readSerialFileFromStream (std::ifstream& inp
data_type = Vtk::Map::to_datatype[attr["type"]]; data_type = Vtk::Map::to_datatype[attr["type"]];
// Use Section.Name as id
data_id = toString(section) + "." + attr["Name"];
if (section == POINTS) if (section == POINTS)
// In the Points section must only be one DataArray with id=Points // In the Points section must only be one DataArray with id=Points
data_name = toString(section); data_id = "Points";
else if (section == CELLS)
// All DataArrays in the Cells sections are identified by lower case Cells.name
data_name = toString(section) + "." + Vtk::to_lower(attr["Name"]);
else if (!attr["Name"].empty())
// Use Section.Name as key
data_name = toString(section) + "." + attr["Name"];
else
data_name = toString(section) + "." + "_Unknown_";
data_components = 1; data_components = 1;
if (!attr["NumberOfComponents"].empty()) if (!attr["NumberOfComponents"].empty())
...@@ -142,7 +137,7 @@ void VtkReader<Grid,Creator,Field>::readSerialFileFromStream (std::ifstream& inp ...@@ -142,7 +137,7 @@ void VtkReader<Grid,Creator,Field>::readSerialFileFromStream (std::ifstream& inp
} }
// Store attributes of DataArray // Store attributes of DataArray
dataArray_[data_name] = {attr["Name"], data_type, data_components, data_offset, section}; dataArray_[data_id] = {attr["Name"], data_type, data_components, data_offset, section};
// Skip section in appended mode // Skip section in appended mode
if (data_format == "appended") { if (data_format == "appended") {
...@@ -216,16 +211,16 @@ void VtkReader<Grid,Creator,Field>::readSerialFileFromStream (std::ifstream& inp ...@@ -216,16 +211,16 @@ void VtkReader<Grid,Creator,Field>::readSerialFileFromStream (std::ifstream& inp
switch (section) { switch (section) {
case PD_DATA_ARRAY: case PD_DATA_ARRAY:
section = readPointData(input, data_name); section = readPointData(input, data_id);
break; break;
case POINTS_DATA_ARRAY: case POINTS_DATA_ARRAY:
section = readPoints(input, data_name); section = readPoints(input, data_id);
break; break;
case CD_DATA_ARRAY: case CD_DATA_ARRAY:
section = readCellData(input, data_name); section = readCellData(input, data_id);
break; break;
case CELLS_DATA_ARRAY: case CELLS_DATA_ARRAY:
section = readCells(input, data_name); section = readCells(input, data_id);
break; break;
default: default:
// do nothing // do nothing
......
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