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
6334aebc
Commit
6334aebc
authored
Apr 29, 2020
by
Praetorius, Simon
Browse files
read cell offset and connectivity with flexible index type
parent
7a18a879
Changes
1
Hide whitespace changes
Inline
Side-by-side
dune/vtk/vtkreader.impl.hh
View file @
6334aebc
...
...
@@ -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
)
{
...
...
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