From d0adb66e48913a0d7566e48b0fb65c8a281a9310 Mon Sep 17 00:00:00 2001 From: Thomas Fischer <thomas.fischer@ufz.de> Date: Mon, 20 Dec 2021 12:04:03 +0100 Subject: [PATCH] [MaL/LA/Lis] Rm. unused LisLinearSolver. --- MathLib/LinAlg/Lis/LisLinearSolver.cpp | 117 ------------------------- MathLib/LinAlg/Lis/LisLinearSolver.h | 62 ------------- 2 files changed, 179 deletions(-) delete mode 100644 MathLib/LinAlg/Lis/LisLinearSolver.cpp delete mode 100644 MathLib/LinAlg/Lis/LisLinearSolver.h diff --git a/MathLib/LinAlg/Lis/LisLinearSolver.cpp b/MathLib/LinAlg/Lis/LisLinearSolver.cpp deleted file mode 100644 index ff9e50fe153..00000000000 --- a/MathLib/LinAlg/Lis/LisLinearSolver.cpp +++ /dev/null @@ -1,117 +0,0 @@ -/** - * \file - * \author Norihiro Watanabe - * \date 2013-04-16 - * \brief Implementation of the LisLinearSolver class. - * - * \copyright - * Copyright (c) 2012-2021, OpenGeoSys Community (http://www.opengeosys.org) - * Distributed under a Modified BSD License. - * See accompanying file LICENSE.txt or - * http://www.opengeosys.org/project/license - * - */ - -#ifdef _OPENMP -#include <omp.h> -#endif - -#include "BaseLib/Logging.h" -#include "LisCheck.h" -#include "LisLinearSolver.h" -#include "LisMatrix.h" -#include "LisVector.h" - -namespace MathLib -{ -LisLinearSolver::LisLinearSolver(const std::string /*solver_name*/, - const BaseLib::ConfigTree* const option) - : lis_option_(option) -{ -} - -bool LisLinearSolver::solve(LisMatrix& A, LisVector& b, LisVector& x) -{ - finalizeMatrixAssembly(A); - - INFO("------------------------------------------------------------------"); - INFO("*** LIS solver computation"); - - // Create solver - LIS_SOLVER solver; - int ierr = lis_solver_create(&solver); - if (!checkLisError(ierr)) - return false; - - lis_solver_set_option(const_cast<char*>(lis_option_.option_string_.c_str()), - solver); -#ifdef _OPENMP - INFO("-> number of threads: {:d}", (int)omp_get_max_threads()); -#endif - { - int precon; - ierr = lis_solver_get_precon(solver, &precon); - if (!checkLisError(ierr)) - return false; - INFO("-> precon: {:d}", precon); - } - { - int slv; - ierr = lis_solver_get_solver(solver, &slv); - if (!checkLisError(ierr)) - return false; - INFO("-> solver: {:d}", slv); - } - - // solve - INFO("-> solve"); - ierr = - lis_solve(A.getRawMatrix(), b.getRawVector(), x.getRawVector(), solver); - if (!checkLisError(ierr)) - return false; - - LIS_INT linear_solver_status; - ierr = lis_solver_get_status(solver, &linear_solver_status); - if (!checkLisError(ierr)) - return false; - - INFO("-> status: {:d}", linear_solver_status); - - { - int iter = 0; - ierr = lis_solver_get_iter(solver, &iter); - if (!checkLisError(ierr)) - return false; - - INFO("-> iteration: {:d}", iter); - } - { - double resid = 0.0; - ierr = lis_solver_get_residualnorm(solver, &resid); - if (!checkLisError(ierr)) - return false; - INFO("-> residual: {:g}", resid); - } - { - double time, itime, ptime, p_ctime, p_itime; - ierr = lis_solver_get_timeex(solver, &time, &itime, &ptime, &p_ctime, - &p_itime); - if (!checkLisError(ierr)) - return false; - INFO("-> time total (s): {:g}", time); - INFO("-> time iterations (s): {:g}", itime); - INFO("-> time preconditioning (s): {:g}", ptime); - INFO("-> time precond. create (s): {:g}", p_ctime); - INFO("-> time precond. iter (s): {:g}", p_itime); - } - - // Clear solver - ierr = lis_solver_destroy(solver); - if (!checkLisError(ierr)) - return false; - INFO("------------------------------------------------------------------"); - - return linear_solver_status == LIS_SUCCESS; -} - -} // namespace MathLib diff --git a/MathLib/LinAlg/Lis/LisLinearSolver.h b/MathLib/LinAlg/Lis/LisLinearSolver.h deleted file mode 100644 index 8c9cbd56331..00000000000 --- a/MathLib/LinAlg/Lis/LisLinearSolver.h +++ /dev/null @@ -1,62 +0,0 @@ -/** - * \file - * \author Norihiro Watanabe - * \date 2013-04-16 - * \brief Definition of the LisLinearSolver class. - * - * \copyright - * Copyright (c) 2012-2021, OpenGeoSys Community (http://www.opengeosys.org) - * Distributed under a Modified BSD License. - * See accompanying file LICENSE.txt or - * http://www.opengeosys.org/project/license - * - */ - -#pragma once - -#include <vector> -#include <string> - -#include <lis.h> - -#include "BaseLib/ConfigTree.h" - -#include "LisOption.h" - -namespace MathLib -{ - -class LisMatrix; -class LisVector; - -/** - * \brief Linear solver using Lis (http://www.ssisc.org/lis/) - * - */ -class LisLinearSolver final -{ -public: - /** - * Constructor - * @param solver_name A name used as a prefix for command line options - * if there are such options available. - * @param option A pointer to a linear solver option. In case you omit - * this argument, default settings follow those of - * LisOption struct. - */ - LisLinearSolver(const std::string solver_name = "", - BaseLib::ConfigTree const*const option = nullptr); - - /** - * configure linear solvers - * @param option - */ - void setOption(const LisOption& option) { lis_option_ = option; } - - bool solve(LisMatrix& A, LisVector &b, LisVector &x); - -private: - LisOption lis_option_; -}; - -} // MathLib -- GitLab