Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
iwr
dune-vtk
Commits
c7e99f56
Commit
c7e99f56
authored
Dec 12, 2020
by
Praetorius, Simon
Browse files
Simplify data_id creation
parent
8b76686c
Changes
1
Hide whitespace changes
Inline
Side-by-side
dune/vtk/vtkreader.impl.hh
View file @
c7e99f56
...
...
@@ -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
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment