Skip to content
Snippets Groups Projects
Commit d0c0a5ea authored by Elias Pipping's avatar Elias Pipping
Browse files

Move implementation to library

parent 81a54245
No related branches found
No related tags found
No related merge requests found
dune_add_library("dunesolvers"
iterationsteps/blockgssteps.cc
solvers/criterion.cc)
dune_register_package_flags(LIBRARIES dunesolvers)
......
#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;
}
}
}
}
#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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment