Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
dumux-repositories
dumux
Commits
3e012335
Commit
3e012335
authored
Sep 29, 2020
by
Ned Coltman
Committed by
Timo Koch
Sep 29, 2020
Browse files
[vtk][io] Add function to query if a data array exists
parent
f131b944
Changes
1
Show whitespace changes
Inline
Side-by-side
dumux/io/vtk/vtkreader.hh
View file @
3e012335
...
...
@@ -76,6 +76,27 @@ public:
DUNE_THROW
(
Dune
::
IOError
,
"Couldn't get 'Piece' node in "
<<
fileName_
<<
"."
);
}
/*!
* \brief Reviews data from the vtk file to check if there is a data array with a specified name
* \param name the name attribute of the data array to read
* \param type the data array type
*/
bool
hasData
(
const
std
::
string
&
name
,
const
DataType
&
type
)
const
{
using
namespace
tinyxml2
;
const
XMLElement
*
pieceNode
=
getPieceNode_
();
const
XMLElement
*
dataNode
=
getDataNode_
(
pieceNode
,
type
);
if
(
dataNode
==
nullptr
)
return
false
;
const
XMLElement
*
dataArray
=
findDataArray_
(
dataNode
,
name
);
if
(
dataArray
==
nullptr
)
return
false
;
return
true
;
}
/*!
* \brief read data from the vtk file to a container, e.g. std::vector<double>
* \tparam Container a container type that has begin(), end(), push_back(), e.g. std::vector<>
...
...
Write
Preview
Markdown
is supported
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