diff --git a/dune/solvers/CMakeLists.txt b/dune/solvers/CMakeLists.txt index ce9d0fe3048778f7d6c0c8612ac2ca06e1a5c7b9..f79381dcf9124e6c9d3064d2c2cc25dfe85f1f1a 100644 --- a/dune/solvers/CMakeLists.txt +++ b/dune/solvers/CMakeLists.txt @@ -1,4 +1,5 @@ dune_add_library("dunesolvers" + iterationsteps/blockgssteps.cc solvers/criterion.cc) dune_register_package_flags(LIBRARIES dunesolvers) diff --git a/dune/solvers/iterationsteps/blockgssteps.cc b/dune/solvers/iterationsteps/blockgssteps.cc new file mode 100644 index 0000000000000000000000000000000000000000..9a20158496a743e7b1a37cc3269efe347e750ea4 --- /dev/null +++ b/dune/solvers/iterationsteps/blockgssteps.cc @@ -0,0 +1,41 @@ +#include <algorithm> + +#include "blockgssteps.hh" + +namespace Dune { +namespace Solvers { + namespace BlockGS { + std::istream& operator>>(std::istream& lhs, Direction& t) { + std::string s; + lhs >> s; + std::transform(s.begin(), s.end(), s.begin(), ::tolower); + + if (s == "forward") + t = Direction::FORWARD; + else if (s == "backward") + t = Direction::BACKWARD; + else if (s == "symmetric") + t = Direction::SYMMETRIC; + else + lhs.setstate(std::ios_base::failbit); + return lhs; + } + + std::istream& operator>>(std::istream& lhs, BlockGSType& t) { + std::string s; + lhs >> s; + std::transform(s.begin(), s.end(), s.begin(), ::tolower); + + if (s == "direct") + t = BlockGSType::Direct; + else if (s == "ldlt") + t = BlockGSType::LDLt; + else if (s == "cg") + t = BlockGSType::CG; + else + lhs.setstate(std::ios_base::failbit); + return lhs; + } + } +} +} diff --git a/dune/solvers/iterationsteps/blockgssteps.hh b/dune/solvers/iterationsteps/blockgssteps.hh index c5b3b02e7135923ed0d996bbc14450ee14217b0a..1b3358776296c731549ed90566ece2bd21b5ec68 100644 --- a/dune/solvers/iterationsteps/blockgssteps.hh +++ b/dune/solvers/iterationsteps/blockgssteps.hh @@ -1,7 +1,6 @@ #ifndef DUNE_SOLVERS_ITERATIONSTEPS_BLOCKGSSTEPS_HH #define DUNE_SOLVERS_ITERATIONSTEPS_BLOCKGSSTEPS_HH -#include <algorithm> #include <functional> #include <dune/common/parametertree.hh> @@ -20,21 +19,7 @@ enum class Direction { FORWARD, BACKWARD, SYMMETRIC }; /** * @brief Provides support to parse the @Direction enum. */ -std::istream& operator>>(std::istream& lhs, Direction& t) { - std::string s; - lhs >> s; - std::transform(s.begin(), s.end(), s.begin(), ::tolower); - - if (s == "forward") - t = Direction::FORWARD; - else if (s == "backward") - t = Direction::BACKWARD; - else if (s == "symmetric") - t = Direction::SYMMETRIC; - else - lhs.setstate(std::ios_base::failbit); - return lhs; -} +std::istream& operator>>(std::istream& lhs, Direction& t); /** * \brief Iterates over all rows i and updates the i-th component by solving @@ -293,21 +278,7 @@ enum class BlockGSType { Direct, LDLt, CG }; /** * @brief Provides support to parse the @BlockGSType enum. */ -std::istream& operator>>(std::istream& lhs, BlockGSType& t) { - std::string s; - lhs >> s; - std::transform(s.begin(), s.end(), s.begin(), ::tolower); - - if (s == "direct") - t = BlockGSType::Direct; - else if (s == "ldlt") - t = BlockGSType::LDLt; - else if (s == "cg") - t = BlockGSType::CG; - else - lhs.setstate(std::ios_base::failbit); - return lhs; -} +std::istream& operator>>(std::istream& lhs, BlockGSType& t); /** * @brief The BlockGSStepFactory struct allows to conveniently construct various