summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2016-01-12 16:54:37 +0000
committervrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2016-01-12 16:54:37 +0000
commitd944e35af84a59c9dc88f7027b04c9528cc1bf9b (patch)
tree449420f406a63fc0df73fcfd4201e35f98678407
parent178f37684b9f3bebf95534568b5ef54c15e11c63 (diff)
parent9aa92aa2b504d9530125a6a164f76c11f45d8bb5 (diff)
Backmerge of last trunk modifications
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/alphashapes@959 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: a5c6ef0ae2ee1e18fff88b98131ff4d14a252152
-rw-r--r--CMakeLists.txt4
-rw-r--r--data/points/tore3D_1307.txt1307
-rw-r--r--src/CMakeLists.txt4
-rw-r--r--src/GudhUI/utils/K_nearest_builder.h10
-rw-r--r--src/Hasse_complex/include/gudhi/Hasse_complex.h44
-rw-r--r--src/Persistent_cohomology/concept/FilteredComplex.h6
-rw-r--r--src/Persistent_cohomology/example/CMakeLists.txt7
-rw-r--r--src/Persistent_cohomology/example/alpha_shapes_persistence.cpp7
-rw-r--r--src/Persistent_cohomology/example/parallel_rips_persistence.cpp180
-rw-r--r--src/Persistent_cohomology/example/performance_rips_persistence.cpp2
-rw-r--r--src/Persistent_cohomology/example/persistence_from_file.cpp2
-rw-r--r--src/Persistent_cohomology/example/rips_multifield_persistence.cpp5
-rw-r--r--src/Persistent_cohomology/example/rips_persistence.cpp5
-rw-r--r--src/Persistent_cohomology/include/gudhi/Persistent_cohomology.h3
-rw-r--r--src/Persistent_cohomology/include/gudhi/Persistent_cohomology/Persistent_cohomology_column.h1
-rw-r--r--src/Simplex_tree/concept/SimplexTreeOptions.h2
-rw-r--r--src/Simplex_tree/example/simplex_tree_from_alpha_shapes_3.cpp5
-rw-r--r--src/Simplex_tree/include/gudhi/Simplex_tree.h64
-rw-r--r--src/Simplex_tree/include/gudhi/Simplex_tree/Simplex_tree_iterators.h81
-rw-r--r--src/Simplex_tree/include/gudhi/Simplex_tree/Simplex_tree_siblings.h2
-rw-r--r--src/Simplex_tree/test/simplex_tree_unit_test.cpp167
-rw-r--r--src/cmake/modules/FindTBB.cmake433
-rw-r--r--src/cmake/modules/UseTBB.cmake6
-rw-r--r--src/common/include/gudhi/allocator.h55
24 files changed, 2264 insertions, 138 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 54e86f72..93e72dd2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -38,6 +38,10 @@ endif()
find_package(CGAL)
+# Find TBB package for parallel sort - not mandatory, just optional.
+set(TBB_FIND_QUIETLY ON)
+find_package(TBB)
+
# Required programs for unitary tests purpose
FIND_PROGRAM( GCOVR_PATH gcovr )
if (GCOVR_PATH)
diff --git a/data/points/tore3D_1307.txt b/data/points/tore3D_1307.txt
new file mode 100644
index 00000000..7a1b9e60
--- /dev/null
+++ b/data/points/tore3D_1307.txt
@@ -0,0 +1,1307 @@
+-1.081352 -0.451815 0.237511
+-1.062873 -0.492063 -0.246058
+-0.490280 -0.890039 0.299674
+-1.094597 -0.620156 0.153419
+-0.517128 -1.189962 -0.039580
+1.152877 0.300175 -0.231559
+0.502337 1.174528 0.114471
+-0.299269 -1.235308 -0.128350
+0.559591 1.172809 -0.019004
+0.184193 -0.676264 -0.024016
+-0.888412 0.748820 -0.252659
+-0.859062 -0.581840 0.297612
+0.293395 -1.216582 -0.163670
+0.393949 -1.126922 -0.228892
+0.441284 -1.075139 -0.252409
+-0.658443 0.286084 0.102036
+-0.770782 -0.787327 -0.282279
+-0.406644 1.191333 -0.151820
+0.421148 0.751386 0.266188
+-0.337991 -1.233999 0.109125
+-0.576506 0.405645 -0.054051
+0.359474 0.613240 0.079974
+-0.455484 -0.568690 -0.127880
+0.702136 -0.235409 -0.150928
+0.091056 -0.696011 0.037399
+-0.064213 -1.043207 -0.296606
+-0.066480 -0.708601 -0.083866
+-0.866010 -0.584473 -0.296793
+0.476020 0.521113 0.058829
+0.470937 0.518518 -0.020041
+0.436955 0.578033 0.118941
+0.510216 0.479447 0.010043
+0.552069 0.434267 -0.037525
+0.570514 0.483559 0.162698
+0.520778 0.488742 0.091457
+0.007764 -1.064538 0.292870
+-0.050586 -1.121647 0.273674
+0.055839 -1.248122 0.166563
+-0.032797 -1.208186 0.215517
+-0.111026 -1.277187 0.102083
+-0.108199 -1.228175 0.189078
+-0.130166 -1.089441 0.283875
+-0.152281 -0.988000 0.299890
+-0.257364 -1.167207 0.227592
+-0.171612 -1.165220 0.241502
+-1.162998 0.381345 -0.199780
+-1.118806 0.446593 -0.219113
+-0.969520 0.369639 -0.297369
+-1.015149 0.442441 -0.279944
+-0.945706 0.502039 -0.291395
+-0.907852 0.668109 -0.271495
+-0.989109 0.583976 -0.260348
+-1.151615 0.505514 -0.153644
+-1.207510 0.471993 -0.044521
+-1.104315 0.650680 -0.102654
+-1.092710 0.584417 -0.180772
+-0.520165 0.523045 0.145339
+-0.908993 0.242970 0.293971
+-0.810558 0.265720 0.261300
+-0.897194 0.450947 0.299838
+-0.801677 0.368615 0.275680
+-0.618631 0.339910 -0.058175
+-0.745800 0.194272 0.193649
+-0.764778 0.089444 0.192796
+-0.677218 0.179465 -0.017122
+-0.951381 0.107469 -0.296882
+-1.044006 0.122763 -0.295486
+-1.130206 0.327437 -0.242377
+-1.039272 0.319024 -0.286828
+-1.006740 0.250370 -0.297517
+-1.074288 0.196042 -0.285418
+-1.179201 0.271080 -0.214486
+-1.159801 0.205309 -0.241580
+-1.262356 0.149537 -0.128957
+-1.209803 0.141532 -0.206239
+-1.103598 0.056448 -0.281019
+-1.069017 -0.026030 -0.291850
+-1.230492 -0.003439 -0.192273
+-1.186921 0.066026 -0.233374
+-1.239215 0.383964 -0.040221
+-1.221544 0.353027 -0.127998
+-1.231122 0.282629 -0.144722
+-1.265581 0.224586 -0.093610
+-1.278661 0.235723 -0.002121
+-1.258566 0.316739 0.036060
+-1.142814 0.618337 0.016377
+-1.186973 0.519848 0.048538
+-1.002081 0.324515 0.294944
+-0.998092 0.428671 0.287072
+-1.081725 0.504658 0.228721
+-1.161877 0.464839 0.162892
+-1.228669 0.307236 0.137309
+-1.223687 0.221595 0.175255
+-1.094190 0.299505 0.267834
+-1.172804 0.362343 0.194898
+-1.287785 0.080944 -0.076717
+-1.278902 0.004250 -0.110779
+-1.296965 0.086769 0.015989
+-1.290442 0.014796 0.076047
+-1.257240 0.161846 0.135908
+-1.285433 0.163110 0.051651
+-0.886853 0.152690 -0.282767
+-0.904457 0.223940 -0.291991
+-0.853657 0.340015 -0.288701
+-0.662561 0.323217 -0.144815
+-0.688153 0.235729 -0.124945
+-0.746102 0.209917 -0.198615
+-0.825513 0.260841 -0.268220
+-0.814460 0.106161 -0.241124
+-0.751881 0.125125 -0.182955
+-0.694463 0.087754 -0.002227
+-0.718096 0.030274 0.104055
+-0.725588 -0.037936 -0.124016
+-0.715162 0.057103 -0.100962
+-0.589244 0.833226 -0.299481
+-0.698686 0.797210 -0.293987
+-0.724145 0.963727 -0.218762
+-0.772661 0.863564 -0.254443
+-0.952389 0.746095 -0.214405
+-1.037783 0.734366 -0.127409
+-0.906947 0.888998 -0.130794
+-0.879694 0.826349 -0.216987
+-0.708976 0.691352 -0.299681
+-0.795825 0.632666 -0.299354
+-1.094557 0.205733 0.277474
+-1.166956 0.180982 0.239452
+-1.235100 0.093251 0.182145
+-1.252852 0.020112 0.161546
+-1.122616 0.045423 0.273322
+-1.176019 0.104304 0.239683
+-0.831534 0.028847 -0.248610
+-0.784800 -0.051320 -0.210683
+-0.970175 -0.039735 -0.298404
+-0.915801 0.031759 -0.287960
+-1.017315 0.133847 0.298781
+-1.040809 0.053958 0.296991
+-0.850253 0.061846 0.261250
+-0.922621 0.144598 0.292551
+-1.205576 -0.083392 -0.215756
+-1.127676 -0.097664 -0.269488
+-1.218875 -0.228370 -0.179640
+-1.241479 -0.151333 -0.164511
+-1.281008 -0.141697 -0.081100
+-1.282725 -0.207501 -0.019002
+-1.295404 -0.061623 0.045226
+-1.294057 -0.065990 -0.051164
+-1.266583 -0.280977 -0.040054
+-1.240056 -0.292948 -0.121946
+-1.272968 -0.133906 0.108272
+-1.274739 -0.205619 0.072097
+-1.254749 -0.331515 0.036391
+-1.230958 -0.414312 0.026169
+-1.188467 -0.290913 0.199876
+-1.247215 -0.280317 0.111825
+-0.714306 -0.076055 0.102946
+-0.722893 -0.247937 0.185450
+-0.755066 -0.146639 0.191478
+-0.892565 -0.032108 0.280205
+-0.993747 -0.023773 0.299917
+-0.848739 -0.126278 0.264223
+-1.137674 -0.030533 0.266157
+-1.209182 -0.047928 0.214183
+-1.221441 -0.129173 0.194550
+-1.160987 -0.202671 0.240867
+-1.069850 -0.172552 0.288004
+-1.063790 -0.080596 0.292372
+-1.158039 -0.249717 -0.236406
+-1.100040 -0.186683 -0.276695
+-1.150286 -0.337789 -0.224600
+-1.074319 -0.379918 -0.265438
+-1.211559 -0.436746 -0.083952
+-1.207229 -0.363808 -0.148360
+-0.931978 -0.130288 -0.293972
+-0.829416 -0.140227 -0.254308
+-0.987281 -0.311755 -0.297765
+-1.005930 -0.209775 -0.298601
+-0.521727 0.765192 -0.290775
+-1.148019 -0.386210 0.212818
+-1.190078 -0.459193 0.118044
+-1.158436 -0.559820 0.087646
+-1.167821 -0.516767 -0.114878
+-1.096278 -0.674600 -0.086267
+-1.155066 -0.591214 -0.036592
+-0.771608 1.005459 -0.135935
+-0.852825 0.959308 -0.097955
+-0.814246 1.007568 0.052984
+-0.869887 0.966193 -0.005886
+-0.965682 0.863491 -0.052417
+-1.028122 0.791500 -0.038978
+-0.927269 0.875414 0.119585
+-0.930881 0.906369 0.024163
+-0.566961 0.990224 0.264677
+-0.534303 1.091724 0.208631
+-0.718230 1.074222 -0.067833
+-0.745807 1.063247 0.028303
+-0.691291 1.076225 0.109998
+-0.602869 1.125480 0.115647
+-0.618246 1.129229 -0.085232
+-0.561684 1.171822 0.013519
+-0.450125 1.218907 0.016890
+-0.427083 1.134526 0.212045
+-0.271294 1.244331 0.122793
+-0.387285 1.213311 0.122658
+-1.094776 0.667045 0.101590
+-1.058368 0.607909 0.203007
+-0.978607 0.795203 0.147752
+-1.045755 0.757303 0.071993
+-0.801245 0.978278 0.141861
+-0.848741 0.906595 0.177594
+-0.668853 0.960921 0.246697
+-0.722169 1.011591 0.176481
+-0.480102 0.515515 0.050987
+-0.713545 -0.254054 -0.176596
+-0.686648 -0.346332 -0.191457
+-0.878900 -0.326981 -0.293245
+-0.797228 -0.236768 -0.248167
+-0.935677 0.734226 0.232423
+-0.967497 0.636933 0.254631
+-0.888477 0.555640 0.296089
+-0.791078 0.572816 0.298952
+-0.705808 0.865927 0.276371
+-0.802219 0.847107 0.249569
+-0.839916 0.754886 0.270695
+-0.771240 0.672138 0.299109
+-0.613878 0.599194 0.264134
+-0.530763 0.595344 0.221167
+-0.640168 0.780483 0.299749
+-0.673841 0.682444 0.297213
+-1.049085 -0.401913 0.273442
+-1.018454 -0.506904 0.266417
+-0.767742 -0.615905 0.299286
+-0.927725 -0.790117 0.205312
+-0.963772 -0.701033 0.230404
+-0.397985 0.701026 -0.229017
+-0.429407 0.774740 -0.277375
+-0.243658 0.752702 -0.215316
+-0.314726 0.693460 -0.182081
+-0.309573 0.643825 -0.091955
+-0.232485 0.661107 -0.021837
+-0.406312 0.572607 0.034624
+-0.391149 0.590737 -0.071491
+-0.551266 -0.809351 0.299338
+-0.687239 -0.975305 0.229314
+-0.536247 0.795816 0.297073
+-0.376939 0.918504 0.299808
+-0.494239 0.903007 0.298412
+-0.347646 0.634621 0.116610
+-0.251386 0.667185 0.087247
+-0.585533 -0.668753 0.278789
+-0.515444 -0.720691 0.277880
+-0.584628 -0.577694 0.241249
+-0.675393 -0.440771 0.228850
+-0.671482 -0.539889 0.265697
+-0.853291 -0.420036 -0.295950
+-0.751319 -0.421284 -0.266151
+-0.730875 -0.506183 -0.278896
+-0.790705 -0.568691 -0.299425
+-1.040254 -0.658033 -0.191569
+-0.916951 -0.512416 -0.295830
+-0.810410 -0.638033 -0.298556
+-0.748693 -0.696571 -0.299261
+-0.953502 -0.699942 -0.237685
+-0.889123 -0.651913 -0.282308
+0.962416 0.841972 -0.111265
+0.913452 0.821515 -0.194271
+0.810323 0.959205 -0.157265
+0.825787 0.882616 -0.215781
+0.654429 0.921109 -0.270355
+0.740022 0.854310 -0.270155
+0.617250 0.707515 -0.293668
+0.729631 0.755312 -0.295664
+0.929579 0.731572 -0.237493
+1.025178 0.659435 -0.204964
+0.815022 0.609543 -0.299435
+0.829173 0.699676 -0.287674
+-0.954822 -0.852912 0.106773
+-0.920233 -0.786312 -0.213849
+-0.888107 -0.920442 -0.110019
+-0.950851 -0.845548 -0.125402
+-0.204577 1.197671 0.209135
+-0.047190 1.054470 0.294865
+-0.140538 0.995875 0.299919
+-0.183526 0.717846 0.151647
+-0.028992 0.841029 0.254906
+-0.131597 0.885679 0.281198
+-0.893964 -0.927064 0.084480
+-0.872584 -0.962902 -0.015965
+-0.757646 -1.003637 0.153780
+-0.825670 -0.941871 0.162142
+-0.562879 1.104166 -0.180672
+-0.545627 0.937180 -0.287941
+-0.612412 1.007909 -0.240620
+-0.617710 -0.377137 -0.116819
+-0.280120 -0.643123 0.027697
+-0.362574 -0.598874 0.004105
+-0.641128 -0.520733 -0.244197
+-0.583385 -0.459863 -0.154090
+-0.508969 -0.499792 -0.087955
+-0.217732 1.280782 0.020568
+-0.044103 1.290446 -0.071942
+-0.103040 1.295146 0.019918
+-0.092171 1.215808 0.204421
+-0.026018 1.151911 0.258433
+0.071646 1.277176 0.109400
+-0.042088 1.275636 0.116383
+-0.428680 0.956160 -0.296166
+-0.365528 1.061240 -0.273915
+-0.271612 0.843132 -0.277322
+-0.375317 0.857960 -0.293228
+-0.200079 0.918983 -0.294116
+-0.178178 1.215719 -0.194119
+-0.075228 1.249002 -0.163810
+-0.051371 1.064720 -0.292426
+-0.749268 -1.055549 0.055744
+-0.800770 -1.021747 -0.030796
+-0.810673 -0.939807 -0.178594
+-0.676875 -1.042950 -0.174886
+-0.764002 -1.010285 -0.137011
+-0.607360 -0.978326 -0.258591
+-0.639279 -0.869686 -0.289246
+-0.099286 0.882593 -0.278219
+-0.026016 0.952109 -0.296002
+-0.075059 0.785864 -0.213491
+0.022346 0.754006 -0.172106
+-0.147283 0.691698 -0.065795
+-0.152610 0.736776 -0.169325
+-0.378927 -1.218959 -0.116129
+-0.460774 -1.212046 -0.046903
+-0.673535 -1.110549 0.021351
+-0.641230 -1.110616 -0.100066
+-0.552196 -1.145175 -0.127541
+-0.478087 -1.206587 0.038229
+-0.426464 -1.201374 0.120116
+-0.602509 -1.137404 0.087065
+-0.542556 -1.180242 0.029905
+-0.562520 -1.097531 0.188483
+-0.460930 -1.132398 0.201171
+-0.595745 -1.009843 0.245200
+0.018426 -0.699933 0.003927
+-0.220857 -0.669403 -0.053967
+-0.136855 -0.687966 -0.029266
+-0.039762 -0.737462 -0.147506
+0.013375 -0.765153 -0.187063
+-0.161318 -0.763629 -0.204449
+-0.102092 -0.735829 -0.155003
+-0.501991 -1.011704 -0.270374
+-0.385708 -1.151435 -0.209805
+-0.481519 -1.109550 -0.214688
+-0.084473 -0.912505 0.287939
+-0.009384 -0.954155 0.296280
+-0.235834 -0.958771 0.299674
+-0.264772 -0.680387 0.130846
+-0.343569 -0.823271 0.280057
+-0.251071 -0.852290 0.278391
+-0.090018 -0.814576 0.239527
+-0.013113 -0.763248 0.184274
+-0.028831 -0.712816 0.088689
+-0.115013 -0.698739 0.069244
+-0.182891 -0.715992 0.147883
+-0.173557 -0.786385 0.228326
+-0.299909 -1.096421 -0.266587
+-0.140175 -1.059353 -0.292189
+-0.198818 -1.124595 -0.263882
+-0.182305 -1.281469 0.057550
+-0.312375 -1.255560 -0.061168
+-0.156831 -1.204198 -0.209697
+-0.040651 -1.198621 -0.224542
+-0.154841 -1.287160 -0.046290
+-0.219968 -1.256120 -0.119186
+-0.065222 0.696920 -0.002844
+0.026516 0.706518 -0.064130
+-0.007319 0.755929 0.174347
+-0.083290 0.717101 0.112792
+0.027699 1.128169 -0.270914
+0.014769 1.214505 -0.209679
+0.061354 1.289607 -0.072153
+0.123107 1.293828 0.011937
+0.194987 1.222109 -0.182960
+0.095568 1.249916 -0.160038
+0.005081 -1.109260 -0.279505
+-0.126805 -0.982559 -0.299961
+-0.185024 -0.908465 -0.290877
+-0.134344 -0.830990 -0.254870
+-0.030626 -0.832050 -0.249210
+0.009648 -0.910269 -0.286484
+-0.050433 -0.969471 -0.298845
+0.041177 1.007630 0.300057
+0.054442 0.902242 0.284235
+0.113508 1.077381 0.288041
+0.208155 1.053604 0.290424
+0.129841 1.227050 0.187522
+0.075815 1.162148 0.250734
+0.240147 1.215023 0.181620
+0.279879 1.132062 0.249544
+0.457600 1.159578 0.170861
+0.382487 1.106421 0.246255
+0.483023 0.975561 0.286352
+0.398800 1.001107 0.289444
+0.230786 0.939193 0.298007
+0.153231 0.861608 0.272702
+0.326097 0.914284 0.298337
+0.300457 1.251699 0.085600
+0.426068 1.218448 0.073121
+0.274212 1.248636 -0.111198
+0.236083 1.278119 -0.004401
+-0.058656 -1.291853 -0.064397
+0.007691 -1.257719 -0.154006
+0.059179 -1.292552 0.059443
+-0.033167 -1.297935 0.031239
+0.524254 -1.172829 -0.093831
+0.680024 -1.036405 -0.180477
+0.588607 -1.019811 -0.241688
+0.688092 -0.861809 -0.281993
+0.588081 -0.921022 -0.285347
+0.545699 -0.717525 -0.283527
+0.104077 -1.060046 -0.293005
+0.103169 -0.939224 -0.294890
+0.190046 -0.865922 -0.277689
+0.358496 -1.182321 -0.186063
+0.195163 -1.103773 -0.274883
+0.139164 -1.291090 -0.027577
+0.114294 -1.259480 -0.141230
+0.201509 -1.200514 -0.206958
+0.365868 -1.225732 -0.110196
+0.438981 -1.219682 -0.045834
+0.240009 -1.277322 -0.010875
+0.293495 -1.253573 -0.086921
+0.275945 -0.973380 0.299654
+0.057305 -0.799652 0.224755
+0.052788 -0.894999 0.281478
+0.122150 -0.936773 0.294861
+0.128478 1.083846 -0.285647
+0.211785 1.139038 -0.254607
+0.308977 0.989490 -0.297975
+0.307056 1.090644 -0.268967
+0.381529 1.208847 -0.134663
+0.472080 1.207292 -0.045157
+0.487524 1.067336 -0.244599
+0.395848 1.131245 -0.224775
+0.384004 0.927480 -0.300089
+0.476426 0.961494 -0.290944
+0.554536 0.885807 -0.296415
+0.528181 0.772403 -0.292877
+0.099619 0.801283 -0.229813
+0.072511 0.906825 -0.285850
+0.145019 0.974900 -0.299572
+0.234103 0.933480 -0.297689
+0.356271 0.829250 -0.283622
+0.423502 0.747092 -0.264788
+0.202947 0.768384 -0.218615
+0.262419 0.835079 -0.272805
+0.288495 -1.255384 0.083645
+0.402270 -1.228877 0.063658
+0.232743 -1.215498 0.182993
+0.284587 -1.141892 0.242286
+0.235422 -1.056762 0.288326
+0.148416 -1.038004 0.295980
+0.093182 -1.108653 0.277987
+0.127978 -1.204079 0.213226
+0.247820 0.694114 -0.144552
+0.279902 0.717162 0.192782
+0.175906 0.762650 0.206597
+0.096975 0.728765 0.141098
+0.554793 1.119556 0.166533
+0.557149 1.031838 0.245398
+0.707704 0.981963 0.214120
+0.621770 0.975174 0.255932
+0.499888 0.883087 0.299571
+0.633511 0.819251 0.297640
+0.585835 0.888221 0.292755
+0.382817 -1.129194 0.230101
+0.450111 -1.177304 0.148434
+0.554877 -1.062688 0.224601
+0.547087 -1.134743 0.149614
+0.616089 -1.141655 -0.038338
+0.690686 -1.084182 -0.091947
+0.713191 -1.060448 0.112490
+0.626418 -1.127788 0.075791
+0.622131 -1.005820 0.238017
+0.704955 -1.003844 0.196622
+0.372015 -0.868978 0.294789
+0.353677 -0.965625 0.298543
+0.409685 -1.040978 0.275379
+0.488880 -1.017382 0.270835
+0.592248 -0.930935 0.281773
+0.636318 -0.857503 0.292346
+0.454105 -0.849356 0.297671
+0.509796 -0.931635 0.293481
+0.100362 -0.733003 -0.149052
+0.106011 -0.694022 -0.035885
+0.186966 -0.762933 -0.209494
+0.264656 -0.648763 -0.020676
+0.171153 -0.682499 0.048323
+0.644979 1.109511 0.098613
+0.723575 1.042383 0.133371
+0.643327 1.129261 -0.012966
+0.731125 1.066529 -0.063191
+0.735769 1.021555 -0.151593
+0.661112 1.016580 -0.211551
+0.577174 1.089469 -0.188525
+0.569973 1.153206 -0.089037
+0.496925 0.607536 0.209207
+0.582530 0.553639 0.226988
+0.600442 0.730008 0.294883
+0.499216 0.692742 0.261996
+0.497070 -0.760675 0.285834
+0.595361 -0.774001 0.299140
+0.462269 -0.669636 0.235124
+0.543659 -0.590459 0.226011
+0.366772 -0.666334 0.180901
+0.462710 -0.543362 -0.089479
+0.541941 -0.471227 -0.103146
+0.518095 -0.634633 -0.239425
+0.443382 -0.612238 -0.173940
+0.770376 0.902477 0.234897
+0.728863 0.828294 0.281473
+0.682704 0.684132 0.298120
+0.677508 0.589203 0.282142
+0.867906 0.716179 0.272504
+0.765689 0.743942 0.292183
+0.791940 -1.024801 0.052917
+0.774972 -1.039592 -0.044206
+0.763018 -0.975194 -0.182386
+0.773694 -0.897213 -0.236617
+0.904634 -0.917168 -0.082862
+0.822859 -0.981979 -0.104505
+0.700611 -0.764893 -0.297920
+0.632368 -0.707732 -0.295909
+0.585191 -0.575751 -0.240822
+0.595841 -0.488753 -0.193600
+0.717391 -0.584984 -0.290581
+0.647996 -0.619303 -0.281588
+0.613023 0.606343 -0.266521
+0.711991 0.567597 -0.286250
+0.576003 0.461515 -0.146199
+0.542279 0.550486 -0.195749
+0.800811 1.023281 -0.019748
+0.804401 1.009700 0.073645
+0.920616 0.910473 -0.056411
+0.852528 0.967320 -0.079500
+0.646476 -0.611121 0.278777
+0.665480 -0.711019 0.298794
+0.726785 -0.852133 0.275179
+0.769212 -0.921322 0.223643
+0.854869 -0.722552 0.275257
+0.754953 -0.761594 0.291154
+0.929233 -0.848637 -0.152528
+0.859708 -0.837695 -0.223687
+0.784008 -0.718281 -0.293370
+0.783025 -0.630882 -0.299905
+0.926067 -0.692431 -0.256085
+0.860366 -0.753068 -0.263737
+0.863227 0.882869 0.186969
+0.925960 0.787953 0.208249
+0.939989 0.895718 0.032622
+0.876337 0.936474 0.101820
+0.872470 -0.946356 0.086184
+0.939219 -0.897996 0.014703
+0.921253 -0.791732 0.209547
+0.861473 -0.893730 0.178149
+1.011950 -0.754854 0.145024
+1.015580 -0.807465 0.037848
+0.742315 -0.551148 0.290009
+0.858941 -0.609519 0.294990
+0.934448 -0.430807 0.298546
+0.954522 -0.543808 0.283316
+1.154398 -0.594227 0.030710
+1.146413 -0.433385 0.197503
+1.161911 0.448906 0.172005
+0.882196 0.608502 0.291139
+0.774028 0.543762 0.294907
+0.958682 0.438441 0.295091
+0.976412 0.550518 0.274661
+1.029955 0.785386 -0.052364
+1.008879 0.815541 0.040295
+1.014120 0.759855 0.136049
+0.676848 -0.179346 -0.010685
+0.690110 -0.190866 -0.097051
+0.669004 -0.306090 -0.142069
+0.724850 -0.173534 -0.158843
+0.744120 -0.102561 -0.167415
+0.808341 -0.257098 -0.258833
+0.748255 -0.224531 -0.205765
+0.742118 0.090151 -0.161946
+0.676606 0.180382 0.011167
+0.655121 -0.254165 0.040569
+0.625228 -0.321331 -0.041687
+0.573020 -0.403162 -0.021541
+0.735876 -0.441472 0.264158
+0.831858 -0.387813 0.288421
+0.684045 -0.281952 0.149830
+0.660509 -0.387710 0.187547
+0.858557 0.392168 0.294688
+0.768042 0.439061 0.277044
+0.612020 0.413813 0.147531
+0.591019 0.379264 0.035168
+0.627978 0.309341 0.001827
+0.662612 0.251153 0.072768
+0.701323 0.280691 0.174432
+0.687070 0.380323 0.210031
+1.118092 -0.651290 -0.059560
+1.055819 -0.750298 -0.053264
+1.001667 -0.771773 -0.141811
+0.995520 -0.699458 -0.207720
+1.108977 -0.585948 -0.159087
+1.038365 -0.615304 -0.217255
+0.917814 -0.606493 -0.282803
+0.845411 -0.577835 -0.299133
+0.987525 -0.557775 -0.268346
+0.889943 0.542554 -0.297015
+1.222820 0.415983 0.069436
+1.217593 0.305147 -0.156870
+1.144438 -0.478794 -0.179068
+1.208277 -0.427621 -0.102134
+1.235958 -0.306822 -0.122413
+1.215422 -0.406665 0.102329
+1.206357 -0.483060 0.010549
+1.185614 -0.245192 -0.213354
+0.871611 -0.192130 -0.280159
+0.818725 -0.097645 -0.243261
+1.025984 -0.096418 -0.298406
+0.980099 -0.197894 -0.299969
+0.863848 -0.413479 -0.297150
+0.817636 -0.496759 -0.296888
+0.733302 -0.504268 -0.279179
+0.674549 -0.446113 -0.231166
+0.705405 -0.364418 -0.218107
+0.799773 -0.342705 -0.270286
+1.122262 0.352151 0.242808
+1.021343 0.354050 0.288929
+0.860115 0.286518 0.285114
+0.777918 0.224508 0.231974
+0.959504 0.261832 0.299707
+0.762268 -0.219779 0.217501
+0.839147 -0.280112 0.276984
+1.001574 -0.341729 0.294266
+1.105292 -0.335866 0.256625
+0.980311 -0.132138 0.299837
+0.940644 -0.246220 0.298701
+1.165480 0.233322 -0.232930
+0.656768 0.422261 -0.204497
+0.726403 0.481505 -0.270911
+0.832377 0.463625 -0.296040
+0.863536 0.370322 -0.293756
+0.962370 0.164539 -0.298955
+1.016050 0.073361 -0.299309
+0.963117 -0.010756 -0.297558
+0.859511 -0.010374 -0.264817
+0.814212 0.075072 -0.238101
+0.858030 0.158883 -0.271600
+1.115317 0.045633 -0.276695
+1.185542 0.113619 -0.231393
+1.195818 -0.124843 -0.221636
+1.120924 -0.063365 -0.273934
+0.782512 0.114529 0.215037
+0.775154 -0.108192 0.206922
+1.164754 0.237906 0.233001
+1.094081 -0.111437 0.282761
+1.154254 -0.216724 0.243831
+1.233599 0.006519 0.188448
+1.143764 0.000654 0.263208
+1.265412 -0.086944 0.134226
+1.236869 -0.198568 0.161288
+1.256210 -0.286906 0.080777
+1.275136 -0.241531 -0.032615
+1.259630 -0.062482 -0.147524
+1.256014 0.059308 -0.153941
+1.296757 -0.052817 0.036629
+1.290030 -0.119559 -0.050287
+0.709465 -0.047610 -0.080018
+0.693844 -0.095693 0.017962
+0.723811 -0.052492 0.122263
+0.725727 0.056212 0.127028
+0.694529 0.095815 0.027164
+0.708872 0.042114 -0.076576
+1.270438 0.246598 -0.058191
+1.259910 0.298051 0.055014
+1.242345 0.212671 0.148578
+1.266931 0.099039 0.129284
+1.296990 0.060790 0.031381
+1.287049 0.123373 -0.063715
+0.789145 0.216251 -0.238613
+0.728162 0.172093 -0.163104
+0.682332 0.208230 -0.088440
+0.656445 0.285993 -0.096871
+0.687970 0.335464 -0.186786
+0.780751 0.303558 -0.252109
+0.135508 -0.782976 0.218312
+0.169909 -0.866128 0.275945
+0.243915 -0.884224 0.288209
+0.302182 -0.818153 0.271380
+0.287490 -0.731087 0.209549
+0.192495 -0.720849 0.159476
+0.370903 -1.033939 -0.283443
+0.277237 -1.023820 -0.293778
+0.273185 -0.916310 -0.296699
+-0.796540 -0.878001 0.235911
+-0.708436 -0.889039 0.267125
+-0.646483 -0.815647 0.297459
+-0.667236 -0.730681 0.299898
+-0.759885 -0.717053 0.296493
+-0.834289 -0.799007 0.256798
+-0.612888 0.534769 -0.234888
+-0.617458 0.636376 -0.277816
+-0.538548 0.680382 -0.269273
+-0.465081 0.646712 -0.220646
+-0.464578 0.578950 -0.153904
+-0.542161 0.512962 -0.160492
+-0.649026 0.356285 0.149854
+-0.592371 0.407559 0.104765
+-0.579940 0.472056 0.162251
+-0.635487 0.515446 0.238547
+-0.711330 0.492828 0.267841
+-0.714295 0.398239 0.237973
+-0.685261 0.484037 -0.253085
+-0.701891 0.392885 -0.227738
+-0.790928 0.394196 -0.276596
+-0.834396 0.477478 -0.297499
+-0.768501 0.533539 -0.293094
+-0.762294 -0.319516 0.245107
+-0.835549 -0.341110 0.284045
+-0.821897 -0.425285 0.290792
+-0.745804 -0.402675 0.258445
+0.370568 -0.661759 -0.177739
+0.350364 -0.725302 -0.228616
+0.269312 -0.716197 -0.186586
+0.296292 -0.662405 -0.121866
+-0.389697 -0.594860 -0.081527
+-0.394159 -0.631719 -0.157238
+-0.468058 -0.614941 -0.196464
+1.054329 0.592118 0.215565
+1.118434 0.550900 0.170789
+1.119161 0.626165 0.101492
+1.065042 0.672237 0.150358
+1.202716 0.412027 -0.127709
+1.155164 0.478490 -0.165348
+1.212313 0.466093 -0.026041
+1.057486 -0.660840 0.170278
+1.114889 -0.610178 0.129444
+1.103640 -0.536177 0.196273
+1.038992 -0.580559 0.232303
+0.302600 0.659550 0.122060
+0.285892 0.642011 0.041481
+0.346889 0.607680 -0.000538
+0.413031 -0.929655 -0.299561
+0.356975 -0.871187 -0.294306
+0.397431 -0.787875 -0.276079
+0.491573 -0.790195 -0.292010
+0.503099 -0.880806 -0.299861
+-0.230347 1.037901 0.293338
+-0.252574 1.115751 0.263669
+-0.346938 1.086762 0.265383
+-0.325746 1.006858 0.294464
+-0.983754 -0.314178 0.298579
+-0.900572 -0.294456 0.295570
+-0.909603 -0.206607 0.292661
+-0.994319 -0.224547 0.299606
+-0.565330 0.413696 0.020050
+-0.547525 0.461399 -0.098082
+-0.527867 0.460442 -0.019763
+-0.280076 1.262025 -0.066755
+-0.261959 1.232560 -0.149640
+-0.386260 1.232627 -0.069757
+-0.259011 -1.259173 0.092090
+-0.281130 -1.219505 0.163988
+-0.312092 -1.260466 0.031755
+-0.583252 -0.403921 0.074423
+-0.608341 -0.345944 -0.011131
+-0.647202 -0.269335 0.026117
+-0.662918 -0.289520 0.116611
+-0.630989 -0.380907 0.144753
+0.441252 0.822211 0.292631
+0.361679 0.821086 0.282074
+0.339515 0.749680 0.242679
+-0.310323 -1.101878 0.262833
+-0.301766 -1.024790 0.292255
+-0.383030 -1.016220 0.287557
+-0.392581 -1.088534 0.255606
+-1.010324 -0.812112 -0.047781
+-1.008865 -0.815856 0.039056
+-1.058848 -0.746022 0.054108
+-1.065420 -0.742579 -0.029529
+-0.395237 1.137124 -0.220310
+-0.471595 1.140205 -0.188323
+-0.338405 1.194313 -0.178527
+-0.699800 -0.109455 -0.070765
+-0.689467 -0.120599 0.010743
+-0.671033 -0.199956 -0.014290
+-0.688217 -0.191421 -0.092680
+0.408102 0.663417 -0.203096
+0.466253 0.585630 -0.163718
+0.441485 0.557009 -0.079492
+0.377190 0.599405 -0.069782
+0.341626 0.653908 -0.145644
+-0.523619 -0.644705 -0.247708
+-0.511240 -0.750521 -0.285482
+-0.596144 -0.773469 -0.299212
+-0.656851 -0.683275 -0.295784
+-0.612259 -0.606882 -0.266568
+-0.473594 0.725633 0.268886
+-0.475706 0.654965 0.231692
+-0.393511 0.666313 0.197441
+-0.386707 0.728519 0.243539
+-0.226713 0.769971 0.226267
+-0.213057 0.836123 0.266821
+-0.309151 0.845991 0.283220
+-0.317285 0.776245 0.252873
+-0.213294 1.021565 -0.296975
+-0.267976 1.076045 -0.279727
+-0.196093 1.141235 -0.255162
+-0.146277 1.086413 -0.284270
+-0.839221 -0.808840 -0.250598
+-0.718594 -0.852266 -0.277379
+-0.786471 -0.873174 -0.243957
+0.503781 -0.508397 0.096169
+0.540943 -0.516324 0.162880
+0.590295 -0.440457 0.143772
+0.556546 -0.438798 0.070722
+1.084562 0.281819 -0.274968
+1.002617 0.250258 -0.298497
+0.963113 0.338957 -0.299498
+1.037546 0.369298 -0.282492
+-0.532627 -0.474451 0.087948
+-0.518299 -0.543742 0.167953
+-0.443480 -0.591791 0.149136
+-0.424565 -0.565344 0.064974
+-0.489497 -0.501100 0.020071
+-0.326613 -0.988326 -0.297219
+-0.423097 -0.944084 -0.297997
+-0.432796 -0.826832 -0.292235
+-0.345999 -0.809039 -0.274921
+-0.279305 -0.905123 -0.295123
+0.515979 -1.070956 -0.233456
+0.487322 -1.130354 -0.191475
+-0.925013 -0.626671 0.276302
+-0.865072 -0.495252 0.300282
+-0.935223 -0.536835 0.289813
+-0.694036 0.225684 0.130812
+-0.667444 0.225671 0.053514
+-0.638271 0.289192 0.023586
+-1.071978 -0.687841 0.123612
+-1.033204 -0.671857 0.189812
+-1.059406 -0.587136 0.213413
+-1.108029 -0.518786 -0.200463
+-1.005976 -0.519367 -0.269572
+-1.051147 -0.573816 -0.226187
+-0.256151 -0.689419 -0.141839
+-0.237598 -0.737223 -0.197979
+-0.317606 -0.741037 -0.229220
+-0.332805 -0.682788 -0.179335
+-0.434458 -0.956063 0.295992
+-0.418513 -0.880376 0.299329
+-0.520850 -0.950210 0.288273
+-0.406629 -0.654765 0.193769
+-0.435712 -0.703126 0.245543
+-0.365948 -0.743199 0.246380
+-0.335779 -0.691988 0.191801
+0.845940 -0.044368 0.258445
+0.920449 -0.047701 0.289810
+0.924185 0.051448 0.290867
+0.850188 0.054180 0.261087
+1.002923 0.179360 0.299276
+0.988118 0.102835 0.300023
+1.085193 0.084243 0.286641
+1.098530 0.165028 0.278701
+1.096941 0.491263 -0.222004
+1.047839 0.454144 -0.264349
+0.986637 0.533674 -0.274259
+1.038420 0.573741 -0.235162
+0.345377 -0.609810 0.022919
+0.373212 -0.611043 0.096142
+0.439669 -0.553656 0.065038
+0.418793 -0.561034 -0.005764
+0.197046 0.678459 -0.061239
+0.214682 0.666422 0.011519
+0.131791 0.691916 0.050055
+0.108886 0.692463 -0.025146
+0.959843 -0.396427 -0.297619
+1.020302 -0.294707 -0.293721
+1.106118 -0.311297 -0.260537
+1.092619 -0.419161 -0.247120
+1.008918 -0.464677 -0.278913
+1.149537 0.561453 -0.109365
+1.091539 0.650928 -0.129086
+1.087481 0.700464 -0.061449
+1.136442 0.630776 0.011438
+1.174761 0.553075 -0.030822
+1.133565 0.623716 -0.062652
+1.038339 -0.377038 -0.281436
+0.162973 0.680410 -0.005997
+0.392771 -0.583099 0.044769
+1.046037 0.514975 -0.250228
+1.042142 0.131698 0.296308
+0.887198 0.005667 0.278026
+-0.385225 -0.697638 0.220953
+-0.287247 -0.712424 -0.190682
+-0.361292 -0.892823 -0.298239
+-0.480323 -0.532860 0.101348
+1.021875 0.310137 -0.291827
+0.547213 -0.474621 0.119170
+-0.208484 1.085819 -0.281035
+-0.265340 0.807132 0.259915
+-0.432875 0.692462 0.237538
+-0.579202 -0.687890 -0.282278
+0.408028 0.608769 -0.136862
+-0.685228 -0.154704 -0.040935
+-1.038974 -0.782102 0.003329
+-0.345953 -1.058978 0.277886
+-0.622988 -0.336168 0.068561
+-0.333663 1.228897 -0.124423
+-0.946411 -0.259107 0.299701
+-0.288648 1.060153 0.283369
+0.435763 -0.849970 -0.296752
+1.080817 -0.600194 0.185898
+1.187064 0.491222 -0.095295
+1.092250 0.614291 0.162193
+0.321060 -0.689488 -0.180002
+-0.790436 -0.372131 0.272004
+-0.750981 0.453802 -0.274045
+-0.641491 0.433991 0.198160
+-0.538569 0.594090 -0.225269
+-0.738466 -0.806338 0.284981
+0.335689 -0.955376 -0.300047
+0.219879 -0.794505 0.243485
+0.714547 0.251899 -0.176459
+1.284759 0.177475 0.041395
+0.701976 -0.000094 0.025814
+1.293667 0.001496 -0.060971
+1.283623 -0.167662 0.057339
+1.196388 -0.100567 0.222714
+1.188741 0.115287 0.227322
+0.781304 0.003527 0.205291
+1.197613 -0.005335 -0.224563
+0.910174 0.076370 -0.287542
+0.754686 0.394175 -0.260221
+1.080500 0.163865 -0.284556
+1.049075 -0.230342 0.290757
+0.863443 -0.156463 0.273149
+0.886441 0.162727 0.283041
+1.065795 0.255608 0.284282
+0.765245 -0.425605 -0.272580
+0.919351 -0.101886 -0.290301
+1.097663 -0.188737 -0.276717
+1.248133 -0.364149 -0.011244
+1.170256 -0.364441 -0.197203
+1.243852 0.364273 -0.044454
+1.133731 0.378613 -0.226953
+0.950037 0.445355 -0.295828
+0.913630 -0.503915 -0.296384
+1.066848 -0.520520 -0.234196
+1.061512 -0.683630 -0.143390
+0.640481 0.333956 0.111468
+0.770423 0.333989 0.252824
+0.745613 -0.331928 0.237063
+0.616144 -0.353610 0.078030
+0.697696 0.128961 -0.076097
+0.656083 0.245281 -0.019514
+0.782450 0.143255 -0.219342
+0.783315 -0.174863 -0.224851
+0.735358 -0.287864 -0.213594
+0.663794 -0.246043 -0.068058
+0.700057 -0.130073 -0.084843
+1.078931 0.719457 0.042099
+0.872559 0.497771 0.299897
+1.064970 0.471428 0.248964
+1.174830 0.533671 0.073146
+1.165577 -0.517894 0.117455
+1.046029 -0.459347 0.263552
+0.843475 -0.495601 0.299050
+1.087216 -0.700345 0.058688
+0.947530 -0.855401 0.116531
+0.946399 0.851423 0.121924
+0.854614 -0.665396 -0.288293
+0.933853 -0.771911 -0.211684
+0.821348 -0.826783 0.249217
+0.755945 -0.660166 0.299903
+0.870917 0.964023 0.010052
+0.630665 0.511276 -0.234018
+0.656377 -0.532049 -0.256787
+0.711577 -0.672076 -0.299239
+0.847823 -0.914921 -0.168488
+0.858428 -0.976098 -0.011968
+0.778314 0.647835 0.299678
+0.825945 0.814106 0.254337
+0.520044 -0.550086 -0.175867
+0.499485 -0.490291 0.002695
+0.454858 -0.586310 0.153266
+0.564152 -0.681757 0.276917
+0.587484 0.639916 0.269631
+0.659302 1.089643 -0.122970
+0.729996 1.073118 0.036291
+0.280777 -0.661310 0.102565
+0.196742 -0.690763 -0.102394
+0.545238 -0.849572 0.299153
+0.430846 -0.945793 0.297467
+0.678016 -0.933021 0.256883
+0.706615 -1.090987 0.012267
+0.631560 -1.075420 0.170197
+0.474461 -1.102604 0.223018
+0.524459 0.792483 0.295663
+0.677042 0.903799 0.271064
+0.638259 1.051658 0.190681
+0.209779 0.689675 0.109820
+0.290751 0.642813 -0.056385
+0.186576 -1.136193 0.258473
+0.342557 -1.203144 0.163966
+0.317527 0.737031 -0.225710
+0.167898 0.865240 -0.275581
+0.452548 0.850725 -0.297566
+0.484132 1.156008 -0.161150
+0.395626 1.031177 -0.280414
+0.222405 1.037605 -0.292985
+0.106590 -0.851849 0.264438
+0.198043 -0.961127 0.299476
+0.309138 -0.900195 0.296481
+0.341555 -1.253686 -0.018260
+0.213467 -1.260160 -0.111836
+0.296387 -1.130088 -0.247429
+0.192045 -0.986292 -0.299564
+0.288130 -0.801942 -0.261039
+0.446086 -0.702796 -0.248639
+0.595047 -0.807409 -0.299158
+0.680988 -0.956747 -0.244088
+0.592480 -1.104059 -0.159214
+0.433448 -1.183813 -0.148564
+0.039850 -1.294161 -0.053755
+0.349873 1.251193 -0.025144
+0.263298 0.817737 0.264375
+0.415561 0.897538 0.299856
+0.477293 1.073650 0.243567
+0.351666 1.193906 0.172983
+0.176656 1.151739 0.250687
+0.134091 0.972600 0.299294
+-0.087780 -0.904717 -0.286028
+0.020739 -1.006647 -0.299486
+0.166393 1.275452 -0.089359
+0.113207 1.179685 -0.236258
+0.025541 0.705468 0.058925
+-0.103112 -1.258094 -0.143523
+-0.243233 -1.276510 -0.006395
+-0.220601 -1.012859 -0.297423
+-0.096562 -1.128849 -0.269241
+-0.097820 -0.741547 0.162203
+-0.269248 -0.752295 0.222120
+-0.335014 -0.930542 0.299118
+-0.014468 -0.848928 0.259489
+-0.399618 -1.054522 -0.271504
+-0.075808 -0.774613 -0.202316
+-0.166639 -0.709791 -0.127486
+-0.064692 -0.696862 0.003664
+0.022457 -0.717398 -0.100987
+-0.483929 -1.037551 0.262555
+-0.516662 -1.164995 0.118062
+-0.596990 -1.153686 -0.024490
+-0.466923 -1.177271 -0.135536
+-0.392522 -1.238452 0.011467
+-0.062508 0.720967 -0.116611
+0.000283 0.841427 -0.254475
+-0.527635 -0.881717 -0.298495
+-0.715712 -0.946184 -0.233992
+-0.725448 -1.071146 -0.062676
+-0.085621 1.167435 -0.246122
+-0.124362 0.990962 -0.299777
+-0.306633 0.961511 -0.298678
+0.019507 1.228251 0.194642
+0.010721 1.299333 0.020677
+-0.164692 1.274488 -0.090192
+-0.542117 -0.550397 -0.195481
+-0.354184 -0.629887 0.113838
+-0.314622 -0.639677 -0.086426
+-0.418548 -0.705238 -0.239834
+-0.555494 -0.429030 -0.027770
+-0.485255 1.054094 -0.252320
+-0.824014 -0.994260 0.072133
+-0.120315 0.783749 0.216169
+-0.043365 0.945925 0.294151
+-0.140639 1.115889 0.272260
+-0.868483 -0.866283 -0.195326
+-0.949294 -0.887371 -0.012285
+0.934768 0.629323 -0.271342
+0.716838 0.657872 -0.297925
+0.637481 0.815215 -0.298063
+0.741681 0.945776 -0.220741
+0.886355 0.900773 -0.141404
+1.011776 0.749745 -0.150310
+-0.849358 -0.722809 -0.276476
+-0.963078 -0.604729 -0.266292
+-0.820903 -0.503451 -0.296998
+-0.715608 -0.600052 -0.291700
+-0.591372 -0.476112 0.178584
+-0.496234 -0.631264 0.225554
+-0.295122 0.706965 0.187750
+-0.417277 0.810449 0.286567
+-0.758337 -0.941245 0.215972
+-0.606537 -0.905749 0.285800
+-0.592261 -0.747008 0.295486
+-0.319623 0.622724 0.011634
+-0.336120 0.766622 -0.251861
+-0.230614 0.690614 -0.126746
+-1.011110 -0.762588 0.137434
+-0.866564 -0.696891 0.277708
+-0.768817 -0.504952 0.288830
+-0.926781 -0.414174 0.298443
+-0.566321 0.687500 0.279264
+-0.740593 0.769341 0.291323
+-0.869486 0.657424 0.286230
+-0.773690 -0.332442 -0.254055
+-0.654199 -0.281884 -0.082753
+-0.477093 0.522429 -0.063321
+-0.761076 0.932961 0.219033
+-1.023409 0.705858 0.176122
+-0.316669 1.171607 0.208738
+-0.333856 1.255383 0.022199
+-0.498825 1.182537 -0.097484
+-0.662063 1.118218 0.018235
+-0.634137 1.050324 0.194884
+-0.444113 1.021245 0.276952
+-0.989021 0.836556 0.046266
+-0.871789 0.945475 0.088068
+-0.800765 1.019591 -0.041067
+-1.111179 -0.593964 -0.148119
+-1.113799 -0.663495 0.041517
+-1.113335 -0.501697 0.201047
+-0.470258 0.711833 -0.261737
+-0.901328 -0.227061 -0.291633
+-1.150844 -0.434771 -0.191904
+-1.082069 -0.281890 -0.275609
+-1.146876 -0.112645 0.258782
+-0.965621 -0.122543 0.298437
+-0.815534 -0.235538 0.258090
+-0.688630 -0.187247 0.089101
+-1.218876 -0.364691 0.125998
+-1.234556 -0.209229 0.162613
+-1.243078 -0.358125 -0.056401
+-1.291799 -0.135678 0.012645
+-1.179781 -0.165963 -0.231119
+-1.262744 -0.217687 -0.104573
+-0.948766 0.054904 0.296129
+-0.871901 -0.050292 -0.272258
+-1.193823 0.030164 0.228481
+-1.103530 0.121596 0.278886
+-0.695327 0.585352 -0.285173
+-0.969277 0.814429 -0.138299
+-0.823344 0.923277 -0.183927
+-0.660499 0.902212 -0.274850
+-0.614177 0.735157 -0.296825
+-0.700365 -0.021777 -0.009941
+-0.763507 0.038492 -0.185001
+-0.744164 0.304834 -0.225524
+-0.815437 0.181977 -0.250976
+-1.277097 0.090381 0.105103
+-1.298741 0.010112 -0.018292
+-1.170109 0.266349 0.223723
+-1.093022 0.400462 0.251565
+-1.134482 0.568923 0.133131
+-1.257375 0.301626 -0.061501
+-1.263764 0.237232 0.091195
+-1.157995 -0.013609 -0.253936
+-1.249421 0.073709 -0.162266
+-1.224630 0.213093 -0.174756
+-1.102260 0.263601 -0.269010
+-0.978337 0.179315 -0.300004
+-1.009465 0.043444 -0.300077
+-0.702293 0.143041 0.097832
+-0.652204 0.262211 -0.041095
+-0.799087 0.471327 0.290908
+-0.901325 0.345953 0.298035
+-0.827719 0.162785 0.255674
+-0.573771 0.537543 0.210402
+-0.608195 0.352016 0.040296
+-0.539532 0.459420 0.071839
+-1.161672 0.562918 -0.071742
+-1.022200 0.663911 -0.205014
+-0.873140 0.565987 -0.297309
+-0.899071 0.420435 -0.299924
+-1.077667 0.384472 -0.263383
+-1.194517 0.427458 -0.132809
+-0.221954 -1.074123 0.283686
+-0.197812 -1.236929 0.161346
+-0.027199 -1.269649 0.131024
+0.033153 -1.167080 0.248574
+-0.071734 -1.020248 0.299181
+0.553785 0.441919 0.070900
+0.509938 0.535755 0.148952
+0.415637 0.563573 0.011890
+0.504684 0.506203 -0.092321
+-0.100478 -1.165557 0.247145
+-1.059598 0.514116 -0.241154
+-0.716764 0.297246 0.199604
+-1.134249 0.133226 -0.264320
+-1.223679 0.409124 0.075771
+-1.286767 0.157405 -0.040141
+-0.931157 0.296156 -0.299125
+-0.703442 0.148197 -0.105304
+-1.190109 0.324692 -0.187302
+-0.816138 0.749402 -0.280168
+-1.215038 0.153564 0.197816
+-0.876619 0.088736 -0.275358
+-1.006467 0.225050 0.298517
+-1.262985 -0.073425 -0.140711
+-1.271486 -0.262955 0.033891
+-0.783521 -0.029131 0.207660
+-1.071746 -0.007821 0.291655
+-1.199206 -0.295942 -0.186709
+-1.264506 -0.056967 0.136794
+-1.034512 -0.114702 -0.297369
+-1.199315 -0.501852 0.000603
+-0.911068 0.920378 -0.055649
+-0.499617 1.172257 0.120120
+-1.088676 0.709305 -0.014877
+-0.758306 1.032974 0.104410
+-0.614517 0.425404 -0.161404
+-0.739086 -0.145185 -0.170103
+-0.699324 0.587635 0.287443
+-0.987609 0.533904 0.273485
+-0.993118 -0.606965 0.251690
+-1.087055 -0.285907 0.272603
+-0.388057 0.637913 -0.159614
+-0.604151 0.883993 0.291897
+-0.446252 0.589326 0.147701
+-0.671295 -0.638783 0.291060
+0.832245 0.794109 -0.260058
+-1.016082 -0.753739 -0.139099
+-0.894835 0.824646 0.207504
+-0.247091 0.930871 0.297818
+-0.880746 -0.870640 0.179956
+-0.672892 1.055080 -0.163345
+-0.692494 -0.344178 0.196723
+-0.437475 -0.548657 -0.031920
+-0.972922 -0.422594 -0.293486
+-0.156200 1.264978 0.120963
+-0.481776 0.854096 -0.299669
+-0.288375 1.159083 -0.228295
+-0.831926 -0.977799 -0.098569
+-0.685803 -0.773099 -0.298065
+-0.172297 0.816041 -0.249909
+-0.662959 -0.434336 -0.216522
+-0.669757 -1.066680 0.150107
+-0.580343 -1.074976 -0.202341
+-0.164271 -0.881216 0.281444
+-0.280485 -1.197167 -0.193463
+-0.157734 0.686583 0.046142
+0.010477 1.266321 -0.139080
+-0.197007 -0.676013 0.049491
+0.031927 1.093881 0.285191
+-0.241454 -0.811989 -0.258068
+0.305172 1.026459 0.291551
+0.185417 1.269667 0.099601
+-0.109657 -1.295002 0.016156
+-0.354647 -1.170912 0.199913
+0.482117 -0.991245 -0.281734
+0.296864 1.182822 -0.204655
+0.308390 0.901747 -0.296522
+0.164858 -1.271650 0.100107
+0.129654 0.719653 -0.133167
+0.550309 0.952475 0.283317
+0.522361 -1.187875 0.038151
+0.554652 -0.992806 0.267233
+0.066576 -1.001324 0.299941
+0.084642 -0.823150 -0.243917
+0.078487 -0.720663 0.119464
+0.546613 1.173373 0.054810
+0.048774 1.020560 -0.299526
+0.572081 0.994658 -0.261348
+0.086106 -1.178953 -0.236369
+0.389068 0.664193 0.190664
+0.324206 -1.056296 0.281174
+0.387759 -0.759751 0.261106
+0.368951 -0.608104 -0.081707
+0.682709 0.762105 0.299490
+0.750020 -1.029661 -0.123713
+0.585383 -0.652051 -0.272713
+0.507029 0.656832 -0.246647
+0.790019 1.012750 -0.096791
+0.676726 -0.791754 0.297507
+0.780244 -0.808226 -0.272429
+0.072286 0.802450 0.228718
+-0.445675 -0.791086 0.284580
+0.794911 0.966254 0.162237
+0.791395 -0.982968 0.146609
+0.966902 -0.670928 0.241519
+0.979615 0.675052 0.231564
+0.630714 -0.501266 0.228137
+0.664544 0.483615 0.240031
+0.975127 -0.635308 -0.251803
+1.103024 0.571856 -0.176418
+1.168994 -0.543437 -0.080376
+0.907130 -0.302976 -0.296636
+0.931345 0.345940 0.300500
+0.909958 -0.338604 0.298790
+0.889916 0.259396 -0.290507
+0.611543 0.370879 -0.094045
+0.619942 -0.394671 -0.138017
+0.978067 0.854318 -0.032130
+0.983555 -0.839775 -0.064698
+1.050455 -0.009957 -0.296278
+1.019182 -0.004924 0.298903
+1.252915 -0.184549 -0.138450
+0.778990 -0.558492 -0.297438
+0.761885 -0.007291 -0.182637
+0.795919 0.534301 -0.297579
+1.242510 0.182706 -0.157288
+1.196213 -0.316951 0.183497
+0.703267 -0.168386 0.112542
+0.710297 0.170562 0.129136
+1.207701 0.332450 0.162218
+1.279836 0.005212 0.106332
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 3a75527e..962afeb2 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -31,6 +31,10 @@ endif()
find_package(CGAL)
+# Find TBB package for parallel sort - not mandatory, just optional.
+set(TBB_FIND_QUIETLY ON)
+find_package(TBB)
+
if(NOT Boost_FOUND)
message(FATAL_ERROR "NOTICE: This demo requires Boost and will not be compiled.")
else()
diff --git a/src/GudhUI/utils/K_nearest_builder.h b/src/GudhUI/utils/K_nearest_builder.h
index cab24b7c..7be0a4f4 100644
--- a/src/GudhUI/utils/K_nearest_builder.h
+++ b/src/GudhUI/utils/K_nearest_builder.h
@@ -29,12 +29,10 @@
#include <CGAL/Search_traits_d.h>
#include <CGAL/Search_traits_adapter.h>
#include <CGAL/property_map.h>
-#include <boost/iterator/iterator_facade.hpp>
-#include <boost/iterator/zip_iterator.hpp>
#include <unordered_map>
-#include <tuple>
#include <list>
+#include <utility>
#include "utils/UI_utils.h"
#include "model/Complex_typedefs.h"
@@ -43,9 +41,9 @@ template<typename SkBlComplex> class K_nearest_builder {
private:
typedef Geometry_trait Kernel;
typedef Point Point_d;
- typedef boost::tuple<Point_d, unsigned> Point_d_with_id;
+ typedef std::pair<Point_d, unsigned> Point_d_with_id;
typedef CGAL::Search_traits_d<Kernel> Traits_base;
- typedef CGAL::Search_traits_adapter<Point_d_with_id, CGAL::Nth_of_tuple_property_map<0, Point_d_with_id>,
+ typedef CGAL::Search_traits_adapter<Point_d_with_id, CGAL::First_of_pair_property_map<Point_d_with_id>,
Traits_base> Traits;
typedef CGAL::Orthogonal_k_neighbor_search<Traits> Neighbor_search;
typedef Neighbor_search::Tree Tree;
@@ -81,7 +79,7 @@ template<typename SkBlComplex> class K_nearest_builder {
for (auto p : complex_.vertex_range()) {
Neighbor_search search(tree, complex_.point(p), k + 1);
for (auto it = ++search.begin(); it != search.end(); ++it) {
- Vertex_handle q(boost::get<1>(it->first));
+ Vertex_handle q(std::get<1>(it->first));
if (p != q && complex_.contains_vertex(p) && complex_.contains_vertex(q))
complex_.add_edge(p, q);
}
diff --git a/src/Hasse_complex/include/gudhi/Hasse_complex.h b/src/Hasse_complex/include/gudhi/Hasse_complex.h
index 67079687..8b06b771 100644
--- a/src/Hasse_complex/include/gudhi/Hasse_complex.h
+++ b/src/Hasse_complex/include/gudhi/Hasse_complex.h
@@ -23,12 +23,18 @@
#ifndef HASSE_COMPLEX_H_
#define HASSE_COMPLEX_H_
+#include <gudhi/allocator.h>
+
#include <boost/iterator/counting_iterator.hpp>
#include <algorithm>
#include <utility> // for pair
#include <vector>
+#ifdef GUDHI_USE_TBB
+#include <tbb/parallel_for.h>
+#endif
+
namespace Gudhi {
template < class HasseCpx >
@@ -38,8 +44,7 @@ struct Hasse_simplex {
template< class Complex_ds >
Hasse_simplex(Complex_ds & cpx
, typename Complex_ds::Simplex_handle sh)
- : key_(cpx.key(sh))
- , filtration_(cpx.filtration(sh))
+ : filtration_(cpx.filtration(sh))
, boundary_() {
boundary_.reserve(cpx.dimension(sh) + 1);
for (auto b_sh : cpx.boundary_simplex_range(sh)) {
@@ -49,7 +54,7 @@ struct Hasse_simplex {
Hasse_simplex(typename HasseCpx::Simplex_key key
, typename HasseCpx::Filtration_value fil
- , std::vector<typename HasseCpx::Simplex_handle> boundary)
+ , std::vector<typename HasseCpx::Simplex_handle> const& boundary)
: key_(key)
, filtration_(fil)
, boundary_(boundary) { }
@@ -97,20 +102,24 @@ class Hasse_complex {
template < class Complex_ds >
Hasse_complex(Complex_ds & cpx)
- : complex_()
+ : complex_(cpx.num_simplices())
, vertices_()
, threshold_(cpx.filtration())
, num_vertices_()
, dim_max_(cpx.dimension()) {
- complex_.reserve(cpx.num_simplices());
- int idx = 0;
- for (auto cpx_sh : cpx.filtration_simplex_range()) {
- complex_.push_back(Hasse_simp(cpx, cpx_sh));
- if (dimension(idx) == 0) {
+ int size = complex_.size();
+#ifdef GUDHI_USE_TBB
+ tbb::parallel_for(0, size, [&](int idx){new (&complex_[idx]) Hasse_simp(cpx, cpx.simplex(idx));});
+ for (int idx=0; idx < size; ++idx)
+ if (complex_[idx].boundary_.empty())
+ vertices_.push_back(idx);
+#else
+ for (int idx=0; idx < size; ++idx) {
+ new (&complex_[idx]) Hasse_simp(cpx, cpx.simplex(idx));
+ if (complex_[idx].boundary_.empty())
vertices_.push_back(idx);
- }
- ++idx;
}
+#endif
}
Hasse_complex()
@@ -187,14 +196,15 @@ class Hasse_complex {
}
void initialize_filtration() {
+ // Setting the keys is done by pcoh, Simplex_tree doesn't do it either.
+#if 0
Simplex_key key = 0;
- for (auto & h_simp : complex_) {
- h_simp.key_ = key;
- ++key;
- }
+ for (auto & h_simp : complex_)
+ h_simp.key_ = key++;
+#endif
}
- std::vector< Hasse_simp > complex_;
+ std::vector< Hasse_simp, Gudhi::no_init_allocator<Hasse_simp> > complex_;
std::vector<Simplex_handle> vertices_;
Filtration_value threshold_;
size_t num_vertices_;
@@ -218,7 +228,7 @@ std::istream& operator>>(std::istream & is
// read all simplices in the file as a list of vertices
while (read_hasse_simplex(is, boundary, fil)) {
// insert every simplex in the simplex tree
- hcpx.complex_.push_back(Hasse_simplex< Hasse_complex<T1, T2, T3> >(key, fil, boundary));
+ hcpx.complex_.emplace_back(key, fil, boundary);
if (max_dim < hcpx.dimension(key)) {
max_dim = hcpx.dimension(key);
diff --git a/src/Persistent_cohomology/concept/FilteredComplex.h b/src/Persistent_cohomology/concept/FilteredComplex.h
index 1834903b..e124d524 100644
--- a/src/Persistent_cohomology/concept/FilteredComplex.h
+++ b/src/Persistent_cohomology/concept/FilteredComplex.h
@@ -65,9 +65,9 @@ struct FilteredComplex
Simplex_key key ( Simplex_handle sh );
/** \brief Returns the simplex associated to a key.
*
- * If key is different from null_key(), there must be a unique
- * simplex having this key. */
- Simplex_handle simplex ( Simplex_key key );
+ * If key is different from null_key(), returns the simplex that
+ * has index idx in the filtration. */
+ Simplex_handle simplex ( Simplex_key idx );
/** \brief Assign a key to a simplex. */
void assign_key(Simplex_handle sh, Simplex_key key);
diff --git a/src/Persistent_cohomology/example/CMakeLists.txt b/src/Persistent_cohomology/example/CMakeLists.txt
index 9e96adc0..5fec8ad4 100644
--- a/src/Persistent_cohomology/example/CMakeLists.txt
+++ b/src/Persistent_cohomology/example/CMakeLists.txt
@@ -18,6 +18,11 @@ target_link_libraries(rips_persistence ${Boost_SYSTEM_LIBRARY} ${Boost_PROGRAM_O
add_test(rips_persistence_3 ${CMAKE_CURRENT_BINARY_DIR}/rips_persistence ${CMAKE_SOURCE_DIR}/data/points/Kl.txt -r 0.25 -d 3 -p 3 -m 100)
+add_executable(parallel_rips_persistence parallel_rips_persistence.cpp)
+target_link_libraries(parallel_rips_persistence ${Boost_SYSTEM_LIBRARY} ${Boost_PROGRAM_OPTIONS_LIBRARY})
+
+add_test(parallel_rips_persistence_3 ${CMAKE_CURRENT_BINARY_DIR}/parallel_rips_persistence ${CMAKE_SOURCE_DIR}/data/points/tore3D_1307.txt -r 0.3 -d 3 -p 3 -m 100)
+
add_executable(persistence_from_file persistence_from_file.cpp)
target_link_libraries(persistence_from_file ${Boost_SYSTEM_LIBRARY} ${Boost_PROGRAM_OPTIONS_LIBRARY})
add_test(persistence_from_file_3_2_0 ${CMAKE_CURRENT_BINARY_DIR}/persistence_from_file ${CMAKE_SOURCE_DIR}/data/points/bunny_5000.st -p 2 -m 0)
@@ -77,6 +82,4 @@ if(GMPXX_FOUND AND GMP_FOUND)
# message(WARNING "CGAL not found.")
endif()
-else()
- # message(WARNING "GMP not found.")
endif()
diff --git a/src/Persistent_cohomology/example/alpha_shapes_persistence.cpp b/src/Persistent_cohomology/example/alpha_shapes_persistence.cpp
index 235ea141..ac208957 100644
--- a/src/Persistent_cohomology/example/alpha_shapes_persistence.cpp
+++ b/src/Persistent_cohomology/example/alpha_shapes_persistence.cpp
@@ -66,7 +66,8 @@ typedef Alpha_shape_3::Edge Edge_3;
typedef std::list<Alpha_shape_3::Vertex_handle> Vertex_list;
// gudhi type definition
-typedef Simplex_tree<>::Vertex_handle Simplex_tree_vertex;
+typedef Simplex_tree<Simplex_tree_options_fast_persistence> ST;
+typedef ST::Vertex_handle Simplex_tree_vertex;
typedef std::map<Alpha_shape_3::Vertex_handle, Simplex_tree_vertex > Alpha_shape_simplex_tree_map;
typedef std::pair<Alpha_shape_3::Vertex_handle, Simplex_tree_vertex> Alpha_shape_simplex_tree_pair;
typedef std::vector< Simplex_tree_vertex > Simplex_tree_vector_vertex;
@@ -184,7 +185,7 @@ int main(int argc, char * const argv[]) {
// Loop on objects vector
Vertex_list vertex_list;
- Simplex_tree<> simplex_tree;
+ ST simplex_tree;
Alpha_shape_simplex_tree_map map_cgal_simplex_tree;
std::vector<Alpha_value_type>::iterator the_alpha_value_iterator = the_alpha_values.begin();
int dim_max = 0;
@@ -281,7 +282,7 @@ int main(int argc, char * const argv[]) {
std::cout << "Simplex_tree dim: " << simplex_tree.dimension() << std::endl;
// Compute the persistence diagram of the complex
- Persistent_cohomology< Simplex_tree<>, Field_Zp > pcoh(simplex_tree);
+ Persistent_cohomology< ST, Field_Zp > pcoh(simplex_tree);
// initializes the coefficient field for homology
pcoh.init_coefficients(coeff_field_characteristic);
diff --git a/src/Persistent_cohomology/example/parallel_rips_persistence.cpp b/src/Persistent_cohomology/example/parallel_rips_persistence.cpp
new file mode 100644
index 00000000..4c6656f5
--- /dev/null
+++ b/src/Persistent_cohomology/example/parallel_rips_persistence.cpp
@@ -0,0 +1,180 @@
+/* This file is part of the Gudhi Library. The Gudhi library
+ * (Geometric Understanding in Higher Dimensions) is a generic C++
+ * library for computational topology.
+ *
+ * Author(s): Clément Maria, Marc Glisse
+ *
+ * Copyright (C) 2014 INRIA Sophia Antipolis-Méditerranée (France),
+ * 2015 INRIA Saclay ÃŽle de France)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <gudhi/reader_utils.h>
+#include <gudhi/graph_simplicial_complex.h>
+#include <gudhi/distance_functions.h>
+#include <gudhi/Simplex_tree.h>
+#include <gudhi/Persistent_cohomology.h>
+#include <gudhi/Hasse_complex.h>
+
+#include <boost/program_options.hpp>
+
+#ifdef GUDHI_USE_TBB
+#include <tbb/task_scheduler_init.h>
+#endif
+
+#include <string>
+#include <vector>
+
+////////////////////////////////////////////////////////////////
+// //
+// WARNING: persistence computation itself is not parallel, //
+// and this uses more memory than rips_persistence. //
+// //
+////////////////////////////////////////////////////////////////
+
+using namespace Gudhi;
+using namespace Gudhi::persistent_cohomology;
+
+typedef int Vertex_handle;
+typedef double Filtration_value;
+
+void program_options(int argc, char * argv[]
+ , std::string & filepoints
+ , std::string & filediag
+ , Filtration_value & threshold
+ , int & dim_max
+ , int & p
+ , Filtration_value & min_persistence);
+
+int main(int argc, char * argv[]) {
+ std::string filepoints;
+ std::string filediag;
+ Filtration_value threshold;
+ int dim_max;
+ int p;
+ Filtration_value min_persistence;
+
+ program_options(argc, argv, filepoints, filediag, threshold, dim_max, p, min_persistence);
+
+ // Extract the points from the file filepoints
+ typedef std::vector<double> Point_t;
+ std::vector< Point_t > points;
+ read_points(filepoints, points);
+
+ // Compute the proximity graph of the points
+ Graph_t prox_graph = compute_proximity_graph(points, threshold
+ , euclidean_distance<Point_t>);
+
+ // Construct the Rips complex in a Simplex Tree
+ Simplex_tree<>& st = *new Simplex_tree<>;
+ // insert the proximity graph in the simplex tree
+ st.insert_graph(prox_graph);
+ // expand the graph until dimension dim_max
+ st.expansion(dim_max);
+
+ std::cout << "The complex contains " << st.num_simplices() << " simplices \n";
+ std::cout << " and has dimension " << st.dimension() << " \n";
+
+#ifdef GUDHI_USE_TBB
+ // Unnecessary, but clarifies which operations are parallel.
+ tbb::task_scheduler_init ts;
+#endif
+
+ // Sort the simplices in the order of the filtration
+ st.initialize_filtration();
+ int count = 0;
+ for (auto sh : st.filtration_simplex_range())
+ st.assign_key(sh, count++);
+
+ // Convert to a more convenient representation.
+ Hasse_complex<> hcpx(st);
+
+#ifdef GUDHI_USE_TBB
+ ts.terminate();
+#endif
+
+ // Free some space.
+ delete &st;
+
+ // Compute the persistence diagram of the complex
+ persistent_cohomology::Persistent_cohomology< Hasse_complex<>, Field_Zp > pcoh(hcpx);
+ // initializes the coefficient field for homology
+ pcoh.init_coefficients(p);
+
+ pcoh.compute_persistent_cohomology(min_persistence);
+
+ // Output the diagram in filediag
+ if (filediag.empty()) {
+ pcoh.output_diagram();
+ } else {
+ std::ofstream out(filediag);
+ pcoh.output_diagram(out);
+ out.close();
+ }
+}
+
+void program_options(int argc, char * argv[]
+ , std::string & filepoints
+ , std::string & filediag
+ , Filtration_value & threshold
+ , int & dim_max
+ , int & p
+ , Filtration_value & min_persistence) {
+ namespace po = boost::program_options;
+ po::options_description hidden("Hidden options");
+ hidden.add_options()
+ ("input-file", po::value<std::string>(&filepoints),
+ "Name of file containing a point set. Format is one point per line: X1 ... Xd ");
+
+ po::options_description visible("Allowed options", 100);
+ visible.add_options()
+ ("help,h", "produce help message")
+ ("output-file,o", po::value<std::string>(&filediag)->default_value(std::string()),
+ "Name of file in which the persistence diagram is written. Default print in std::cout")
+ ("max-edge-length,r", po::value<Filtration_value>(&threshold)->default_value(0),
+ "Maximal length of an edge for the Rips complex construction.")
+ ("cpx-dimension,d", po::value<int>(&dim_max)->default_value(1),
+ "Maximal dimension of the Rips complex we want to compute.")
+ ("field-charac,p", po::value<int>(&p)->default_value(11),
+ "Characteristic p of the coefficient field Z/pZ for computing homology.")
+ ("min-persistence,m", po::value<Filtration_value>(&min_persistence),
+ "Minimal lifetime of homology feature to be recorded. Default is 0. Enter a negative value to see zero length intervals");
+
+ po::positional_options_description pos;
+ pos.add("input-file", 1);
+
+ po::options_description all;
+ all.add(visible).add(hidden);
+
+ po::variables_map vm;
+ po::store(po::command_line_parser(argc, argv).
+ options(all).positional(pos).run(), vm);
+ po::notify(vm);
+
+ if (vm.count("help") || !vm.count("input-file")) {
+ std::cout << std::endl;
+ std::cout << "Compute the persistent homology with coefficient field Z/pZ \n";
+ std::cout << "of a Rips complex defined on a set of input points.\n \n";
+ std::cout << "The output diagram contains one bar per line, written with the convention: \n";
+ std::cout << " p dim b d \n";
+ std::cout << "where dim is the dimension of the homological feature,\n";
+ std::cout << "b and d are respectively the birth and death of the feature and \n";
+ std::cout << "p is the characteristic of the field Z/pZ used for homology coefficients." << std::endl << std::endl;
+
+ std::cout << "Usage: " << argv[0] << " [options] input-file" << std::endl << std::endl;
+ std::cout << visible << std::endl;
+ std::abort();
+ }
+}
diff --git a/src/Persistent_cohomology/example/performance_rips_persistence.cpp b/src/Persistent_cohomology/example/performance_rips_persistence.cpp
index fc48d6b1..b4d282ac 100644
--- a/src/Persistent_cohomology/example/performance_rips_persistence.cpp
+++ b/src/Persistent_cohomology/example/performance_rips_persistence.cpp
@@ -86,7 +86,7 @@ int main(int argc, char * argv[]) {
std::cout << "Compute Rips graph in " << elapsed_sec << " ms.\n";
// Construct the Rips complex in a Simplex Tree
- Simplex_tree<> st;
+ Simplex_tree<Simplex_tree_options_fast_persistence> st;
start = std::chrono::system_clock::now();
// insert the proximity graph in the simplex tree
diff --git a/src/Persistent_cohomology/example/persistence_from_file.cpp b/src/Persistent_cohomology/example/persistence_from_file.cpp
index 8eb8d0f3..67235467 100644
--- a/src/Persistent_cohomology/example/persistence_from_file.cpp
+++ b/src/Persistent_cohomology/example/persistence_from_file.cpp
@@ -54,7 +54,7 @@ int main(int argc, char * argv[]) {
<< std::endl;
std::cout << " - p=" << p << " - min_persistence=" << min_persistence << std::endl;
- // Construct the Rips complex in a Simplex Tree
+ // Read the list of simplices from a file.
Simplex_tree<> simplex_tree;
std::ifstream simplex_tree_stream(simplex_tree_file);
diff --git a/src/Persistent_cohomology/example/rips_multifield_persistence.cpp b/src/Persistent_cohomology/example/rips_multifield_persistence.cpp
index 5277bf7a..c5cd775d 100644
--- a/src/Persistent_cohomology/example/rips_multifield_persistence.cpp
+++ b/src/Persistent_cohomology/example/rips_multifield_persistence.cpp
@@ -68,7 +68,8 @@ int main(int argc, char * argv[]) {
, euclidean_distance<Point_t>);
// Construct the Rips complex in a Simplex Tree
- Simplex_tree<> st;
+ typedef Simplex_tree<Simplex_tree_options_fast_persistence> ST;
+ ST st;
// insert the proximity graph in the simplex tree
st.insert_graph(prox_graph);
// expand the graph until dimension dim_max
@@ -78,7 +79,7 @@ int main(int argc, char * argv[]) {
st.initialize_filtration();
// Compute the persistence diagram of the complex
- Persistent_cohomology< Simplex_tree<>, Multi_field > pcoh(st);
+ Persistent_cohomology<ST, Multi_field > pcoh(st);
// initializes the coefficient field for homology
pcoh.init_coefficients(min_p, max_p);
// compute persistent homology, disgarding persistent features of life shorter than min_persistence
diff --git a/src/Persistent_cohomology/example/rips_persistence.cpp b/src/Persistent_cohomology/example/rips_persistence.cpp
index fa0449a8..cab49395 100644
--- a/src/Persistent_cohomology/example/rips_persistence.cpp
+++ b/src/Persistent_cohomology/example/rips_persistence.cpp
@@ -66,7 +66,8 @@ int main(int argc, char * argv[]) {
, euclidean_distance<Point_t>);
// Construct the Rips complex in a Simplex Tree
- Simplex_tree<> st;
+ typedef Simplex_tree<Simplex_tree_options_fast_persistence> ST;
+ ST st;
// insert the proximity graph in the simplex tree
st.insert_graph(prox_graph);
// expand the graph until dimension dim_max
@@ -79,7 +80,7 @@ int main(int argc, char * argv[]) {
st.initialize_filtration();
// Compute the persistence diagram of the complex
- persistent_cohomology::Persistent_cohomology< Simplex_tree<>, Field_Zp > pcoh(st);
+ persistent_cohomology::Persistent_cohomology<ST, Field_Zp > pcoh(st);
// initializes the coefficient field for homology
pcoh.init_coefficients(p);
diff --git a/src/Persistent_cohomology/include/gudhi/Persistent_cohomology.h b/src/Persistent_cohomology/include/gudhi/Persistent_cohomology.h
index 3e761473..19417ace 100644
--- a/src/Persistent_cohomology/include/gudhi/Persistent_cohomology.h
+++ b/src/Persistent_cohomology/include/gudhi/Persistent_cohomology.h
@@ -27,7 +27,6 @@
#include <gudhi/Persistent_cohomology/Field_Zp.h>
#include <gudhi/Simple_object_pool.h>
-#include <boost/tuple/tuple.hpp>
#include <boost/intrusive/set.hpp>
#include <boost/pending/disjoint_sets.hpp>
#include <boost/intrusive/list.hpp>
@@ -223,7 +222,7 @@ class Persistent_cohomology {
// Sparse column type for the annotation of the boundary of an element.
typedef std::vector<std::pair<Simplex_key, Arith_element> > A_ds_type;
// Persistent interval type. The Arith_element field is used for the multi-field framework.
- typedef boost::tuple<Simplex_handle, Simplex_handle, Arith_element> Persistent_interval;
+ typedef std::tuple<Simplex_handle, Simplex_handle, Arith_element> Persistent_interval;
/** \brief Initializes the Persistent_cohomology class.
*
diff --git a/src/Persistent_cohomology/include/gudhi/Persistent_cohomology/Persistent_cohomology_column.h b/src/Persistent_cohomology/include/gudhi/Persistent_cohomology/Persistent_cohomology_column.h
index 612658e6..5deb2d88 100644
--- a/src/Persistent_cohomology/include/gudhi/Persistent_cohomology/Persistent_cohomology_column.h
+++ b/src/Persistent_cohomology/include/gudhi/Persistent_cohomology/Persistent_cohomology_column.h
@@ -23,7 +23,6 @@
#ifndef PERSISTENT_COHOMOLOGY_PERSISTENT_COHOMOLOGY_COLUMN_H_
#define PERSISTENT_COHOMOLOGY_PERSISTENT_COHOMOLOGY_COLUMN_H_
-#include <boost/tuple/tuple.hpp>
#include <boost/intrusive/set.hpp>
#include <boost/intrusive/list.hpp>
diff --git a/src/Simplex_tree/concept/SimplexTreeOptions.h b/src/Simplex_tree/concept/SimplexTreeOptions.h
index add3ebdd..d072cf34 100644
--- a/src/Simplex_tree/concept/SimplexTreeOptions.h
+++ b/src/Simplex_tree/concept/SimplexTreeOptions.h
@@ -37,5 +37,7 @@ struct SimplexTreeOptions {
static const bool store_key;
/// If true, each simplex has extra storage for one `Filtration_value`, and this value is propagated by operations like `Gudhi::Simplex_tree::expansion`. Without it, `Persistent_cohomology` degenerates to computing usual (non-persistent) cohomology.
static const bool store_filtration;
+ /// If true, the list of vertices present in the complex must always be 0, ..., num_vertices-1, without any hole.
+ static constexpr bool contiguous_vertices;
};
diff --git a/src/Simplex_tree/example/simplex_tree_from_alpha_shapes_3.cpp b/src/Simplex_tree/example/simplex_tree_from_alpha_shapes_3.cpp
index 45efe3ed..49d358ab 100644
--- a/src/Simplex_tree/example/simplex_tree_from_alpha_shapes_3.cpp
+++ b/src/Simplex_tree/example/simplex_tree_from_alpha_shapes_3.cpp
@@ -62,7 +62,8 @@ typedef Alpha_shape_3::Edge Edge;
typedef std::list<Alpha_shape_3::Vertex_handle> Vertex_list;
// gudhi type definition
-typedef Gudhi::Simplex_tree<>::Vertex_handle Simplex_tree_vertex;
+typedef Gudhi::Simplex_tree<> Simplex_tree;
+typedef Simplex_tree::Vertex_handle Simplex_tree_vertex;
typedef std::map<Alpha_shape_3::Vertex_handle, Simplex_tree_vertex > Alpha_shape_simplex_tree_map;
typedef std::pair<Alpha_shape_3::Vertex_handle, Simplex_tree_vertex> Alpha_shape_simplex_tree_pair;
typedef std::vector< Simplex_tree_vertex > Simplex_tree_vector_vertex;
@@ -161,7 +162,7 @@ int main(int argc, char * const argv[]) {
// Loop on objects vector
Vertex_list vertex_list;
- Gudhi::Simplex_tree<> simplex_tree;
+ Simplex_tree simplex_tree;
Alpha_shape_simplex_tree_map map_cgal_simplex_tree;
std::vector<Alpha_value_type>::iterator the_alpha_value_iterator = the_alpha_values.begin();
for (auto object_iterator : the_objects) {
diff --git a/src/Simplex_tree/include/gudhi/Simplex_tree.h b/src/Simplex_tree/include/gudhi/Simplex_tree.h
index d4f9aeae..3ba838a7 100644
--- a/src/Simplex_tree/include/gudhi/Simplex_tree.h
+++ b/src/Simplex_tree/include/gudhi/Simplex_tree.h
@@ -36,6 +36,10 @@
#include <boost/iterator/transform_iterator.hpp>
#include <boost/graph/adjacency_list.hpp>
+#ifdef GUDHI_USE_TBB
+#include <tbb/parallel_sort.h>
+#endif
+
#include <algorithm>
#include <utility>
#include <vector>
@@ -80,15 +84,7 @@ namespace Gudhi {
* @{
*/
-/// Model of SimplexTreeOptions.
-struct Simplex_tree_options_full_featured {
- typedef linear_indexing_tag Indexing_tag;
- typedef int Vertex_handle;
- typedef double Filtration_value;
- typedef int Simplex_key;
- static const bool store_key = true;
- static const bool store_filtration = true;
-};
+struct Simplex_tree_options_full_featured;
/**
* \brief Simplex Tree data structure for representing simplicial complexes.
@@ -543,7 +539,7 @@ class Simplex_tree {
* The type InputVertexRange must be a range of <CODE>Vertex_handle</CODE>
* on which we can call std::begin() function
*/
- template<class InputVertexRange=std::initializer_list<Vertex_handle>>
+ template<class InputVertexRange = std::initializer_list<Vertex_handle>>
Simplex_handle find(const InputVertexRange & s) {
auto first = std::begin(s);
auto last = std::end(s);
@@ -579,9 +575,22 @@ class Simplex_tree {
/** \brief Returns the Simplex_handle corresponding to the 0-simplex
* representing the vertex with Vertex_handle v. */
Simplex_handle find_vertex(Vertex_handle v) {
- return root_.members_.begin() + v;
+ if (Options::contiguous_vertices) {
+ assert(contiguous_vertices());
+ return root_.members_.begin() + v;
+ } else {
+ return root_.members_.find(v);
+ }
+ }
+
+ public:
+ /** \private \brief Test if the vertices have contiguous numbering: 0, 1, etc. */
+ bool contiguous_vertices() const {
+ if (root_.members_.empty()) return true;
+ if (root_.members_.begin()->first != 0) return false;
+ if (std::prev(root_.members_.end())->first != root_.members_.size()-1) return false;
+ return true;
}
- //{ return root_.members_.find(v); }
private:
/** \brief Inserts a simplex represented by a vector of vertex.
@@ -637,7 +646,7 @@ class Simplex_tree {
*
* The type InputVertexRange must be a range for which .begin() and
* .end() return input iterators, with 'value_type' Vertex_handle. */
- template<class InputVertexRange=std::initializer_list<Vertex_handle>>
+ template<class InputVertexRange = std::initializer_list<Vertex_handle>>
std::pair<Simplex_handle, bool> insert_simplex(const InputVertexRange & simplex,
Filtration_value filtration = 0) {
auto first = std::begin(simplex);
@@ -799,8 +808,12 @@ class Simplex_tree {
* heuristic consists in inserting the cofaces of a simplex as soon as
* possible.
*/
+#ifdef GUDHI_USE_TBB
+ tbb::parallel_sort(filtration_vect_, is_before_in_filtration(this));
+#else
std::stable_sort(filtration_vect_.begin(), filtration_vect_.end(),
is_before_in_filtration(this));
+#endif
}
private:
@@ -1263,6 +1276,31 @@ std::istream& operator>>(std::istream & is, Simplex_tree<T...> & st) {
return is;
}
+
+/// Model of SimplexTreeOptions.
+struct Simplex_tree_options_full_featured {
+ typedef linear_indexing_tag Indexing_tag;
+ typedef int Vertex_handle;
+ typedef double Filtration_value;
+ typedef int Simplex_key;
+ static const bool store_key = true;
+ static const bool store_filtration = true;
+ static const bool contiguous_vertices = false;
+};
+
+/** Model of SimplexTreeOptions, faster than
+ `Simplex_tree_options_full_featured` but note the unsafe
+ `contiguous_vertices` option. */
+struct Simplex_tree_options_fast_persistence {
+ typedef linear_indexing_tag Indexing_tag;
+ typedef int Vertex_handle;
+ typedef float Filtration_value;
+ typedef int Simplex_key;
+ static const bool store_key = true;
+ static const bool store_filtration = true;
+ static const bool contiguous_vertices = true;
+};
+
/** @} */ // end defgroup simplex_tree
} // namespace Gudhi
diff --git a/src/Simplex_tree/include/gudhi/Simplex_tree/Simplex_tree_iterators.h b/src/Simplex_tree/include/gudhi/Simplex_tree/Simplex_tree_iterators.h
index 372ef329..936b7a1f 100644
--- a/src/Simplex_tree/include/gudhi/Simplex_tree/Simplex_tree_iterators.h
+++ b/src/Simplex_tree/include/gudhi/Simplex_tree/Simplex_tree_iterators.h
@@ -54,7 +54,7 @@ class Simplex_tree_simplex_vertex_iterator : public boost::iterator_facade<
explicit Simplex_tree_simplex_vertex_iterator(SimplexTree * st)
: // any end() iterator
- sib_(NULL),
+ sib_(nullptr),
v_(st->null_vertex()) {
}
@@ -99,21 +99,22 @@ class Simplex_tree_boundary_simplex_iterator : public boost::iterator_facade<
// any end() iterator
explicit Simplex_tree_boundary_simplex_iterator(SimplexTree * st)
- : last_(st->null_vertex()),
- sib_(NULL) {
+ : sib_(nullptr),
+ sh_(st->null_simplex()),
+ st_(st) {
}
Simplex_tree_boundary_simplex_iterator(SimplexTree * st, Simplex_handle sh)
- : suffix_(),
+ : last_(sh->first),
+ sib_(nullptr),
st_(st) {
- last_ = sh->first;
Siblings * sib = st->self_siblings(sh);
next_ = sib->parent();
- sib_ = sib->oncles(); /* \todo check if NULL*/
- if (sib_ != NULL) {
+ sib_ = sib->oncles();
+ if (sib_ != nullptr) {
sh_ = sib_->find(next_);
} else {
- last_ = st->null_vertex();
+ sh_ = st->null_simplex();
} // vertex: == end()
}
@@ -121,28 +122,40 @@ class Simplex_tree_boundary_simplex_iterator : public boost::iterator_facade<
friend class boost::iterator_core_access;
// valid when iterating along the SAME boundary.
bool equal(Simplex_tree_boundary_simplex_iterator const& other) const {
- return (sib_ == other.sib_ && last_ == other.last_);
+ return sh_ == other.sh_;
}
Simplex_handle const& dereference() const {
+ assert(sh_ != st_->null_simplex());
return sh_;
}
void increment() {
- if (sib_ == NULL) {
- last_ = st_->null_vertex();
+ if (sib_ == nullptr) {
+ sh_ = st_->null_simplex();
return;
}
Siblings * for_sib = sib_;
- for (auto rit = suffix_.rbegin(); rit != suffix_.rend(); ++rit) {
+ Siblings * new_sib = sib_->oncles();
+ auto rit = suffix_.rbegin();
+ if (SimplexTree::Options::contiguous_vertices && new_sib == nullptr && rit != suffix_.rend()) {
+ // We reached the root, use a short-cut to find a vertex. We could also
+ // optimize finding the second vertex of a segment, but people are
+ // expected to call endpoints().
+ assert(st_->contiguous_vertices());
+ sh_ = for_sib->members_.begin()+*rit;
+ for_sib = sh_->second.children();
+ ++rit;
+ }
+ for (; rit != suffix_.rend(); ++rit) {
sh_ = for_sib->find(*rit);
for_sib = sh_->second.children();
}
sh_ = for_sib->find(last_); // sh_ points to the right simplex now
suffix_.push_back(next_);
next_ = sib_->parent();
- sib_ = sib_->oncles();
+ sib_ = new_sib;
}
// Most of the storage should be moved to the range, iterators should be light.
@@ -176,13 +189,15 @@ class Simplex_tree_complex_simplex_iterator : public boost::iterator_facade<
// any end() iterator
Simplex_tree_complex_simplex_iterator()
- : st_(NULL) {
+ : sib_(nullptr),
+ st_(nullptr) {
}
explicit Simplex_tree_complex_simplex_iterator(SimplexTree * st)
- : st_(st) {
- if (st == NULL || st->root() == NULL || st->root()->members().empty()) {
- st_ = NULL;
+ : sib_(nullptr),
+ st_(st) {
+ if (st == nullptr || st->root() == nullptr || st->root()->members().empty()) {
+ st_ = nullptr;
} else {
sh_ = st->root()->members().begin();
sib_ = st->root();
@@ -197,10 +212,10 @@ class Simplex_tree_complex_simplex_iterator : public boost::iterator_facade<
// valid when iterating along the SAME boundary.
bool equal(Simplex_tree_complex_simplex_iterator const& other) const {
- if (other.st_ == NULL) {
- return (st_ == NULL);
+ if (other.st_ == nullptr) {
+ return (st_ == nullptr);
}
- if (st_ == NULL) {
+ if (st_ == nullptr) {
return false;
}
return (&(sh_->second) == &(other.sh_->second));
@@ -214,8 +229,8 @@ class Simplex_tree_complex_simplex_iterator : public boost::iterator_facade<
void increment() {
++sh_;
if (sh_ == sib_->members().end()) {
- if (sib_->oncles() == NULL) {
- st_ = NULL;
+ if (sib_->oncles() == nullptr) {
+ st_ = nullptr;
return;
} // reach the end
sh_ = sib_->oncles()->members().find(sib_->parent());
@@ -248,15 +263,19 @@ class Simplex_tree_skeleton_simplex_iterator : public boost::iterator_facade<
// any end() iterator
Simplex_tree_skeleton_simplex_iterator()
- : st_(NULL) {
+ : sib_(nullptr),
+ st_(nullptr),
+ dim_skel_(0),
+ curr_dim_(0) {
}
Simplex_tree_skeleton_simplex_iterator(SimplexTree * st, int dim_skel)
- : st_(st),
+ : sib_(nullptr),
+ st_(st),
dim_skel_(dim_skel),
curr_dim_(0) {
- if (st == NULL || st->root() == NULL || st->root()->members().empty()) {
- st_ = NULL;
+ if (st == nullptr || st->root() == nullptr || st->root()->members().empty()) {
+ st_ = nullptr;
} else {
sh_ = st->root()->members().begin();
sib_ = st->root();
@@ -272,10 +291,10 @@ class Simplex_tree_skeleton_simplex_iterator : public boost::iterator_facade<
// valid when iterating along the SAME boundary.
bool equal(Simplex_tree_skeleton_simplex_iterator const& other) const {
- if (other.st_ == NULL) {
- return (st_ == NULL);
+ if (other.st_ == nullptr) {
+ return (st_ == nullptr);
}
- if (st_ == NULL) {
+ if (st_ == nullptr) {
return false;
}
return (&(sh_->second) == &(other.sh_->second));
@@ -289,8 +308,8 @@ class Simplex_tree_skeleton_simplex_iterator : public boost::iterator_facade<
void increment() {
++sh_;
if (sh_ == sib_->members().end()) {
- if (sib_->oncles() == NULL) {
- st_ = NULL;
+ if (sib_->oncles() == nullptr) {
+ st_ = nullptr;
return;
} // reach the end
sh_ = sib_->oncles()->members().find(sib_->parent());
diff --git a/src/Simplex_tree/include/gudhi/Simplex_tree/Simplex_tree_siblings.h b/src/Simplex_tree/include/gudhi/Simplex_tree/Simplex_tree_siblings.h
index c1ff8bf2..8942d92c 100644
--- a/src/Simplex_tree/include/gudhi/Simplex_tree/Simplex_tree_siblings.h
+++ b/src/Simplex_tree/include/gudhi/Simplex_tree/Simplex_tree_siblings.h
@@ -57,7 +57,7 @@ class Simplex_tree_siblings {
/* Default constructor.*/
Simplex_tree_siblings()
- : oncles_(NULL),
+ : oncles_(nullptr),
parent_(-1),
members_() {
}
diff --git a/src/Simplex_tree/test/simplex_tree_unit_test.cpp b/src/Simplex_tree/test/simplex_tree_unit_test.cpp
index 0d73d347..1a050a25 100644
--- a/src/Simplex_tree/test/simplex_tree_unit_test.cpp
+++ b/src/Simplex_tree/test/simplex_tree_unit_test.cpp
@@ -4,10 +4,12 @@
#include <utility> // std::pair, std::make_pair
#include <cmath> // float comparison
#include <limits>
+#include <functional> // greater
#define BOOST_TEST_DYN_LINK
#define BOOST_TEST_MODULE "simplex_tree"
#include <boost/test/unit_test.hpp>
+#include <boost/mpl/list.hpp>
// ^
// /!\ Nothing else from Simplex_tree shall be included to test includes are well defined.
@@ -15,26 +17,25 @@
using namespace Gudhi;
-typedef Simplex_tree<> typeST;
-typedef std::pair<typeST::Simplex_handle, bool> typePairSimplexBool;
-typedef std::vector<Vertex_handle> typeVectorVertex;
-typedef std::pair<typeVectorVertex, Filtration_value> typeSimplex;
+typedef boost::mpl::list<Simplex_tree<>, Simplex_tree<Simplex_tree_options_fast_persistence>> list_of_tested_variants;
const Vertex_handle DEFAULT_VERTEX_HANDLE = (const Vertex_handle) - 1;
const Filtration_value DEFAULT_FILTRATION_VALUE = (const Filtration_value) 0.0;
+template<class typeST>
void test_empty_simplex_tree(typeST& tst) {
BOOST_CHECK(tst.null_vertex() == DEFAULT_VERTEX_HANDLE);
BOOST_CHECK(tst.filtration() == DEFAULT_FILTRATION_VALUE);
BOOST_CHECK(tst.num_vertices() == (size_t) 0);
BOOST_CHECK(tst.num_simplices() == (size_t) 0);
- typeST::Siblings* STRoot = tst.root();
- BOOST_CHECK(STRoot != NULL);
- BOOST_CHECK(STRoot->oncles() == NULL);
+ typename typeST::Siblings* STRoot = tst.root();
+ BOOST_CHECK(STRoot != nullptr);
+ BOOST_CHECK(STRoot->oncles() == nullptr);
BOOST_CHECK(STRoot->parent() == DEFAULT_VERTEX_HANDLE);
BOOST_CHECK(tst.dimension() == -1);
}
+template<class typeST>
void test_iterators_on_empty_simplex_tree(typeST& tst) {
std::cout << "Iterator on vertices: " << std::endl;
for (auto vertex : tst.complex_vertex_range()) {
@@ -56,8 +57,9 @@ void test_iterators_on_empty_simplex_tree(typeST& tst) {
}
}
-BOOST_AUTO_TEST_CASE(simplex_tree_when_empty) {
- const Filtration_value DEFAULT_FILTRATION_VALUE = 0;
+BOOST_AUTO_TEST_CASE_TEMPLATE(simplex_tree_when_empty, typeST, list_of_tested_variants) {
+ typedef std::pair<typename typeST::Simplex_handle, bool> typePairSimplexBool;
+ typedef std::vector<Vertex_handle> typeVectorVertex;
std::cout << "********************************************************************" << std::endl;
std::cout << "TEST OF DEFAULT CONSTRUCTOR" << std::endl;
@@ -72,7 +74,7 @@ BOOST_AUTO_TEST_CASE(simplex_tree_when_empty) {
BOOST_CHECK(simplexVectorEmpty.empty() == true);
typePairSimplexBool returnEmptyValue = st.insert_simplex(simplexVectorEmpty,
DEFAULT_FILTRATION_VALUE);
- BOOST_CHECK(returnEmptyValue.first == typeST::Simplex_handle(NULL));
+ BOOST_CHECK(returnEmptyValue.first == typename typeST::Simplex_handle(nullptr));
BOOST_CHECK(returnEmptyValue.second == true);
test_empty_simplex_tree(st);
@@ -84,7 +86,7 @@ bool AreAlmostTheSame(float a, float b) {
return std::fabs(a - b) < std::numeric_limits<float>::epsilon();
}
-BOOST_AUTO_TEST_CASE(simplex_tree_from_file) {
+BOOST_AUTO_TEST_CASE_TEMPLATE(simplex_tree_from_file, typeST, list_of_tested_variants) {
// TEST OF INSERTION
std::cout << "********************************************************************" << std::endl;
std::cout << "TEST OF SIMPLEX TREE FROM A FILE" << std::endl;
@@ -101,7 +103,7 @@ BOOST_AUTO_TEST_CASE(simplex_tree_from_file) {
// Check
BOOST_CHECK(st.num_simplices() == 143353);
BOOST_CHECK(st.dimension() == 3);
- BOOST_CHECK(st.filtration() == 0.4);
+ BOOST_CHECK(AreAlmostTheSame(st.filtration(), 0.4));
int previous_size = 0;
for (auto f_simplex : st.filtration_simplex_range()) {
@@ -119,6 +121,7 @@ BOOST_AUTO_TEST_CASE(simplex_tree_from_file) {
simplex_tree_stream.close();
}
+template<class typeST, class typeSimplex>
void test_simplex_tree_contains(typeST& simplexTree, typeSimplex& simplex, int pos) {
auto f_simplex = simplexTree.filtration_simplex_range().begin() + pos;
@@ -135,16 +138,18 @@ void test_simplex_tree_contains(typeST& simplexTree, typeSimplex& simplex, int p
}
}
+template<class typeST, class typePairSimplexBool>
void test_simplex_tree_insert_returns_true(const typePairSimplexBool& returnValue) {
BOOST_CHECK(returnValue.second == true);
- typeST::Simplex_handle shReturned = returnValue.first; // Simplex_handle = boost::container::flat_map< Vertex_handle, Node >::iterator
- BOOST_CHECK(shReturned != typeST::Simplex_handle(NULL));
+ typename typeST::Simplex_handle shReturned = returnValue.first; // Simplex_handle = boost::container::flat_map< Vertex_handle, Node >::iterator
+ BOOST_CHECK(shReturned != typename typeST::Simplex_handle(nullptr));
}
// Global variables
Filtration_value max_fil = DEFAULT_FILTRATION_VALUE;
int dim_max = -1;
+template<class typeST, class Filtration_value>
void set_and_test_simplex_tree_dim_fil(typeST& simplexTree, int vectorSize, const Filtration_value& fil) {
if (vectorSize > dim_max + 1) {
dim_max = vectorSize - 1;
@@ -173,11 +178,17 @@ void set_and_test_simplex_tree_dim_fil(typeST& simplexTree, int vectorSize, cons
BOOST_CHECK(simplexTree.num_simplices() == num_simp);
}
-BOOST_AUTO_TEST_CASE(simplex_tree_insertion) {
+BOOST_AUTO_TEST_CASE_TEMPLATE(simplex_tree_insertion, typeST, list_of_tested_variants) {
+ typedef std::pair<typename typeST::Simplex_handle, bool> typePairSimplexBool;
+ typedef std::vector<Vertex_handle> typeVectorVertex;
+ typedef std::pair<typeVectorVertex, Filtration_value> typeSimplex;
const Filtration_value FIRST_FILTRATION_VALUE = 0.1;
const Filtration_value SECOND_FILTRATION_VALUE = 0.2;
const Filtration_value THIRD_FILTRATION_VALUE = 0.3;
const Filtration_value FOURTH_FILTRATION_VALUE = 0.4;
+ // reset since we run the test several times
+ dim_max = -1;
+ max_fil = DEFAULT_FILTRATION_VALUE;
// TEST OF INSERTION
std::cout << "********************************************************************" << std::endl;
@@ -191,7 +202,7 @@ BOOST_AUTO_TEST_CASE(simplex_tree_insertion) {
typeSimplex firstSimplex = std::make_pair(firstSimplexVector, Filtration_value(FIRST_FILTRATION_VALUE));
typePairSimplexBool returnValue = st.insert_simplex(firstSimplex.first, firstSimplex.second);
- test_simplex_tree_insert_returns_true(returnValue);
+ test_simplex_tree_insert_returns_true<typeST>(returnValue);
set_and_test_simplex_tree_dim_fil(st, firstSimplexVector.size(), firstSimplex.second);
BOOST_CHECK(st.num_vertices() == (size_t) 1);
@@ -202,7 +213,7 @@ BOOST_AUTO_TEST_CASE(simplex_tree_insertion) {
typeSimplex secondSimplex = std::make_pair(secondSimplexVector, Filtration_value(FIRST_FILTRATION_VALUE));
returnValue = st.insert_simplex(secondSimplex.first, secondSimplex.second);
- test_simplex_tree_insert_returns_true(returnValue);
+ test_simplex_tree_insert_returns_true<typeST>(returnValue);
set_and_test_simplex_tree_dim_fil(st, secondSimplexVector.size(), secondSimplex.second);
BOOST_CHECK(st.num_vertices() == (size_t) 2);
@@ -213,7 +224,7 @@ BOOST_AUTO_TEST_CASE(simplex_tree_insertion) {
typeSimplex thirdSimplex = std::make_pair(thirdSimplexVector, Filtration_value(SECOND_FILTRATION_VALUE));
returnValue = st.insert_simplex(thirdSimplex.first, thirdSimplex.second);
- test_simplex_tree_insert_returns_true(returnValue);
+ test_simplex_tree_insert_returns_true<typeST>(returnValue);
set_and_test_simplex_tree_dim_fil(st, thirdSimplexVector.size(), thirdSimplex.second);
BOOST_CHECK(st.num_vertices() == (size_t) 2); // Not incremented !!
@@ -224,7 +235,7 @@ BOOST_AUTO_TEST_CASE(simplex_tree_insertion) {
typeSimplex fourthSimplex = std::make_pair(fourthSimplexVector, Filtration_value(FIRST_FILTRATION_VALUE));
returnValue = st.insert_simplex(fourthSimplex.first, fourthSimplex.second);
- test_simplex_tree_insert_returns_true(returnValue);
+ test_simplex_tree_insert_returns_true<typeST>(returnValue);
set_and_test_simplex_tree_dim_fil(st, fourthSimplexVector.size(), fourthSimplex.second);
BOOST_CHECK(st.num_vertices() == (size_t) 3);
@@ -235,7 +246,7 @@ BOOST_AUTO_TEST_CASE(simplex_tree_insertion) {
typeSimplex fifthSimplex = std::make_pair(fifthSimplexVector, Filtration_value(SECOND_FILTRATION_VALUE));
returnValue = st.insert_simplex(fifthSimplex.first, fifthSimplex.second);
- test_simplex_tree_insert_returns_true(returnValue);
+ test_simplex_tree_insert_returns_true<typeST>(returnValue);
set_and_test_simplex_tree_dim_fil(st, fifthSimplexVector.size(), fifthSimplex.second);
BOOST_CHECK(st.num_vertices() == (size_t) 3); // Not incremented !!
@@ -246,7 +257,7 @@ BOOST_AUTO_TEST_CASE(simplex_tree_insertion) {
typeSimplex sixthSimplex = std::make_pair(sixthSimplexVector, Filtration_value(SECOND_FILTRATION_VALUE));
returnValue = st.insert_simplex(sixthSimplex.first, sixthSimplex.second);
- test_simplex_tree_insert_returns_true(returnValue);
+ test_simplex_tree_insert_returns_true<typeST>(returnValue);
set_and_test_simplex_tree_dim_fil(st, sixthSimplexVector.size(), sixthSimplex.second);
BOOST_CHECK(st.num_vertices() == (size_t) 3); // Not incremented !!
@@ -257,7 +268,7 @@ BOOST_AUTO_TEST_CASE(simplex_tree_insertion) {
typeSimplex seventhSimplex = std::make_pair(seventhSimplexVector, Filtration_value(THIRD_FILTRATION_VALUE));
returnValue = st.insert_simplex(seventhSimplex.first, seventhSimplex.second);
- test_simplex_tree_insert_returns_true(returnValue);
+ test_simplex_tree_insert_returns_true<typeST>(returnValue);
set_and_test_simplex_tree_dim_fil(st, seventhSimplexVector.size(), seventhSimplex.second);
BOOST_CHECK(st.num_vertices() == (size_t) 3); // Not incremented !!
@@ -268,7 +279,7 @@ BOOST_AUTO_TEST_CASE(simplex_tree_insertion) {
typeSimplex eighthSimplex = std::make_pair(eighthSimplexVector, Filtration_value(FIRST_FILTRATION_VALUE));
returnValue = st.insert_simplex(eighthSimplex.first, eighthSimplex.second);
- test_simplex_tree_insert_returns_true(returnValue);
+ test_simplex_tree_insert_returns_true<typeST>(returnValue);
set_and_test_simplex_tree_dim_fil(st, eighthSimplexVector.size(), eighthSimplex.second);
BOOST_CHECK(st.num_vertices() == (size_t) 4);
@@ -279,7 +290,7 @@ BOOST_AUTO_TEST_CASE(simplex_tree_insertion) {
typeSimplex ninethSimplex = std::make_pair(ninethSimplexVector, Filtration_value(SECOND_FILTRATION_VALUE));
returnValue = st.insert_simplex(ninethSimplex.first, ninethSimplex.second);
- test_simplex_tree_insert_returns_true(returnValue);
+ test_simplex_tree_insert_returns_true<typeST>(returnValue);
set_and_test_simplex_tree_dim_fil(st, ninethSimplexVector.size(), ninethSimplex.second);
BOOST_CHECK(st.num_vertices() == (size_t) 4); // Not incremented !!
@@ -292,8 +303,8 @@ BOOST_AUTO_TEST_CASE(simplex_tree_insertion) {
returnValue = st.insert_simplex(tenthSimplex.first, tenthSimplex.second);
BOOST_CHECK(returnValue.second == false);
- typeST::Simplex_handle shReturned = returnValue.first; // Simplex_handle = boost::container::flat_map< Vertex_handle, Node >::iterator
- BOOST_CHECK(shReturned == typeST::Simplex_handle(NULL));
+ typename typeST::Simplex_handle shReturned = returnValue.first; // Simplex_handle = boost::container::flat_map< Vertex_handle, Node >::iterator
+ BOOST_CHECK(shReturned == typename typeST::Simplex_handle(nullptr));
BOOST_CHECK(st.num_vertices() == (size_t) 4); // Not incremented !!
BOOST_CHECK(st.dimension() == dim_max);
BOOST_CHECK(AreAlmostTheSame(st.filtration(), max_fil));
@@ -307,7 +318,7 @@ BOOST_AUTO_TEST_CASE(simplex_tree_insertion) {
BOOST_CHECK(returnValue.second == false);
shReturned = returnValue.first; // Simplex_handle = boost::container::flat_map< Vertex_handle, Node >::iterator
- BOOST_CHECK(shReturned == typeST::Simplex_handle(NULL));
+ BOOST_CHECK(shReturned == typename typeST::Simplex_handle(nullptr));
BOOST_CHECK(st.num_vertices() == (size_t) 4); // Not incremented !!
BOOST_CHECK(st.dimension() == dim_max);
BOOST_CHECK(AreAlmostTheSame(st.filtration(), max_fil));
@@ -351,7 +362,7 @@ BOOST_AUTO_TEST_CASE(simplex_tree_insertion) {
// Display the Simplex_tree - Can not be done in the middle of 2 inserts
std::cout << "The complex contains " << st.num_simplices() << " simplices" << std::endl;
std::cout << " - dimension " << st.dimension() << " - filtration " << st.filtration() << std::endl;
- std::cout << "Iterator on Simplices in the filtration, with [filtration value]:" << std::endl;
+ std::cout << std::endl << std::endl << "Iterator on Simplices in the filtration, with [filtration value]:" << std::endl;
for (auto f_simplex : st.filtration_simplex_range()) {
std::cout << " " << "[" << st.filtration(f_simplex) << "] ";
for (auto vertex : st.simplex_vertex_range(f_simplex)) {
@@ -362,11 +373,10 @@ BOOST_AUTO_TEST_CASE(simplex_tree_insertion) {
}
-bool sort_in_decr_order(Vertex_handle i, Vertex_handle j) {
- return (i > j);
-}
-
-BOOST_AUTO_TEST_CASE(NSimplexAndSubfaces_tree_insertion) {
+BOOST_AUTO_TEST_CASE_TEMPLATE(NSimplexAndSubfaces_tree_insertion, typeST, list_of_tested_variants) {
+ typedef std::pair<typename typeST::Simplex_handle, bool> typePairSimplexBool;
+ typedef std::vector<Vertex_handle> typeVectorVertex;
+ typedef std::pair<typeVectorVertex, Filtration_value> typeSimplex;
std::cout << "********************************************************************" << std::endl;
std::cout << "TEST OF RECURSIVE INSERTION" << std::endl;
typeST st;
@@ -384,7 +394,7 @@ BOOST_AUTO_TEST_CASE(NSimplexAndSubfaces_tree_insertion) {
// Check it is well inserted
BOOST_CHECK(true == returnValue.second);
position = 0;
- std::sort(SimplexVector1.begin(), SimplexVector1.end(), sort_in_decr_order);
+ std::sort(SimplexVector1.begin(), SimplexVector1.end(), std::greater<Vertex_handle>());
for (auto vertex : st.simplex_vertex_range(returnValue.first)) {
// Check returned Simplex_handle
std::cout << "vertex = " << vertex << " | vector[" << position << "] = " << SimplexVector1[position] << std::endl;
@@ -403,7 +413,7 @@ BOOST_AUTO_TEST_CASE(NSimplexAndSubfaces_tree_insertion) {
// Check it is well inserted
BOOST_CHECK(true == returnValue.second);
position = 0;
- std::sort(SimplexVector2.begin(), SimplexVector2.end(), sort_in_decr_order);
+ std::sort(SimplexVector2.begin(), SimplexVector2.end(), std::greater<Vertex_handle>());
for (auto vertex : st.simplex_vertex_range(returnValue.first)) {
// Check returned Simplex_handle
std::cout << "vertex = " << vertex << " | vector[" << position << "] = " << SimplexVector2[position] << std::endl;
@@ -422,7 +432,7 @@ BOOST_AUTO_TEST_CASE(NSimplexAndSubfaces_tree_insertion) {
// Check it is well inserted
BOOST_CHECK(true == returnValue.second);
position = 0;
- std::sort(SimplexVector3.begin(), SimplexVector3.end(), sort_in_decr_order);
+ std::sort(SimplexVector3.begin(), SimplexVector3.end(), std::greater<Vertex_handle>());
for (auto vertex : st.simplex_vertex_range(returnValue.first)) {
// Check returned Simplex_handle
std::cout << "vertex = " << vertex << " | vector[" << position << "] = " << SimplexVector3[position] << std::endl;
@@ -452,7 +462,7 @@ BOOST_AUTO_TEST_CASE(NSimplexAndSubfaces_tree_insertion) {
// Check it is well inserted
BOOST_CHECK(true == returnValue.second);
position = 0;
- std::sort(SimplexVector5.begin(), SimplexVector5.end(), sort_in_decr_order);
+ std::sort(SimplexVector5.begin(), SimplexVector5.end(), std::greater<Vertex_handle>());
for (auto vertex : st.simplex_vertex_range(returnValue.first)) {
// Check returned Simplex_handle
std::cout << "vertex = " << vertex << " | vector[" << position << "] = " << SimplexVector5[position] << std::endl;
@@ -471,14 +481,14 @@ BOOST_AUTO_TEST_CASE(NSimplexAndSubfaces_tree_insertion) {
// Check it is well inserted
BOOST_CHECK(true == returnValue.second);
position = 0;
- std::sort(SimplexVector6.begin(), SimplexVector6.end(), sort_in_decr_order);
+ std::sort(SimplexVector6.begin(), SimplexVector6.end(), std::greater<Vertex_handle>());
for (auto vertex : st.simplex_vertex_range(returnValue.first)) {
// Check returned Simplex_handle
std::cout << "vertex = " << vertex << " | vector[" << position << "] = " << SimplexVector6[position] << std::endl;
BOOST_CHECK(vertex == SimplexVector6[position]);
position++;
}
-
+
/* Inserted simplex: */
/* 1 6 */
/* o---o */
@@ -494,11 +504,24 @@ BOOST_AUTO_TEST_CASE(NSimplexAndSubfaces_tree_insertion) {
/* A facet [3,4,5] */
/* A cell [0,1,6,7] */
+ typeSimplex simplexPair1 = std::make_pair(SimplexVector1, DEFAULT_FILTRATION_VALUE);
+ typeSimplex simplexPair2 = std::make_pair(SimplexVector2, DEFAULT_FILTRATION_VALUE);
+ typeSimplex simplexPair3 = std::make_pair(SimplexVector3, DEFAULT_FILTRATION_VALUE);
+ typeSimplex simplexPair4 = std::make_pair(SimplexVector4, DEFAULT_FILTRATION_VALUE);
+ typeSimplex simplexPair5 = std::make_pair(SimplexVector5, DEFAULT_FILTRATION_VALUE);
+ typeSimplex simplexPair6 = std::make_pair(SimplexVector6, DEFAULT_FILTRATION_VALUE);
+ test_simplex_tree_contains(st, simplexPair1, 6); // (2,1,0) is in position 6
+ test_simplex_tree_contains(st, simplexPair2, 7); // (3) is in position 7
+ test_simplex_tree_contains(st, simplexPair3, 8); // (3,0) is in position 8
+ test_simplex_tree_contains(st, simplexPair4, 2); // (1,0) is in position 2
+ test_simplex_tree_contains(st, simplexPair5, 14); // (3,4,5) is in position 14
+ test_simplex_tree_contains(st, simplexPair6, 26); // (7,6,1,0) is in position 26
+
// ------------------------------------------------------------------------------------------------------------------
// Find in the simplex_tree
// ------------------------------------------------------------------------------------------------------------------
typeVectorVertex simpleSimplexVector{1};
- Simplex_tree<>::Simplex_handle simplexFound = st.find(simpleSimplexVector);
+ typename typeST::Simplex_handle simplexFound = st.find(simpleSimplexVector);
std::cout << "**************IS THE SIMPLEX {1} IN THE SIMPLEX TREE ?\n";
if (simplexFound != st.null_simplex())
std::cout << "***+ YES IT IS!\n";
@@ -549,7 +572,7 @@ BOOST_AUTO_TEST_CASE(NSimplexAndSubfaces_tree_insertion) {
// Display the Simplex_tree - Can not be done in the middle of 2 inserts
std::cout << "The complex contains " << st.num_simplices() << " simplices" << std::endl;
std::cout << " - dimension " << st.dimension() << " - filtration " << st.filtration() << std::endl;
- std::cout << "Iterator on Simplices in the filtration, with [filtration value]:" << std::endl;
+ std::cout << std::endl << std::endl << "Iterator on Simplices in the filtration, with [filtration value]:" << std::endl;
for (auto f_simplex : st.filtration_simplex_range()) {
std::cout << " " << "[" << st.filtration(f_simplex) << "] ";
for (auto vertex : st.simplex_vertex_range(f_simplex)) {
@@ -559,14 +582,15 @@ BOOST_AUTO_TEST_CASE(NSimplexAndSubfaces_tree_insertion) {
}
}
-void test_cofaces(typeST& st, std::vector<Vertex_handle> expected, int dim, std::vector<typeST::Simplex_handle> res) {
- typeST::Cofaces_simplex_range cofaces;
+template<class typeST, class Vertex_handle>
+void test_cofaces(typeST& st, const std::vector<Vertex_handle>& expected, int dim, const std::vector<typename typeST::Simplex_handle>& res) {
+ typename typeST::Cofaces_simplex_range cofaces;
if (dim == 0)
cofaces = st.star_simplex_range(st.find(expected));
else
cofaces = st.cofaces_simplex_range(st.find(expected), dim);
for (auto simplex = cofaces.begin(); simplex != cofaces.end(); ++simplex) {
- typeST::Simplex_vertex_range rg = st.simplex_vertex_range(*simplex);
+ typename typeST::Simplex_vertex_range rg = st.simplex_vertex_range(*simplex);
for (auto vertex = rg.begin(); vertex != rg.end(); ++vertex) {
std::cout << "(" << *vertex << ")";
}
@@ -575,7 +599,8 @@ void test_cofaces(typeST& st, std::vector<Vertex_handle> expected, int dim, std:
}
}
-BOOST_AUTO_TEST_CASE(coface_on_simplex_tree) {
+BOOST_AUTO_TEST_CASE_TEMPLATE(coface_on_simplex_tree, typeST, list_of_tested_variants) {
+ typedef std::vector<Vertex_handle> typeVectorVertex;
std::cout << "********************************************************************" << std::endl;
std::cout << "TEST COFACE ALGORITHM" << std::endl;
typeST st;
@@ -605,7 +630,7 @@ BOOST_AUTO_TEST_CASE(coface_on_simplex_tree) {
st.set_dimension(3);
std::vector<Vertex_handle> simplex_result;
- std::vector<typeST::Simplex_handle> result;
+ std::vector<typename typeST::Simplex_handle> result;
std::cout << "First test - Star of (3):" << std::endl;
simplex_result = {3};
@@ -673,7 +698,8 @@ BOOST_AUTO_TEST_CASE(coface_on_simplex_tree) {
}
-BOOST_AUTO_TEST_CASE(copy_move_on_simplex_tree) {
+BOOST_AUTO_TEST_CASE_TEMPLATE(copy_move_on_simplex_tree, typeST, list_of_tested_variants) {
+ typedef std::vector<Vertex_handle> typeVectorVertex;
std::cout << "********************************************************************" << std::endl;
std::cout << "TEST COPY MOVE CONSTRUCTORS" << std::endl;
typeST st;
@@ -722,21 +748,58 @@ BOOST_AUTO_TEST_CASE(copy_move_on_simplex_tree) {
// Check there is a new simplex tree reference
BOOST_CHECK(&st_move != &st_copy);
BOOST_CHECK(&st_move != &st);
-
+
typeST st_empty;
// Check st has been emptied by the move
BOOST_CHECK(st == st_empty);
BOOST_CHECK(st.filtration() == 0);
BOOST_CHECK(st.dimension() == -1);
BOOST_CHECK(st.num_simplices() == 0);
- BOOST_CHECK(st.num_vertices() == (size_t) 0);
-
+ BOOST_CHECK(st.num_vertices() == (size_t)0);
+
std::cout << "Printing st once again- address = " << &st << std::endl;
}
+template<class typeST>
+void test_simplex_is_vertex(typeST& st, typename typeST::Simplex_handle sh, typename typeST::Vertex_handle v) {
+ BOOST_CHECK(st.dimension(sh) == 0);
+ auto&& r = st.simplex_vertex_range(sh);
+ auto i = std::begin(r);
+ BOOST_CHECK(*i == v);
+ BOOST_CHECK(++i == std::end(r));
+}
+
+BOOST_AUTO_TEST_CASE(non_contiguous) {
+ typedef Simplex_tree<> typeST;
+ typedef typeST::Vertex_handle Vertex_handle;
+ typedef typeST::Simplex_handle Simplex_handle;
+ std::cout << "********************************************************************" << std::endl;
+ std::cout << "TEST NON-CONTIGUOUS VERTICES" << std::endl;
+ typeST st;
+ Vertex_handle e[] = {3,-7};
+ std::cout << "Insert" << std::endl;
+ st.insert_simplex_and_subfaces(e);
+ BOOST_CHECK(st.num_vertices() == 2);
+ BOOST_CHECK(st.num_simplices() == 3);
+ std::cout << "Find" << std::endl;
+ Simplex_handle sh = st.find(e);
+ BOOST_CHECK(sh != st.null_simplex());
+ std::cout << "Endpoints" << std::endl;
+ auto p = st.endpoints(sh);
+ test_simplex_is_vertex(st, p.first, 3);
+ test_simplex_is_vertex(st, p.second, -7);
+ std::cout << "Boundary" << std::endl;
+ auto&& b = st.boundary_simplex_range(sh);
+ auto i = std::begin(b);
+ test_simplex_is_vertex(st, *i, -7);
+ test_simplex_is_vertex(st, *++i, 3);
+ BOOST_CHECK(++i == std::end(b));
+}
+
BOOST_AUTO_TEST_CASE(make_filtration_non_decreasing) {
std::cout << "********************************************************************" << std::endl;
std::cout << "MAKE FILTRATION NON DECREASING" << std::endl;
+ typedef Simplex_tree<> typeST;
typeST st;
st.insert_simplex_and_subfaces({2, 1, 0}, 4.0);
@@ -803,12 +866,13 @@ struct MyOptions : Simplex_tree_options_full_featured {
// I have few vertices
typedef short Vertex_handle;
};
-typedef Simplex_tree<MyOptions> miniST;
BOOST_AUTO_TEST_CASE(remove_maximal_simplex) {
std::cout << "********************************************************************" << std::endl;
std::cout << "REMOVE MAXIMAL SIMPLEX" << std::endl;
+
+ typedef Simplex_tree<MyOptions> miniST;
miniST st;
// FIXME
@@ -892,6 +956,7 @@ BOOST_AUTO_TEST_CASE(remove_maximal_simplex) {
BOOST_AUTO_TEST_CASE(prune_above_filtration) {
std::cout << "********************************************************************" << std::endl;
std::cout << "PRUNE ABOVE FILTRATION" << std::endl;
+ typedef Simplex_tree<> typeST;
typeST st;
// FIXME
diff --git a/src/cmake/modules/FindTBB.cmake b/src/cmake/modules/FindTBB.cmake
new file mode 100644
index 00000000..414a929b
--- /dev/null
+++ b/src/cmake/modules/FindTBB.cmake
@@ -0,0 +1,433 @@
+# Locate Intel Threading Building Blocks include paths and libraries
+# FindTBB.cmake can be found at https://code.google.com/p/findtbb/
+# Written by Hannes Hofmann <hannes.hofmann _at_ informatik.uni-erlangen.de>
+# Improvements by Gino van den Bergen <gino _at_ dtecta.com>,
+# Florian Uhlig <F.Uhlig _at_ gsi.de>,
+# Jiri Marsik <jiri.marsik89 _at_ gmail.com>
+
+# The MIT License
+#
+# Copyright (c) 2011 Hannes Hofmann
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+# GvdB: This module uses the environment variable TBB_ARCH_PLATFORM which defines architecture and compiler.
+# e.g. "ia32/vc8" or "em64t/cc4.1.0_libc2.4_kernel2.6.16.21"
+# TBB_ARCH_PLATFORM is set by the build script tbbvars[.bat|.sh|.csh], which can be found
+# in the TBB installation directory (TBB_INSTALL_DIR).
+#
+# GvdB: Mac OS X distribution places libraries directly in lib directory.
+#
+# For backwards compatibility, you may explicitely set the CMake variables TBB_ARCHITECTURE and TBB_COMPILER.
+# TBB_ARCHITECTURE [ ia32 | em64t | itanium ]
+# which architecture to use
+# TBB_COMPILER e.g. vc9 or cc3.2.3_libc2.3.2_kernel2.4.21 or cc4.0.1_os10.4.9
+# which compiler to use (detected automatically on Windows)
+
+# This module respects
+# TBB_INSTALL_DIR or $ENV{TBB21_INSTALL_DIR} or $ENV{TBB_INSTALL_DIR}
+
+# This module defines
+# TBB_INCLUDE_DIRS, where to find task_scheduler_init.h, etc.
+# TBB_LIBRARY_DIRS, where to find TBB libraries
+# TBB_INSTALL_DIR, the base TBB install directory.
+# TBB_LIBRARIES, all the following TBB libraries (both release and debug versions, using "optimized" and "debug" CMake keywords). Note that if the debug versions are not found, the release versions will be used instead for the debug mode.
+# TBB_RELEASE_LIBRARY, the TBB release library
+# TBB_MALLOC_RELEASE_LIBRARY, the TBB release malloc library
+# TBB_DEBUG_LIBRARY, the TBB debug library
+# TBB_MALLOC_DEBUG_LIBRARY, the TBB debug malloc library
+# TBB_FOUND, If false, don't try to use TBB.
+# TBB_INTERFACE_VERSION, as defined in tbb/tbb_stddef.h
+# TBB_MALLOCPROXY_DEBUG_LIBRARY, the TBB debug malloc_proxy library (not included in TBB_LIBRARIES since it's optionnal)
+# TBB_MALLOCPROXY_RELEASE_LIBRARY, the TBB release malloc_proxy library (not included in TBB_LIBRARIES since it's optionnal)
+
+include(CheckCXXSourceCompiles)
+
+# Usage:
+# try_TBB_with_pthread(<result_var_name> [additional linker args...])
+function(try_TBB_with_pthread result_var)
+ set(TBB_try_ts_source "
+ #include <tbb/enumerable_thread_specific.h>
+ int main() {
+ tbb::enumerable_thread_specific<
+ bool*,
+ tbb::cache_aligned_allocator<bool*>,
+ tbb::ets_key_per_instance> grid;
+ }
+ ")
+ set(CMAKE_REQUIRED_LIBRARIES ${ALL_TBB_LIBRARIES} ${ARGN})
+ set(CMAKE_REQUIRED_INCLUDES ${TBB_INCLUDE_DIR})
+ check_cxx_source_compiles("${TBB_try_ts_source}" ${result_var})
+ set(${result_var} ${${result_var}} PARENT_SCOPE)
+endfunction(try_TBB_with_pthread)
+
+if (WIN32)
+ # has em64t/vc8 em64t/vc9
+ # has ia32/vc7.1 ia32/vc8 ia32/vc9
+ set(_TBB_DEFAULT_INSTALL_DIR "C:/Program Files/Intel/TBB" "C:/Program Files (x86)/Intel/TBB")
+ set(_TBB_LIB_RELEASE_NAME "tbb")
+ set(_TBB_LIB_MALLOC_RELEASE_NAME "${_TBB_LIB_RELEASE_NAME}malloc")
+ set(_TBB_LIB_MALLOCPROXY_RELEASE_NAME "${_TBB_LIB_RELEASE_NAME}malloc_proxy")
+ set(_TBB_LIB_DEBUG_NAME "${_TBB_LIB_RELEASE_NAME}_debug")
+ set(_TBB_LIB_MALLOC_DEBUG_NAME "${_TBB_LIB_MALLOC_RELEASE_NAME}_debug")
+ set(_TBB_LIB_MALLOCPROXY_DEBUG_NAME "${_TBB_LIB_MALLOCPROXY_RELEASE_NAME}_debug")
+ if (MSVC71)
+ set (_TBB_COMPILER "vc7.1")
+ endif(MSVC71)
+ if (MSVC80)
+ set(_TBB_COMPILER "vc8")
+ endif(MSVC80)
+ if (MSVC90)
+ set(_TBB_COMPILER "vc9")
+ endif(MSVC90)
+ if(MSVC10)
+ set(_TBB_COMPILER "vc10")
+ endif(MSVC10)
+ if(MSVC11)
+ set(_TBB_COMPILER "vc11")
+ endif(MSVC11)
+ if(MSVC12)
+ set(_TBB_COMPILER "vc12")
+ endif(MSVC12)
+ #note there was no MSVC13
+ if(MSVC14)
+ if(RUNNING_CGAL_AUTO_TEST)
+ set (TBB_FOUND "NO")
+ return()#binaries for TBB not publicly available when CGAL-4.7 is published
+ endif(RUNNING_CGAL_AUTO_TEST)
+ message(STATUS "[Warning] FindTBB.cmake: TBB 4.4 (latest available when CGAL-4.7 is published) does not provide support for MSVC 2015.")
+ endif(MSVC14)
+ # Todo: add other Windows compilers such as ICL.
+ set(_TBB_ARCHITECTURE ${TBB_ARCHITECTURE})
+endif (WIN32)
+
+if (UNIX)
+ if (APPLE)
+ # MAC
+ set(_TBB_DEFAULT_INSTALL_DIR "/Library/Frameworks/Intel_TBB.framework/Versions")
+ # libs: libtbb.dylib, libtbbmalloc.dylib, *_debug
+ set(_TBB_LIB_RELEASE_NAME "tbb")
+ set(_TBB_LIB_MALLOC_RELEASE_NAME "${_TBB_LIB_RELEASE_NAME}malloc")
+ #set(_TBB_LIB_MALLOCPROXY_RELEASE_NAME "${_TBB_LIB_RELEASE_NAME}malloc_proxy")
+ set(_TBB_LIB_DEBUG_NAME "${_TBB_LIB_RELEASE_NAME}_debug")
+ set(_TBB_LIB_MALLOC_DEBUG_NAME "${_TBB_LIB_MALLOC_RELEASE_NAME}_debug")
+ #set(_TBB_LIB_MALLOCPROXY_DEBUG_NAME "${_TBB_LIB_MALLOCPROXY_RELEASE_NAME}_debug")
+ # default flavor on apple: ia32/cc4.0.1_os10.4.9
+ # Jiri: There is no reason to presume there is only one flavor and
+ # that user's setting of variables should be ignored.
+ if(NOT TBB_COMPILER)
+ set(_TBB_COMPILER "cc4.0.1_os10.4.9")
+ elseif (NOT TBB_COMPILER)
+ set(_TBB_COMPILER ${TBB_COMPILER})
+ endif(NOT TBB_COMPILER)
+ if(NOT TBB_ARCHITECTURE)
+ set(_TBB_ARCHITECTURE "ia32")
+ elseif(NOT TBB_ARCHITECTURE)
+ set(_TBB_ARCHITECTURE ${TBB_ARCHITECTURE})
+ endif(NOT TBB_ARCHITECTURE)
+ else (APPLE)
+ # LINUX
+ set(_TBB_DEFAULT_INSTALL_DIR "/opt/intel/tbb" "/usr/local/include" "/usr/include")
+ set(_TBB_LIB_RELEASE_NAME "tbb")
+ set(_TBB_LIB_MALLOC_RELEASE_NAME "${_TBB_LIB_RELEASE_NAME}malloc")
+ set(_TBB_LIB_MALLOCPROXY_RELEASE_NAME "${_TBB_LIB_RELEASE_NAME}malloc_proxy")
+ set(_TBB_LIB_DEBUG_NAME "${_TBB_LIB_RELEASE_NAME}_debug")
+ set(_TBB_LIB_MALLOC_DEBUG_NAME "${_TBB_LIB_MALLOC_RELEASE_NAME}_debug")
+ set(_TBB_LIB_MALLOCPROXY_DEBUG_NAME "${_TBB_LIB_MALLOCPROXY_RELEASE_NAME}_debug")
+ # has em64t/cc3.2.3_libc2.3.2_kernel2.4.21 em64t/cc3.3.3_libc2.3.3_kernel2.6.5 em64t/cc3.4.3_libc2.3.4_kernel2.6.9 em64t/cc4.1.0_libc2.4_kernel2.6.16.21
+ # has ia32/*
+ # has itanium/*
+ set(_TBB_COMPILER ${TBB_COMPILER})
+ set(_TBB_ARCHITECTURE ${TBB_ARCHITECTURE})
+ endif (APPLE)
+endif (UNIX)
+
+if (CMAKE_SYSTEM MATCHES "SunOS.*")
+# SUN
+# not yet supported
+# has em64t/cc3.4.3_kernel5.10
+# has ia32/*
+endif (CMAKE_SYSTEM MATCHES "SunOS.*")
+
+
+#-- Clear the public variables
+set (TBB_FOUND "NO")
+
+
+#-- Find TBB install dir and set ${_TBB_INSTALL_DIR} and cached ${TBB_INSTALL_DIR}
+# first: use CMake variable TBB_INSTALL_DIR
+if (TBB_INSTALL_DIR)
+ set (_TBB_INSTALL_DIR ${TBB_INSTALL_DIR})
+endif (TBB_INSTALL_DIR)
+# second: use environment variable
+if (NOT _TBB_INSTALL_DIR)
+ if (NOT "$ENV{TBBROOT}" STREQUAL "")
+ set (_TBB_INSTALL_DIR $ENV{TBBROOT})
+ endif (NOT "$ENV{TBBROOT}" STREQUAL "")
+ if (NOT "$ENV{TBB_INSTALL_DIR}" STREQUAL "")
+ set (_TBB_INSTALL_DIR $ENV{TBB_INSTALL_DIR})
+ endif (NOT "$ENV{TBB_INSTALL_DIR}" STREQUAL "")
+ # Intel recommends setting TBB21_INSTALL_DIR
+ if (NOT "$ENV{TBB21_INSTALL_DIR}" STREQUAL "")
+ set (_TBB_INSTALL_DIR $ENV{TBB21_INSTALL_DIR})
+ endif (NOT "$ENV{TBB21_INSTALL_DIR}" STREQUAL "")
+ if (NOT "$ENV{TBB22_INSTALL_DIR}" STREQUAL "")
+ set (_TBB_INSTALL_DIR $ENV{TBB22_INSTALL_DIR})
+ endif (NOT "$ENV{TBB22_INSTALL_DIR}" STREQUAL "")
+ if (NOT "$ENV{TBB30_INSTALL_DIR}" STREQUAL "")
+ set (_TBB_INSTALL_DIR $ENV{TBB30_INSTALL_DIR})
+ endif (NOT "$ENV{TBB30_INSTALL_DIR}" STREQUAL "")
+endif (NOT _TBB_INSTALL_DIR)
+# third: try to find path automatically
+if (NOT _TBB_INSTALL_DIR)
+ if (_TBB_DEFAULT_INSTALL_DIR)
+ set (_TBB_INSTALL_DIR ${_TBB_DEFAULT_INSTALL_DIR})
+ endif (_TBB_DEFAULT_INSTALL_DIR)
+endif (NOT _TBB_INSTALL_DIR)
+# sanity check
+if (NOT _TBB_INSTALL_DIR)
+ message ("ERROR: Unable to find Intel TBB install directory. ${_TBB_INSTALL_DIR}")
+else (NOT _TBB_INSTALL_DIR)
+# finally: set the cached CMake variable TBB_INSTALL_DIR
+if (NOT TBB_INSTALL_DIR)
+ set (TBB_INSTALL_DIR ${_TBB_INSTALL_DIR} CACHE PATH "Intel TBB install directory")
+ mark_as_advanced(TBB_INSTALL_DIR)
+endif (NOT TBB_INSTALL_DIR)
+
+
+#-- A macro to rewrite the paths of the library. This is necessary, because
+# find_library() always found the em64t/vc9 version of the TBB libs
+macro(TBB_CORRECT_LIB_DIR var_name)
+# if (NOT "${_TBB_ARCHITECTURE}" STREQUAL "em64t")
+ string(REPLACE em64t "${_TBB_ARCHITECTURE}" ${var_name} ${${var_name}})
+# endif (NOT "${_TBB_ARCHITECTURE}" STREQUAL "em64t")
+ string(REPLACE ia32 "${_TBB_ARCHITECTURE}" ${var_name} ${${var_name}})
+ string(REPLACE vc7.1 "${_TBB_COMPILER}" ${var_name} ${${var_name}})
+ string(REPLACE vc8 "${_TBB_COMPILER}" ${var_name} ${${var_name}})
+ string(REPLACE vc9 "${_TBB_COMPILER}" ${var_name} ${${var_name}})
+ string(REPLACE vc10 "${_TBB_COMPILER}" ${var_name} ${${var_name}})
+ string(REPLACE vc11 "${_TBB_COMPILER}" ${var_name} ${${var_name}})
+endmacro(TBB_CORRECT_LIB_DIR var_content)
+
+
+#-- Look for include directory and set ${TBB_INCLUDE_DIR}
+set (TBB_INC_SEARCH_DIR ${_TBB_INSTALL_DIR}/include)
+# Jiri: tbbvars now sets the CPATH environment variable to the directory
+# containing the headers.
+# LR: search first with NO_DEFAULT_PATH...
+find_path(TBB_INCLUDE_DIR
+ tbb/task_scheduler_init.h
+ PATHS ${TBB_INC_SEARCH_DIR} ENV CPATH
+ NO_DEFAULT_PATH
+)
+if(NOT TBB_INCLUDE_DIR)
+# LR: ... and then search again with NO_DEFAULT_PATH if nothing was found in
+# hinted paths
+ find_path(TBB_INCLUDE_DIR
+ tbb/task_scheduler_init.h
+ PATHS ${TBB_INC_SEARCH_DIR} ENV CPATH
+ )
+endif()
+mark_as_advanced(TBB_INCLUDE_DIR)
+
+
+#-- Look for libraries
+# GvdB: $ENV{TBB_ARCH_PLATFORM} is set by the build script tbbvars[.bat|.sh|.csh]
+if (NOT $ENV{TBB_ARCH_PLATFORM} STREQUAL "")
+ set (_TBB_LIBRARY_DIR
+ ${_TBB_INSTALL_DIR}/lib/$ENV{TBB_ARCH_PLATFORM}
+ ${_TBB_INSTALL_DIR}/$ENV{TBB_ARCH_PLATFORM}/lib
+ )
+endif (NOT $ENV{TBB_ARCH_PLATFORM} STREQUAL "")
+# Jiri: This block isn't mutually exclusive with the previous one
+# (hence no else), instead I test if the user really specified
+# the variables in question.
+if ((NOT ${TBB_ARCHITECTURE} STREQUAL "") AND (NOT ${TBB_COMPILER} STREQUAL ""))
+ # HH: deprecated
+ message(STATUS "[Warning] FindTBB.cmake: The use of TBB_ARCHITECTURE and TBB_COMPILER is deprecated and may not be supported in future versions. Please set \$ENV{TBB_ARCH_PLATFORM} (using tbbvars.[bat|csh|sh]).")
+ # Jiri: It doesn't hurt to look in more places, so I store the hints from
+ # ENV{TBB_ARCH_PLATFORM} and the TBB_ARCHITECTURE and TBB_COMPILER
+ # variables and search them both.
+ set (_TBB_LIBRARY_DIR "${_TBB_INSTALL_DIR}/${_TBB_ARCHITECTURE}/${_TBB_COMPILER}/lib" ${_TBB_LIBRARY_DIR})
+endif ((NOT ${TBB_ARCHITECTURE} STREQUAL "") AND (NOT ${TBB_COMPILER} STREQUAL ""))
+
+# GvdB: Mac OS X distribution places libraries directly in lib directory.
+list(APPEND _TBB_LIBRARY_DIR ${_TBB_INSTALL_DIR}/lib)
+
+# Jiri: No reason not to check the default paths. From recent versions,
+# tbbvars has started exporting the LIBRARY_PATH and LD_LIBRARY_PATH
+# variables, which now point to the directories of the lib files.
+# It all makes more sense to use the ${_TBB_LIBRARY_DIR} as a HINTS
+# argument instead of the implicit PATHS as it isn't hard-coded
+# but computed by system introspection. Searching the LIBRARY_PATH
+# and LD_LIBRARY_PATH environment variables is now even more important
+# that tbbvars doesn't export TBB_ARCH_PLATFORM and it facilitates
+# the use of TBB built from sources.
+# LR: search first with NO_DEFAULT_PATH...
+find_library(TBB_RELEASE_LIBRARY ${_TBB_LIB_RELEASE_NAME} HINTS ${_TBB_LIBRARY_DIR}
+ PATHS ENV LIBRARY_PATH ENV LD_LIBRARY_PATH NO_DEFAULT_PATH)
+find_library(TBB_MALLOC_RELEASE_LIBRARY ${_TBB_LIB_MALLOC_RELEASE_NAME} HINTS ${_TBB_LIBRARY_DIR}
+ PATHS ENV LIBRARY_PATH ENV LD_LIBRARY_PATH NO_DEFAULT_PATH)
+find_library(TBB_MALLOCPROXY_RELEASE_LIBRARY ${_TBB_LIB_MALLOCPROXY_RELEASE_NAME} HINTS ${_TBB_LIBRARY_DIR}
+ PATHS ENV LIBRARY_PATH ENV LD_LIBRARY_PATH NO_DEFAULT_PATH)
+if(NOT TBB_RELEASE_LIBRARY OR NOT TBB_MALLOC_RELEASE_LIBRARY OR NOT TBB_MALLOCPROXY_RELEASE_LIBRARY)
+# LR: ... and then search again with NO_DEFAULT_PATH if nothing was found
+# in hinted paths
+ find_library(TBB_RELEASE_LIBRARY ${_TBB_LIB_RELEASE_NAME} HINTS ${_TBB_LIBRARY_DIR}
+ PATHS ENV LIBRARY_PATH ENV LD_LIBRARY_PATH)
+ find_library(TBB_MALLOC_RELEASE_LIBRARY ${_TBB_LIB_MALLOC_RELEASE_NAME} HINTS ${_TBB_LIBRARY_DIR}
+ PATHS ENV LIBRARY_PATH ENV LD_LIBRARY_PATH)
+ find_library(TBB_MALLOCPROXY_RELEASE_LIBRARY ${_TBB_LIB_MALLOCPROXY_RELEASE_NAME} HINTS ${_TBB_LIBRARY_DIR}
+ PATHS ENV LIBRARY_PATH ENV LD_LIBRARY_PATH)
+endif()
+
+#Extract path from TBB_RELEASE_LIBRARY name
+get_filename_component(TBB_RELEASE_LIBRARY_DIR ${TBB_RELEASE_LIBRARY} PATH)
+
+#TBB_CORRECT_LIB_DIR(TBB_RELEASE_LIBRARY)
+#TBB_CORRECT_LIB_DIR(TBB_MALLOC_RELEASE_LIBRARY)
+#TBB_CORRECT_LIB_DIR(TBB_MALLOCPROXY_RELEASE_LIBRARY)
+mark_as_advanced(TBB_RELEASE_LIBRARY TBB_MALLOC_RELEASE_LIBRARY TBB_MALLOCPROXY_RELEASE_LIBRARY)
+
+#-- Look for debug libraries
+# Jiri: Changed the same way as for the release libraries.
+find_library(TBB_DEBUG_LIBRARY ${_TBB_LIB_DEBUG_NAME} HINTS ${_TBB_LIBRARY_DIR}
+ PATHS ENV LIBRARY_PATH ENV LD_LIBRARY_PATH NO_DEFAULT_PATH)
+find_library(TBB_MALLOC_DEBUG_LIBRARY ${_TBB_LIB_MALLOC_DEBUG_NAME} HINTS ${_TBB_LIBRARY_DIR}
+ PATHS ENV LIBRARY_PATH ENV LD_LIBRARY_PATH NO_DEFAULT_PATH)
+find_library(TBB_MALLOCPROXY_DEBUG_LIBRARY ${_TBB_LIB_MALLOCPROXY_DEBUG_NAME} HINTS ${_TBB_LIBRARY_DIR}
+ PATHS ENV LIBRARY_PATH ENV LD_LIBRARY_PATH NO_DEFAULT_PATH)
+if(NOT TBB_DEBUG_LIBRARY OR NOT TBB_MALLOC_DEBUG_LIBRARY OR NOT TBB_MALLOCPROXY_DEBUG_LIBRARY)
+ find_library(TBB_DEBUG_LIBRARY ${_TBB_LIB_DEBUG_NAME} HINTS ${_TBB_LIBRARY_DIR}
+ PATHS ENV LIBRARY_PATH ENV LD_LIBRARY_PATH)
+ find_library(TBB_MALLOC_DEBUG_LIBRARY ${_TBB_LIB_MALLOC_DEBUG_NAME} HINTS ${_TBB_LIBRARY_DIR}
+ PATHS ENV LIBRARY_PATH ENV LD_LIBRARY_PATH)
+ find_library(TBB_MALLOCPROXY_DEBUG_LIBRARY ${_TBB_LIB_MALLOCPROXY_DEBUG_NAME} HINTS ${_TBB_LIBRARY_DIR}
+ PATHS ENV LIBRARY_PATH ENV LD_LIBRARY_PATH)
+endif()
+
+# Jiri: Self-built TBB stores the debug libraries in a separate directory.
+# Extract path from TBB_DEBUG_LIBRARY name
+get_filename_component(TBB_DEBUG_LIBRARY_DIR ${TBB_DEBUG_LIBRARY} PATH)
+
+#TBB_CORRECT_LIB_DIR(TBB_DEBUG_LIBRARY)
+#TBB_CORRECT_LIB_DIR(TBB_MALLOC_DEBUG_LIBRARY)
+#TBB_CORRECT_LIB_DIR(TBB_MALLOCPROXY_DEBUG_LIBRARY)
+mark_as_advanced(TBB_DEBUG_LIBRARY TBB_MALLOC_DEBUG_LIBRARY TBB_MALLOCPROXY_DEBUG_LIBRARY)
+
+if (TBB_INCLUDE_DIR)
+ if (TBB_RELEASE_LIBRARY)
+ set (TBB_FOUND "YES")
+
+ # NOTE: Removed because we don't want to link with the malloc_proxy by default
+ #if (NOT "${TBB_MALLOCPROXY_RELEASE_LIBRARY}" STREQUAL "TBB_MALLOCPROXY_RELEASE_LIBRARY-NOTFOUND")
+ # mark_as_advanced(TBB_MALLOCPROXY_RELEASE_LIBRARY)
+ # set (_TBB_MALLOCPROXY optimized ${TBB_MALLOCPROXY_RELEASE_LIBRARY})
+ #endif (NOT "${TBB_MALLOCPROXY_RELEASE_LIBRARY}" STREQUAL "TBB_MALLOCPROXY_RELEASE_LIBRARY-NOTFOUND")
+ #if (NOT "${TBB_MALLOCPROXY_DEBUG_LIBRARY}" STREQUAL "TBB_MALLOCPROXY_DEBUG_LIBRARY-NOTFOUND")
+ # mark_as_advanced(TBB_MALLOCPROXY_DEBUG_LIBRARY)
+ # set (_TBB_MALLOCPROXY ${_TBB_MALLOCPROXY} debug ${TBB_MALLOCPROXY_DEBUG_LIBRARY})
+ #endif (NOT "${TBB_MALLOCPROXY_DEBUG_LIBRARY}" STREQUAL "TBB_MALLOCPROXY_DEBUG_LIBRARY-NOTFOUND")
+
+ # TBB release library
+ set (ALL_TBB_LIBRARIES optimized ${TBB_RELEASE_LIBRARY})
+
+ # TBB debug library found?
+ if (TBB_DEBUG_LIBRARY)
+ list(APPEND ALL_TBB_LIBRARIES debug ${TBB_DEBUG_LIBRARY})
+ else (TBB_DEBUG_LIBRARY)
+ # Otherwise, link with the release library even in debug mode
+ list(APPEND ALL_TBB_LIBRARIES debug ${TBB_RELEASE_LIBRARY})
+ endif (TBB_DEBUG_LIBRARY)
+
+ # TBB malloc - release
+ if (TBB_MALLOC_RELEASE_LIBRARY)
+ list(APPEND ALL_TBB_LIBRARIES optimized ${TBB_MALLOC_RELEASE_LIBRARY})
+
+ # TBB malloc - debug
+ if (TBB_MALLOC_DEBUG_LIBRARY)
+ list(APPEND ALL_TBB_LIBRARIES debug ${TBB_MALLOC_DEBUG_LIBRARY})
+ else (TBB_MALLOC_DEBUG_LIBRARY)
+ list(APPEND ALL_TBB_LIBRARIES debug ${TBB_MALLOC_RELEASE_LIBRARY})
+ endif (TBB_MALLOC_DEBUG_LIBRARY)
+ endif (TBB_MALLOC_RELEASE_LIBRARY)
+
+ if(UNIX AND NOT APPLE)
+ # On Fedora, code using TBB might need -pthread
+
+ # First check without pthread
+ try_TBB_with_pthread(TBB_without_pthread)
+
+ if(NOT TBB_without_pthread)
+ # Then check with -pthread
+ try_TBB_with_pthread(TBB_with_pthread -pthread)
+ if(TBB_with_pthread)
+ list(APPEND ALL_TBB_LIBRARIES general -pthread)
+ endif(TBB_with_pthread)
+ endif(NOT TBB_without_pthread)
+ endif(UNIX AND NOT APPLE)
+
+ set (TBB_LIBRARIES ${ALL_TBB_LIBRARIES}
+ CACHE PATH "TBB libraries" FORCE)
+
+ # Include dirs
+ set (TBB_INCLUDE_DIRS ${TBB_INCLUDE_DIR} CACHE PATH "TBB include directory" FORCE)
+
+ # Library dirs
+ if( "${TBB_DEBUG_LIBRARY_DIR}" STREQUAL "" OR "${TBB_RELEASE_LIBRARY_DIR}" STREQUAL "${TBB_DEBUG_LIBRARY_DIR}" )
+ set (TBB_LIBRARY_DIRS
+ ${TBB_RELEASE_LIBRARY_DIR}
+ CACHE PATH "TBB library directories" FORCE)
+ else( "${TBB_DEBUG_LIBRARY_DIR}" STREQUAL "" OR "${TBB_RELEASE_LIBRARY_DIR}" STREQUAL "${TBB_DEBUG_LIBRARY_DIR}" )
+ set (TBB_LIBRARY_DIRS
+ ${TBB_RELEASE_LIBRARY_DIR} ${TBB_DEBUG_LIBRARY_DIR}
+ CACHE PATH "TBB library directories" FORCE)
+ endif( "${TBB_DEBUG_LIBRARY_DIR}" STREQUAL "" OR "${TBB_RELEASE_LIBRARY_DIR}" STREQUAL "${TBB_DEBUG_LIBRARY_DIR}" )
+
+ message(STATUS "Found Intel TBB")
+ endif (TBB_RELEASE_LIBRARY)
+endif (TBB_INCLUDE_DIR)
+
+if (NOT TBB_FOUND)
+ if(NOT TBB_FIND_QUIETLY)
+ message("ERROR: Intel TBB NOT found! Please define the TBBROOT (or TBB_INSTALL_DIR) and/or TBB_ARCH_PLATFORM environment variables.")
+ message(STATUS "Looked for Threading Building Blocks in ${_TBB_INSTALL_DIR}")
+ endif(NOT TBB_FIND_QUIETLY)
+ SET(TBB_INSTALL_DIR "TBB_INSTALL_DIR_NOT_FOUND" CACHE STRING "Intel TBB install directory")
+ # do only throw fatal, if this pkg is REQUIRED
+ if (TBB_FIND_REQUIRED)
+ message(FATAL_ERROR "Could NOT find TBB library.")
+ endif (TBB_FIND_REQUIRED)
+endif (NOT TBB_FOUND)
+
+endif (NOT _TBB_INSTALL_DIR)
+
+if (TBB_FOUND)
+ set(TBB_INTERFACE_VERSION 0)
+ FILE(READ "${TBB_INCLUDE_DIRS}/tbb/tbb_stddef.h" _TBB_VERSION_CONTENTS)
+ STRING(REGEX REPLACE ".*#define TBB_INTERFACE_VERSION ([0-9]+).*" "\\1" TBB_INTERFACE_VERSION "${_TBB_VERSION_CONTENTS}")
+ set(TBB_INTERFACE_VERSION "${TBB_INTERFACE_VERSION}")
+endif (TBB_FOUND)
+
+set(TBB_USE_FILE "UseTBB")
+
+### ** Emacs settings **
+### Local Variables:
+### cmake-tab-width: 4
+### End:
diff --git a/src/cmake/modules/UseTBB.cmake b/src/cmake/modules/UseTBB.cmake
new file mode 100644
index 00000000..e1ef5dfe
--- /dev/null
+++ b/src/cmake/modules/UseTBB.cmake
@@ -0,0 +1,6 @@
+# This module setups the compiler for using TBB library.
+# It assumes that find_package(TBB) was already called.
+
+include_directories ( ${TBB_INCLUDE_DIRS} )
+link_directories( ${TBB_LIBRARY_DIRS} )
+add_definitions( -DNOMINMAX -DGUDHI_USE_TBB )
diff --git a/src/common/include/gudhi/allocator.h b/src/common/include/gudhi/allocator.h
new file mode 100644
index 00000000..4ede14e4
--- /dev/null
+++ b/src/common/include/gudhi/allocator.h
@@ -0,0 +1,55 @@
+/* This file is part of the Gudhi Library. The Gudhi library
+ * (Geometric Understanding in Higher Dimensions) is a generic C++
+ * library for computational topology.
+ *
+ * Author(s): Marc Glisse
+ *
+ * Copyright (C) 2015 INRIA Saclay - Ile de France
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef ALLOCATOR_H_
+#define ALLOCATOR_H_
+
+#include <memory>
+#include <utility>
+
+namespace Gudhi {
+
+/** \private
+ * An allocator that can be used to build an uninitialized vector.
+ */
+template <class T, class Base = std::allocator<T>>
+struct no_init_allocator : Base {
+ typedef std::allocator_traits<Base> Base_traits;
+ template <class U> struct rebind {
+ typedef no_init_allocator<U, typename Base_traits::template rebind_alloc<U>> other;
+ };
+
+ // Inherit constructors.
+ using Base::Base;
+
+ // Do nothing: that's the whole point!
+ template<class P>
+ void construct(P*) noexcept {}
+
+ template<class P, class...U> void construct(P*p, U&&...u) {
+ Base_traits::construct(*(Base*)this, p, std::forward<U>(u)...);
+ }
+};
+
+} // namespace Gudhi
+
+#endif // ALLOCATOR_H_