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
{
clear();
std::string compressor = "";
std::string data_name = "", data_format = "";
std::string data_id = "", data_format = "";
Vtk::DataTypes data_type = Vtk::UNKNOWN;
unsigned int data_components = 0;
std::uint64_t data_offset = 0;
......@@ -110,17 +110,12 @@ void VtkReader<Grid,Creator,Field>::readSerialFileFromStream (std::ifstream& inp
data_type = Vtk::Map::to_datatype[attr["type"]];
// Use Section.Name as id
data_id = toString(section) + "." + attr["Name"];
if (section == POINTS)
// In the Points section must only be one DataArray with id=Points
data_name = toString(section);
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_id = "Points";
data_components = 1;
if (!attr["NumberOfComponents"].empty())
......@@ -142,7 +137,7 @@ void VtkReader<Grid,Creator,Field>::readSerialFileFromStream (std::ifstream& inp
}
// 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
if (data_format == "appended") {
......@@ -216,16 +211,16 @@ void VtkReader<Grid,Creator,Field>::readSerialFileFromStream (std::ifstream& inp
switch (section) {
case PD_DATA_ARRAY:
section = readPointData(input, data_name);
section = readPointData(input, data_id);
break;
case POINTS_DATA_ARRAY:
section = readPoints(input, data_name);
section = readPoints(input, data_id);
break;
case CD_DATA_ARRAY:
section = readCellData(input, data_name);
section = readCellData(input, data_id);
break;
case CELLS_DATA_ARRAY:
section = readCells(input, data_name);
section = readCells(input, data_id);
break;
default:
// 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