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

[io][loadsolution] Remane loadFromVtuFile->loadSolutionFromVtuFile

parent 910a16ef
No related branches found
No related tags found
1 merge request!1039Feature/restart from vtk
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
namespace Dumux { namespace Dumux {
namespace Detail {
//! helper struct detecting if a PrimaryVariables object has a state() function //! helper struct detecting if a PrimaryVariables object has a state() function
struct hasState struct hasState
{ {
...@@ -46,16 +47,18 @@ struct hasState ...@@ -46,16 +47,18 @@ struct hasState
{} {}
}; };
} // end namespace Detail
/*! /*!
* \ingroup InputOutput * \ingroup InputOutput
* \brief helper function to read from a file into a solution vector * \brief helper function to read from a file into a solution vector
*/ */
template <class SolutionVector, class PvNamesFunc> template <class SolutionVector, class PvNamesFunc>
auto loadFromVtuFile(const std::string fileName, auto loadSolutionFromVtuFile(const std::string fileName,
const VTUReader::DataType& dataType, const VTUReader::DataType& dataType,
PvNamesFunc&& pvNamesFunc, PvNamesFunc&& pvNamesFunc,
SolutionVector& sol) SolutionVector& sol)
-> typename std::enable_if_t<!decltype(isValid(hasState())(sol[0]))::value, void> -> typename std::enable_if_t<!decltype(isValid(Detail::hasState())(sol[0]))::value, void>
{ {
VTUReader vtu(fileName); VTUReader vtu(fileName);
using PrimaryVariables = typename SolutionVector::block_type; using PrimaryVariables = typename SolutionVector::block_type;
...@@ -78,11 +81,11 @@ auto loadFromVtuFile(const std::string fileName, ...@@ -78,11 +81,11 @@ auto loadFromVtuFile(const std::string fileName,
* \brief helper function to read from a file into a solution vector * \brief helper function to read from a file into a solution vector
*/ */
template <class SolutionVector, class PvNamesFunc> template <class SolutionVector, class PvNamesFunc>
auto loadFromVtuFile(const std::string fileName, auto loadSolutionFromVtuFile(const std::string fileName,
const VTUReader::DataType& dataType, const VTUReader::DataType& dataType,
PvNamesFunc&& pvNamesFunc, PvNamesFunc&& pvNamesFunc,
SolutionVector& sol) SolutionVector& sol)
-> typename std::enable_if_t<decltype(isValid(hasState())(sol[0]))::value, void> -> typename std::enable_if_t<decltype(isValid(Detail::hasState())(sol[0]))::value, void>
{ {
VTUReader vtu(fileName); VTUReader vtu(fileName);
const auto vec = vtu.readData<std::vector<int>>("phase presence", dataType); const auto vec = vtu.readData<std::vector<int>>("phase presence", dataType);
...@@ -160,7 +163,7 @@ void loadSolution(const std::string& fileName, ...@@ -160,7 +163,7 @@ void loadSolution(const std::string& fileName,
{ {
const auto dataType = FVGridGeometry::discMethod == DiscretizationMethod::box const auto dataType = FVGridGeometry::discMethod == DiscretizationMethod::box
? VTUReader::DataType::pointData : VTUReader::DataType::cellData; ? VTUReader::DataType::pointData : VTUReader::DataType::cellData;
loadFromVtuFile(fileName, dataType, pvNamesFunc, sol); loadSolutionFromVtuFile(fileName, dataType, pvNamesFunc, sol);
} }
else else
DUNE_THROW(Dune::NotImplemented, "loadSolution for extension " << extension); DUNE_THROW(Dune::NotImplemented, "loadSolution for extension " << extension);
......
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