From b463ed7de51684f68494c163d798916384f5399d Mon Sep 17 00:00:00 2001 From: pdlotko Date: Wed, 1 Nov 2017 18:33:18 +0000 Subject: Fixing Marc's comments. git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/periodic_cubical_complex_fix@2822 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 9349d7b76ee2301c2554480f33af0a395451a9a9 --- .../include/gudhi/Bitmap_cubical_complex_base.h | 46 +++++++++++----------- ...cal_complex_periodic_boundary_conditions_base.h | 28 +++++++------ 2 files changed, 39 insertions(+), 35 deletions(-) (limited to 'src/Bitmap_cubical_complex') diff --git a/src/Bitmap_cubical_complex/include/gudhi/Bitmap_cubical_complex_base.h b/src/Bitmap_cubical_complex/include/gudhi/Bitmap_cubical_complex_base.h index 58e5bbbd..6a1ff3ff 100644 --- a/src/Bitmap_cubical_complex/include/gudhi/Bitmap_cubical_complex_base.h +++ b/src/Bitmap_cubical_complex/include/gudhi/Bitmap_cubical_complex_base.h @@ -1,4 +1,4 @@ -/* This file is part of the Gudhi Library. The Gudhi +/* This file is part of the Gudhi Library. The Gudhi library * (Geometric Understanding in Higher Dimensions) is a generic C++ * library for computational topology. * @@ -101,7 +101,7 @@ class Bitmap_cubical_complex_base { * In the case of functions that compute (co)boundary, the output is a vector if non-negative integers pointing to * the positions of (co)boundary element of the input cell. * The boundary elements are guaranteed to be returned so that the - * incidence coeficcients are alternating. + * incidence coefficients of boundary elements are alternating. */ virtual inline std::vector< size_t > get_boundary_of_a_cell(size_t cell)const; /** @@ -119,38 +119,31 @@ class Bitmap_cubical_complex_base { * **/ virtual inline std::vector< size_t > get_coboundary_of_a_cell(size_t cell)const; - /** - * In the case of get_dimension_of_a_cell function, the output is a non-negative integer - * indicating the dimension of a cell. - * Note that unlike in the case of boundary, over here the elements are - * not guaranteed to be returned with alternating incidence numbers. - * To compute incidence between cells use compute_incidence_between_cells - * procedure - **/ /** - * This procedure compute incidence numbers between cells. - * Note that first parameter is the address of a cell of dimension n, - * and the second parameter is the address of adjusted cell in dimension - * n-1. + * This procedure compute incidence numbers between cells. For a cell A of + * dimension n and a cell B \subset A of dimension n-1, an incidence + * between A and B is the integer with which B appears in the boundary of A. + * Note that first parameter is a cell of dimension n, + * and the second parameter is an adjusted cell in dimension n-1. **/ - virtual int compute_incidence_between_cells( size_t coBoundary , size_t boundary ) + virtual int compute_incidence_between_cells( size_t coface , size_t face ) { //first get the counters for coBoundary and boundary: - std::vector cbd_counter = this->compute_counter_for_given_cell( coBoundary ); - std::vector bd_counter = this->compute_counter_for_given_cell( boundary ); + std::vector coface_counter = this->compute_counter_for_given_cell( coface ); + std::vector face_counter = this->compute_counter_for_given_cell( face ); //cbd_counter and bd_counter should agree at all positions except from one: int number_of_position_in_which_counters_do_not_agree = -1; size_t number_of_full_faces_that_comes_before = 0; - for ( size_t i = 0 ; i != cbd_counter.size() ; ++i ) + for ( size_t i = 0 ; i != coface_counter.size() ; ++i ) { - if ( (cbd_counter[i]%2 == 1)&&(number_of_position_in_which_counters_do_not_agree==-1) ) + if ( (coface_counter[i]%2 == 1)&&(number_of_position_in_which_counters_do_not_agree==-1) ) { ++number_of_full_faces_that_comes_before; } - if ( cbd_counter[i] != bd_counter[i] ) + if ( coface_counter[i] != face_counter[i] ) { if ( number_of_position_in_which_counters_do_not_agree != -1 ) { @@ -164,8 +157,8 @@ class Bitmap_cubical_complex_base { int incidence = 1; if ( number_of_full_faces_that_comes_before%2 )incidence = -1; //if the boundary cell is on the right from coboundary cell: - if ( cbd_counter[number_of_position_in_which_counters_do_not_agree]+1 == - bd_counter[number_of_position_in_which_counters_do_not_agree] + if ( coface_counter[number_of_position_in_which_counters_do_not_agree]+1 == + face_counter[number_of_position_in_which_counters_do_not_agree] ) { incidence *= -1; @@ -174,7 +167,16 @@ class Bitmap_cubical_complex_base { return incidence; } + /** + * In the case of get_dimension_of_a_cell function, the output is a non-negative integer + * indicating the dimension of a cell. + * Note that unlike in the case of boundary, over here the elements are + * not guaranteed to be returned with alternating incidence numbers. + * To compute incidence between cells use compute_incidence_between_cells + * procedure + **/ inline unsigned get_dimension_of_a_cell(size_t cell)const; + /** * In the case of get_cell_data, the output parameter is a reference to the value of a cube in a given position. * This allows reading and changing the value of filtration. Note that if the value of a filtration is changed, the diff --git a/src/Bitmap_cubical_complex/include/gudhi/Bitmap_cubical_complex_periodic_boundary_conditions_base.h b/src/Bitmap_cubical_complex/include/gudhi/Bitmap_cubical_complex_periodic_boundary_conditions_base.h index 9411f4b2..176d64ad 100644 --- a/src/Bitmap_cubical_complex/include/gudhi/Bitmap_cubical_complex_periodic_boundary_conditions_base.h +++ b/src/Bitmap_cubical_complex/include/gudhi/Bitmap_cubical_complex_periodic_boundary_conditions_base.h @@ -105,27 +105,29 @@ class Bitmap_cubical_complex_periodic_boundary_conditions_base : public Bitmap_c /** - * This procedure compute incidence numbers between cells. - * Note that first parameter is the address of a cell of dimension n, - * and the second parameter is the address of adjusted cell in dimension + * This procedure compute incidence numbers between cells. For a cell A of + * dimension n and a cell B \subset A of dimension n-1, an incidence + * between A and B is the integer with which B appears in the boundary of A. + * Note that first parameter is a cell of dimension n, + * and the second parameter is an adjusted cell in dimension * n-1. **/ - virtual int compute_incidence_between_cells( size_t coBoundary , size_t boundary ) + virtual int compute_incidence_between_cells( size_t coface , size_t face ) { //first get the counters for coBoundary and boundary: - std::vector cbd_counter = this->compute_counter_for_given_cell( coBoundary ); - std::vector bd_counter = this->compute_counter_for_given_cell( boundary ); + std::vector coface_counter = this->compute_counter_for_given_cell( coface ); + std::vector face_counter = this->compute_counter_for_given_cell( face ); //cbd_counter and bd_counter should agree at all positions except from one: int number_of_position_in_which_counters_do_not_agree = -1; size_t number_of_full_faces_that_comes_before = 0; - for ( size_t i = 0 ; i != cbd_counter.size() ; ++i ) + for ( size_t i = 0 ; i != coface_counter.size() ; ++i ) { - if ( (cbd_counter[i]%2 == 1)&&(number_of_position_in_which_counters_do_not_agree==-1) ) + if ( (coface_counter[i]%2 == 1)&&(number_of_position_in_which_counters_do_not_agree==-1) ) { ++number_of_full_faces_that_comes_before; } - if ( cbd_counter[i] != bd_counter[i] ) + if ( coface_counter[i] != face_counter[i] ) { if ( number_of_position_in_which_counters_do_not_agree != -1 ) { @@ -139,13 +141,13 @@ class Bitmap_cubical_complex_periodic_boundary_conditions_base : public Bitmap_c int incidence = 1; if ( number_of_full_faces_that_comes_before%2 )incidence = -1; //if the boundary cell is on the right from coboundary cell: - if ( (cbd_counter[number_of_position_in_which_counters_do_not_agree]+1 == - bd_counter[number_of_position_in_which_counters_do_not_agree]) + if ( (coface_counter[number_of_position_in_which_counters_do_not_agree]+1 == + face_counter[number_of_position_in_which_counters_do_not_agree]) || ( - (cbd_counter[number_of_position_in_which_counters_do_not_agree] != 1) + (coface_counter[number_of_position_in_which_counters_do_not_agree] != 1) && - (bd_counter[number_of_position_in_which_counters_do_not_agree]==0) + (face_counter[number_of_position_in_which_counters_do_not_agree]==0) ) ) { -- cgit v1.2.3