#ifndef POISSON_SOLVER_H
#define POISSON_SOLVER_H
#include "Array2D.h"
#include "LinearSolver.h"
#include "PhysicsModel.h"
#include "NonLinearSolver.h"
#include <vector>
#include <map>
namespace ATC {
class ATC_Coupling;
class FE_Engine;
class PrescribedDataManager;
class PhysicsModel;
class PoissonSolver {
public:
PoissonSolver(
const FieldName fieldName,
const PhysicsModel * physicsModel,
const FE_Engine * feEngine,
const PrescribedDataManager * prescribedDataMgr,
ATC_Coupling * atc,
const Array2D<bool> & rhsMask,
const int solverType = LinearSolver::DIRECT_SOLVE,
bool parallel = false
);
~PoissonSolver();
bool modify(int narg, char **arg);
void initialize(void);
void compute_rhs(const FIELDS & fields, FIELDS & rhs);
bool solve(FIELDS & fields, FIELDS & rhs); bool solve(DENS_MAT & field, const DENS_MAT & rhs);
void greens_function(const int I, VECTOR & inv_stiffness_I) const
{
solver_->greens_function(I,inv_stiffness_I);
}
double penalty_coefficient() const
{
return solver_->penalty_coefficient();
}
void set_tolerance(double tol)
{
solverTol_ = tol;
}
void set_max_iterations(int maxIter)
{
solverMaxIter_ = maxIter;
}
protected:
void set_charges(FIELDS & fields);
ATC_Coupling * atc_;
const FE_Engine * feEngine_;
const PrescribedDataManager * prescribedDataMgr_;
const PhysicsModel * physicsModel_;
FieldName fieldName_;
int nNodes_;
int dof_;
Array2D<bool> rhsMask_;
bool linear_;
LinearSolver * solver_;
NonLinearSolver *solverNL_;
PhysicsModelTangentOperator * tangent_;
int solverType_;
double solverTol_;
int solverMaxIter_;
IntegrationDomainType integrationType_;
SPAR_MAT stiffness_;
bool useOwnGrid_;
bool parallel_;
};
} #endif