preCICE v3.1.2
Loading...
Searching...
No Matches
Acceleration.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <Eigen/Core>
4#include <map>
5#include <vector>
6
9
10namespace precice {
11namespace io {
12class TXTWriter;
13class TXTReader;
14} // namespace io
15} // namespace precice
16
17namespace precice {
18namespace acceleration {
19
21public:
22 static const int NOFILTER = 0;
23 static const int QR1FILTER = 1;
24 static const int QR1FILTER_ABS = 2;
25 static const int QR2FILTER = 3;
26 static const int PODFILTER = 4;
27
30
31 virtual ~Acceleration() = default;
32
33 virtual std::vector<int> getDataIDs() const = 0;
34
35 virtual void initialize(const DataMap &cpldata) = 0;
36
37 virtual void performAcceleration(DataMap &cpldata) = 0;
38
39 virtual void iterationsConverged(const DataMap &cpldata) = 0;
40
41 virtual void exportState(io::TXTWriter &writer) {}
42
43 virtual void importState(io::TXTReader &reader) {}
44
46 virtual int getDeletedColumns() const
47 {
48 return 0;
49 }
50
52 virtual int getDroppedColumns() const
53 {
54 return 0;
55 }
56
58 virtual int getLSSystemCols() const
59 {
60 return 0;
61 }
62
63protected:
65 void checkDataIDs(const DataMap &cplData) const;
66
68 void concatenateCouplingData(const DataMap &cplData, const std::vector<DataID> &dataIDs, Eigen::VectorXd &targetValues, Eigen::VectorXd &targetOldValues) const;
69
71 static void applyRelaxation(double omega, DataMap &cplData);
72};
73} // namespace acceleration
74} // namespace precice
virtual void importState(io::TXTReader &reader)
void checkDataIDs(const DataMap &cplData) const
Checks if all dataIDs are contained in cplData.
virtual int getDeletedColumns() const
Gives the number of QN columns that where filtered out (i.e. deleted) in this time window.
static void applyRelaxation(double omega, DataMap &cplData)
performs a relaxation given a relaxation factor omega
virtual void iterationsConverged(const DataMap &cpldata)=0
virtual void initialize(const DataMap &cpldata)=0
virtual int getDroppedColumns() const
Gives the number of QN columns that went out of scope in this time window.
void concatenateCouplingData(const DataMap &cplData, const std::vector< DataID > &dataIDs, Eigen::VectorXd &targetValues, Eigen::VectorXd &targetOldValues) const
Concatenates all coupling data involved into a single vector.
virtual void performAcceleration(DataMap &cpldata)=0
virtual std::vector< int > getDataIDs() const =0
virtual int getLSSystemCols() const
Gives the number of current QN columns (LS = least squares)
virtual void exportState(io::TXTWriter &writer)
File reader for matrix/vector in Matlab V7 ASCII format.
Definition TXTReader.hpp:16
File writer for matrix in Matlab V7 ASCII format.
Definition TXTWriter.hpp:14
Main namespace of the precice library.