19int main(
int argc,
char *argv[]) {
24 util::io::print(fmt::format(
"Initialized MPI. MPI size = {}, MPI rank = {}\n", mpiSize, mpiRank));
33 <<
") -i <num-points> -o <select-test; 0 - test with different lattice, 1 - profile nanoflann, 2 - test closest point search>" << std::endl;
42 std::cout <<
"Running test with default num-points = " << N <<
"\n";
49 std::cout <<
"Running test with default test selection = " << testSelect <<
"\n";
52 std::vector<int> leafMaxSizes = {2, 5, 8, 10, 12, 15, 20};
53 std::vector<double> L_test = {1., 0.01};
54 std::vector<double> dL_test = {0.2, 0.5};
55 std::vector<int> seeds = {1093};
56 std::vector<int> N_test = {N};
57 std::vector<int> dims{2, 3};
58 std::vector<int> numTags{4, 8, 12};
62 if (testSelect == 0) {
64 std::cout <<
"\n\nTesting Exclude and Include tag for different lattice sizes\n\n";
66 for (
auto L: L_test) {
67 for (
auto dL: dL_test) {
68 for (
auto seed: seeds) {
69 for (
auto n: N_test) {
70 for (
auto dim: dims) {
78 std::cout <<
"\n**** Test number = " << test_count++ <<
" ****\n";
79 std::cout << fmt::format(
"Test parameters: L = {}, lattice "
80 "perturbation = {}, seed = {}, "
81 "N = {}, leafMaxSize = {}, num_tags = {}, "
89 msg = test::testNanoflannExcludeInclude<2>(n, L, dL * L, seed,
92 msg = test::testNanoflannExcludeInclude<3>(n, L, dL * L, seed,
103 else if (testSelect == 1) {
106 <<
"\n\nTesting Exclude and Include tag type neighbor search for different leaf sizes and number of tags\n\n";
109 std::vector<std::vector<std::vector<test::testNSearchData> > > data_set(
110 leafMaxSizes.size());
112 for (
size_t i = 0; i < leafMaxSizes.size(); i++) {
114 data_set[i].resize(numTags.size());
116 for (
size_t j = 0; j < numTags.size(); j++) {
118 data_set[i][j].resize(dims.size());
120 for (
size_t k = 0; k < dims.size(); k++) {
123 auto dL = dL_test[0];
124 auto seed = seeds[0];
129 data.
d_dim = dims[k];
133 std::cout <<
"\n**** Test number = " << test_count++ <<
" ****\n";
134 std::cout << fmt::format(
"Test parameters: L = {}, lattice "
135 "perturbation = {}, seed = {}, "
136 "N = {}, leafMaxSize = {}, num_tags = {}, "
144 msg = test::testNanoflannExcludeInclude<2>(n, L, dL * L, seed,
146 else if (data.
d_dim == 3)
147 msg = test::testNanoflannExcludeInclude<3>(n, L, dL * L, seed,
152 data_set[i][j][k] = data;
157 std::cout <<
"\n\nSummarize results of test 2\n\n";
158 for (
size_t k = 0; k < dims.size(); k++) {
159 std::cout <<
"Dim = " << dims[k] <<
"\n";
160 for (
size_t j = 0; j < numTags.size(); j++) {
161 std::cout << fmt::format(
" numTag = {:2d}\n", numTags[j]);
162 for (
size_t i = 0; i < leafMaxSizes.size(); i++) {
163 const auto &data = data_set[i][j][k];
164 std::cout << fmt::format(
165 " leafMaxSize = {:2d}, numPoints = {:8d}, bld_time = {:8d}\n"
166 " (brute-search) def_time = {:8d}, exc_time = {:8d}, inc_time = {:8d}\n"
167 " (nflan-search) def_time = {:8d}, exc_time = {:8d}, inc_time = {:8d}\n",
170 int(data.d_treeBuildTime),
171 int(data.d_defaultBruteSearchTime),
172 int(data.d_excludeBruteSearchTime),
173 int(data.d_includeBruteSearchTime),
174 int(data.d_defaultNFlannSearchTime),
175 int(data.d_excludeNFlannSearchTime),
176 int(data.d_includeNFlannSearchTime));
181 else if (testSelect == 2) {
183 std::cout <<
"\n\nTesting closest point search for different lattice sizes\n\n";
187 for (
auto L: L_test) {
188 for (
auto dL: dL_test) {
189 for (
auto seed: seeds) {
190 for (
auto n: N_test) {
198 std::cout <<
"\n**** Test number = " << test_count++ <<
" ****\n";
199 std::cout << fmt::format(
"Test parameters: L = {}, lattice "
200 "perturbation = {}, seed = {}, "
201 "N = {}, leafMaxSize = {}, num_tags = {}"