1#include <boost/test/tools/context.hpp>
25 BOOST_TEST(ranks.
size() == 1);
26 BOOST_TEST(ranks.
front() == 0);
31 BOOST_TEST((secondaryRanks.begin() == secondaryRanks.end()));
52 BOOST_TEST(ranks == expected, boost::test_tools::per_element());
59 BOOST_TEST(ranks == expected, boost::test_tools::per_element());
69 const double norm = 16.881943016134134;
70 if (context.isPrimary()) {
75 if (context.isRank(1)) {
80 if (context.isRank(2)) {
91 const double norm = 16.881943016134134;
93 v << 1, 2, 3, 4, 5, 6, 7, 8, 9;
101 if (context.isPrimary()) {
102 Eigen::VectorXd u(3), v(3);
107 if (context.isRank(1)) {
108 Eigen::VectorXd u(2), v(2);
113 if (context.isRank(2)) {
114 Eigen::VectorXd u(4), v(4);
125 Eigen::VectorXd u(9), v(9);
126 u << 1, 2, 3, 4, 5, 6, 7, 8, 9;
127 v << 9, 8, 7, 6, 5, 4, 3, 2, 1;
135 if (context.isPrimary()) {
142 int in = 1,
out = -1;
144 BOOST_TEST(
out == 9);
147 double in = 1.1,
out = -1;
149 BOOST_TEST(
out == 9.9);
152 if (context.isRank(1)) {
160 int in = 3,
out = -1;
162 BOOST_TEST(
out == -1);
165 double in = 3.3,
out = -1;
167 BOOST_TEST(
out == -1);
170 if (context.isRank(2)) {
178 int in = 5,
out = -1;
180 BOOST_TEST(
out == -1);
183 double in = 5.5,
out = -1;
185 BOOST_TEST(
out == -1);
200 int in = 1,
out = -1;
202 BOOST_TEST(
out == in);
205 double in = 1.1,
out = -1;
207 BOOST_TEST(
out == in);
215 if (context.isPrimary()) {
222 int in = 1,
out = -1;
224 BOOST_TEST(
out == 9);
227 double in = 1.1,
out = -1;
229 BOOST_TEST(
out == 9.9);
232 if (context.isRank(1)) {
239 int in = 3,
out = -1;
241 BOOST_TEST(
out == 9);
244 double in = 3.3,
out = -1;
246 BOOST_TEST(
out == 9.9);
249 if (context.isRank(2)) {
256 int in = 5,
out = -1;
258 BOOST_TEST(
out == 9);
261 double in = 5.5,
out = -1;
263 BOOST_TEST(
out == 9.9);
278 int in = 1,
out = -1;
280 BOOST_TEST(
out == in);
283 double in = 1.1,
out = -1;
285 BOOST_TEST(
out == in);
293 if (context.isPrimary()) {
307 BOOST_TEST(in == 9.9);
323 BOOST_TEST(
out == 9.9);
344 BOOST_TEST(in == 9.9);
BOOST_AUTO_TEST_CASE(SerialConfig)
BOOST_AUTO_TEST_SUITE(PreProcess)
BOOST_AUTO_TEST_SUITE_END()
#define PRECICE_TEST(...)
static void allreduceSum(precice::span< const double > sendData, precice::span< double > rcvData)
static int getSize()
Number of ranks. This includes ranks from both participants, e.g. minimal size is 2.
static double l2norm(const Eigen::VectorXd &vec)
The l2 norm of a vector is calculated on distributed data.
static Rank getRank()
Current rank.
static double dot(const Eigen::VectorXd &vec1, const Eigen::VectorXd &vec2)
static bool isPrimary()
True if this process is running the primary rank.
static void broadcast(bool &value)
static auto allSecondaryRanks()
Returns an iterable range over salve ranks [1, _size)
static auto allRanks()
Returns an iterable range over all ranks [0, _size)
static bool isParallel()
True if this process is running in parallel.
static bool isSecondary()
True if this process is running a secondary rank.
static com::PtrCommunication & getCommunication()
Intra-participant communication.
static void reduceSum(precice::span< const double > sendData, precice::span< double > rcvData)
boost::test_tools::predicate_result equals(const std::vector< float > &VectorA, const std::vector< float > &VectorB, float tolerance)
equals to be used in tests. Compares two std::vectors using a given tolerance. Prints both operands o...
Main namespace of the precice library.