inmost_solver_interface.h 1.69 KB
Newer Older
Dmitry Bagaev's avatar
Dmitry Bagaev committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
#ifndef INMOST_SOLVERINTERFACE_H
#define INMOST_SOLVERINTERFACE_H

#include <string>
#include "inmost_sparse.h"

namespace INMOST {

#if defined(USE_SOLVER)

    class SolverInterface {
    protected:
        INMOST_MPI_Comm communicator;
    public:
        SolverInterface() {};
        SolverInterface(const SolverInterface* other) {};
        virtual void Assign(const SolverInterface* other) = 0;

        virtual void Initialize(int *argc, char ***argv, const char *parameters_file, std::string prefix) = 0;
        virtual void SetMatrix(Sparse::Matrix & A, bool ModifiedPattern, bool OldPreconditioner) = 0;
        virtual bool Solve(INMOST::Sparse::Vector & RHS, INMOST::Sparse::Vector & SOL) = 0;
        virtual bool Clear() = 0;

        virtual bool isMatrixSet() = 0;

        virtual INMOST_DATA_REAL_TYPE GetPropertyReal(std::string property) const = 0;
        virtual INMOST_DATA_ENUM_TYPE GetPropertyEnum(std::string property) const = 0;

        virtual void SetPropertyReal(std::string property, INMOST_DATA_REAL_TYPE value) = 0;
        virtual void SetPropertyEnum(std::string property, INMOST_DATA_ENUM_TYPE value) = 0;

        virtual const INMOST_DATA_ENUM_TYPE Iterations() const = 0;
        virtual const INMOST_DATA_REAL_TYPE Residual() const = 0;
        virtual const std::string ReturnReason() const = 0;

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

        virtual void Finalize() = 0;
        virtual ~SolverInterface() {};


        void SetCommunicator(INMOST_MPI_Comm _communicator) {
            communicator = _communicator;
        }

        INMOST_MPI_Comm GetCommunicator() {
            return communicator;
        }
    };

}
#endif


#endif //INMOST_SOLVERINTERFACE_H