Skip to content
Snippets Groups Projects
Commit 34852ce8 authored by Timo Koch's avatar Timo Koch
Browse files

[io][vtk] Rename VTUReader to VTKReader as is supports multiple vtk formats

parent 041069eb
No related branches found
No related tags found
1 merge request!1039Feature/restart from vtk
add_subdirectory(grid)
add_subdirectory(vtk)
add_subdirectory(xml)
install(FILES
adaptivegridrestart.hh
container.hh
defaultvtkoutputfields.hh
gnuplotinterface.hh
loadsolution.hh
ploteffectivediffusivitymodel.hh
plotmateriallaw.hh
plotmateriallaw3p.hh
......
......@@ -33,7 +33,7 @@
#include <dumux/common/parameters.hh>
#include <dumux/common/typetraits/isvalid.hh>
#include <dumux/io/vtk/vtureader.hh>
#include <dumux/io/vtk/vtkreader.hh>
namespace Dumux {
......@@ -55,12 +55,12 @@ struct hasState
*/
template <class SolutionVector, class PvNamesFunc>
auto loadSolutionFromVtuFile(const std::string fileName,
const VTUReader::DataType& dataType,
const VTKReader::DataType& dataType,
PvNamesFunc&& pvNamesFunc,
SolutionVector& sol)
-> typename std::enable_if_t<!decltype(isValid(Detail::hasState())(sol[0]))::value, void>
{
VTUReader vtu(fileName);
VTKReader vtu(fileName);
using PrimaryVariables = typename SolutionVector::block_type;
using Scalar = typename PrimaryVariables::field_type;
......@@ -82,12 +82,12 @@ auto loadSolutionFromVtuFile(const std::string fileName,
*/
template <class SolutionVector, class PvNamesFunc>
auto loadSolutionFromVtuFile(const std::string fileName,
const VTUReader::DataType& dataType,
const VTKReader::DataType& dataType,
PvNamesFunc&& pvNamesFunc,
SolutionVector& sol)
-> typename std::enable_if_t<decltype(isValid(Detail::hasState())(sol[0]))::value, void>
{
VTUReader vtu(fileName);
VTKReader vtu(fileName);
const auto vec = vtu.readData<std::vector<int>>("phase presence", dataType);
std::unordered_set<int> states;
for (size_t i = 0; i < sol.size(); ++i)
......@@ -163,7 +163,7 @@ std::string primaryVariableName(int pvIdx)
/*!
* \ingroup InputOutput
* \brief load a solution vector from file
* \note Supports the following file extensions: *.vtu
* \note Supports the following file extensions: *.vtu *.vtp
*/
template <class SolutionVector, class PvNamesFunc>
void loadSolution(const std::string& fileName,
......@@ -176,7 +176,7 @@ void loadSolution(const std::string& fileName,
if (extension == "vtu" || extension == "vtp")
{
const auto dataType = discMethod == DiscretizationMethod::box
? VTUReader::DataType::pointData : VTUReader::DataType::cellData;
? VTKReader::DataType::pointData : VTKReader::DataType::cellData;
loadSolutionFromVtuFile(fileName, dataType, pvNamesFunc, sol);
}
else
......
install(FILES
vtkreader.hh
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/dumux/io/vtk)
......@@ -19,10 +19,10 @@
/*!
* \file
* \ingroup InputOutput
* \brief A vtu reader using tinyxml2 as xml backend
* \brief A vtk file reader using tinyxml2 as xml backend
*/
#ifndef DUMUX_IO_VTK_VTUREADER_HH
#define DUMUX_IO_VTK_VTUREADER_HH
#ifndef DUMUX_IO_VTK_VTKREADER_HH
#define DUMUX_IO_VTK_VTKREADER_HH
#include <iostream>
#include <iterator>
......@@ -39,9 +39,9 @@ namespace Dumux {
/*!
* \ingroup InputOutput
* \brief A vtu reader using tinyxml2 as xml backend
* \brief A vtk file reader using tinyxml2 as xml backend
*/
class VTUReader
class VTKReader
{
public:
/*!
......@@ -55,7 +55,7 @@ public:
/*!
* \brief The contructor creates a tinyxml2::XMLDocument from file
*/
VTUReader(const std::string& fileName)
VTKReader(const std::string& fileName)
: fileName_(fileName)
{
using namespace tinyxml2;
......@@ -291,7 +291,7 @@ private:
}
}
const std::string fileName_; //!< the vtu file name
const std::string fileName_; //!< the vtk file name
tinyxml2::XMLDocument doc_; //!< the xml document created from file with name fileName_
};
......
install(FILES
tinyxml2.cpp
tinyxml2.h
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/dumux/io/xml)
......@@ -35,9 +35,9 @@ int main(int argc, char** argv) try
{
Dune::MPIHelper::instance(argc, argv);
Dumux::VTUReader vtkReader("test-in.vtu");
Dumux::VTKReader vtkReader("test-in.vtu");
using Grid = Dune::ALUGrid<3, 3, Dune::cube, Dune::nonconforming>;
Dumux::VTUReader::Data cellData, pointData;
Dumux::VTKReader::Data cellData, pointData;
Dune::GridFactory<Grid> gridFactory;
auto grid = vtkReader.readGrid(gridFactory, cellData, pointData, /*verbose=*/true);
const auto& gridView = grid->leafGridView();
......@@ -61,7 +61,7 @@ int main(int argc, char** argv) try
}
}
Dumux::VTUReader::Data reorderedCellData = cellData, reorderedPointData = pointData;
Dumux::VTKReader::Data reorderedCellData = cellData, reorderedPointData = pointData;
for (const auto& data : cellData)
{
auto& reorderedData = reorderedCellData[data.first];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment