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
tests
EigenHelperFunctionsTest.cpp
Go to the documentation of this file.
1
#include <Eigen/Core>
2
#include <
iosfwd
>
3
#include <
string
>
4
#include "
math/constants.hpp
"
5
#include "
testing/TestContext.hpp
"
6
#include "
testing/Testing.hpp
"
7
#include "
utils/EigenHelperFunctions.hpp
"
8
#include "
utils/String.hpp
"
9
#include "
utils/algorithm.hpp
"
10
11
using namespace
precice
;
12
using namespace
precice::utils
;
13
14
BOOST_AUTO_TEST_SUITE
(UtilsTests)
15
BOOST_AUTO_TEST_SUITE
(EigenHelperFunctionsTests)
16
17
PRECICE_TEST_SETUP
(1_rank)
18
BOOST_AUTO_TEST_CASE
(FirstN)
19
{
20
PRECICE_TEST
();
21
Eigen::VectorXd a(7);
22
a << 1, 2, 3, 4, 5, 6, 7;
23
Eigen::RowVectorXd b(3);
24
b << 1, 2, 3;
25
BOOST_TEST(
firstN
(a, 3) == b);
26
}
18
BOOST_AUTO_TEST_CASE
(FirstN) {
…
}
27
28
BOOST_AUTO_TEST_SUITE
(
RangePreview
)
29
30
PRECICE_TEST_SETUP
(1_rank)
31
BOOST_AUTO_TEST_CASE
(EigenVector)
32
{
33
PRECICE_TEST
();
34
Eigen::VectorXd a{7};
35
a << 1, 2, 3, 4, 5, 6, 0;
36
std::ostringstream
oss;
37
oss <<
previewRange
(2, a);
38
std::string
str{oss.
str
()};
39
BOOST_TEST(str ==
"[1, 2, ... , 6, 0] min:0 max:6"
);
40
}
31
BOOST_AUTO_TEST_CASE
(EigenVector) {
…
}
41
42
BOOST_AUTO_TEST_SUITE_END
()
43
44
PRECICE_TEST_SETUP
(1_rank)
45
BOOST_AUTO_TEST_CASE
(
ComponentWiseLess
)
46
{
47
PRECICE_TEST
();
48
precice::utils::ComponentWiseLess
cwl;
49
50
Eigen::VectorXd a(8);
51
a << 1, 2, 3, 4, 5, 6, 7, 9;
52
53
Eigen::VectorXd b(8);
54
b << 1, 2, 3, 4, 5, 6, 8, 0;
55
56
BOOST_TEST(
componentWiseLess
(a, b));
57
BOOST_TEST(!
componentWiseLess
(b, a));
58
BOOST_TEST(cwl(a, b));
59
BOOST_TEST(!cwl(b, a));
60
61
Eigen::VectorXd c = b;
62
63
BOOST_TEST(!
componentWiseLess
(c, b));
64
BOOST_TEST(!
componentWiseLess
(b, c));
65
BOOST_TEST(!cwl(c, b));
66
BOOST_TEST(!cwl(b, c));
67
}
45
BOOST_AUTO_TEST_CASE
(
ComponentWiseLess
) {
…
}
68
69
BOOST_AUTO_TEST_SUITE_END
()
70
BOOST_AUTO_TEST_SUITE_END
()
BOOST_AUTO_TEST_CASE
BOOST_AUTO_TEST_CASE(FirstN)
Definition
EigenHelperFunctionsTest.cpp:18
EigenHelperFunctions.hpp
BOOST_AUTO_TEST_SUITE
BOOST_AUTO_TEST_SUITE(PreProcess)
BOOST_AUTO_TEST_SUITE_END
BOOST_AUTO_TEST_SUITE_END()
String.hpp
TestContext.hpp
Testing.hpp
PRECICE_TEST
#define PRECICE_TEST()
Definition
Testing.hpp:39
PRECICE_TEST_SETUP
#define PRECICE_TEST_SETUP(...)
Creates and attaches a TestSetup to a Boost test case.
Definition
Testing.hpp:29
algorithm.hpp
std::ostringstream
std::string
constants.hpp
iosfwd
precice::utils
contains precice-related utilities.
Definition
PointToPointCommunicationTest.cpp:23
precice::utils::previewRange
const RangePreview< Iter > previewRange(Size n, const Range &range)
Definition
algorithm.hpp:172
precice::utils::firstN
auto firstN(const Eigen::PlainObjectBase< Derived > &val, unsigned n) -> const Eigen::Map< const Eigen::Matrix< typename Derived::Scalar, 1, Eigen::Dynamic > >
Definition
EigenHelperFunctions.hpp:57
precice::utils::componentWiseLess
bool componentWiseLess(const Eigen::PlainObjectBase< DerivedLHS > &lhs, const Eigen::PlainObjectBase< DerivedRHS > &rhs)
Definition
EigenHelperFunctions.hpp:72
precice
Main namespace of the precice library.
Definition
Acceleration.cpp:5
std::ostringstream::str
T str(T... args)
string
precice::utils::ComponentWiseLess
Definition
EigenHelperFunctions.hpp:85
precice::utils::RangePreview
The RangePreview object used as a lazy proxy struct for proviewing the content of a Range.
Definition
algorithm.hpp:118