ALL 0.9.3
A Loadbalacing Library
Loading...
Searching...
No Matches
all_class_creation.cpp
Go to the documentation of this file.
1/*
2Copyright 2018-2020 Rene Halver, Forschungszentrum Juelich GmbH, Germany
3Copyright 2018-2020 Godehard Sutmann, Forschungszentrum Juelich GmbH, Germany
4
5Redistribution and use in source and binary forms, with or without modification,
6are permitted provided that the following conditions are met:
7
81. Redistributions of source code must retain the above copyright notice, this
9 list of conditions and the following disclaimer.
10
112. Redistributions in binary form must reproduce the above copyright notice,
12this list of conditions and the following disclaimer in the documentation and/or
13 other materials provided with the distribution.
14
153. Neither the name of the copyright holder nor the names of its contributors
16may be used to endorse or promote products derived from this software without
17 specific prior written permission.
18
19THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
23ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
26ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29*/
30
31#define BOOST_TEST_MAIN
32
33#define BOOST_TEST_MODULE all_class_creation
34#include "ALL.hpp"
35#include "ALL_Point.hpp"
37#include <boost/test/unit_test.hpp>
38#include <list>
39#include <mpi.h>
40#include <vector>
41
42BOOST_AUTO_TEST_SUITE(all_class_creation)
43
45 int already_init;
46 MPI_Initialized(&already_init);
47 if (!already_init)
48 MPI_Init(NULL, NULL);
49
51
52 int already_final;
53 MPI_Finalized(&already_final);
54 if (!already_final)
55 MPI_Finalize();
56}
57
59 int already_init;
60 MPI_Initialized(&already_init);
61 if (!already_init)
62 MPI_Init(NULL, NULL);
63
64 ALL::LB_t method = ALL::TENSOR;
65 int dimension = 3;
66 double gamma = 4.0;
67
68 ALL::ALL<double, double> test(method, dimension, gamma);
69
70 // comment(s.schulz): What is supposed to be checked here?
71 // Just the calling? Then we should make sure to also access the result
72 double check_dim = test.getDimension();
73 double check_gamma = test.getGamma();
74
75 // comment(s.schulz): Not sure if there is a better way than assert in the boost framework
76 assert(check_dim == dimension);
77 assert(check_gamma == gamma);
78
79 int already_final;
80 MPI_Finalized(&already_final);
81 if (!already_final)
82 MPI_Finalize();
83}
84
85// comment (r.halver): check if the constructor fails when using a dimension not equal to 3
86// !to be changed, when the library can deal with dimensions not equal to 3!
88{
89 int already_init;
90 MPI_Initialized(&already_init);
91 if (!already_init)
92 MPI_Init(NULL,NULL);
93
94 ALL::LB_t method = ALL::TENSOR;
95 int dimension = 2;
96 double gamma = 4.0;
97
98 bool success = false;
99 try
100 {
101 ALL::ALL<double, double> test(method, dimension, gamma);
102 }
104 {
105 success = true;
106 }
107 BOOST_TEST(success);
108}
109
110BOOST_AUTO_TEST_SUITE_END()
BOOST_AUTO_TEST_CASE(empty)
T getGamma()
Definition ALL.hpp:273
int getDimension()
Definition ALL.hpp:428
LB_t
enum type to describe the different balancing methods
Definition ALL.hpp:80
@ TENSOR
tensor based load balancing
Definition ALL.hpp:84