From 52d431dfb69f420469dd329adf4b7ff76c0e31b3 Mon Sep 17 00:00:00 2001 From: Christoph Lehmann <christoph.lehmann@ufz.de> Date: Fri, 8 Jan 2016 16:06:38 +0100 Subject: [PATCH] [T] changed to new ConfigTree --- Tests/AssemblerLib/TestSerialLinearSolver.cpp | 4 ++-- Tests/MathLib/TestLinearSolver.cpp | 22 +++++++++++-------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/Tests/AssemblerLib/TestSerialLinearSolver.cpp b/Tests/AssemblerLib/TestSerialLinearSolver.cpp index 5318e9cc039..ef64f0a9ad5 100644 --- a/Tests/AssemblerLib/TestSerialLinearSolver.cpp +++ b/Tests/AssemblerLib/TestSerialLinearSolver.cpp @@ -19,7 +19,6 @@ #include "AssemblerLib/VectorMatrixAssembler.h" #include "AssemblerLib/LocalAssemblerBuilder.h" - #include "MathLib/LinAlg/ApplyKnownSolution.h" #include "MathLib/LinAlg/Solvers/GaussAlgorithm.h" #include "MathLib/LinAlg/FinalizeMatrixAssembly.h" @@ -137,8 +136,9 @@ TEST(AssemblerLibSerialLinearSolver, Steady2DdiffusionQuadElem) t_root.put_child("eigen", t_solver); } t_root.put("lis", "-i cg -p none -tol 1e-16 -maxiter 1000"); + BaseLib::ConfigTreeNew conf(t_root); - GlobalSetup::LinearSolver ls(*A, "solver_name", &t_root); + GlobalSetup::LinearSolver ls(*A, "solver_name", &conf); ls.solve(*rhs, *x); // copy solution to double vector diff --git a/Tests/MathLib/TestLinearSolver.cpp b/Tests/MathLib/TestLinearSolver.cpp index 55e68d9b82d..7f3f9f6fc90 100644 --- a/Tests/MathLib/TestLinearSolver.cpp +++ b/Tests/MathLib/TestLinearSolver.cpp @@ -99,7 +99,7 @@ template<typename IntType> struct Example1 }; template <class T_MATRIX, class T_VECTOR, class T_LINEAR_SOVLER, typename IntType> -void checkLinearSolverInterface(T_MATRIX &A, BaseLib::ConfigTree& ls_option) +void checkLinearSolverInterface(T_MATRIX &A, BaseLib::ConfigTreeNew const& ls_option) { Example1<IntType> ex1; @@ -136,7 +136,7 @@ void checkLinearSolverInterface(T_MATRIX &A, BaseLib::ConfigTree& ls_option) template <class T_MATRIX, class T_VECTOR, class T_LINEAR_SOVLER> void checkLinearSolverInterface(T_MATRIX& A, T_VECTOR& b, const std::string& prefix_name, - BaseLib::ConfigTree& ls_option) + BaseLib::ConfigTreeNew const& ls_option) { int mrank; MPI_Comm_rank(PETSC_COMM_WORLD, &mrank); @@ -206,6 +206,7 @@ TEST(MathLib, CheckInterface_GaussAlgorithm) boost::property_tree::ptree t_root; boost::property_tree::ptree t_solver; t_root.put_child("ogs", t_solver); + BaseLib::ConfigTreeNew conf(t_root); using Example = Example1<std::size_t>; @@ -213,7 +214,7 @@ TEST(MathLib, CheckInterface_GaussAlgorithm) MathLib::GlobalDenseMatrix<double> A(Example::dim_eqs, Example::dim_eqs); checkLinearSolverInterface<MathLib::GlobalDenseMatrix<double>, MathLib::DenseVector<double>, LinearSolverType, std::size_t>( - A, t_root); + A, conf); } #ifdef OGS_USE_EIGEN @@ -227,12 +228,13 @@ TEST(Math, CheckInterface_Eigen) t_solver.put("error_tolerance", 1e-15); t_solver.put("max_iteration_step", 1000); t_root.put_child("eigen", t_solver); + BaseLib::ConfigTreeNew conf(t_root); using IntType = MathLib::EigenMatrix::IndexType; MathLib::EigenMatrix A(Example1<IntType>::dim_eqs); checkLinearSolverInterface<MathLib::EigenMatrix, MathLib::EigenVector, - MathLib::EigenLinearSolver, IntType>(A, t_root); + MathLib::EigenLinearSolver, IntType>(A, conf); } #endif @@ -243,12 +245,13 @@ TEST(Math, CheckInterface_EigenLis) boost::property_tree::ptree t_root; boost::property_tree::ptree t_solver; t_root.put("lis", "-i cg -p none -tol 1e-15 -maxiter 1000"); + BaseLib::ConfigTreeNew conf(t_root); using IntType = MathLib::LisMatrix::IndexType; MathLib::EigenMatrix A(Example1<IntType>::dim_eqs); checkLinearSolverInterface<MathLib::EigenMatrix, MathLib::EigenVector, - MathLib::EigenLisLinearSolver, IntType>(A, t_root); + MathLib::EigenLisLinearSolver, IntType>(A, conf); } #endif @@ -259,12 +262,13 @@ TEST(Math, CheckInterface_Lis) boost::property_tree::ptree t_root; boost::property_tree::ptree t_solver; t_root.put("lis", "-i cg -p none -tol 1e-15 -maxiter 1000"); + BaseLib::ConfigTreeNew conf(t_root); using IntType = MathLib::LisMatrix::IndexType; MathLib::LisMatrix A(Example1<IntType>::dim_eqs); checkLinearSolverInterface<MathLib::LisMatrix, MathLib::LisVector, - MathLib::LisLinearSolver, IntType>(A, t_root); + MathLib::LisLinearSolver, IntType>(A, conf); } #endif @@ -292,7 +296,7 @@ TEST(MPITest_Math, CheckInterface_PETSc_Linear_Solver_basic) checkLinearSolverInterface<MathLib::PETScMatrix, MathLib::PETScVector, MathLib::PETScLinearSolver>( - A, b, "ptest1_", t_root); + A, b, "ptest1_", BaseLib::ConfigTreeNew(t_root)); } TEST(MPITest_Math, CheckInterface_PETSc_Linear_Solver_chebyshev_sor) @@ -318,7 +322,7 @@ TEST(MPITest_Math, CheckInterface_PETSc_Linear_Solver_chebyshev_sor) checkLinearSolverInterface<MathLib::PETScMatrix, MathLib::PETScVector, MathLib::PETScLinearSolver>( - A, b, "ptest2_", t_root); + A, b, "ptest2_", BaseLib::ConfigTreeNew(t_root)); } TEST(MPITest_Math, CheckInterface_PETSc_Linear_Solver_gmres_amg) @@ -346,7 +350,7 @@ TEST(MPITest_Math, CheckInterface_PETSc_Linear_Solver_gmres_amg) checkLinearSolverInterface<MathLib::PETScMatrix, MathLib::PETScVector, MathLib::PETScLinearSolver>( - A, b, "ptest3_", t_root); + A, b, "ptest3_", BaseLib::ConfigTreeNew(t_root)); } #endif -- GitLab