@@ -60,6 +60,7 @@ class H2Test: public CxxTest::TestSuite {
60
60
ABORIA_VARIABLE (target_h2,double ," target h2" );
61
61
62
62
public:
63
+ #ifdef HAVE_EIGEN
63
64
template <unsigned int N, typename ParticlesType, typename KernelFunction>
64
65
void helper_fast_methods_calculate (ParticlesType& particles, const KernelFunction& kernel, const double scale) {
65
66
typedef typename ParticlesType::position position;
@@ -105,13 +106,9 @@ class H2Test: public CxxTest::TestSuite {
105
106
typedef Eigen::Map<Eigen::Matrix<double ,Eigen::Dynamic,1 >> map_type;
106
107
map_type target_eigen (get<target_h2>(particles).data (),particles.size ());
107
108
map_type source_eigen (get<source>(particles).data (),particles.size ());
108
- typedef Eigen::Matrix<double ,Eigen::Dynamic,1 > vector_type;
109
- vector_type target_eigen_v (particles.size ());
110
- vector_type source_eigen_v (particles.size ());
111
- source_eigen_v = source_eigen;
112
109
113
110
t0 = Clock::now ();
114
- target_eigen_v = h2_eigen*source_eigen_v ;
111
+ target_eigen = h2_eigen*source_eigen ;
115
112
t1 = Clock::now ();
116
113
time_h2_eval = t1 - t0;
117
114
@@ -124,7 +121,7 @@ class H2Test: public CxxTest::TestSuite {
124
121
);
125
122
126
123
std::cout << " for h2 operator:" <<std::endl;
127
- std::cout << " dimension = " <<dimension<<" . N = " <<N<<" . L2_h2 error = " <<L2_h2<<" . L2_fmm relative error is " <<std::sqrt (L2_h2/scale)<<" . time_h2_setup = " <<time_h2_setup.count ()<<" . time_h2_eval = " <<time_h2_eval.count ()<<std::endl;
124
+ std::cout << " dimension = " <<dimension<<" . N = " <<N<<" . L2_h2 error = " <<L2_h2<<" . L2_h2 relative error is " <<std::sqrt (L2_h2/scale)<<" . time_h2_setup = " <<time_h2_setup.count ()<<" . time_h2_eval = " <<time_h2_eval.count ()<<std::endl;
128
125
129
126
if (N == 3 ) {
130
127
TS_ASSERT_LESS_THAN (L2_h2/scale,1e-2 );
@@ -134,7 +131,6 @@ class H2Test: public CxxTest::TestSuite {
134
131
135
132
template <unsigned int D, template <typename ,typename > class StorageVector ,template <typename > class SearchMethod >
136
133
void helper_fast_methods (size_t N) {
137
- #ifdef HAVE_EIGEN
138
134
typedef Vector<double ,D> double_d;
139
135
typedef Vector<int ,D> int_d;
140
136
typedef Vector<bool ,D> bool_d;
@@ -207,12 +203,10 @@ class H2Test: public CxxTest::TestSuite {
207
203
helper_fast_methods_calculate<1 >(particles,kernel,scale);
208
204
helper_fast_methods_calculate<2 >(particles,kernel,scale);
209
205
helper_fast_methods_calculate<3 >(particles,kernel,scale);
210
- #endif
211
206
}
212
207
213
208
template <typename Expansions>
214
209
void helper_fmm_matrix_operators (Expansions& expansions) {
215
- #ifdef HAVE_EIGEN
216
210
const unsigned int D = Expansions::dimension;
217
211
typedef Vector<double ,D> double_d;
218
212
typedef Vector<int ,D> int_d;
@@ -359,8 +353,8 @@ class H2Test: public CxxTest::TestSuite {
359
353
scale += std::pow (field_all_leaf1[i],2 );
360
354
}
361
355
TS_ASSERT_LESS_THAN (std::sqrt (L2/scale),1e-4 );
362
- #endif
363
356
}
357
+ #endif
364
358
365
359
void test_fmm_matrix_operators () {
366
360
#ifdef HAVE_EIGEN
@@ -376,67 +370,50 @@ class H2Test: public CxxTest::TestSuite {
376
370
377
371
378
372
void test_fast_methods_bucket_search_serial (void ) {
373
+ #ifdef HAVE_EIGEN
379
374
const size_t N = 10000 ;
380
- #ifdef HAVE_GPERFTOOLS
381
- ProfilerStart (" h2_bucket_search_serial" );
382
- #endif
383
375
std::cout << " BUCKET_SEARCH_SERIAL: testing 1D..." << std::endl;
384
376
helper_fast_methods<1 ,std::vector,bucket_search_serial>(N);
385
377
std::cout << " BUCKET_SEARCH_SERIAL: testing 2D..." << std::endl;
386
378
helper_fast_methods<2 ,std::vector,bucket_search_serial>(N);
387
379
std::cout << " BUCKET_SEARCH_SERIAL: testing 3D..." << std::endl;
388
380
helper_fast_methods<3 ,std::vector,bucket_search_serial>(N);
389
- #ifdef HAVE_GPERFTOOLS
390
- ProfilerStop ();
391
381
#endif
392
-
393
382
}
394
383
395
384
void test_fast_methods_bucket_search_parallel (void ) {
385
+ #ifdef HAVE_EIGEN
396
386
const size_t N = 10000 ;
397
- #ifdef HAVE_GPERFTOOLS
398
- ProfilerStart (" h2_bucket_search_parallel" );
399
- #endif
400
387
std::cout << " BUCKET_SEARCH_PARALLEL: testing 1D..." << std::endl;
401
388
helper_fast_methods<1 ,std::vector,bucket_search_parallel>(N);
402
389
std::cout << " BUCKET_SEARCH_PARALLEL: testing 2D..." << std::endl;
403
390
helper_fast_methods<2 ,std::vector,bucket_search_parallel>(N);
404
391
std::cout << " BUCKET_SEARCH_PARALLEL: testing 3D..." << std::endl;
405
392
helper_fast_methods<3 ,std::vector,bucket_search_parallel>(N);
406
- #ifdef HAVE_GPERFTOOLS
407
- ProfilerStop ();
408
393
#endif
409
394
}
410
395
411
396
void test_fast_methods_kd_tree (void ) {
397
+ #ifdef HAVE_EIGEN
412
398
const size_t N = 10000 ;
413
- #ifdef HAVE_GPERFTOOLS
414
- ProfilerStart (" h2_kd_tree" );
415
- #endif
416
399
std::cout << " KD_TREE: testing 1D..." << std::endl;
417
400
helper_fast_methods<1 ,std::vector,nanoflann_adaptor>(N);
418
401
std::cout << " KD_TREE: testing 2D..." << std::endl;
419
402
helper_fast_methods<2 ,std::vector,nanoflann_adaptor>(N);
420
403
std::cout << " KD_TREE: testing 3D..." << std::endl;
421
404
helper_fast_methods<3 ,std::vector,nanoflann_adaptor>(N);
422
- #ifdef HAVE_GPERFTOOLS
423
- ProfilerStop ();
424
405
#endif
425
406
}
426
407
427
408
void test_fast_methods_octtree (void ) {
409
+ #ifdef HAVE_EIGEN
428
410
const size_t N = 10000 ;
429
- #ifdef HAVE_GPERFTOOLS
430
- ProfilerStart (" h2_octtree" );
431
- #endif
432
411
std::cout << " OCTTREE: testing 1D..." << std::endl;
433
412
helper_fast_methods<1 ,std::vector,octtree>(N);
434
413
std::cout << " OCTTREE: testing 2D..." << std::endl;
435
414
helper_fast_methods<2 ,std::vector,octtree>(N);
436
415
std::cout << " OCTTREE: testing 3D..." << std::endl;
437
416
helper_fast_methods<3 ,std::vector,octtree>(N);
438
- #ifdef HAVE_GPERFTOOLS
439
- ProfilerStop ();
440
417
#endif
441
418
}
442
419
0 commit comments