preCICE v3.1.2
Loading...
Searching...
No Matches
ConstantPreconditioner.cpp
Go to the documentation of this file.
2#include <algorithm>
3#include <utility>
4
6#include "utils/assertion.hpp"
7
9
11 : Preconditioner(-1),
12 _factors(std::move(factors))
13{
14}
15
17{
20
21 // is always constant by definition
22 _frozen = true;
24
26
27 int offset = 0;
28 for (size_t k = 0; k < _subVectorSizes.size(); k++) {
29 for (size_t i = 0; i < _subVectorSizes[k]; i++) {
30 _weights[i + offset] = 1.0 / _factors[k];
31 _invWeights[i + offset] = _factors[k];
32 }
33 offset += _subVectorSizes[k];
34 }
35}
36
37void ConstantPreconditioner::_update_(bool timeWindowComplete,
38 const Eigen::VectorXd &oldValues,
39 const Eigen::VectorXd &res)
40{
41
42 //nothing to do here
43}
44
45} // namespace precice::acceleration::impl
#define PRECICE_TRACE(...)
Definition LogMacros.hpp:95
#define PRECICE_ASSERT(...)
Definition assertion.hpp:87
std::vector< double > _factors
Constant user-defined factors to scale the quasi-Newton system.
virtual void _update_(bool timeWindowComplete, const Eigen::VectorXd &oldValues, const Eigen::VectorXd &res)
Update the scaling after every FSI iteration.
virtual void initialize(std::vector< size_t > &svs)
initialize the preconditioner
Interface for preconditioner variants that can be applied to quasi-Newton acceleration schemes.
std::vector< size_t > _subVectorSizes
Sizes of each sub-vector, i.e. each coupling data.
virtual void initialize(std::vector< size_t > &svs)
initialize the preconditioner
std::vector< double > _invWeights
Inverse weights (for efficiency reasons)
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.
bool _frozen
True if _nbNonConstTimeWindows >= _maxNonConstTimeWindows, i.e., preconditioner is not updated any mo...
STL namespace.
T size(T... args)