Page MenuHomec4science

cg.hh
No OneTemporary

File Metadata

Created
Sun, Oct 6, 14:42
#include "matrix.hh"
#include "matrix_coo.hh"
#include <cblas.h>
#include <string>
#include <vector>
#ifndef __CG_HH__
#define __CG_HH__
class Solver {
public:
virtual void read_matrix(const std::string & filename) = 0;
void init_source_term(double h);
virtual void solve(std::vector<double> & x) = 0;
inline int m() const { return m_m; }
inline int n() const { return m_n; }
void tolerance(double tolerance) { m_tolerance = tolerance; }
protected:
int m_m{0};
int m_n{0};
std::vector<double> m_b; // Resides on ROOT process
std::vector<double> m_b_loc;
double m_tolerance{1e-10};
/* MPI parameters */
std::vector<int> m_workloads;
int m_prank, m_psize, m_pstart, m_pend, m_chunk_size;
std::vector<int> m_displs;
};
class CGSolver : public Solver {
public:
CGSolver() = default;
virtual void read_matrix(const std::string & filename);
virtual void solve(std::vector<double> & x);
private:
Matrix m_A;
Matrix m_A_loc;
};
#endif /* __CG_HH__ */

Event Timeline