diff options
Diffstat (limited to 'src/common/include/gudhi/reader_utils.h')
-rw-r--r-- | src/common/include/gudhi/reader_utils.h | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/src/common/include/gudhi/reader_utils.h b/src/common/include/gudhi/reader_utils.h index 98335552..a7d82541 100644 --- a/src/common/include/gudhi/reader_utils.h +++ b/src/common/include/gudhi/reader_utils.h @@ -14,7 +14,7 @@ #include <gudhi/graph_simplicial_complex.h> #include <gudhi/Debug_utils.h> -#include <boost/function_output_iterator.hpp> +# include <boost/iterator/function_output_iterator.hpp> #include <boost/graph/adjacency_list.hpp> #include <iostream> @@ -220,7 +220,7 @@ template <typename Filtration_value> std::vector<std::vector<Filtration_value>> read_lower_triangular_matrix_from_csv_file(const std::string& filename, const char separator = ';') { #ifdef DEBUG_TRACES - std::cout << "Using procedure read_lower_triangular_matrix_from_csv_file \n"; + std::clog << "Using procedure read_lower_triangular_matrix_from_csv_file \n"; #endif // DEBUG_TRACES std::vector<std::vector<Filtration_value>> result; std::ifstream in; @@ -231,7 +231,7 @@ std::vector<std::vector<Filtration_value>> read_lower_triangular_matrix_from_csv std::string line; - // the first line is emtpy, so we ignore it: + // the first line is empty, so we ignore it: std::getline(in, line); std::vector<Filtration_value> values_in_this_line; result.push_back(values_in_this_line); @@ -272,12 +272,12 @@ std::vector<std::vector<Filtration_value>> read_lower_triangular_matrix_from_csv in.close(); #ifdef DEBUG_TRACES - std::cerr << "Here is the matrix we read : \n"; + std::clog << "Here is the matrix we read : \n"; for (size_t i = 0; i != result.size(); ++i) { for (size_t j = 0; j != result[i].size(); ++j) { - std::cerr << result[i][j] << " "; + std::clog << result[i][j] << " "; } - std::cerr << std::endl; + std::clog << std::endl; } #endif // DEBUG_TRACES @@ -293,6 +293,9 @@ Note: the function does not check that birth <= death. **/ template <typename OutputIterator> void read_persistence_intervals_and_dimension(std::string const& filename, OutputIterator out) { +#ifdef DEBUG_TRACES + std::clog << "read_persistence_intervals_and_dimension - " << filename << std::endl; +#endif // DEBUG_TRACES std::ifstream in(filename); if (!in.is_open()) { std::string error_str("read_persistence_intervals_and_dimension - Unable to open file "); @@ -307,6 +310,13 @@ void read_persistence_intervals_and_dimension(std::string const& filename, Outpu if (line.length() != 0 && line[0] != '#') { double numbers[4]; int n = sscanf(line.c_str(), "%lf %lf %lf %lf", &numbers[0], &numbers[1], &numbers[2], &numbers[3]); +#ifdef DEBUG_TRACES + std::clog << "[" << n << "] = "; + for (int i = 0; i < n; i++) { + std::clog << numbers[i] << ","; + } + std::clog << std::endl; +#endif // DEBUG_TRACES if (n >= 2) { int dim = (n >= 3 ? static_cast<int>(numbers[n - 3]) : -1); *out++ = std::make_tuple(dim, numbers[n - 2], numbers[n - 1]); |