preCICE
v3.2.0
Toggle main menu visibility
Main Page
Related Pages
Namespaces
Namespace List
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
x
Functions
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
x
Variables
_
a
b
c
d
e
f
h
i
m
n
p
r
s
t
Typedefs
b
d
e
g
l
m
p
r
s
t
u
v
Enumerations
Enumerator
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
~
Functions
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
~
Variables
_
a
b
c
d
e
f
g
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
Typedefs
a
b
c
d
e
f
i
k
m
n
o
p
r
s
t
v
w
Enumerations
Enumerator
c
d
e
i
l
m
n
o
r
s
u
v
w
Related Symbols
Files
File List
File Members
All
_
a
b
c
d
e
g
i
j
m
n
o
p
r
s
t
v
Functions
a
b
c
g
m
p
r
s
t
v
Variables
Typedefs
Macros
b
d
m
n
p
t
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
Loading...
Searching...
No Matches
src
utils
EigenHelperFunctions.cpp
Go to the documentation of this file.
1
/*
2
* EigenHelperFunctions.cpp
3
*
4
* Created on: Dec 9, 2015
5
* Author: scheufks
6
*/
7
8
#include "
EigenHelperFunctions.hpp
"
9
10
namespace
precice::utils
{
11
12
void
shiftSetFirst
(
13
Eigen::MatrixXd &A,
const
Eigen::VectorXd &v)
14
{
15
PRECICE_ASSERT
(v.size() == A.rows(), v.size(), A.rows());
16
// A.bottomRightCorner(n, m - 1) = A.topLeftCorner(n, m - 1);
17
for
(
auto
i = A.cols() - 1; i > 0; i--)
18
A.col(i) = A.col(i - 1);
19
A.col(0) = v;
20
}
12
void
shiftSetFirst
( {
…
}
21
22
void
appendFront
(
23
Eigen::MatrixXd &A, Eigen::VectorXd &v)
24
{
25
int
n = A.rows(), m = A.cols();
26
if
(n <= 0 && m <= 0) {
27
A = v;
28
}
else
{
29
PRECICE_ASSERT
(v.size() == n, v.size(), A.rows());
30
A.conservativeResize(n, m + 1);
31
// A.topRightCorner(n, m) = A.topLeftCorner(n, m); // bad error, reason unknown!
32
for
(
auto
i = A.cols() - 1; i > 0; i--)
33
A.col(i) = A.col(i - 1);
34
A.col(0) = v;
35
}
36
}
22
void
appendFront
( {
…
}
37
38
void
removeColumnFromMatrix
(
39
Eigen::MatrixXd &A,
int
col)
40
{
41
PRECICE_ASSERT
(col < A.cols() && col >= 0, col, A.cols());
42
for
(
int
j = col; j < A.cols() - 1; j++)
43
A.col(j) = A.col(j + 1);
44
45
A.conservativeResize(A.rows(), A.cols() - 1);
46
}
38
void
removeColumnFromMatrix
( {
…
}
47
48
void
append
(
49
Eigen::VectorXd &v,
50
double
value)
51
{
52
int
n = v.size();
53
v.conservativeResize(n + 1);
54
v(n) = value;
55
}
48
void
append
( {
…
}
56
57
}
// namespace precice::utils
EigenHelperFunctions.hpp
PRECICE_ASSERT
#define PRECICE_ASSERT(...)
Definition
assertion.hpp:85
precice::utils
contains precice-related utilities.
Definition
PointToPointCommunicationTest.cpp:23
precice::utils::removeColumnFromMatrix
void removeColumnFromMatrix(Eigen::MatrixXd &A, int col)
Definition
EigenHelperFunctions.cpp:38
precice::utils::appendFront
void appendFront(Eigen::MatrixXd &A, Eigen::VectorXd &v)
Definition
EigenHelperFunctions.cpp:22
precice::utils::append
void append(Eigen::VectorXd &v, double value)
Definition
EigenHelperFunctions.cpp:48
precice::utils::shiftSetFirst
void shiftSetFirst(Eigen::MatrixXd &A, const Eigen::VectorXd &v)
Definition
EigenHelperFunctions.cpp:12