summaryrefslogtreecommitdiff
path: root/src/Bitmap_cubical_complex/include/gudhi/Bitmap_cubical_complex.h
diff options
context:
space:
mode:
authorpdlotko <pdlotko@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2016-01-13 10:14:41 +0000
committerpdlotko <pdlotko@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2016-01-13 10:14:41 +0000
commit35143d2a24e7a601a4629a7cfe43ea6b8ea35f1a (patch)
treea65fab2617e5ad8b4384ca258b1abf3fa0d31612 /src/Bitmap_cubical_complex/include/gudhi/Bitmap_cubical_complex.h
parent12226486b5bf3f1d867f46aed5dc6d2c9727a03c (diff)
Adding documentation of the class.
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/bitmap@963 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 6eec3b7216880475ed667660275c2314bf0feb0c
Diffstat (limited to 'src/Bitmap_cubical_complex/include/gudhi/Bitmap_cubical_complex.h')
-rw-r--r--src/Bitmap_cubical_complex/include/gudhi/Bitmap_cubical_complex.h43
1 files changed, 32 insertions, 11 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 b324d272..63edcadd 100644
--- a/src/Bitmap_cubical_complex/include/gudhi/Bitmap_cubical_complex.h
+++ b/src/Bitmap_cubical_complex/include/gudhi/Bitmap_cubical_complex.h
@@ -23,7 +23,8 @@
#pragma once
#include <limits>
-#include "Bitmap_cubical_complex_base.h"
+#include "Bitmap_cubical_complex_base.h"
+#include "Bitmap_cubical_complex_periodic_boundary_conditions_base.h"
@@ -38,15 +39,15 @@ const bool globalDbg = false;
template <typename T> class is_before_in_filtration;
-template <typename T = double>
-class Bitmap_cubical_complex : public Bitmap_cubical_complex_base<T>
+template <typename T>
+class Bitmap_cubical_complex : public T
{
public:
//*********************************************//
//Typedefs and typenames
//*********************************************//
typedef size_t Simplex_key;
- typedef T Filtration_value;
+ typedef typename T::filtration_type Filtration_value;
typedef Simplex_key Simplex_handle;
@@ -63,7 +64,7 @@ public:
* Constructor form a Perseus-style file.
**/
Bitmap_cubical_complex( const char* perseus_style_file ):
- Bitmap_cubical_complex_base<T>(perseus_style_file),key_associated_to_simplex(this->total_number_of_cells+1)
+ T(perseus_style_file),key_associated_to_simplex(this->total_number_of_cells+1)
{
if ( globalDbg ){cerr << "Bitmap_cubical_complex( const char* perseus_style_file )\n";}
for ( size_t i = 0 ; i != this->total_number_of_cells ; ++i )
@@ -82,8 +83,28 @@ public:
* in the following directions and vector of element of a type T
* with filtration on top dimensional cells.
**/
- Bitmap_cubical_complex( const std::vector<unsigned>& dimensions , const std::vector<T>& top_dimensional_cells ):
- Bitmap_cubical_complex_base<T>(dimensions,top_dimensional_cells),
+ Bitmap_cubical_complex( const std::vector<unsigned>& dimensions , const std::vector<typename T::filtration_type>& top_dimensional_cells ):
+ T(dimensions,top_dimensional_cells),
+ key_associated_to_simplex(this->total_number_of_cells+1)
+ {
+ for ( size_t i = 0 ; i != this->total_number_of_cells ; ++i )
+ {
+ this->key_associated_to_simplex[i] = i;
+ }
+ //we initialize this only once, in each constructor, when the bitmap is constructed.
+ //If the user decide to change some elements of the bitmap, then this procedure need
+ //to be called again.
+ this->initialize_simplex_associated_to_key();
+ }
+
+ /**
+ * Constructor that requires vector of elements of type unsigned, which gives number of top dimensional cells
+ * in the following directions and vector of element of a type T::filtration_type
+ * with filtration on top dimensional cells. The last parameter of the constructor is a vector of bools of a length equal to the dimension of cubical complex.
+ * If the position i on this vector is true, then we impose periodic boundary conditions in this direction.
+ **/
+ Bitmap_cubical_complex( const std::vector<unsigned>& dimensions , const std::vector<typename T::filtration_type>& top_dimensional_cells , std::vector< bool > directions_in_which_periodic_b_cond_are_to_be_imposed ):
+ T(dimensions,top_dimensional_cells,directions_in_which_periodic_b_cond_are_to_be_imposed),
key_associated_to_simplex(this->total_number_of_cells+1)
{
for ( size_t i = 0 ; i != this->total_number_of_cells ; ++i )
@@ -138,9 +159,9 @@ public:
/**
* Return the filtration of a cell pointed by the Simplex_handle.
**/
- T filtration(Simplex_handle sh)
+ typename T::filtration_type filtration(Simplex_handle sh)
{
- if ( globalDbg ){cerr << "T filtration(const Simplex_handle& sh)\n";}
+ if ( globalDbg ){cerr << "T::filtration_type filtration(const Simplex_handle& sh)\n";}
//Returns the filtration value of a simplex.
if ( sh != std::numeric_limits<Simplex_handle>::max() ) return this->data[sh];
return std::numeric_limits<Simplex_handle>::max();
@@ -493,8 +514,8 @@ public:
bool operator()( const typename Bitmap_cubical_complex<T>::Simplex_handle sh1, const typename Bitmap_cubical_complex<T>::Simplex_handle sh2) const
{
// Not using st_->filtration(sh1) because it uselessly tests for null_simplex.
- T fil1 = CC_->data[sh1];
- T fil2 = CC_->data[sh2];
+ typename T::filtration_type fil1 = CC_->data[sh1];
+ typename T::filtration_type fil2 = CC_->data[sh2];
if ( fil1 != fil2 )
{
return fil1 < fil2;