preCICE v3.1.2
Loading...
Searching...
No Matches
AbsoluteOrRelativeConvergenceMeasureTest.cpp
Go to the documentation of this file.
1#include <Eigen/Core>
5#include "testing/Testing.hpp"
6
7using namespace precice;
8using namespace cplscheme;
9
10BOOST_AUTO_TEST_SUITE(CplSchemeTests)
11
12BOOST_AUTO_TEST_CASE(AbsoluteOrRelativeConvergenceMeasureTest)
13{
14 PRECICE_TEST(1_rank);
15 using Eigen::Vector3d;
16 // Create convergence measure for Vector data
17 double absLimit1 = 1.0;
18 double relLimit1 = 0.05;
19 double absLimit2 = 0.2;
20 double relLimit2 = 0.2;
21 cplscheme::impl::AbsoluteOrRelativeConvergenceMeasure measure1(absLimit1, relLimit1);
22 cplscheme::impl::AbsoluteOrRelativeConvergenceMeasure measure2(absLimit2, relLimit2);
23
24 // Create data sets for old state of data and new state of data
25 Vector3d oldValues0(1, 1, 1);
26 Vector3d oldValues1(2.6, 2.6, 2.6);
27 Vector3d oldValues2(2.9, 2.9, 2.9);
28 Vector3d newValues(3, 3, 3);
29
30 measure1.measure(oldValues0, newValues);
31 BOOST_TEST(not measure1.isConvergence());
32
33 measure1.measure(oldValues1, newValues);
34 BOOST_TEST(measure1.isConvergence());
35
36 measure1.measure(oldValues2, newValues);
37 BOOST_TEST(measure1.isConvergence());
38
39 measure2.measure(oldValues0, newValues);
40 BOOST_TEST(not measure2.isConvergence());
41
42 measure2.measure(oldValues1, newValues);
43 BOOST_TEST(measure2.isConvergence());
44
45 measure2.measure(oldValues2, newValues);
46 BOOST_TEST(measure2.isConvergence());
47}
48
BOOST_AUTO_TEST_CASE(AbsoluteOrRelativeConvergenceMeasureTest)
BOOST_AUTO_TEST_SUITE(PreProcess)
BOOST_AUTO_TEST_SUITE_END()
#define PRECICE_TEST(...)
Definition Testing.hpp:27
Measures the convergence from an old data set to a new one.
virtual void measure(const Eigen::VectorXd &oldValues, const Eigen::VectorXd &newValues)
Performs convergence measurement.
virtual bool isConvergence() const
Returns true, if the last measurement indicates convergence.
Main namespace of the precice library.