13namespace acceleration {
57 void apply(Eigen::MatrixXd &M,
bool transpose)
62 for (
int i = 0; i < M.cols(); i++) {
63 for (
int j = 0; j < M.rows(); j++) {
69 for (
int i = 0; i < M.cols(); i++) {
70 for (
int j = 0; j < M.rows(); j++) {
81 void revert(Eigen::MatrixXd &M,
bool transpose)
87 for (
int i = 0; i < M.cols(); i++) {
88 for (
int j = 0; j < M.rows(); j++) {
94 for (
int i = 0; i < M.cols(); i++) {
95 for (
int j = 0; j < M.rows(); j++) {
109 for (
int i = 0; i < M.cols(); i++) {
110 for (
int j = 0; j < M.rows(); j++) {
124 for (
int j = 0; j < v.size(); j++) {
137 for (
int i = 0; i < M.cols(); i++) {
138 for (
int j = 0; j < M.rows(); j++) {
152 for (
int j = 0; j < v.size(); j++) {
162 void update(
bool timeWindowComplete,
const Eigen::VectorXd &oldValues,
const Eigen::VectorXd &res)
171 if (timeWindowComplete) {
178 _update_(timeWindowComplete, oldValues, res);
233 virtual void _update_(
bool timeWindowComplete,
const Eigen::VectorXd &oldValues,
const Eigen::VectorXd &res) = 0;
#define PRECICE_TRACE(...)
#define PRECICE_ASSERT(...)
Interface for preconditioner variants that can be applied to quasi-Newton acceleration schemes.
void apply(Eigen::MatrixXd &M, bool transpose)
Apply preconditioner to matrix.
void revert(Eigen::MatrixXd &M, bool transpose)
Apply inverse preconditioner to matrix.
int _nbNonConstTimeWindows
Counts the number of completed time windows with a non-const weighting.
std::vector< size_t > _subVectorSizes
Sizes of each sub-vector, i.e. each coupling data.
void newQRfulfilled()
to tell the preconditioner that QR-decomposition has been recomputed
void update(bool timeWindowComplete, const Eigen::VectorXd &oldValues, const Eigen::VectorXd &res)
Update the scaling after every FSI iteration and require a new QR decomposition (if necessary)
Preconditioner(int maxNonConstTimeWindows)
virtual void _update_(bool timeWindowComplete, const Eigen::VectorXd &oldValues, const Eigen::VectorXd &res)=0
Update the scaling after every FSI iteration and require a new QR decomposition (if necessary)
virtual void initialize(std::vector< size_t > &svs)
initialize the preconditioner
std::vector< double > & getWeights()
virtual ~Preconditioner()
Destructor, empty.
void revert(Eigen::MatrixXd &M)
To transform balanced values back to physical values. Matrix version.
std::vector< double > _invWeights
Inverse weights (for efficiency reasons)
bool requireNewQR()
returns true if a QR decomposition from scratch is necessary
int _maxNonConstTimeWindows
maximum number of non-const time windows, i.e., after this number of time windows,...
std::vector< double > _weights
Weights used to scale the matrix V and the residual.
void revert(Eigen::VectorXd &v)
To transform balanced values back to physical values. Vector version.
bool _requireNewQR
True if a QR decomposition from scratch is necessary.
void apply(Eigen::VectorXd &v)
To transform physical values to balanced values. Vector version.
void apply(Eigen::MatrixXd &M)
To transform physical values to balanced values. Matrix version.
bool _frozen
True if _nbNonConstTimeWindows >= _maxNonConstTimeWindows, i.e., preconditioner is not updated any mo...
This class provides a lightweight logger.
Main namespace of the precice library.
static std::unique_ptr< precice::Participant > impl