From 5b589de006e816739d2807d7f388835ec6afee74 Mon Sep 17 00:00:00 2001 From: pdlotko Date: Mon, 15 May 2017 12:41:40 +0000 Subject: another cry to remove problem on osx git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/gudhi_stat@2419 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 4113cf4b19c33496bbee34302aa61f2d32c94442 --- .../include/gudhi/read_persistence_from_file.h | 58 ++++++++++++---------- 1 file changed, 31 insertions(+), 27 deletions(-) diff --git a/src/Gudhi_stat/include/gudhi/read_persistence_from_file.h b/src/Gudhi_stat/include/gudhi/read_persistence_from_file.h index b82a55b3..058c77a4 100644 --- a/src/Gudhi_stat/include/gudhi/read_persistence_from_file.h +++ b/src/Gudhi_stat/include/gudhi/read_persistence_from_file.h @@ -158,8 +158,8 @@ std::vector > read_persistence_intervals_in_one_dimensi if ( number_of_entries_per_line == -1 ) { number_of_entries_per_line = 0; - std::string line_copy = line; - if ( line.find("inf") != std::string::npos ) + std::string line_copy(line); + if ( line_copy.find("inf") != std::string::npos ) { size_t np = line_copy.find("inf"); //replace symbols 'inf' in line_copy with whilespaces: @@ -231,6 +231,7 @@ std::vector > read_persistence_intervals_in_one_dimensi } else { + //this is a line with infinity. Since the variable what_to_substitute_for_infinite_bar have not been set up, it means that this line will be skipped. if ( dbg ) { std::cerr << "We will skip it \n"; @@ -238,37 +239,40 @@ std::vector > read_persistence_intervals_in_one_dimensi } continue; } - //Then, we read the content of the line. We know that it do not contain 'inf' substring. - std::stringstream lineSS(line); - double beginn, endd, field, dim; - if ( number_of_entries_per_line == 4 )lineSS >> field; - if ( number_of_entries_per_line >= 3 ) - { - lineSS >> dim; - } else { - dim = dimension; - } - lineSS >> beginn; - lineSS >> endd; - if ( beginn > endd ) - { - std::swap(beginn,endd); - } - if ( dim == dimension ) - { - barcode.push_back( std::make_pair( beginn , endd ) ); - if (dbg) + //Then, we read the content of the line. We know that it do not contain 'inf' substring. + std::stringstream lineSS(line); + double beginn, endd, field, dim; + if ( number_of_entries_per_line == 4 )lineSS >> field; + if ( number_of_entries_per_line >= 3 ) { - std::cerr << "This is a line that is going to the output : " << beginn << " , " << endd << std::endl; + lineSS >> dim; } - } - else - { - if ( (number_of_entries_per_line==3) && (dimension == -1) ) + else { + dim = dimension; + } + lineSS >> beginn; + lineSS >> endd; + if ( beginn > endd ) + { + std::swap(beginn,endd); + } + if ( dim == dimension ) + { barcode.push_back( std::make_pair( beginn , endd ) ); + if (dbg) + { + std::cerr << "This is a line that is going to the output : " << beginn << " , " << endd << std::endl; + } + } + else + { + if ( (number_of_entries_per_line==3) && (dimension == -1) ) + { + barcode.push_back( std::make_pair( beginn , endd ) ); + } } } } -- cgit v1.2.3