From d6bb19de457fa74c84dbd6d8afa63074fefb4552 Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Thu, 18 May 2017 08:47:16 +0000 Subject: Modify the way cmake handles utilities, examples, test and benchmarks with new options to activate/desactivate them. Move hypergenerator as a common utility. Move random point generation from hypergenerator in src/common/include/gudhi/random_point_generators.h git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/cmake_modules_for_gudhi@2442 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: e2d13e4b0c09455fb604b684f6d71530352271eb --- data/points/generator/CMakeLists.txt | 15 ---- data/points/generator/README | 29 ------- data/points/generator/hypergenerator.cpp | 133 ------------------------------- 3 files changed, 177 deletions(-) delete mode 100644 data/points/generator/CMakeLists.txt delete mode 100644 data/points/generator/hypergenerator.cpp (limited to 'data') diff --git a/data/points/generator/CMakeLists.txt b/data/points/generator/CMakeLists.txt deleted file mode 100644 index 88d377a7..00000000 --- a/data/points/generator/CMakeLists.txt +++ /dev/null @@ -1,15 +0,0 @@ -cmake_minimum_required(VERSION 2.6) -project(data_points_generator) - -if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.6.0) - add_executable ( data_points_generator hypergenerator.cpp ) - target_link_libraries(data_points_generator ${Boost_SYSTEM_LIBRARY}) - add_test(NAME data_points_generator_on_sphere_1000_3_15.2 COMMAND $ - "on" "sphere" "onSphere.off" "1000" "3" "15.2") - add_test(NAME data_points_generator_in_sphere_100_2 COMMAND $ - "in" "sphere" "inSphere.off" "100" "2") - - # on cube is not available in CGAL - add_test(NAME data_points_generator_in_cube_10000_3_5.8 COMMAND $ - "in" "cube" "inCube.off" "10000" "3" "5.8") -endif(NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.6.0) diff --git a/data/points/generator/README b/data/points/generator/README index 951bcfe1..3183a51f 100644 --- a/data/points/generator/README +++ b/data/points/generator/README @@ -1,32 +1,3 @@ -=========================== C++ generators ===================================== - -To build the C++ generators, run in a Terminal: - -cd /path-to-gudhi/ -cmake . -cd /path-to-data-generator/ -make - -======================= data_points_generator ================================== - -Example of use : - -*** Hyper sphere|cube generator - -./data_points_generator on sphere onSphere.off 1000 3 15.2 - - => generates a onSphere.off file with 1000 points randomized on a sphere of dimension 3 and radius 15.2 - -./data_points_generator in sphere inSphere.off 100 2 - - => generates a inSphere.off file with 100 points randomized in a sphere of dimension 2 (circle) and radius 1.0 (default) - -./data_points_generator in cube inCube.off 10000 3 5.8 - - => generates a inCube.off file with 10000 points randomized in a cube of dimension 3 and side 5.8 - -!! Warning: hypegenerator on cube is not available !! - ===================== aurelien_alvarez_surfaces_in_R8 ========================== This generator is written in Python. diff --git a/data/points/generator/hypergenerator.cpp b/data/points/generator/hypergenerator.cpp deleted file mode 100644 index 5831de18..00000000 --- a/data/points/generator/hypergenerator.cpp +++ /dev/null @@ -1,133 +0,0 @@ -/* 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): Vincent Rouvreau - * - * Copyright (C) 2014 INRIA Saclay (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 . - */ - -#include -#include -#include -#include - -#include -#include -#include -#include // for std::ofstream -#include - -typedef CGAL::Epick_d< CGAL::Dynamic_dimension_tag > K; -typedef K::Point_d Point; - -void usage(char * const progName) { - std::cerr << "Usage: " << progName << " in|on sphere|cube off_file_name points_number[integer > 0] " << - "dimension[integer > 1] radius[double > 0.0 | default = 1.0]" << std::endl; - exit(-1); -} - -int main(int argc, char **argv) { - // program args management - if ((argc != 6) && (argc != 7)) { - std::cerr << "Error: Number of arguments (" << argc << ") is not correct" << std::endl; - usage(argv[0]); - } - - int points_number = atoi(argv[4]); - if (points_number <= 0) { - std::cerr << "Error: " << argv[4] << " is not correct" << std::endl; - usage(argv[0]); - } - - int dimension = atoi(argv[5]); - if (dimension <= 0) { - std::cerr << "Error: " << argv[5] << " is not correct" << std::endl; - usage(argv[0]); - } - - double radius = 1.0; - if (argc == 7) { - radius = atof(argv[6]); - if (radius <= 0.0) { - std::cerr << "Error: " << argv[6] << " is not correct" << std::endl; - usage(argv[0]); - } - } - - bool in = false; - if (strcmp(argv[1], "in") == 0) { - in = true; - } else if (strcmp(argv[1], "on") != 0) { - std::cerr << "Error: " << argv[1] << " is not correct" << std::endl; - usage(argv[0]); - } - - bool sphere = false; - if (memcmp(argv[2], "sphere", sizeof("sphere")) == 0) { - sphere = true; - } else if (memcmp(argv[2], "cube", sizeof("cube")) != 0) { - std::cerr << "Error: " << argv[2] << " is not correct" << std::endl; - usage(argv[0]); - } - - std::ofstream diagram_out(argv[3]); - if (dimension == 3) { - diagram_out << "OFF" << std::endl; - diagram_out << points_number << " 0 0" << std::endl; - } else { - diagram_out << "nOFF" << std::endl; - diagram_out << dimension << " " << points_number << " 0 0" << std::endl; - } - - if (diagram_out.is_open()) { - // Instanciate a random point generator - CGAL::Random rng(0); - // Generate "points_number" random points in a vector - std::vector points; - if (in) { - if (sphere) { - CGAL::Random_points_in_ball_d rand_it(dimension, radius, rng); - CGAL::cpp11::copy_n(rand_it, points_number, std::back_inserter(points)); - } else { - CGAL::Random_points_in_cube_d rand_it(dimension, radius, rng); - CGAL::cpp11::copy_n(rand_it, points_number, std::back_inserter(points)); - } - } else { // means "on" - if (sphere) { - CGAL::Random_points_on_sphere_d rand_it(dimension, radius, rng); - CGAL::cpp11::copy_n(rand_it, points_number, std::back_inserter(points)); - } else { - std::cerr << "Sorry: on cube is not available" << std::endl; - usage(argv[0]); - } - } - - for (auto thePoint : points) { - int i = 0; - for (; i < dimension - 1; i++) { - diagram_out << thePoint[i] << " "; - } - diagram_out << thePoint[i] << std::endl; // last point + Carriage Return - } - } else { - std::cerr << "Error: " << argv[3] << " cannot be opened" << std::endl; - usage(argv[0]); - } - - return 0; -} - -- cgit v1.2.3 From df15aa4e16c00a7dc3bca01e01db8608b50dd4b9 Mon Sep 17 00:00:00 2001 From: cjamin Date: Wed, 31 May 2017 11:58:05 +0000 Subject: Add persistence diagram samples git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/read_persistence_from_file@2489 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: bcad955589cbfccdb5f887e409df17a07288c9e4 --- data/persistence_diagram/first.pers | 5 +++++ data/persistence_diagram/second.pers | 3 +++ 2 files changed, 8 insertions(+) create mode 100644 data/persistence_diagram/first.pers create mode 100644 data/persistence_diagram/second.pers (limited to 'data') diff --git a/data/persistence_diagram/first.pers b/data/persistence_diagram/first.pers new file mode 100644 index 00000000..193c60ba --- /dev/null +++ b/data/persistence_diagram/first.pers @@ -0,0 +1,5 @@ +# Simple persistence diagram +2.7 3.7 +9.6 14. +34.2 34.974 +3. inf \ No newline at end of file diff --git a/data/persistence_diagram/second.pers b/data/persistence_diagram/second.pers new file mode 100644 index 00000000..6292fde6 --- /dev/null +++ b/data/persistence_diagram/second.pers @@ -0,0 +1,3 @@ +2.8 4.45 +9.5 14.1 +3.2 inf \ No newline at end of file -- cgit v1.2.3