summaryrefslogtreecommitdiff
path: root/src/Bitmap_cubical_complex
diff options
context:
space:
mode:
authorvrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2016-03-30 06:14:43 +0000
committervrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2016-03-30 06:14:43 +0000
commitbea7dab826c2dcff4632df3d99480adc94be3f8d (patch)
treebb6ca7fabf379cc48dc08c3c0e4ac6c7441e5d0d /src/Bitmap_cubical_complex
parentc3f3b627da09dc85616ae4a43787ea5f1fdeaf1f (diff)
cpplint/cppcheck fixes
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/bitmap@1078 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 794e42d37fa8417489d92d6d67d05399225d6fcd
Diffstat (limited to 'src/Bitmap_cubical_complex')
-rw-r--r--src/Bitmap_cubical_complex/include/gudhi/Bitmap_cubical_complex.h2
-rw-r--r--src/Bitmap_cubical_complex/include/gudhi/Bitmap_cubical_complex_base.h77
-rw-r--r--src/Bitmap_cubical_complex/include/gudhi/Bitmap_cubical_complex_periodic_boundary_conditions_base.h19
3 files changed, 59 insertions, 39 deletions
diff --git a/src/Bitmap_cubical_complex/include/gudhi/Bitmap_cubical_complex.h b/src/Bitmap_cubical_complex/include/gudhi/Bitmap_cubical_complex.h
index 86bfbd56..de463d8e 100644
--- a/src/Bitmap_cubical_complex/include/gudhi/Bitmap_cubical_complex.h
+++ b/src/Bitmap_cubical_complex/include/gudhi/Bitmap_cubical_complex.h
@@ -285,6 +285,7 @@ class Bitmap_cubical_complex : public T {
}
this->b = rhs.b;
this->position = rhs.position;
+ return (*this);
}
bool operator==(const Filtration_simplex_iterator& rhs)const {
@@ -454,6 +455,7 @@ class Bitmap_cubical_complex : public T {
this->b = rhs.b;
this->position = rhs.position;
this->dimension = rhs.dimension;
+ return (*this);
}
bool operator==(const Skeleton_simplex_iterator& rhs)const {
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 d858f3c5..2258b581 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
@@ -140,7 +140,7 @@ class Bitmap_cubical_complex_base {
* then there is no need to call this function. Call it only if you are putting the filtration
* of the cells by your own (for instance by using Top_dimensional_cells_iterator).
**/
- void impose_lower_star_filtration(); // assume that top dimensional cells are already set.
+ void impose_lower_star_filtration(); // assume that top dimensional cells are already set.
/**
* Returns dimension of a complex.
@@ -198,7 +198,6 @@ class Bitmap_cubical_complex_base {
**/
class All_cells_iterator : std::iterator< std::input_iterator_tag, T > {
public:
-
All_cells_iterator() {
this->counter = 0;
}
@@ -215,7 +214,7 @@ class Bitmap_cubical_complex_base {
return result;
}
- All_cells_iterator operator=(const All_cells_iterator& rhs) {
+ All_cells_iterator& operator=(const All_cells_iterator& rhs) {
this->counter = rhs.counter;
return *this;
}
@@ -230,8 +229,10 @@ class Bitmap_cubical_complex_base {
}
/*
- * The operator * returns position of a cube in the structure of cubical complex. This position can be then used as an argument of the following functions:
- * get_boundary_of_a_cell, get_coboundary_of_a_cell, get_dimension_of_a_cell to get information about the cell boundary and coboundary and dimension
+ * The operator * returns position of a cube in the structure of cubical complex. This position can be then used as
+ * an argument of the following functions:
+ * get_boundary_of_a_cell, get_coboundary_of_a_cell, get_dimension_of_a_cell to get information about the cell
+ * boundary and coboundary and dimension
* and in function get_cell_data to get a filtration of a cell.
*/
size_t operator*() {
@@ -264,8 +265,7 @@ class Bitmap_cubical_complex_base {
**/
class All_cells_range {
public:
-
- All_cells_range(Bitmap_cubical_complex_base* b) : b(b) { };
+ All_cells_range(Bitmap_cubical_complex_base* b) : b(b) { }
All_cells_iterator begin() {
return b->all_cells_iterator_begin();
@@ -344,7 +344,7 @@ class Bitmap_cubical_complex_base {
return result;
}
- Top_dimensional_cells_iterator operator=(const Top_dimensional_cells_iterator& rhs) {
+ Top_dimensional_cells_iterator& operator=(const Top_dimensional_cells_iterator& rhs) {
this->counter = rhs.counter;
this->b = rhs.b;
return *this;
@@ -364,8 +364,10 @@ class Bitmap_cubical_complex_base {
}
/*
- * The operator * returns position of a cube in the structure of cubical complex. This position can be then used as an argument of the following functions:
- * get_boundary_of_a_cell, get_coboundary_of_a_cell, get_dimension_of_a_cell to get information about the cell boundary and coboundary and dimension
+ * The operator * returns position of a cube in the structure of cubical complex. This position can be then used as
+ * an argument of the following functions:
+ * get_boundary_of_a_cell, get_coboundary_of_a_cell, get_dimension_of_a_cell to get information about the cell
+ * boundary and coboundary and dimension
* and in function get_cell_data to get a filtration of a cell.
*/
size_t operator*() {
@@ -416,8 +418,7 @@ class Bitmap_cubical_complex_base {
**/
class Top_dimensional_cells_range {
public:
-
- Top_dimensional_cells_range(Bitmap_cubical_complex_base* b) : b(b) { };
+ Top_dimensional_cells_range(Bitmap_cubical_complex_base* b) : b(b) { }
Top_dimensional_cells_iterator begin() {
return b->top_dimensional_cells_iterator_begin();
@@ -485,10 +486,13 @@ class Bitmap_cubical_complex_base {
return counter;
}
void read_perseus_style_file(const char* perseus_style_file);
- void setup_bitmap_based_on_top_dimensional_cells_list(const std::vector<unsigned>& sizes_in_following_directions, const std::vector<T>& top_dimensional_cells);
+ void setup_bitmap_based_on_top_dimensional_cells_list(const std::vector<unsigned>& sizes_in_following_directions,
+ const std::vector<T>& top_dimensional_cells);
Bitmap_cubical_complex_base(const char* perseus_style_file, std::vector<bool> directions);
Bitmap_cubical_complex_base(const std::vector<unsigned>& sizes, std::vector<bool> directions);
- Bitmap_cubical_complex_base(const std::vector<unsigned>& dimensions, const std::vector<T>& top_dimensional_cells, std::vector<bool> directions);
+ Bitmap_cubical_complex_base(const std::vector<unsigned>& dimensions,
+ const std::vector<T>& top_dimensional_cells,
+ std::vector<bool> directions);
};
template <typename T>
@@ -556,7 +560,8 @@ Bitmap_cubical_complex_base<T>::Bitmap_cubical_complex_base
}
template <typename T>
-void Bitmap_cubical_complex_base<T>::setup_bitmap_based_on_top_dimensional_cells_list(const std::vector<unsigned>& sizes_in_following_directions, const std::vector<T>& top_dimensional_cells) {
+void Bitmap_cubical_complex_base<T>::setup_bitmap_based_on_top_dimensional_cells_list(const std::vector<unsigned>& sizes_in_following_directions,
+ const std::vector<T>& top_dimensional_cells) {
this->set_up_containers(sizes_in_following_directions);
size_t number_of_top_dimensional_elements = 1;
@@ -568,7 +573,7 @@ void Bitmap_cubical_complex_base<T>::setup_bitmap_based_on_top_dimensional_cells
<< ", std::vector<T> top_dimensional_cells ). Number of top dimensional elements that follow from "
<< "sizes_in_following_directions vector is different than the size of top_dimensional_cells vector."
<< std::endl;
- throw ("Error in constructor Bitmap_cubical_complex_base( std::vector<size_t> sizes_in_following_directions,"
+ throw("Error in constructor Bitmap_cubical_complex_base( std::vector<size_t> sizes_in_following_directions,"
"std::vector<T> top_dimensional_cells ). Number of top dimensional elements that follow from "
"sizes_in_following_directions vector is different than the size of top_dimensional_cells vector.");
}
@@ -591,7 +596,7 @@ Bitmap_cubical_complex_base<T>::Bitmap_cubical_complex_base
template <typename T>
void Bitmap_cubical_complex_base<T>::read_perseus_style_file(const char* perseus_style_file) {
bool dbg = false;
- std::ifstream inFiltration, inIds;
+ std::ifstream inFiltration;
inFiltration.open(perseus_style_file);
unsigned dimensionOfData;
inFiltration >> dimensionOfData;
@@ -634,23 +639,30 @@ void Bitmap_cubical_complex_base<T>::read_perseus_style_file(const char* perseus
}
template <typename T>
-Bitmap_cubical_complex_base<T>::Bitmap_cubical_complex_base(const char* perseus_style_file, std::vector<bool> directions) {
- //this constructor is here just for compatibility with a class that creates cubical complexes with periodic bundary conditions.
- //It ignores the last parameter of the function.
+Bitmap_cubical_complex_base<T>::Bitmap_cubical_complex_base(const char* perseus_style_file,
+ std::vector<bool> directions) {
+ // this constructor is here just for compatibility with a class that creates cubical complexes with periodic boundary
+ // conditions.
+ // It ignores the last parameter of the function.
this->read_perseus_style_file(perseus_style_file);
}
template <typename T>
-Bitmap_cubical_complex_base<T>::Bitmap_cubical_complex_base(const std::vector<unsigned>& sizes, std::vector<bool> directions) {
- //this constructor is here just for compatibility with a class that creates cubical complexes with periodic bundary conditions.
- //It ignores the last parameter of the function.
+Bitmap_cubical_complex_base<T>::Bitmap_cubical_complex_base(const std::vector<unsigned>& sizes,
+ std::vector<bool> directions) {
+ // this constructor is here just for compatibility with a class that creates cubical complexes with periodic boundary
+ // conditions.
+ // It ignores the last parameter of the function.
this->set_up_containers(sizes);
}
template <typename T>
-Bitmap_cubical_complex_base<T>::Bitmap_cubical_complex_base(const std::vector<unsigned>& dimensions, const std::vector<T>& top_dimensional_cells, std::vector<bool> directions) {
- //this constructor is here just for compatibility with a class that creates cubical complexes with periodic bundary conditions.
- //It ignores the last parameter of the function.
+Bitmap_cubical_complex_base<T>::Bitmap_cubical_complex_base(const std::vector<unsigned>& dimensions,
+ const std::vector<T>& top_dimensional_cells,
+ std::vector<bool> directions) {
+ // this constructor is here just for compatibility with a class that creates cubical complexes with periodic boundary
+ // conditions.
+ // It ignores the last parameter of the function.
this->setup_bitmap_based_on_top_dimensional_cells_list(dimensions, top_dimensional_cells);
}
@@ -663,7 +675,7 @@ template <typename T>
std::vector< size_t > Bitmap_cubical_complex_base<T>::get_boundary_of_a_cell(size_t cell)const {
std::vector< size_t > boundary_elements;
- //Speed traded of for memory. Check if it is better in practice.
+ // Speed traded of for memory. Check if it is better in practice.
boundary_elements.reserve(this->dimension()*2);
size_t cell1 = cell;
@@ -763,14 +775,17 @@ void Bitmap_cubical_complex_base<T>::impose_lower_star_filtration() {
std::vector<size_t> bd = this->get_boundary_of_a_cell(indices_to_consider[i]);
for (size_t boundaryIt = 0; boundaryIt != bd.size(); ++boundaryIt) {
if (dbg) {
- std::cerr << "filtration of a cell : " << bd[boundaryIt] << " is : " << this->data[ bd[boundaryIt] ] << " while of a cell: " << indices_to_consider[i] << " is: " << this->data[ indices_to_consider[i] ] << std::endl;
+ std::cerr << "filtration of a cell : " << bd[boundaryIt] << " is : " << this->data[ bd[boundaryIt] ]
+ << " while of a cell: " << indices_to_consider[i] << " is: " << this->data[ indices_to_consider[i] ]
+ << std::endl;
getchar();
}
if (this->data[ bd[boundaryIt] ] > this->data[ indices_to_consider[i] ]) {
this->data[ bd[boundaryIt] ] = this->data[ indices_to_consider[i] ];
if (dbg) {
- std::cerr << "Setting the value of a cell : " << bd[boundaryIt] << " to : " << this->data[ indices_to_consider[i] ] << std::endl;
+ std::cerr << "Setting the value of a cell : " << bd[boundaryIt] << " to : "
+ << this->data[ indices_to_consider[i] ] << std::endl;
getchar();
}
}
@@ -798,8 +813,8 @@ bool compareFirstElementsOfTuples(const std::pair< std::pair< T, size_t >, char
}
}
-} // namespace Cubical_complex
+} // namespace Cubical_complex
-} // namespace Gudhi
+} // namespace Gudhi
#endif // BITMAP_CUBICAL_COMPLEX_BASE_H_
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 8afa342e..a446c0e8 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
@@ -44,9 +44,10 @@ namespace Cubical_complex {
* @ingroup cubical_complex
*/
/**
-* This is a class implementing a bitmap data structure with periodic boundary conditions. Most of the functions are identical to the functions from Bitmap_cubical_complex_base.
-* The ones that needed to be updated are the constructors and get_boundary_of_a_cell and get_coboundary_of_a_cell.
-*/
+ * This is a class implementing a bitmap data structure with periodic boundary conditions. Most of the functions are
+ * identical to the functions from Bitmap_cubical_complex_base.
+ * The ones that needed to be updated are the constructors and get_boundary_of_a_cell and get_coboundary_of_a_cell.
+ */
template <typename T>
class Bitmap_cubical_complex_periodic_boundary_conditions_base : public Bitmap_cubical_complex_base<T> {
public:
@@ -88,14 +89,16 @@ class Bitmap_cubical_complex_periodic_boundary_conditions_base : public Bitmap_c
// overwritten methods co compute boundary and coboundary
/**
- * A version of a function that return boundary of a given cell for an object of Bitmap_cubical_complex_periodic_boundary_conditions_base class.
+ * A version of a function that return boundary of a given cell for an object of
+ * Bitmap_cubical_complex_periodic_boundary_conditions_base class.
*/
- virtual std::vector< size_t > get_boundary_of_a_cell(size_t cell)const;
+ virtual std::vector< size_t > get_boundary_of_a_cell(size_t cell) const;
/**
- * A version of a function that return coboundary of a given cell for an object of Bitmap_cubical_complex_periodic_boundary_conditions_base class.
+ * A version of a function that return coboundary of a given cell for an object of
+ * Bitmap_cubical_complex_periodic_boundary_conditions_base class.
*/
- virtual std::vector< size_t > get_coboundary_of_a_cell( size_t cell )const;
+ virtual std::vector< size_t > get_coboundary_of_a_cell(size_t cell) const;
protected:
std::vector< bool > directions_in_which_periodic_b_cond_are_to_be_imposed;
@@ -132,7 +135,7 @@ void Bitmap_cubical_complex_periodic_boundary_conditions_base<T>::construct_comp
this->set_up_containers(dimensions);
size_t i = 0;
- for (typename Bitmap_cubical_complex_periodic_boundary_conditions_base<T>::Top_dimensional_cells_iterator it = this->top_dimensional_cells_iterator_begin(); it != this->top_dimensional_cells_iterator_end(); ++it) {
+ for (auto it = this->top_dimensional_cells_iterator_begin(); it != this->top_dimensional_cells_iterator_end(); ++it) {
this->get_cell_data(*it) = topDimensionalCells[i];
++i;
}