-- cgit v1.2.3 From 753ab8e366bb7d44b6cbe5e26d95c13317fc48c9 Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Tue, 13 Feb 2018 16:55:41 +0000 Subject: Add documentation tests for example_vector_double_points_off_reader Fix Marc's comments about reader git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/offreaderfix_vincent@3243 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 7dfb928c064c1286c1903cb91600ebace7a8fd47 --- src/common/example/CMakeLists.txt | 11 +++++++- src/common/example/cgaloffreader_result.txt | 7 ------ .../example/example_CGAL_3D_points_off_reader.cpp | 6 ++--- .../example/example_CGAL_points_off_reader.cpp | 6 ++--- .../example_vector_double_points_off_reader.cpp | 14 ++++++----- .../example/vectordoubleoffreader_result.txt | 7 ++++++ src/common/include/gudhi/Off_reader.h | 29 ++++++++++++---------- src/common/include/gudhi/Points_off_io.h | 4 +-- 8 files changed, 49 insertions(+), 35 deletions(-) delete mode 100644 src/common/example/cgaloffreader_result.txt create mode 100644 src/common/example/vectordoubleoffreader_result.txt diff --git a/src/common/example/CMakeLists.txt b/src/common/example/CMakeLists.txt index afe865d4..1273c699 100644 --- a/src/common/example/CMakeLists.txt +++ b/src/common/example/CMakeLists.txt @@ -3,11 +3,20 @@ project(Common_examples) add_executable ( vector_double_off_reader example_vector_double_points_off_reader.cpp ) target_link_libraries(vector_double_off_reader ${CGAL_LIBRARY}) +file(COPY "${CMAKE_SOURCE_DIR}/data/points/alphacomplexdoc.off" DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/) add_test(NAME Common_example_vector_double_off_reader COMMAND $ - "${CMAKE_SOURCE_DIR}/data/points/SO3_10000.off") + "alphacomplexdoc.off") install(TARGETS vector_double_off_reader DESTINATION bin) +if (DIFF_PATH) + # Do not forget to copy test results files in current binary dir + file(COPY "vectordoubleoffreader_result.txt" DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/) + + add_test(Common_example_vector_double_off_reader_diff_files ${DIFF_PATH} + ${CMAKE_CURRENT_BINARY_DIR}/vectordoubleoffreader_result.txt ${CMAKE_CURRENT_BINARY_DIR}/alphacomplexdoc.off.txt) +endif() + if(CGAL_FOUND) add_executable ( cgal_3D_off_reader example_CGAL_3D_points_off_reader.cpp ) target_link_libraries(cgal_3D_off_reader ${CGAL_LIBRARY}) diff --git a/src/common/example/cgaloffreader_result.txt b/src/common/example/cgaloffreader_result.txt deleted file mode 100644 index 1deb8dbd..00000000 --- a/src/common/example/cgaloffreader_result.txt +++ /dev/null @@ -1,7 +0,0 @@ -Point[0] = 1 1 -Point[1] = 7 0 -Point[2] = 4 6 -Point[3] = 9 6 -Point[4] = 0 14 -Point[5] = 2 19 -Point[6] = 9 17 diff --git a/src/common/example/example_CGAL_3D_points_off_reader.cpp b/src/common/example/example_CGAL_3D_points_off_reader.cpp index 665b7a29..4658d8d5 100644 --- a/src/common/example/example_CGAL_3D_points_off_reader.cpp +++ b/src/common/example/example_CGAL_3D_points_off_reader.cpp @@ -20,12 +20,12 @@ int main(int argc, char **argv) { usage(argv[0]); } - std::string offInputFile(argv[1]); + std::string off_input_file(argv[1]); // Read the OFF file (input file name given as parameter) and triangulate points - Gudhi::Points_3D_off_reader off_reader(offInputFile); + Gudhi::Points_3D_off_reader off_reader(off_input_file); // Check the read operation was correct if (!off_reader.is_valid()) { - std::cerr << "Unable to read file " << offInputFile << std::endl; + std::cerr << "Unable to read file " << off_input_file << std::endl; usage(argv[0]); } diff --git a/src/common/example/example_CGAL_points_off_reader.cpp b/src/common/example/example_CGAL_points_off_reader.cpp index 8c6a6b54..f45683a5 100644 --- a/src/common/example/example_CGAL_points_off_reader.cpp +++ b/src/common/example/example_CGAL_points_off_reader.cpp @@ -22,12 +22,12 @@ int main(int argc, char **argv) { usage(argv[0]); } - std::string offInputFile(argv[1]); + std::string off_input_file(argv[1]); // Read the OFF file (input file name given as parameter) and triangulate points - Gudhi::Points_off_reader off_reader(offInputFile); + Gudhi::Points_off_reader off_reader(off_input_file); // Check the read operation was correct if (!off_reader.is_valid()) { - std::cerr << "Unable to read file " << offInputFile << std::endl; + std::cerr << "Unable to read file " << off_input_file << std::endl; usage(argv[0]); } diff --git a/src/common/example/example_vector_double_points_off_reader.cpp b/src/common/example/example_vector_double_points_off_reader.cpp index 8aecb26e..5093da85 100644 --- a/src/common/example/example_vector_double_points_off_reader.cpp +++ b/src/common/example/example_vector_double_points_off_reader.cpp @@ -17,25 +17,27 @@ int main(int argc, char **argv) { usage(argv[0]); } - std::string offInputFile(argv[1]); + std::string off_input_file(argv[1]); // Read the OFF file (input file name given as parameter) and triangulate points - Gudhi::Points_off_reader off_reader(offInputFile); + Gudhi::Points_off_reader off_reader(off_input_file); // Check the read operation was correct if (!off_reader.is_valid()) { - std::cerr << "Unable to read file " << offInputFile << std::endl; + std::cerr << "Unable to read file " << off_input_file << std::endl; usage(argv[0]); } // Retrieve the triangulation std::vector point_cloud = off_reader.get_point_cloud(); + std::ofstream output_file(off_input_file + ".txt"); int n {0}; for (auto point : point_cloud) { - std::cout << "Point[" << n << "] = "; + output_file << "Point[" << n << "] = "; for (std::size_t i {0}; i < point.size(); i++) - std::cout << point[i] << " "; - std::cout << "\n"; + output_file << point[i] << " "; + output_file << "\n"; ++n; } + output_file.close(); return 0; } diff --git a/src/common/example/vectordoubleoffreader_result.txt b/src/common/example/vectordoubleoffreader_result.txt new file mode 100644 index 00000000..1deb8dbd --- /dev/null +++ b/src/common/example/vectordoubleoffreader_result.txt @@ -0,0 +1,7 @@ +Point[0] = 1 1 +Point[1] = 7 0 +Point[2] = 4 6 +Point[3] = 9 6 +Point[4] = 0 14 +Point[5] = 2 19 +Point[6] = 9 17 diff --git a/src/common/include/gudhi/Off_reader.h b/src/common/include/gudhi/Off_reader.h index 4fcd2af2..32320e4d 100644 --- a/src/common/include/gudhi/Off_reader.h +++ b/src/common/include/gudhi/Off_reader.h @@ -105,25 +105,26 @@ class Off_reader { bool is_off_file = (line.find("OFF") != std::string::npos); bool is_noff_file = (line.find("nOFF") != std::string::npos); + + if (!is_off_file && !is_noff_file) { std::cerr << line << std::endl; std::cerr << "missing off header\n"; return false; } + if (is_noff_file) { + // Should be on a separate line, but we accept it on the same line as the number of vertices + stream_ >> off_info_.dim; + } else { + off_info_.dim = 3; + } + if (!goto_next_uncomment_line(line)) return false; std::istringstream iss(line); - if ((is_off_file) && (!is_noff_file)) { - off_info_.dim = 3; - if (!(iss >> off_info_.num_vertices >> off_info_.num_faces >> off_info_.num_edges)) { - std::cerr << "incorrect number of vertices/faces/edges\n"; - return false; - } - } else { - if (!(iss >> off_info_.dim >> off_info_.num_vertices >> off_info_.num_faces >> off_info_.num_edges)) { + if (!(iss >> off_info_.num_vertices >> off_info_.num_faces >> off_info_.num_edges)) { std::cerr << "incorrect number of vertices/faces/edges\n"; return false; - } } off_visitor.init(off_info_.dim, off_info_.num_vertices, off_info_.num_faces, off_info_.num_edges); @@ -131,10 +132,12 @@ class Off_reader { } bool goto_next_uncomment_line(std::string& uncomment_line) { - uncomment_line.clear(); - do - std::getline(stream_, uncomment_line); while (uncomment_line[0] == '%'); - return (uncomment_line.size() > 0 && uncomment_line[0] != '%'); + do { + // skip whitespace, including empty lines + if (!std::ifstream::sentry(stream_)) return false; + std::getline(stream_, uncomment_line); + } while (uncomment_line[0] == '#'); + return (bool)stream_; } template diff --git a/src/common/include/gudhi/Points_off_io.h b/src/common/include/gudhi/Points_off_io.h index 29af8a8a..08f324c6 100644 --- a/src/common/include/gudhi/Points_off_io.h +++ b/src/common/include/gudhi/Points_off_io.h @@ -126,9 +126,9 @@ class Points_off_visitor_reader { * \code $> ./vector_double_off_reader ../../data/points/alphacomplexdoc.off * \endcode * - * the program output is: + * the program outputs a file ../../data/points/alphacomplexdoc.off.txt: * - * \include common/cgaloffreader_result.txt + * \include common/vectordoubleoffreader_result.txt */ template class Points_off_reader { -- cgit v1.2.3 From 37b73679e141696471abc5a1665c0955b9465f80 Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Tue, 13 Feb 2018 17:01:01 +0000 Subject: Fix Kl.off strange format git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/offreaderfix_vincent@3244 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 1e297c5703ddd59e5b1af6c65a4fbe2a4c318c33 --- data/points/Kl.off | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/data/points/Kl.off b/data/points/Kl.off index 911bcd23..8930a321 100644 --- a/data/points/Kl.off +++ b/data/points/Kl.off @@ -1,5 +1,5 @@ -OFF -10000 0 0 +nOFF +5 10000 0 0 0.5 0 0 0 1 0.562791 0 0.125333 0 0.998027 0.625333 0 0.24869 0 0.992115 -- cgit v1.2.3 From f95d9eb65491241f953a5dcaef57f1dbf077bd60 Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Tue, 6 Mar 2018 15:56:04 +0000 Subject: Add offline_header.html for Debian package generation that requires self-contained documentation. Command for generation : ( cat Doxyfile ; echo "HTML_HEADER = doc/common/offline_header.html" ) | doxygen - git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/trunk@3266 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 7bd88e71f56b8c7929cfc8475dd49ff2b0901b53 --- src/common/doc/offline_header.html | 41 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 src/common/doc/offline_header.html diff --git a/src/common/doc/offline_header.html b/src/common/doc/offline_header.html new file mode 100644 index 00000000..6a02a895 --- /dev/null +++ b/src/common/doc/offline_header.html @@ -0,0 +1,41 @@ + + + + + + + + +$projectname: $title +$title + + + + +$treeview +$search +$mathjax + +$extrastylesheet + + + + +
+ + +
+ + + + + + + + + + +
$searchbox
+
+ + -- cgit v1.2.3 From b77699a3188d6674427cffaa35f26ec57aadec8b Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Thu, 8 Mar 2018 17:13:25 +0000 Subject: Web site review after Editorial Board Do not need to import gudhi twice in py git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/trunk@3270 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 7d7a4bba27f4cbcad5f8b18cb86587a15e6a8435 --- src/Alpha_complex/utilities/alphacomplex.md | 10 ++++++++++ src/Bitmap_cubical_complex/utilities/cubicalcomplex.md | 10 ++++++++++ src/Bottleneck_distance/utilities/bottleneckdistance.md | 10 ++++++++++ src/Nerve_GIC/utilities/covercomplex.md | 10 ++++++++++ src/Rips_complex/utilities/ripscomplex.md | 10 ++++++++++ src/Witness_complex/utilities/witnesscomplex.md | 10 ++++++++++ src/common/utilities/pointsetgenerator.md | 16 +++++++++++++--- src/cython/example/bottleneck_basic_example.py | 2 -- 8 files changed, 73 insertions(+), 5 deletions(-) diff --git a/src/Alpha_complex/utilities/alphacomplex.md b/src/Alpha_complex/utilities/alphacomplex.md index aace85d3..ede749a9 100644 --- a/src/Alpha_complex/utilities/alphacomplex.md +++ b/src/Alpha_complex/utilities/alphacomplex.md @@ -1,3 +1,13 @@ +--- +layout: page +title: "Alpha complex" +meta_title: "Alpha complex" +teaser: "" +permalink: /alphacomplex/ +--- +{::comment} +Leave the lines above as it is required by the web site generator 'Jekyll' +{:/comment} # Alpha complex # diff --git a/src/Bitmap_cubical_complex/utilities/cubicalcomplex.md b/src/Bitmap_cubical_complex/utilities/cubicalcomplex.md index 6e1b2578..a1bb9007 100644 --- a/src/Bitmap_cubical_complex/utilities/cubicalcomplex.md +++ b/src/Bitmap_cubical_complex/utilities/cubicalcomplex.md @@ -1,3 +1,13 @@ +--- +layout: page +title: "Cubical complex" +meta_title: "Cubical complex" +teaser: "" +permalink: /cubicalcomplex/ +--- +{::comment} +Leave the lines above as it is required by the web site generator 'Jekyll' +{:/comment} # Cubical complex# diff --git a/src/Bottleneck_distance/utilities/bottleneckdistance.md b/src/Bottleneck_distance/utilities/bottleneckdistance.md index 526f5822..f2749acc 100644 --- a/src/Bottleneck_distance/utilities/bottleneckdistance.md +++ b/src/Bottleneck_distance/utilities/bottleneckdistance.md @@ -1,3 +1,13 @@ +--- +layout: page +title: "Bottleneck distance" +meta_title: "Bottleneck distance" +teaser: "" +permalink: /bottleneckdistance/ +--- +{::comment} +Leave the lines above as it is required by the web site generator 'Jekyll' +{:/comment} # Bottleneck distance # diff --git a/src/Nerve_GIC/utilities/covercomplex.md b/src/Nerve_GIC/utilities/covercomplex.md index f33cb2e0..6d16d16f 100644 --- a/src/Nerve_GIC/utilities/covercomplex.md +++ b/src/Nerve_GIC/utilities/covercomplex.md @@ -1,3 +1,13 @@ +--- +layout: page +title: "Cover complex" +meta_title: "Cover complex" +teaser: "" +permalink: /covercomplex/ +--- +{::comment} +Leave the lines above as it is required by the web site generator 'Jekyll' +{:/comment} # Cover complex # diff --git a/src/Rips_complex/utilities/ripscomplex.md b/src/Rips_complex/utilities/ripscomplex.md index 4291fae7..c1f2210e 100644 --- a/src/Rips_complex/utilities/ripscomplex.md +++ b/src/Rips_complex/utilities/ripscomplex.md @@ -1,3 +1,13 @@ +--- +layout: page +title: "Rips complex" +meta_title: "Rips complex" +teaser: "" +permalink: /ripscomplex/ +--- +{::comment} +Leave the lines above as it is required by the web site generator 'Jekyll' +{:/comment} # Rips complex # diff --git a/src/Witness_complex/utilities/witnesscomplex.md b/src/Witness_complex/utilities/witnesscomplex.md index 2341759b..3be9bc55 100644 --- a/src/Witness_complex/utilities/witnesscomplex.md +++ b/src/Witness_complex/utilities/witnesscomplex.md @@ -1,3 +1,13 @@ +--- +layout: page +title: "Witness complex" +meta_title: "Witness complex" +teaser: "" +permalink: /witnesscomplex/ +--- +{::comment} +Leave the lines above as it is required by the web site generator 'Jekyll' +{:/comment} # Witness complex # diff --git a/src/common/utilities/pointsetgenerator.md b/src/common/utilities/pointsetgenerator.md index 284715d4..3b23e668 100644 --- a/src/common/utilities/pointsetgenerator.md +++ b/src/common/utilities/pointsetgenerator.md @@ -1,6 +1,16 @@ - - -# common # +--- +layout: page +title: "OFF point set generator" +meta_title: "OFF point set generator" +teaser: "" +permalink: /pointsetgenerator/ +--- +{::comment} +Leave the lines above as it is required by the web site generator 'Jekyll' +{:/comment} + + +# Miscellaneous # ## off_file_from_shape_generator ## diff --git a/src/cython/example/bottleneck_basic_example.py b/src/cython/example/bottleneck_basic_example.py index 31cecb29..a7fa01c1 100755 --- a/src/cython/example/bottleneck_basic_example.py +++ b/src/cython/example/bottleneck_basic_example.py @@ -28,8 +28,6 @@ __author__ = "Francois Godi, Vincent Rouvreau" __copyright__ = "Copyright (C) 2016 INRIA" __license__ = "GPL v3" -import gudhi - diag1 = [[2.7, 3.7],[9.6, 14.],[34.2, 34.974], [3.,float('Inf')]] diag2 = [[2.8, 4.45],[9.5, 14.1],[3.2,float('Inf')]] -- cgit v1.2.3 From 74d2aab913ce02ba1755ff4fc08e37e38cbb499a Mon Sep 17 00:00:00 2001 From: glisse Date: Tue, 13 Mar 2018 14:51:06 +0000 Subject: Simplex_key clarifications in FilteredComplex concept. git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/trunk@3284 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: a42ef2c14a64a769c9a8c8ddc37071ba260b17bf --- src/Persistent_cohomology/concept/FilteredComplex.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Persistent_cohomology/concept/FilteredComplex.h b/src/Persistent_cohomology/concept/FilteredComplex.h index c19698df..d6b662e9 100644 --- a/src/Persistent_cohomology/concept/FilteredComplex.h +++ b/src/Persistent_cohomology/concept/FilteredComplex.h @@ -31,7 +31,7 @@ struct FilteredComplex typedef unspecified Simplex_handle; /** \brief Key associated to each simplex. * - * Must be a signed integer type. */ + * Must be an integer type. */ typedef unspecified Simplex_key; /** \brief Type for the value of the filtration function. * @@ -67,8 +67,8 @@ struct FilteredComplex Simplex_key key ( Simplex_handle sh ); /** \brief Returns the simplex that has index idx in the filtration. * - * This is never called on null_key(). */ - Simplex_handle simplex ( Simplex_key idx ); + * This is only called on valid indices. */ + Simplex_handle simplex ( size_t idx ); /** \brief Assign a key to a simplex. */ void assign_key(Simplex_handle sh, Simplex_key key); -- cgit v1.2.3