SolverInterface.h 1.39 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13
//
// Created by Dmitri Bagaev on 22.09.16.
//

#ifndef INMOST_SOLVERINTERFACE_H
#define INMOST_SOLVERINTERFACE_H

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

namespace INMOST {

class SolverInterface {
14
protected:
15 16 17 18
    INMOST_MPI_Comm communicator;
public:
    SolverInterface() {};
    SolverInterface(const SolverInterface* other) {};
19
    virtual void Assign(const SolverInterface* other) = 0;
20 21 22

    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;
23 24 25 26 27 28 29 30
    virtual bool Solve(INMOST::Sparse::Vector & RHS, INMOST::Sparse::Vector & SOL) = 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;

31 32 33
    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;
34 35 36

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

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

40 41

    void SetCommunicator(INMOST_MPI_Comm _communicator) {
42 43 44
        communicator = _communicator;
    }

45
    INMOST_MPI_Comm GetCommunicator() {
46 47 48 49 50 51 52
        return communicator;
    }
};

}

#endif //INMOST_SOLVERINTERFACE_H