diff --git a/dumux/io/CMakeLists.txt b/dumux/io/CMakeLists.txt index 6e76c281b1306dae934b3f136131b004be25aeea..72dd61cd9347ab14497b374db3a8218a566e4647 100644 --- a/dumux/io/CMakeLists.txt +++ b/dumux/io/CMakeLists.txt @@ -1,10 +1,13 @@ 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 diff --git a/dumux/io/loadsolution.hh b/dumux/io/loadsolution.hh index edaf2c46370240c4741ea5c1338f560a4f43b73b..47048d42c5bee894b303021f767a15a564d6401e 100644 --- a/dumux/io/loadsolution.hh +++ b/dumux/io/loadsolution.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 diff --git a/dumux/io/vtk/CMakeLists.txt b/dumux/io/vtk/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..6c8d1b946cb3fffc18b67141b1c334a5f3eb27e8 --- /dev/null +++ b/dumux/io/vtk/CMakeLists.txt @@ -0,0 +1,3 @@ +install(FILES +vtkreader.hh +DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/dumux/io/vtk) diff --git a/dumux/io/vtk/vtureader.hh b/dumux/io/vtk/vtkreader.hh similarity index 97% rename from dumux/io/vtk/vtureader.hh rename to dumux/io/vtk/vtkreader.hh index cf9a6e250f5995231ac722e6db232fff69fe4360..f6dd03ddba52b445fdb30fa477e4b5c8d52342c6 100644 --- a/dumux/io/vtk/vtureader.hh +++ b/dumux/io/vtk/vtkreader.hh @@ -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_ }; diff --git a/dumux/io/xml/CMakeLists.txt b/dumux/io/xml/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..25a59e1bc721b8715f99b7e19a5d63cbd02a523b --- /dev/null +++ b/dumux/io/xml/CMakeLists.txt @@ -0,0 +1,4 @@ +install(FILES +tinyxml2.cpp +tinyxml2.h +DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/dumux/io/xml) diff --git a/test/io/vtk/test_vtkreader.cc b/test/io/vtk/test_vtkreader.cc index 4d433e3c77f00f630c1a299f4addb20619cf4f36..bc8a4cad49c7828f099f284bdd2cf238c7fd2940 100644 --- a/test/io/vtk/test_vtkreader.cc +++ b/test/io/vtk/test_vtkreader.cc @@ -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];