mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
BdaSolver.hpp: drop indent for namespace
This commit is contained in:
parent
7e1f4629ed
commit
e03f2394b9
@ -32,66 +32,65 @@ namespace Opm {
|
|||||||
template<class Scalar> class WellContributions;
|
template<class Scalar> class WellContributions;
|
||||||
|
|
||||||
namespace Accelerator {
|
namespace Accelerator {
|
||||||
enum class SolverStatus {
|
|
||||||
BDA_SOLVER_SUCCESS,
|
|
||||||
BDA_SOLVER_ANALYSIS_FAILED,
|
|
||||||
BDA_SOLVER_CREATE_PRECONDITIONER_FAILED,
|
|
||||||
BDA_SOLVER_UNKNOWN_ERROR
|
|
||||||
};
|
|
||||||
|
|
||||||
/// This class serves to simplify choosing between different backend solvers, such as cusparseSolver and openclSolver
|
enum class SolverStatus {
|
||||||
/// This class is abstract, no instantiations can of it can be made, only of its children
|
BDA_SOLVER_SUCCESS,
|
||||||
template <unsigned int block_size>
|
BDA_SOLVER_ANALYSIS_FAILED,
|
||||||
class BdaSolver
|
BDA_SOLVER_CREATE_PRECONDITIONER_FAILED,
|
||||||
{
|
BDA_SOLVER_UNKNOWN_ERROR
|
||||||
|
};
|
||||||
|
|
||||||
protected:
|
/// This class serves to simplify choosing between different backend solvers, such as cusparseSolver and openclSolver
|
||||||
|
/// This class is abstract, no instantiations can of it can be made, only of its children
|
||||||
|
template <unsigned int block_size>
|
||||||
|
class BdaSolver
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
// verbosity
|
||||||
|
// 0: print nothing during solves, only when initializing
|
||||||
|
// 1: print number of iterations and final norm
|
||||||
|
// 2: also print norm each iteration
|
||||||
|
// 3: also print timings of different backend functions
|
||||||
|
|
||||||
// verbosity
|
int verbosity = 0;
|
||||||
// 0: print nothing during solves, only when initializing
|
|
||||||
// 1: print number of iterations and final norm
|
|
||||||
// 2: also print norm each iteration
|
|
||||||
// 3: also print timings of different backend functions
|
|
||||||
|
|
||||||
int verbosity = 0;
|
int maxit = 200;
|
||||||
|
double tolerance = 1e-2;
|
||||||
|
|
||||||
int maxit = 200;
|
int N; // number of rows
|
||||||
double tolerance = 1e-2;
|
int Nb; // number of blocked rows (Nb*block_size == N)
|
||||||
|
int nnz; // number of nonzeroes (scalars)
|
||||||
|
int nnzb; // number of nonzero blocks (nnzb*block_size*block_size == nnz)
|
||||||
|
|
||||||
int N; // number of rows
|
unsigned int platformID = 0; // ID of OpenCL platform to be used, only used by openclSolver now
|
||||||
int Nb; // number of blocked rows (Nb*block_size == N)
|
unsigned int deviceID = 0; // ID of the device to be used
|
||||||
int nnz; // number of nonzeroes (scalars)
|
|
||||||
int nnzb; // number of nonzero blocks (nnzb*block_size*block_size == nnz)
|
|
||||||
|
|
||||||
unsigned int platformID = 0; // ID of OpenCL platform to be used, only used by openclSolver now
|
bool initialized = false;
|
||||||
unsigned int deviceID = 0; // ID of the device to be used
|
|
||||||
|
|
||||||
bool initialized = false;
|
public:
|
||||||
|
/// Construct a BdaSolver
|
||||||
|
/// \param[in] linear_solver_verbosity verbosity of solver
|
||||||
|
/// \param[in] maxit maximum number of iterations for solver
|
||||||
|
/// \param[in] tolerance required relative tolerance for solver
|
||||||
|
/// \param[in] platformID the OpenCL platform to be used, only used in openclSolver
|
||||||
|
/// \param[in] deviceID the device to be used
|
||||||
|
BdaSolver(int linear_solver_verbosity, int max_it, double tolerance_) : verbosity(linear_solver_verbosity), maxit(max_it), tolerance(tolerance_) {};
|
||||||
|
BdaSolver(int linear_solver_verbosity, int max_it, double tolerance_, unsigned int deviceID_) : verbosity(linear_solver_verbosity), maxit(max_it), tolerance(tolerance_), deviceID(deviceID_) {};
|
||||||
|
BdaSolver(int linear_solver_verbosity, int max_it, double tolerance_, unsigned int platformID_, unsigned int deviceID_) : verbosity(linear_solver_verbosity), maxit(max_it), tolerance(tolerance_), platformID(platformID_), deviceID(deviceID_) {};
|
||||||
|
|
||||||
public:
|
/// Define virtual destructor, so that the derivedclass destructor will be called
|
||||||
/// Construct a BdaSolver
|
virtual ~BdaSolver() {};
|
||||||
/// \param[in] linear_solver_verbosity verbosity of solver
|
|
||||||
/// \param[in] maxit maximum number of iterations for solver
|
|
||||||
/// \param[in] tolerance required relative tolerance for solver
|
|
||||||
/// \param[in] platformID the OpenCL platform to be used, only used in openclSolver
|
|
||||||
/// \param[in] deviceID the device to be used
|
|
||||||
BdaSolver(int linear_solver_verbosity, int max_it, double tolerance_) : verbosity(linear_solver_verbosity), maxit(max_it), tolerance(tolerance_) {};
|
|
||||||
BdaSolver(int linear_solver_verbosity, int max_it, double tolerance_, unsigned int deviceID_) : verbosity(linear_solver_verbosity), maxit(max_it), tolerance(tolerance_), deviceID(deviceID_) {};
|
|
||||||
BdaSolver(int linear_solver_verbosity, int max_it, double tolerance_, unsigned int platformID_, unsigned int deviceID_) : verbosity(linear_solver_verbosity), maxit(max_it), tolerance(tolerance_), platformID(platformID_), deviceID(deviceID_) {};
|
|
||||||
|
|
||||||
/// Define virtual destructor, so that the derivedclass destructor will be called
|
/// Define as pure virtual functions, so derivedclass must implement them
|
||||||
virtual ~BdaSolver() {};
|
virtual SolverStatus solve_system(std::shared_ptr<BlockedMatrix<double>> matrix,
|
||||||
|
double *b,
|
||||||
|
std::shared_ptr<BlockedMatrix<double>> jacMatrix,
|
||||||
|
WellContributions<double>& wellContribs,
|
||||||
|
BdaResult& res) = 0;
|
||||||
|
|
||||||
/// Define as pure virtual functions, so derivedclass must implement them
|
virtual void get_result(double *x) = 0;
|
||||||
virtual SolverStatus solve_system(std::shared_ptr<BlockedMatrix<double>> matrix,
|
|
||||||
double *b,
|
|
||||||
std::shared_ptr<BlockedMatrix<double>> jacMatrix,
|
|
||||||
WellContributions<double>& wellContribs,
|
|
||||||
BdaResult& res) = 0;
|
|
||||||
|
|
||||||
virtual void get_result(double *x) = 0;
|
}; // end class BdaSolver
|
||||||
|
|
||||||
}; // end class BdaSolver
|
|
||||||
|
|
||||||
} // namespace Accelerator
|
} // namespace Accelerator
|
||||||
} // namespace Opm
|
} // namespace Opm
|
||||||
|
Loading…
Reference in New Issue
Block a user