Commit 3e012335 authored by Ned Coltman's avatar Ned Coltman Committed by Timo Koch
Browse files

[vtk][io] Add function to query if a data array exists

parent f131b944
......@@ -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<>
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