SolverInner.h 1.52 KB
Newer Older
1 2 3
#ifndef INMOST_SOLVERINNER_H
#define INMOST_SOLVERINNER_H

igor's avatar
igor committed
4 5
#include "../Solver/SolverInterface.h"
#include "../Misc/utils.h"
6 7
#include "solver_prototypes.hpp"
#include "solver_bcgsl.hpp"
Kirill Terekhov's avatar
Kirill Terekhov committed
8
#define KSOLVER BCGS_solver
9 10 11

namespace INMOST {

12
    class SolverInner : public SolverInterface {
13 14 15 16
    protected:
        Sparse::Matrix *matrix;
        KSOLVER *solver;
        Solver::OrderInfo info;
Dmitry Bagaev's avatar
Dmitry Bagaev committed
17

18 19
        INMOST_DATA_ENUM_TYPE maximum_iterations;
        INMOST_DATA_REAL_TYPE atol, rtol, dtol;
20
    public:
Dmitry Bagaev's avatar
Dmitry Bagaev committed
21
        SolverInner();
22

Dmitry Bagaev's avatar
Dmitry Bagaev committed
23
        virtual SolverInterface *Copy(const SolverInterface *other);
24 25 26

        virtual void Assign(const SolverInterface *other);

Dmitry Bagaev's avatar
Dmitry Bagaev committed
27
        virtual void Setup(int *argc, char ***argv, SolverParameters &p);
28 29 30 31 32 33 34 35 36

        virtual void SetMatrix(Sparse::Matrix &A, bool ModifiedPattern, bool OldPreconditioner) = 0;

        virtual bool Solve(Sparse::Vector &RHS, Sparse::Vector &SOL);

        virtual bool Clear();

        virtual bool isMatrixSet();

Dmitry Bagaev's avatar
Dmitry Bagaev committed
37 38 39 40
        virtual std::string GetParameter(std::string name) const;

        virtual void SetParameter(std::string name, std::string value);

41
        virtual INMOST_DATA_ENUM_TYPE Iterations() const;
42

43
        virtual INMOST_DATA_REAL_TYPE Residual() const;
44 45 46 47 48

        virtual const std::string ReturnReason() const;

        virtual const std::string SolverName() const = 0;

Dmitry Bagaev's avatar
2prev  
Dmitry Bagaev committed
49
        virtual INMOST_DATA_REAL_TYPE Condest(INMOST_DATA_REAL_TYPE tol, INMOST_DATA_ENUM_TYPE maxiter);
Dmitry Bagaev's avatar
Dmitry Bagaev committed
50

51 52 53 54 55 56 57 58 59
        virtual void Finalize();

        virtual ~SolverInner();
    };

}


#endif //INMOST_SOLVERINNER_H