Commit 0785d371 authored by Dmitry Bagaev's avatar Dmitry Bagaev

Style fix

parent 4a1aff21
This diff is collapsed.
......@@ -5,7 +5,9 @@ namespace INMOST {
struct SolverBaseFactory {
virtual SolverInterface *create() = 0;
virtual SolverInterface *copy(const SolverInterface *other) = 0;
virtual ~SolverBaseFactory() {};
};
......@@ -28,9 +30,13 @@ namespace INMOST {
static void registerSolver(std::string name) {
solvers.insert(std::make_pair(name, new SolverCreateFactory<T>));
};
static SolverInterface *getSolver(std::string name);
static SolverInterface *copySolver(const SolverInterface *other);
static std::vector<std::string> getAvailableSolvers();
static bool isSolverAvailable(std::string name);
};
......
......@@ -13,29 +13,39 @@ namespace INMOST {
INMOST_MPI_Comm communicator;
public:
SolverInterface() {};
SolverInterface(const SolverInterface* other) {};
virtual void Assign(const SolverInterface* other) = 0;
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 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() {};
......
......@@ -32,30 +32,39 @@ namespace INMOST {
INMOST_DATA_ENUM_TYPE solver_gmres_substeps;
public:
SolverDDPQILUC2();
SolverDDPQILUC2(const SolverInterface* other);
virtual void Assign(const SolverInterface* other);
SolverDDPQILUC2(const SolverInterface *other);
virtual void Assign(const SolverInterface *other);
virtual void Initialize(int *argc, char ***argv, const char *parameters_file, std::string prefix);
virtual void SetMatrix(Sparse::Matrix & A, bool ModifiedPattern, bool OldPreconditioner);
virtual void SetMatrix(Sparse::Matrix &A, bool ModifiedPattern, bool OldPreconditioner);
virtual bool Solve(Sparse::Vector &RHS, Sparse::Vector &SOL);
virtual bool Clear();
virtual bool isMatrixSet();
virtual INMOST_DATA_REAL_TYPE GetPropertyReal(std::string property) const;
virtual INMOST_DATA_ENUM_TYPE GetPropertyEnum(std::string property) const;
virtual void SetPropertyReal(std::string property, INMOST_DATA_REAL_TYPE value);
virtual void SetPropertyEnum(std::string property, INMOST_DATA_ENUM_TYPE value);
virtual const INMOST_DATA_ENUM_TYPE Iterations() const;
virtual const INMOST_DATA_REAL_TYPE Residual() const;
virtual const std::string ReturnReason() const;
virtual const std::string SolverName() const;
virtual void Finalize();
virtual ~SolverDDPQILUC2();
};
......
......@@ -7,13 +7,13 @@
namespace INMOST {
class SolverILU2 : public SolverInterface {
private:
Sparse::Matrix *matrix;
BCGS_solver *solver;
Solver::OrderInfo info;
class SolverILU2 : public SolverInterface {
private:
Sparse::Matrix *matrix;
BCGS_solver *solver;
Solver::OrderInfo info;
INMOST_DATA_ENUM_TYPE additive_schwartz_overlap;
INMOST_DATA_ENUM_TYPE additive_schwartz_overlap;
INMOST_DATA_ENUM_TYPE maximum_iterations;
INMOST_DATA_REAL_TYPE absolute_tolerance;
......@@ -25,34 +25,43 @@ namespace INMOST {
INMOST_DATA_REAL_TYPE preconditioner_fill_level;
INMOST_DATA_ENUM_TYPE preconditioner_rescale_iterations;
INMOST_DATA_ENUM_TYPE solver_gmres_substeps;
public:
public:
SolverILU2();
SolverILU2(const SolverInterface* other);
virtual void Assign(const SolverInterface* other);
SolverILU2(const SolverInterface *other);
virtual void Assign(const SolverInterface *other);
virtual void Initialize(int *argc, char ***argv, const char *parameters_file, std::string prefix);
virtual void SetMatrix(Sparse::Matrix & A, bool ModifiedPattern, bool OldPreconditioner);
virtual void SetMatrix(Sparse::Matrix &A, bool ModifiedPattern, bool OldPreconditioner);
virtual bool Solve(Sparse::Vector &RHS, Sparse::Vector &SOL);
virtual bool Clear();
virtual bool isMatrixSet();
virtual bool isMatrixSet();
virtual INMOST_DATA_REAL_TYPE GetPropertyReal(std::string property) const;
virtual INMOST_DATA_REAL_TYPE GetPropertyReal(std::string property) const;
virtual INMOST_DATA_ENUM_TYPE GetPropertyEnum(std::string property) const;
virtual INMOST_DATA_ENUM_TYPE GetPropertyEnum(std::string property) const;
virtual void SetPropertyReal(std::string property, INMOST_DATA_REAL_TYPE value);
virtual void SetPropertyReal(std::string property, INMOST_DATA_REAL_TYPE value);
virtual void SetPropertyEnum(std::string property, INMOST_DATA_ENUM_TYPE value);
virtual const INMOST_DATA_ENUM_TYPE Iterations() const;
virtual const INMOST_DATA_REAL_TYPE Residual() const;
virtual const std::string ReturnReason() const;
virtual const INMOST_DATA_ENUM_TYPE Iterations() const;
virtual const INMOST_DATA_REAL_TYPE Residual() const;
virtual const std::string ReturnReason() const;
virtual const std::string SolverName() const;
virtual const std::string SolverName() const;
virtual void Finalize();
virtual void Finalize();
virtual ~SolverILU2();
};
};
}
......
......@@ -2,7 +2,6 @@
#define INMOST_SOLVERMPTILU2_H
#include <inmost.h>
#include "solver_mtilu2.hpp"
#include "../solver_bcgsl.hpp"
......@@ -29,30 +28,39 @@ namespace INMOST {
INMOST_DATA_ENUM_TYPE solver_gmres_substeps;
public:
SolverMPTILU2();
SolverMPTILU2(const SolverInterface* other);
virtual void Assign(const SolverInterface* other);
SolverMPTILU2(const SolverInterface *other);
virtual void Assign(const SolverInterface *other);
virtual void Initialize(int *argc, char ***argv, const char *parameters_file, std::string prefix);
virtual void SetMatrix(Sparse::Matrix & A, bool ModifiedPattern, bool OldPreconditioner);
virtual void SetMatrix(Sparse::Matrix &A, bool ModifiedPattern, bool OldPreconditioner);
virtual bool Solve(Sparse::Vector &RHS, Sparse::Vector &SOL);
virtual bool Clear();
virtual bool isMatrixSet();
virtual INMOST_DATA_REAL_TYPE GetPropertyReal(std::string property) const;
virtual INMOST_DATA_ENUM_TYPE GetPropertyEnum(std::string property) const;
virtual void SetPropertyReal(std::string property, INMOST_DATA_REAL_TYPE value);
virtual void SetPropertyEnum(std::string property, INMOST_DATA_ENUM_TYPE value);
virtual const INMOST_DATA_ENUM_TYPE Iterations() const;
virtual const INMOST_DATA_REAL_TYPE Residual() const;
virtual const std::string ReturnReason() const;
virtual const std::string SolverName() const;
virtual void Finalize();
virtual ~SolverMPTILU2();
};
......
......@@ -27,30 +27,39 @@ namespace INMOST {
INMOST_DATA_ENUM_TYPE solver_gmres_substeps;
public:
SolverMPTILUC();
SolverMPTILUC(const SolverInterface* other);
virtual void Assign(const SolverInterface* other);
SolverMPTILUC(const SolverInterface *other);
virtual void Assign(const SolverInterface *other);
virtual void Initialize(int *argc, char ***argv, const char *parameters_file, std::string prefix);
virtual void SetMatrix(Sparse::Matrix & A, bool ModifiedPattern, bool OldPreconditioner);
virtual void SetMatrix(Sparse::Matrix &A, bool ModifiedPattern, bool OldPreconditioner);
virtual bool Solve(Sparse::Vector &RHS, Sparse::Vector &SOL);
virtual bool Clear();
virtual bool isMatrixSet();
virtual INMOST_DATA_REAL_TYPE GetPropertyReal(std::string property) const;
virtual INMOST_DATA_ENUM_TYPE GetPropertyEnum(std::string property) const;
virtual void SetPropertyReal(std::string property, INMOST_DATA_REAL_TYPE value);
virtual void SetPropertyEnum(std::string property, INMOST_DATA_ENUM_TYPE value);
virtual const INMOST_DATA_ENUM_TYPE Iterations() const;
virtual const INMOST_DATA_REAL_TYPE Residual() const;
virtual const std::string ReturnReason() const;
virtual const std::string SolverName() const;
virtual void Finalize();
virtual ~SolverMPTILUC();
};
......
......@@ -10,40 +10,49 @@ namespace INMOST {
class SolverPETSc : public SolverInterface {
private:
//TODO
//may be should find another way to count petsc solvers and finalize them
static unsigned int petscSolversCount;
//TODO
//may be should find another way to count petsc solvers and finalize them
static unsigned int petscSolversCount;
std::string parametersFile;
KSP* ksp;
Mat* matrix;
KSP *ksp;
Mat *matrix;
INMOST_DATA_ENUM_TYPE local_size, global_size;
INMOST_DATA_ENUM_TYPE local_size, global_size;
public:
SolverPETSc();
SolverPETSc(const SolverInterface* other);
virtual void Assign(const SolverInterface* other);
SolverPETSc(const SolverInterface *other);
virtual void Assign(const SolverInterface *other);
virtual void Initialize(int *argc, char ***argv, const char *parameters_file, std::string prefix);
virtual void SetMatrix(Sparse::Matrix & A, bool ModifiedPattern, bool OldPreconditioner);
virtual void SetMatrix(Sparse::Matrix &A, bool ModifiedPattern, bool OldPreconditioner);
virtual bool Solve(Sparse::Vector &RHS, Sparse::Vector &SOL);
virtual bool Clear();
virtual bool isMatrixSet();
virtual bool isMatrixSet();
virtual INMOST_DATA_REAL_TYPE GetPropertyReal(std::string property) const;
virtual INMOST_DATA_REAL_TYPE GetPropertyReal(std::string property) const;
virtual INMOST_DATA_ENUM_TYPE GetPropertyEnum(std::string property) const;
virtual INMOST_DATA_ENUM_TYPE GetPropertyEnum(std::string property) const;
virtual void SetPropertyReal(std::string property, INMOST_DATA_REAL_TYPE value);
virtual void SetPropertyReal(std::string property, INMOST_DATA_REAL_TYPE value);
virtual void SetPropertyEnum(std::string property, INMOST_DATA_ENUM_TYPE value);
virtual const INMOST_DATA_ENUM_TYPE Iterations() const;
virtual const INMOST_DATA_REAL_TYPE Residual() const;
virtual const std::string ReturnReason() const;
virtual const INMOST_DATA_ENUM_TYPE Iterations() const;
virtual const INMOST_DATA_REAL_TYPE Residual() const;
virtual const std::string ReturnReason() const;
virtual const std::string SolverName() const;
virtual const std::string SolverName() const;
virtual void Finalize();
virtual void Finalize();
virtual ~SolverPETSc();
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment