summaryrefslogtreecommitdiff
path: root/src/Bitmap_cubical_complex
diff options
context:
space:
mode:
authorvrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2017-11-07 20:05:53 +0000
committervrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2017-11-07 20:05:53 +0000
commit127c62dc4ceb084b3fe8f5b8b91929793e486f17 (patch)
treedb2ffc2819c9f9214c165b1a8b977f6dd1b21345 /src/Bitmap_cubical_complex
parente938aa1a5852bcef7f68502265582c39a3bb5508 (diff)
clang format files
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/periodic_cubical_complex_fix@2846 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: e4f9294f08f25331eac20bb90a321792e96cca2d
Diffstat (limited to 'src/Bitmap_cubical_complex')
-rw-r--r--src/Bitmap_cubical_complex/example/Bitmap_cubical_complex.cpp22
-rw-r--r--src/Bitmap_cubical_complex/example/Bitmap_cubical_complex_periodic_boundary_conditions.cpp26
-rw-r--r--src/Bitmap_cubical_complex/example/Random_bitmap_cubical_complex.cpp19
-rw-r--r--src/Bitmap_cubical_complex/include/gudhi/Bitmap_cubical_complex.h107
-rw-r--r--src/Bitmap_cubical_complex/include/gudhi/Bitmap_cubical_complex_base.h369
-rw-r--r--src/Bitmap_cubical_complex/include/gudhi/Bitmap_cubical_complex_periodic_boundary_conditions_base.h255
-rw-r--r--src/Bitmap_cubical_complex/test/Bitmap_test.cpp1710
7 files changed, 1168 insertions, 1340 deletions
diff --git a/src/Bitmap_cubical_complex/example/Bitmap_cubical_complex.cpp b/src/Bitmap_cubical_complex/example/Bitmap_cubical_complex.cpp
index 6c02eff1..9d1bc08c 100644
--- a/src/Bitmap_cubical_complex/example/Bitmap_cubical_complex.cpp
+++ b/src/Bitmap_cubical_complex/example/Bitmap_cubical_complex.cpp
@@ -20,7 +20,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-
#include <gudhi/reader_utils.h>
#include <gudhi/Bitmap_cubical_complex.h>
#include <gudhi/Persistent_cohomology.h>
@@ -32,16 +31,18 @@
#include <cstddef>
int main(int argc, char** argv) {
- std::cout << "This program computes persistent homology, by using bitmap_cubical_complex class, of cubical " <<
- "complexes provided in text files in Perseus style (the only numbered in the first line is a dimension D of a" <<
- "bitmap. In the lines I between 2 and D+1 there are numbers of top dimensional cells in the direction I. Let " <<
- "N denote product of the numbers in the lines between 2 and D. In the lines D+2 to D+2+N there are " <<
- "filtrations of top dimensional cells. We assume that the cells are in the lexicographical order. See " <<
- "CubicalOneSphere.txt or CubicalTwoSphere.txt for example.\n" << std::endl;
+ std::cout
+ << "This program computes persistent homology, by using bitmap_cubical_complex class, of cubical "
+ << "complexes provided in text files in Perseus style (the only numbered in the first line is a dimension D of a"
+ << "bitmap. In the lines I between 2 and D+1 there are numbers of top dimensional cells in the direction I. Let "
+ << "N denote product of the numbers in the lines between 2 and D. In the lines D+2 to D+2+N there are "
+ << "filtrations of top dimensional cells. We assume that the cells are in the lexicographical order. See "
+ << "CubicalOneSphere.txt or CubicalTwoSphere.txt for example.\n"
+ << std::endl;
if (argc != 2) {
- std::cerr << "Wrong number of parameters. Please provide the name of a file with a Perseus style bitmap at " <<
- "the input. The program will now terminate.\n";
+ std::cerr << "Wrong number of parameters. Please provide the name of a file with a Perseus style bitmap at "
+ << "the input. The program will now terminate.\n";
return 1;
}
@@ -66,7 +67,7 @@ int main(int argc, char** argv) {
std::size_t last_in_path = output_file_name.find_last_of("/\\");
if (last_in_path != std::string::npos) {
- output_file_name = output_file_name.substr(last_in_path+1);
+ output_file_name = output_file_name.substr(last_in_path + 1);
}
std::ofstream out(output_file_name.c_str());
@@ -77,4 +78,3 @@ int main(int argc, char** argv) {
return 0;
}
-
diff --git a/src/Bitmap_cubical_complex/example/Bitmap_cubical_complex_periodic_boundary_conditions.cpp b/src/Bitmap_cubical_complex/example/Bitmap_cubical_complex_periodic_boundary_conditions.cpp
index 32935205..c812cb3a 100644
--- a/src/Bitmap_cubical_complex/example/Bitmap_cubical_complex_periodic_boundary_conditions.cpp
+++ b/src/Bitmap_cubical_complex/example/Bitmap_cubical_complex_periodic_boundary_conditions.cpp
@@ -20,7 +20,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-
#include <gudhi/reader_utils.h>
#include <gudhi/Bitmap_cubical_complex.h>
#include <gudhi/Bitmap_cubical_complex_periodic_boundary_conditions_base.h>
@@ -33,22 +32,24 @@
#include <string>
int main(int argc, char** argv) {
- std::cout << "This program computes persistent homology, by using " <<
- "Bitmap_cubical_complex_periodic_boundary_conditions class, of cubical complexes provided in text files in " <<
- "Perseus style (the only numbered in the first line is a dimension D of a bitmap. In the lines I between 2 " <<
- "and D+1 there are numbers of top dimensional cells in the direction I. Let N denote product of the numbers " <<
- "in the lines between 2 and D. In the lines D+2 to D+2+N there are filtrations of top dimensional cells. We " <<
- "assume that the cells are in the lexicographical order. See CubicalOneSphere.txt or CubicalTwoSphere.txt for" <<
- " example.\n" << std::endl;
+ std::cout
+ << "This program computes persistent homology, by using "
+ << "Bitmap_cubical_complex_periodic_boundary_conditions class, of cubical complexes provided in text files in "
+ << "Perseus style (the only numbered in the first line is a dimension D of a bitmap. In the lines I between 2 "
+ << "and D+1 there are numbers of top dimensional cells in the direction I. Let N denote product of the numbers "
+ << "in the lines between 2 and D. In the lines D+2 to D+2+N there are filtrations of top dimensional cells. We "
+ << "assume that the cells are in the lexicographical order. See CubicalOneSphere.txt or CubicalTwoSphere.txt for"
+ << " example.\n"
+ << std::endl;
if (argc != 2) {
- std::cerr << "Wrong number of parameters. Please provide the name of a file with a Perseus style bitmap at " <<
- "the input. The program will now terminate.\n";
+ std::cerr << "Wrong number of parameters. Please provide the name of a file with a Perseus style bitmap at "
+ << "the input. The program will now terminate.\n";
return 1;
}
typedef Gudhi::cubical_complex::Bitmap_cubical_complex_periodic_boundary_conditions_base<double> Bitmap_base;
- typedef Gudhi::cubical_complex::Bitmap_cubical_complex< Bitmap_base > Bitmap_cubical_complex;
+ typedef Gudhi::cubical_complex::Bitmap_cubical_complex<Bitmap_base> Bitmap_cubical_complex;
Bitmap_cubical_complex b(argv[1]);
@@ -68,7 +69,7 @@ int main(int argc, char** argv) {
std::size_t last_in_path = output_file_name.find_last_of("/\\");
if (last_in_path != std::string::npos) {
- output_file_name = output_file_name.substr(last_in_path+1);
+ output_file_name = output_file_name.substr(last_in_path + 1);
}
std::ofstream out(output_file_name.c_str());
@@ -79,4 +80,3 @@ int main(int argc, char** argv) {
return 0;
}
-
diff --git a/src/Bitmap_cubical_complex/example/Random_bitmap_cubical_complex.cpp b/src/Bitmap_cubical_complex/example/Random_bitmap_cubical_complex.cpp
index 16ad65a0..f70558f2 100644
--- a/src/Bitmap_cubical_complex/example/Random_bitmap_cubical_complex.cpp
+++ b/src/Bitmap_cubical_complex/example/Random_bitmap_cubical_complex.cpp
@@ -20,7 +20,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-
// for persistence algorithm
#include <gudhi/reader_utils.h>
#include <gudhi/Bitmap_cubical_complex.h>
@@ -34,10 +33,11 @@
int main(int argc, char** argv) {
srand(time(0));
- std::cout << "This program computes persistent homology, by using bitmap_cubical_complex class, of cubical " <<
- "complexes. The first parameter of the program is the dimension D of the bitmap. The next D parameters are " <<
- "number of top dimensional cubes in each dimension of the bitmap. The program will create random cubical " <<
- "complex of that sizes and compute persistent homology of it." << std::endl;
+ std::cout
+ << "This program computes persistent homology, by using bitmap_cubical_complex class, of cubical "
+ << "complexes. The first parameter of the program is the dimension D of the bitmap. The next D parameters are "
+ << "number of top dimensional cubes in each dimension of the bitmap. The program will create random cubical "
+ << "complex of that sizes and compute persistent homology of it." << std::endl;
int p = 2;
double min_persistence = 0;
@@ -47,16 +47,16 @@ int main(int argc, char** argv) {
return 1;
}
- size_t dimensionOfBitmap = (size_t) atoi(argv[1]);
- std::vector< unsigned > sizes;
+ size_t dimensionOfBitmap = (size_t)atoi(argv[1]);
+ std::vector<unsigned> sizes;
size_t multipliers = 1;
for (size_t dim = 0; dim != dimensionOfBitmap; ++dim) {
- unsigned sizeInThisDimension = (unsigned) atoi(argv[2 + dim]);
+ unsigned sizeInThisDimension = (unsigned)atoi(argv[2 + dim]);
sizes.push_back(sizeInThisDimension);
multipliers *= sizeInThisDimension;
}
- std::vector< double > data;
+ std::vector<double> data;
for (size_t i = 0; i != multipliers; ++i) {
data.push_back(rand() / static_cast<double>(RAND_MAX));
}
@@ -80,4 +80,3 @@ int main(int argc, char** argv) {
return 0;
}
-
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 f395de65..f82e8ce9 100644
--- a/src/Bitmap_cubical_complex/include/gudhi/Bitmap_cubical_complex.h
+++ b/src/Bitmap_cubical_complex/include/gudhi/Bitmap_cubical_complex.h
@@ -31,7 +31,7 @@
#endif
#include <limits>
-#include <utility> // for pair<>
+#include <utility> // for pair<>
#include <algorithm> // for sort
#include <vector>
#include <numeric> // for iota
@@ -43,7 +43,8 @@ namespace cubical_complex {
// global variable, was used just for debugging.
const bool globalDbg = false;
-template <typename T> class is_before_in_filtration;
+template <typename T>
+class is_before_in_filtration;
/**
* @brief Cubical complex represented as a bitmap.
@@ -64,7 +65,6 @@ class Bitmap_cubical_complex : public T {
typedef typename T::filtration_type Filtration_value;
typedef Simplex_key Simplex_handle;
-
//*********************************************//
// Constructors
//*********************************************//
@@ -77,8 +77,8 @@ class Bitmap_cubical_complex : public T {
/**
* Constructor form a Perseus-style file.
**/
- Bitmap_cubical_complex(const char* perseus_style_file) :
- T(perseus_style_file), key_associated_to_simplex(this->total_number_of_cells + 1) {
+ Bitmap_cubical_complex(const char* perseus_style_file)
+ : T(perseus_style_file), key_associated_to_simplex(this->total_number_of_cells + 1) {
if (globalDbg) {
std::cerr << "Bitmap_cubical_complex( const char* perseus_style_file )\n";
}
@@ -97,9 +97,8 @@ class Bitmap_cubical_complex : public T {
* with filtration on top dimensional cells.
**/
Bitmap_cubical_complex(const std::vector<unsigned>& dimensions,
- const std::vector<Filtration_value>& top_dimensional_cells) :
- T(dimensions, top_dimensional_cells),
- key_associated_to_simplex(this->total_number_of_cells + 1) {
+ const std::vector<Filtration_value>& 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;
}
@@ -118,9 +117,9 @@ class Bitmap_cubical_complex : public T {
**/
Bitmap_cubical_complex(const std::vector<unsigned>& dimensions,
const std::vector<Filtration_value>& 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) {
+ 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) {
this->key_associated_to_simplex[i] = i;
}
@@ -142,9 +141,7 @@ class Bitmap_cubical_complex : public T {
/**
* Returns number of all cubes in the complex.
**/
- size_t num_simplices()const {
- return this->total_number_of_cells;
- }
+ size_t num_simplices() const { return this->total_number_of_cells; }
/**
* Returns a Simplex_handle to a cube that do not exist in this complex.
@@ -159,14 +156,12 @@ class Bitmap_cubical_complex : public T {
/**
* Returns dimension of the complex.
**/
- inline size_t dimension()const {
- return this->sizes.size();
- }
+ inline size_t dimension() const { return this->sizes.size(); }
/**
* Return dimension of a cell pointed by the Simplex_handle.
**/
- inline unsigned dimension(Simplex_handle sh)const {
+ inline unsigned dimension(Simplex_handle sh) const {
if (globalDbg) {
std::cerr << "unsigned dimension(const Simplex_handle& sh)\n";
}
@@ -199,7 +194,7 @@ class Bitmap_cubical_complex : public T {
/**
* Return the key of a cube pointed by the Simplex_handle.
**/
- Simplex_key key(Simplex_handle sh)const {
+ Simplex_key key(Simplex_handle sh) const {
if (globalDbg) {
std::cerr << "Simplex_key key(const Simplex_handle& sh)\n";
}
@@ -217,7 +212,7 @@ class Bitmap_cubical_complex : public T {
std::cerr << "Simplex_handle simplex(Simplex_key key)\n";
}
if (key != null_key()) {
- return this->simplex_associated_to_key[ key ];
+ return this->simplex_associated_to_key[key];
}
return null_simplex();
}
@@ -246,8 +241,8 @@ class Bitmap_cubical_complex : public T {
/**
* Boundary_simplex_range class provides ranges for boundary iterators.
**/
- typedef typename std::vector< Simplex_handle >::iterator Boundary_simplex_iterator;
- typedef typename std::vector< Simplex_handle > Boundary_simplex_range;
+ typedef typename std::vector<Simplex_handle>::iterator Boundary_simplex_iterator;
+ typedef typename std::vector<Simplex_handle> Boundary_simplex_range;
/**
* Filtration_simplex_iterator class provides an iterator though the whole structure in the order of filtration.
@@ -257,13 +252,13 @@ class Bitmap_cubical_complex : public T {
**/
class Filtration_simplex_range;
- class Filtration_simplex_iterator : std::iterator< std::input_iterator_tag, Simplex_handle > {
+ class Filtration_simplex_iterator : std::iterator<std::input_iterator_tag, Simplex_handle> {
// Iterator over all simplices of the complex in the order of the indexing scheme.
// 'value_type' must be 'Simplex_handle'.
public:
- Filtration_simplex_iterator(Bitmap_cubical_complex* b) : b(b), position(0) { }
+ Filtration_simplex_iterator(Bitmap_cubical_complex* b) : b(b), position(0) {}
- Filtration_simplex_iterator() : b(NULL), position(0) { }
+ Filtration_simplex_iterator() : b(NULL), position(0) {}
Filtration_simplex_iterator operator++() {
if (globalDbg) {
@@ -288,14 +283,14 @@ class Bitmap_cubical_complex : public T {
return (*this);
}
- bool operator==(const Filtration_simplex_iterator& rhs)const {
+ bool operator==(const Filtration_simplex_iterator& rhs) const {
if (globalDbg) {
std::cerr << "bool operator == ( const Filtration_simplex_iterator& rhs )\n";
}
- return ( this->position == rhs.position);
+ return (this->position == rhs.position);
}
- bool operator!=(const Filtration_simplex_iterator& rhs)const {
+ bool operator!=(const Filtration_simplex_iterator& rhs) const {
if (globalDbg) {
std::cerr << "bool operator != ( const Filtration_simplex_iterator& rhs )\n";
}
@@ -306,7 +301,7 @@ class Bitmap_cubical_complex : public T {
if (globalDbg) {
std::cerr << "Simplex_handle operator*()\n";
}
- return this->b->simplex_associated_to_key[ this->position ];
+ return this->b->simplex_associated_to_key[this->position];
}
friend class Filtration_simplex_range;
@@ -326,7 +321,7 @@ class Bitmap_cubical_complex : public T {
typedef Filtration_simplex_iterator const_iterator;
typedef Filtration_simplex_iterator iterator;
- Filtration_simplex_range(Bitmap_cubical_complex<T>* b) : b(b) { }
+ Filtration_simplex_range(Bitmap_cubical_complex<T>* b) : b(b) {}
Filtration_simplex_iterator begin() {
if (globalDbg) {
@@ -348,8 +343,6 @@ class Bitmap_cubical_complex : public T {
Bitmap_cubical_complex<T>* b;
};
-
-
//*********************************************//
// Methods to access iterators from the container:
@@ -357,9 +350,7 @@ class Bitmap_cubical_complex : public T {
* boundary_simplex_range creates an object of a Boundary_simplex_range class
* that provides ranges for the Boundary_simplex_iterator.
**/
- Boundary_simplex_range boundary_simplex_range(Simplex_handle sh) {
- return this->get_boundary_of_a_cell(sh);
- }
+ Boundary_simplex_range boundary_simplex_range(Simplex_handle sh) { return this->get_boundary_of_a_cell(sh); }
/**
* filtration_simplex_range creates an object of a Filtration_simplex_range class
@@ -374,8 +365,6 @@ class Bitmap_cubical_complex : public T {
}
//*********************************************//
-
-
//*********************************************//
// Elements which are in Gudhi now, but I (and in all the cases I asked also Marc) do not understand why they are
// there.
@@ -390,25 +379,25 @@ class Bitmap_cubical_complex : public T {
* Function needed for compatibility with Gudhi. Not useful for other purposes.
**/
std::pair<Simplex_handle, Simplex_handle> endpoints(Simplex_handle sh) {
- std::vector< size_t > bdry = this->get_boundary_of_a_cell(sh);
+ std::vector<size_t> bdry = this->get_boundary_of_a_cell(sh);
if (globalDbg) {
std::cerr << "std::pair<Simplex_handle, Simplex_handle> endpoints( Simplex_handle sh )\n";
std::cerr << "bdry.size() : " << bdry.size() << std::endl;
}
// this method returns two first elements from the boundary of sh.
if (bdry.size() < 2)
- throw("Error in endpoints in Bitmap_cubical_complex class. The cell have less than two elements in the "
- "boundary.");
+ throw(
+ "Error in endpoints in Bitmap_cubical_complex class. The cell have less than two elements in the "
+ "boundary.");
return std::make_pair(bdry[0], bdry[1]);
}
-
/**
* Class needed for compatibility with Gudhi. Not useful for other purposes.
**/
class Skeleton_simplex_range;
- class Skeleton_simplex_iterator : std::iterator< std::input_iterator_tag, Simplex_handle > {
+ class Skeleton_simplex_iterator : std::iterator<std::input_iterator_tag, Simplex_handle> {
// Iterator over all simplices of the complex in the order of the indexing scheme.
// 'value_type' must be 'Simplex_handle'.
public:
@@ -418,15 +407,13 @@ class Bitmap_cubical_complex : public T {
}
// find the position of the first simplex of a dimension d
this->position = 0;
- while (
- (this->position != b->data.size()) &&
- (this->b->get_dimension_of_a_cell(this->position) != this->dimension)
- ) {
+ while ((this->position != b->data.size()) &&
+ (this->b->get_dimension_of_a_cell(this->position) != this->dimension)) {
++this->position;
}
}
- Skeleton_simplex_iterator() : b(NULL), position(0), dimension(0) { }
+ Skeleton_simplex_iterator() : b(NULL), position(0), dimension(0) {}
Skeleton_simplex_iterator operator++() {
if (globalDbg) {
@@ -434,10 +421,8 @@ class Bitmap_cubical_complex : public T {
}
// increment the position as long as you did not get to the next element of the dimension dimension.
++this->position;
- while (
- (this->position != this->b->data.size()) &&
- (this->b->get_dimension_of_a_cell(this->position) != this->dimension)
- ) {
+ while ((this->position != this->b->data.size()) &&
+ (this->b->get_dimension_of_a_cell(this->position) != this->dimension)) {
++this->position;
}
return (*this);
@@ -459,14 +444,14 @@ class Bitmap_cubical_complex : public T {
return (*this);
}
- bool operator==(const Skeleton_simplex_iterator& rhs)const {
+ bool operator==(const Skeleton_simplex_iterator& rhs) const {
if (globalDbg) {
std::cerr << "bool operator ==\n";
}
- return ( this->position == rhs.position);
+ return (this->position == rhs.position);
}
- bool operator!=(const Skeleton_simplex_iterator& rhs)const {
+ bool operator!=(const Skeleton_simplex_iterator& rhs) const {
if (globalDbg) {
std::cerr << "bool operator != ( const Skeleton_simplex_iterator& rhs )\n";
}
@@ -481,6 +466,7 @@ class Bitmap_cubical_complex : public T {
}
friend class Skeleton_simplex_range;
+
private:
Bitmap_cubical_complex<T>* b;
size_t position;
@@ -497,7 +483,7 @@ class Bitmap_cubical_complex : public T {
typedef Skeleton_simplex_iterator const_iterator;
typedef Skeleton_simplex_iterator iterator;
- Skeleton_simplex_range(Bitmap_cubical_complex<T>* b, unsigned dimension) : b(b), dimension(dimension) { }
+ Skeleton_simplex_range(Bitmap_cubical_complex<T>* b, unsigned dimension) : b(b), dimension(dimension) {}
Skeleton_simplex_iterator begin() {
if (globalDbg) {
@@ -533,8 +519,8 @@ class Bitmap_cubical_complex : public T {
friend class is_before_in_filtration<T>;
protected:
- std::vector< size_t > key_associated_to_simplex;
- std::vector< size_t > simplex_associated_to_key;
+ std::vector<size_t> key_associated_to_simplex;
+ std::vector<size_t> simplex_associated_to_key;
}; // Bitmap_cubical_complex
template <typename T>
@@ -552,16 +538,15 @@ void Bitmap_cubical_complex<T>::initialize_simplex_associated_to_key() {
#endif
// we still need to deal here with a key_associated_to_simplex:
- for ( size_t i = 0 ; i != simplex_associated_to_key.size() ; ++i ) {
- this->key_associated_to_simplex[ simplex_associated_to_key[i] ] = i;
+ for (size_t i = 0; i != simplex_associated_to_key.size(); ++i) {
+ this->key_associated_to_simplex[simplex_associated_to_key[i]] = i;
}
}
template <typename T>
class is_before_in_filtration {
public:
- explicit is_before_in_filtration(Bitmap_cubical_complex<T> * CC)
- : CC_(CC) { }
+ explicit is_before_in_filtration(Bitmap_cubical_complex<T>* CC) : CC_(CC) {}
bool operator()(const typename Bitmap_cubical_complex<T>::Simplex_handle& sh1,
const typename Bitmap_cubical_complex<T>::Simplex_handle& sh2) 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 8e8d3a52..4adadce6 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
@@ -32,7 +32,7 @@
#include <algorithm>
#include <iterator>
#include <limits>
-#include <utility>
+#include <utility>
#include <stdexcept>
namespace Gudhi {
@@ -66,8 +66,7 @@ class Bitmap_cubical_complex_base {
/**
*Default constructor
**/
- Bitmap_cubical_complex_base() :
- total_number_of_cells(0) { }
+ Bitmap_cubical_complex_base() : total_number_of_cells(0) {}
/**
* There are a few constructors of a Bitmap_cubical_complex_base class.
* First one, that takes vector<unsigned>, creates an empty bitmap of a dimension equal
@@ -91,7 +90,7 @@ class Bitmap_cubical_complex_base {
/**
* Destructor of the Bitmap_cubical_complex_base class.
**/
- virtual ~Bitmap_cubical_complex_base() { }
+ virtual ~Bitmap_cubical_complex_base() {}
/**
* The functions get_boundary_of_a_cell, get_coboundary_of_a_cell, get_dimension_of_a_cell
@@ -101,10 +100,10 @@ class Bitmap_cubical_complex_base {
* non-negative integer, indicating a position of a cube in the data structure.
* 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
+ * The boundary elements are guaranteed to be returned so that the
* incidence coefficients of boundary elements are alternating.
*/
- virtual inline std::vector< size_t > get_boundary_of_a_cell(size_t cell)const;
+ virtual inline std::vector<size_t> get_boundary_of_a_cell(size_t cell) const;
/**
* The functions get_coboundary_of_a_cell, get_coboundary_of_a_cell,
* get_dimension_of_a_cell and get_cell_data are the basic
@@ -115,79 +114,74 @@ 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.
- * Note that unlike in the case of boundary, over here the elements are
+ * Note that unlike in the case of boundary, over here the elements are
* not guaranteed to be returned with alternating incidence numbers.
- *
+ *
**/
- virtual inline std::vector< size_t > get_coboundary_of_a_cell(size_t cell)const;
-
+ virtual inline std::vector<size_t> get_coboundary_of_a_cell(size_t cell) const;
+
/**
* This procedure compute incidence numbers between cubes. For a cube \f$A\f$ of
* dimension n and a cube \f$B \subset A\f$ of dimension n-1, an incidence
* between \f$A\f$ and \f$B\f$ is the integer with which \f$B\f$ appears in the boundary of \f$A\f$.
* Note that first parameter is a cube of dimension n,
* and the second parameter is an adjusted cube in dimension n-1.
- * Given \f$A = [b_1,e_1] \times \ldots \ [b_{j-1},e_{j-1}] \times [b_{j},e_{j}] \times [b_{j+1},e_{j+1}] \times \ldots \times [b_{n},e_{n}] \f$
+ * Given \f$A = [b_1,e_1] \times \ldots \ [b_{j-1},e_{j-1}] \times [b_{j},e_{j}] \times [b_{j+1},e_{j+1}] \times \ldots
+ *\times [b_{n},e_{n}] \f$
* such that \f$ b_{j} \neq e_{j} \f$
- * and \f$B = [b_1,e_1] \times \ldots \ [b_{j-1},e_{j-1}] \times [a,a] \times [b_{j+1},e_{j+1}] \times \ldots \times [b_{n},e_{n}] \f$
+ * and \f$B = [b_1,e_1] \times \ldots \ [b_{j-1},e_{j-1}] \times [a,a] \times [b_{j+1},e_{j+1}] \times \ldots \times
+ *[b_{n},e_{n}] \f$
* where \f$ a = b_{j}\f$ or \f$ a = e_{j}\f$, the incidence between \f$A\f$ and \f$B\f$
* computed by this procedure is given by formula:
* \f$ c\ (-1)^{\sum_{i=1}^{j-1} dim [b_{i},e_{i}]} \f$
- * Where \f$ dim [b_{i},e_{i}] = 0 \f$ if \f$ b_{i}=e_{i} \f$ and 1 in other case.
- * c is -1 if \f$ a = b_{j}\f$ and 1 if \f$ a = e_{j}\f$.
+ * Where \f$ dim [b_{i},e_{i}] = 0 \f$ if \f$ b_{i}=e_{i} \f$ and 1 in other case.
+ * c is -1 if \f$ a = b_{j}\f$ and 1 if \f$ a = e_{j}\f$.
* @exception std::logic_error In case when the cube \f$B\f$ is not n-1
* dimensional face of a cube \f$A\f$.
- **/
- virtual int compute_incidence_between_cells( size_t coface , size_t face )const
- {
-
- //first get the counters for coface and face:
- std::vector<unsigned> coface_counter = this->compute_counter_for_given_cell( coface );
- std::vector<unsigned> face_counter = this->compute_counter_for_given_cell( face );
-
- //coface_counter and face_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 != coface_counter.size() ; ++i )
- {
- if ( (coface_counter[i]%2 == 1)&&(number_of_position_in_which_counters_do_not_agree==-1) )
- {
- ++number_of_full_faces_that_comes_before;
- }
- if ( coface_counter[i] != face_counter[i] )
- {
- if ( number_of_position_in_which_counters_do_not_agree != -1 )
- {
- std::cout << "Cells given to compute_incidence_between_cells procedure do not form a pair of coface-face.\n";
- throw std::logic_error("Cells given to compute_incidence_between_cells procedure do not form a pair of coface-face.");
- }
- number_of_position_in_which_counters_do_not_agree = i;
- }
- }
-
- int incidence = 1;
- if ( number_of_full_faces_that_comes_before%2 )incidence = -1;
- //if the face cell is on the right from coface cell:
- 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;
- }
-
- return incidence;
+ **/
+ virtual int compute_incidence_between_cells(size_t coface, size_t face) const {
+ // first get the counters for coface and face:
+ std::vector<unsigned> coface_counter = this->compute_counter_for_given_cell(coface);
+ std::vector<unsigned> face_counter = this->compute_counter_for_given_cell(face);
+
+ // coface_counter and face_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 != coface_counter.size(); ++i) {
+ if ((coface_counter[i] % 2 == 1) && (number_of_position_in_which_counters_do_not_agree == -1)) {
+ ++number_of_full_faces_that_comes_before;
+ }
+ if (coface_counter[i] != face_counter[i]) {
+ if (number_of_position_in_which_counters_do_not_agree != -1) {
+ std::cout << "Cells given to compute_incidence_between_cells procedure do not form a pair of coface-face.\n";
+ throw std::logic_error(
+ "Cells given to compute_incidence_between_cells procedure do not form a pair of coface-face.");
+ }
+ number_of_position_in_which_counters_do_not_agree = i;
+ }
+ }
+
+ int incidence = 1;
+ if (number_of_full_faces_that_comes_before % 2) incidence = -1;
+ // if the face cell is on the right from coface cell:
+ 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;
+ }
+
+ 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_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
@@ -196,7 +190,6 @@ class Bitmap_cubical_complex_base {
**/
inline T& get_cell_data(size_t cell);
-
/**
* Typical input used to construct a baseBitmap class is a filtration given at the top dimensional cells.
* Then, there are a few ways one can pick the filtration of lower dimensional
@@ -210,23 +203,19 @@ class Bitmap_cubical_complex_base {
/**
* Returns dimension of a complex.
**/
- inline unsigned dimension()const {
- return sizes.size();
- }
+ inline unsigned dimension() const { return sizes.size(); }
/**
* Returns number of all cubes in the data structure.
**/
- inline unsigned size()const {
- return this->data.size();
- }
+ inline unsigned size() const { return this->data.size(); }
/**
* Writing to stream operator. By using it we get the values T of cells in order in which they are stored in the
* structure. This procedure is used for debugging purposes.
**/
template <typename K>
- friend std::ostream& operator<<(std::ostream & os, const Bitmap_cubical_complex_base<K>& b);
+ friend std::ostream& operator<<(std::ostream& os, const Bitmap_cubical_complex_base<K>& b);
/**
* Function that put the input data to bins. By putting data to bins we mean rounding them to a sequence of values
@@ -253,7 +242,7 @@ class Bitmap_cubical_complex_base {
/**
* Functions to find min and max values of filtration.
**/
- std::pair< T, T > min_max_filtration();
+ std::pair<T, T> min_max_filtration();
// ITERATORS
@@ -261,11 +250,9 @@ class Bitmap_cubical_complex_base {
* @brief Iterator through all cells in the complex (in order they appear in the structure -- i.e.
* in lexicographical order).
**/
- class All_cells_iterator : std::iterator< std::input_iterator_tag, T > {
+ class All_cells_iterator : std::iterator<std::input_iterator_tag, T> {
public:
- All_cells_iterator() {
- this->counter = 0;
- }
+ All_cells_iterator() { this->counter = 0; }
All_cells_iterator operator++() {
// first find first element of the counter that can be increased:
@@ -284,14 +271,12 @@ class Bitmap_cubical_complex_base {
return *this;
}
- bool operator==(const All_cells_iterator& rhs)const {
- if (this->counter != rhs.counter)return false;
+ bool operator==(const All_cells_iterator& rhs) const {
+ if (this->counter != rhs.counter) return false;
return true;
}
- bool operator!=(const All_cells_iterator& rhs)const {
- return !(*this == rhs);
- }
+ bool operator!=(const All_cells_iterator& rhs) const { return !(*this == rhs); }
/*
* The operator * returns position of a cube in the structure of cubical complex. This position can be then used as
@@ -300,10 +285,9 @@ class Bitmap_cubical_complex_base {
* boundary and coboundary and dimension
* and in function get_cell_data to get a filtration of a cell.
*/
- size_t operator*() {
- return this->counter;
- }
+ size_t operator*() { return this->counter; }
friend class Bitmap_cubical_complex_base;
+
protected:
size_t counter;
};
@@ -330,57 +314,47 @@ 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();
- }
+ All_cells_iterator begin() { return b->all_cells_iterator_begin(); }
+
+ All_cells_iterator end() { return b->all_cells_iterator_end(); }
- All_cells_iterator end() {
- return b->all_cells_iterator_end();
- }
private:
Bitmap_cubical_complex_base<T>* b;
};
- All_cells_range all_cells_range() {
- return All_cells_range(this);
- }
-
+ All_cells_range all_cells_range() { return All_cells_range(this); }
/**
* Boundary_range class provides ranges for boundary iterators.
**/
- typedef typename std::vector< size_t >::const_iterator Boundary_iterator;
- typedef typename std::vector< size_t > Boundary_range;
+ typedef typename std::vector<size_t>::const_iterator Boundary_iterator;
+ typedef typename std::vector<size_t> Boundary_range;
/**
* boundary_simplex_range creates an object of a Boundary_simplex_range class
* that provides ranges for the Boundary_simplex_iterator.
**/
- Boundary_range boundary_range(size_t sh) {
- return this->get_boundary_of_a_cell(sh);
- }
+ Boundary_range boundary_range(size_t sh) { return this->get_boundary_of_a_cell(sh); }
/**
* Coboundary_range class provides ranges for boundary iterators.
**/
- typedef typename std::vector< size_t >::const_iterator Coboundary_iterator;
- typedef typename std::vector< size_t > Coboundary_range;
+ typedef typename std::vector<size_t>::const_iterator Coboundary_iterator;
+ typedef typename std::vector<size_t> Coboundary_range;
/**
* boundary_simplex_range creates an object of a Boundary_simplex_range class
* that provides ranges for the Boundary_simplex_iterator.
**/
- Coboundary_range coboundary_range(size_t sh) {
- return this->get_coboundary_of_a_cell(sh);
- }
+ Coboundary_range coboundary_range(size_t sh) { return this->get_coboundary_of_a_cell(sh); }
/**
* @brief Iterator through top dimensional cells of the complex. The cells appear in order they are stored
* in the structure (i.e. in lexicographical order)
**/
- class Top_dimensional_cells_iterator : std::iterator< std::input_iterator_tag, T > {
+ class Top_dimensional_cells_iterator : std::iterator<std::input_iterator_tag, T> {
public:
Top_dimensional_cells_iterator(Bitmap_cubical_complex_base& b) : b(b) {
this->counter = std::vector<size_t>(b.dimension());
@@ -390,7 +364,7 @@ class Bitmap_cubical_complex_base {
Top_dimensional_cells_iterator operator++() {
// first find first element of the counter that can be increased:
size_t dim = 0;
- while ((dim != this->b.dimension()) && (this->counter[dim] == this->b.sizes[dim] - 1))++dim;
+ while ((dim != this->b.dimension()) && (this->counter[dim] == this->b.sizes[dim] - 1)) ++dim;
if (dim != this->b.dimension()) {
++this->counter[dim];
@@ -415,18 +389,16 @@ class Bitmap_cubical_complex_base {
return *this;
}
- bool operator==(const Top_dimensional_cells_iterator& rhs)const {
- if (&this->b != &rhs.b)return false;
- if (this->counter.size() != rhs.counter.size())return false;
+ bool operator==(const Top_dimensional_cells_iterator& rhs) const {
+ if (&this->b != &rhs.b) return false;
+ if (this->counter.size() != rhs.counter.size()) return false;
for (size_t i = 0; i != this->counter.size(); ++i) {
- if (this->counter[i] != rhs.counter[i])return false;
+ if (this->counter[i] != rhs.counter[i]) return false;
}
return true;
}
- bool operator!=(const Top_dimensional_cells_iterator& rhs)const {
- return !(*this == rhs);
- }
+ bool operator!=(const Top_dimensional_cells_iterator& rhs) const { return !(*this == rhs); }
/*
* The operator * returns position of a cube in the structure of cubical complex. This position can be then used as
@@ -435,11 +407,9 @@ class Bitmap_cubical_complex_base {
* boundary and coboundary and dimension
* and in function get_cell_data to get a filtration of a cell.
*/
- size_t operator*() {
- return this->compute_index_in_bitmap();
- }
+ size_t operator*() { return this->compute_index_in_bitmap(); }
- size_t compute_index_in_bitmap()const {
+ size_t compute_index_in_bitmap() const {
size_t index = 0;
for (size_t i = 0; i != this->counter.size(); ++i) {
index += (2 * this->counter[i] + 1) * this->b.multipliers[i];
@@ -447,14 +417,15 @@ class Bitmap_cubical_complex_base {
return index;
}
- void print_counter()const {
+ void print_counter() const {
for (size_t i = 0; i != this->counter.size(); ++i) {
std::cout << this->counter[i] << " ";
}
}
friend class Bitmap_cubical_complex_base;
+
protected:
- std::vector< size_t > counter;
+ std::vector<size_t> counter;
Bitmap_cubical_complex_base& b;
};
@@ -483,32 +454,24 @@ 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();
- }
+ Top_dimensional_cells_iterator begin() { return b->top_dimensional_cells_iterator_begin(); }
+
+ Top_dimensional_cells_iterator end() { return b->top_dimensional_cells_iterator_end(); }
- Top_dimensional_cells_iterator end() {
- return b->top_dimensional_cells_iterator_end();
- }
private:
Bitmap_cubical_complex_base<T>* b;
};
- Top_dimensional_cells_range top_dimensional_cells_range() {
- return Top_dimensional_cells_range(this);
- }
-
+ Top_dimensional_cells_range top_dimensional_cells_range() { return Top_dimensional_cells_range(this); }
//****************************************************************************************************************//
//****************************************************************************************************************//
//****************************************************************************************************************//
//****************************************************************************************************************//
- inline size_t number_cells()const {
- return this->total_number_of_cells;
- }
+ inline size_t number_cells() const { return this->total_number_of_cells; }
//****************************************************************************************************************//
//****************************************************************************************************************//
@@ -532,7 +495,7 @@ class Bitmap_cubical_complex_base {
this->total_number_of_cells = multiplier;
}
- size_t compute_position_in_bitmap(const std::vector< unsigned >& counter) {
+ size_t compute_position_in_bitmap(const std::vector<unsigned>& counter) {
size_t position = 0;
for (size_t i = 0; i != this->multipliers.size(); ++i) {
position += this->multipliers[i] * counter[i];
@@ -540,7 +503,7 @@ class Bitmap_cubical_complex_base {
return position;
}
- std::vector<unsigned> compute_counter_for_given_cell(size_t cell)const {
+ std::vector<unsigned> compute_counter_for_given_cell(size_t cell) const {
std::vector<unsigned> counter;
counter.reserve(this->sizes.size());
for (size_t dim = this->sizes.size(); dim != 0; --dim) {
@@ -555,8 +518,7 @@ class Bitmap_cubical_complex_base {
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,
+ Bitmap_cubical_complex_base(const std::vector<unsigned>& dimensions, const std::vector<T>& top_dimensional_cells,
std::vector<bool> directions);
};
@@ -564,8 +526,8 @@ template <typename T>
void Bitmap_cubical_complex_base<T>::put_data_to_bins(size_t number_of_bins) {
bool bdg = false;
- std::pair< T, T > min_max = this->min_max_filtration();
- T dx = (min_max.second - min_max.first) / (T) number_of_bins;
+ std::pair<T, T> min_max = this->min_max_filtration();
+ T dx = (min_max.second - min_max.first) / (T)number_of_bins;
// now put the data into the appropriate bins:
for (size_t i = 0; i != this->data.size(); ++i) {
@@ -583,7 +545,7 @@ void Bitmap_cubical_complex_base<T>::put_data_to_bins(size_t number_of_bins) {
template <typename T>
void Bitmap_cubical_complex_base<T>::put_data_to_bins(T diameter_of_bin) {
bool bdg = false;
- std::pair< T, T > min_max = this->min_max_filtration();
+ std::pair<T, T> min_max = this->min_max_filtration();
size_t number_of_bins = (min_max.second - min_max.first) / diameter_of_bin;
// now put the data into the appropriate bins:
@@ -600,33 +562,32 @@ void Bitmap_cubical_complex_base<T>::put_data_to_bins(T diameter_of_bin) {
}
template <typename T>
-std::pair< T, T > Bitmap_cubical_complex_base<T>::min_max_filtration() {
- std::pair< T, T > min_max(std::numeric_limits<T>::max(), std::numeric_limits<T>::min());
+std::pair<T, T> Bitmap_cubical_complex_base<T>::min_max_filtration() {
+ std::pair<T, T> min_max(std::numeric_limits<T>::max(), std::numeric_limits<T>::min());
for (size_t i = 0; i != this->data.size(); ++i) {
- if (this->data[i] < min_max.first)min_max.first = this->data[i];
- if (this->data[i] > min_max.second)min_max.second = this->data[i];
+ if (this->data[i] < min_max.first) min_max.first = this->data[i];
+ if (this->data[i] > min_max.second) min_max.second = this->data[i];
}
return min_max;
}
template <typename K>
-std::ostream& operator<<(std::ostream & out, const Bitmap_cubical_complex_base<K>& b) {
- for (typename Bitmap_cubical_complex_base<K>::all_cells_const_iterator
- it = b.all_cells_const_begin(); it != b.all_cells_const_end(); ++it) {
+std::ostream& operator<<(std::ostream& out, const Bitmap_cubical_complex_base<K>& b) {
+ for (typename Bitmap_cubical_complex_base<K>::all_cells_const_iterator it = b.all_cells_const_begin();
+ it != b.all_cells_const_end(); ++it) {
out << *it << " ";
}
return out;
}
template <typename T>
-Bitmap_cubical_complex_base<T>::Bitmap_cubical_complex_base
-(const std::vector<unsigned>& sizes) {
+Bitmap_cubical_complex_base<T>::Bitmap_cubical_complex_base(const std::vector<unsigned>& sizes) {
this->set_up_containers(sizes);
}
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;
@@ -635,12 +596,13 @@ void Bitmap_cubical_complex_base<T>::setup_bitmap_based_on_top_dimensional_cells
}
if (number_of_top_dimensional_elements != top_dimensional_cells.size()) {
std::cerr << "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."
- << std::endl;
- 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.");
+ << ", 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,"
+ "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.");
}
Bitmap_cubical_complex_base<T>::Top_dimensional_cells_iterator it(*this);
@@ -653,8 +615,8 @@ void Bitmap_cubical_complex_base<T>::setup_bitmap_based_on_top_dimensional_cells
}
template <typename T>
-Bitmap_cubical_complex_base<T>::Bitmap_cubical_complex_base
-(const std::vector<unsigned>& sizes_in_following_directions, const std::vector<T>& top_dimensional_cells) {
+Bitmap_cubical_complex_base<T>::Bitmap_cubical_complex_base(const std::vector<unsigned>& sizes_in_following_directions,
+ const std::vector<T>& top_dimensional_cells) {
this->setup_bitmap_based_on_top_dimensional_cells_list(sizes_in_following_directions, top_dimensional_cells);
}
@@ -690,11 +652,9 @@ void Bitmap_cubical_complex_base<T>::read_perseus_style_file(const char* perseus
T filtrationLevel;
inFiltration >> filtrationLevel;
if (dbg) {
- std::cerr << "Cell of an index : "
- << it.compute_index_in_bitmap()
- << " and dimension: "
- << this->get_dimension_of_a_cell(it.compute_index_in_bitmap())
- << " get the value : " << filtrationLevel << std::endl;
+ std::cerr << "Cell of an index : " << it.compute_index_in_bitmap()
+ << " and dimension: " << this->get_dimension_of_a_cell(it.compute_index_in_bitmap())
+ << " get the value : " << filtrationLevel << std::endl;
}
this->get_cell_data(*it) = filtrationLevel;
++it;
@@ -737,59 +697,54 @@ Bitmap_cubical_complex_base<T>::Bitmap_cubical_complex_base(const char* perseus_
}
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;
+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.
- boundary_elements.reserve(this->dimension()*2);
+ boundary_elements.reserve(this->dimension() * 2);
size_t sum_of_dimensions = 0;
- size_t cell1 = cell;
+ size_t cell1 = cell;
for (size_t i = this->multipliers.size(); i != 0; --i) {
unsigned position = cell1 / this->multipliers[i - 1];
if (position % 2 == 1) {
- if ( sum_of_dimensions%2 )
- {
- boundary_elements.push_back(cell + this->multipliers[ i - 1 ]);
- boundary_elements.push_back(cell - this->multipliers[ i - 1 ]);
- }
- else
- {
- boundary_elements.push_back(cell - this->multipliers[ i - 1 ]);
- boundary_elements.push_back(cell + this->multipliers[ i - 1 ]);
- }
+ if (sum_of_dimensions % 2) {
+ boundary_elements.push_back(cell + this->multipliers[i - 1]);
+ boundary_elements.push_back(cell - this->multipliers[i - 1]);
+ } else {
+ boundary_elements.push_back(cell - this->multipliers[i - 1]);
+ boundary_elements.push_back(cell + this->multipliers[i - 1]);
+ }
++sum_of_dimensions;
}
cell1 = cell1 % this->multipliers[i - 1];
- }
-
+ }
+
return boundary_elements;
}
template <typename T>
-std::vector< size_t > Bitmap_cubical_complex_base<T>::get_coboundary_of_a_cell(size_t cell)const {
+std::vector<size_t> Bitmap_cubical_complex_base<T>::get_coboundary_of_a_cell(size_t cell) const {
std::vector<unsigned> counter = this->compute_counter_for_given_cell(cell);
- std::vector< size_t > coboundary_elements;
- size_t cell1 = cell;
+ std::vector<size_t> coboundary_elements;
+ size_t cell1 = cell;
for (size_t i = this->multipliers.size(); i != 0; --i) {
unsigned position = cell1 / this->multipliers[i - 1];
if (position % 2 == 0) {
- if ((cell > this->multipliers[i - 1]) && (counter[i - 1] != 0)) {
- coboundary_elements.push_back(cell - this->multipliers[i - 1]);
- }
- if (
- (cell + this->multipliers[i - 1] < this->data.size()) && (counter[i - 1] != 2 * this->sizes[i - 1])) {
- coboundary_elements.push_back(cell + this->multipliers[i - 1]);
- }
+ if ((cell > this->multipliers[i - 1]) && (counter[i - 1] != 0)) {
+ coboundary_elements.push_back(cell - this->multipliers[i - 1]);
+ }
+ if ((cell + this->multipliers[i - 1] < this->data.size()) && (counter[i - 1] != 2 * this->sizes[i - 1])) {
+ coboundary_elements.push_back(cell + this->multipliers[i - 1]);
+ }
}
cell1 = cell1 % this->multipliers[i - 1];
- }
+ }
return coboundary_elements;
}
-
template <typename T>
-unsigned Bitmap_cubical_complex_base<T>::get_dimension_of_a_cell(size_t cell)const {
+unsigned Bitmap_cubical_complex_base<T>::get_dimension_of_a_cell(size_t cell) const {
bool dbg = false;
if (dbg) std::cerr << "\n\n\n Computing position o a cell of an index : " << cell << std::endl;
unsigned dimension = 0;
@@ -827,7 +782,7 @@ void Bitmap_cubical_complex_base<T>::impose_lower_star_filtration() {
size_t size_to_reserve = 1;
for (size_t i = 0; i != this->multipliers.size(); ++i) {
- size_to_reserve *= (size_t) ((this->multipliers[i] - 1) / 2);
+ size_to_reserve *= (size_t)((this->multipliers[i] - 1) / 2);
}
std::vector<size_t> indices_to_consider;
@@ -852,22 +807,22 @@ 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 (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();
}
}
- if (is_this_cell_considered[ bd[boundaryIt] ] == false) {
+ if (is_this_cell_considered[bd[boundaryIt]] == false) {
new_indices_to_consider.push_back(bd[boundaryIt]);
- is_this_cell_considered[ bd[boundaryIt] ] = true;
+ is_this_cell_considered[bd[boundaryIt]] = true;
}
}
}
@@ -876,8 +831,8 @@ void Bitmap_cubical_complex_base<T>::impose_lower_star_filtration() {
}
template <typename T>
-bool compareFirstElementsOfTuples(const std::pair< std::pair< T, size_t >, char >& first,
- const std::pair< std::pair< T, size_t >, char >& second) {
+bool compareFirstElementsOfTuples(const std::pair<std::pair<T, size_t>, char>& first,
+ const std::pair<std::pair<T, size_t>, char>& second) {
if (first.first.first < second.first.first) {
return true;
} else {
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 30d6bf4f..e2f86f3b 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
@@ -42,7 +42,8 @@ namespace cubical_complex {
/**
* @brief Cubical complex with periodic boundary conditions represented as a bitmap.
* @ingroup cubical_complex
- * @details This is a class implementing a bitmap data structure with periodic boundary conditions. Most of the functions are
+ * @details 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.
*/
@@ -54,7 +55,7 @@ class Bitmap_cubical_complex_periodic_boundary_conditions_base : public Bitmap_c
/**
* Default constructor of Bitmap_cubical_complex_periodic_boundary_conditions_base class.
*/
- Bitmap_cubical_complex_periodic_boundary_conditions_base() { }
+ Bitmap_cubical_complex_periodic_boundary_conditions_base() {}
/**
* A constructor of Bitmap_cubical_complex_periodic_boundary_conditions_base class that takes the following
* parameters: (1) vector with numbers of top dimensional cells in all dimensions and (2) vector of booleans. If
@@ -62,8 +63,9 @@ class Bitmap_cubical_complex_periodic_boundary_conditions_base : public Bitmap_c
* imposed in this direction. In case of false, the periodic boundary conditions will not be imposed in the direction
* i.
*/
- Bitmap_cubical_complex_periodic_boundary_conditions_base(const std::vector<unsigned>& sizes,
- const std::vector<bool>& directions_in_which_periodic_b_cond_are_to_be_imposed);
+ Bitmap_cubical_complex_periodic_boundary_conditions_base(
+ const std::vector<unsigned>& sizes,
+ const std::vector<bool>& directions_in_which_periodic_b_cond_are_to_be_imposed);
/**
* A constructor of Bitmap_cubical_complex_periodic_boundary_conditions_base class that takes the name of Perseus
* style file as an input. Please consult the documentation about the specification of the file.
@@ -76,9 +78,9 @@ class Bitmap_cubical_complex_periodic_boundary_conditions_base : public Bitmap_c
* value, that means that periodic boundary conditions are to be imposed in this direction. In case of false, the
* periodic boundary conditions will not be imposed in the direction i.
*/
- Bitmap_cubical_complex_periodic_boundary_conditions_base(const std::vector<unsigned>& dimensions,
- const std::vector<T>& topDimensionalCells,
- const std::vector< bool >& directions_in_which_periodic_b_cond_are_to_be_imposed);
+ Bitmap_cubical_complex_periodic_boundary_conditions_base(
+ const std::vector<unsigned>& dimensions, const std::vector<T>& topDimensionalCells,
+ const std::vector<bool>& directions_in_which_periodic_b_cond_are_to_be_imposed);
/**
* Destructor of the Bitmap_cubical_complex_periodic_boundary_conditions_base class.
@@ -89,87 +91,77 @@ class Bitmap_cubical_complex_periodic_boundary_conditions_base : public Bitmap_c
/**
* A version of a function that return boundary of a given cell for an object of
* Bitmap_cubical_complex_periodic_boundary_conditions_base class.
- * The boundary elements are guaranteed to be returned so that the
+ * The boundary elements are guaranteed to be returned so that the
* incidence coefficients are alternating.
*/
- 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.
- * Note that unlike in the case of boundary, over here the elements are
+ * 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
*/
- 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;
+
/**
* This procedure compute incidence numbers between cubes. For a cube \f$A\f$ of
* dimension n and a cube \f$B \subset A\f$ of dimension n-1, an incidence
* between \f$A\f$ and \f$B\f$ is the integer with which \f$B\f$ appears in the boundary of \f$A\f$.
* Note that first parameter is a cube of dimension n,
* and the second parameter is an adjusted cube in dimension n-1.
- * Given \f$A = [b_1,e_1] \times \ldots \ [b_{j-1},e_{j-1}] \times [b_{j},e_{j}] \times [b_{j+1},e_{j+1}] \times \ldots \times [b_{n},e_{n}] \f$
+ * Given \f$A = [b_1,e_1] \times \ldots \ [b_{j-1},e_{j-1}] \times [b_{j},e_{j}] \times [b_{j+1},e_{j+1}] \times \ldots
+ *\times [b_{n},e_{n}] \f$
* such that \f$ b_{j} \neq e_{j} \f$
- * and \f$B = [b_1,e_1] \times \ldots \ [b_{j-1},e_{j-1}] \times [a,a] \times [b_{j+1},e_{j+1}] \times \ldots \times [b_{n},e_{n}]s \f$
+ * and \f$B = [b_1,e_1] \times \ldots \ [b_{j-1},e_{j-1}] \times [a,a] \times [b_{j+1},e_{j+1}] \times \ldots \times
+ *[b_{n},e_{n}]s \f$
* where \f$ a = b_{j}\f$ or \f$ a = e_{j}\f$, the incidence between \f$A\f$ and \f$B\f$
* computed by this procedure is given by formula:
* \f$ c\ (-1)^{\sum_{i=1}^{j-1} dim [b_{i},e_{i}]} \f$
- * Where \f$ dim [b_{i},e_{i}] = 0 \f$ if \f$ b_{i}=e_{i} \f$ and 1 in other case.
- * c is -1 if \f$ a = b_{j}\f$ and 1 if \f$ a = e_{j}\f$.
+ * Where \f$ dim [b_{i},e_{i}] = 0 \f$ if \f$ b_{i}=e_{i} \f$ and 1 in other case.
+ * c is -1 if \f$ a = b_{j}\f$ and 1 if \f$ a = e_{j}\f$.
* @exception std::logic_error In case when the cube \f$B\f$ is not n-1
* dimensional face of a cube \f$A\f$.
**/
- virtual int compute_incidence_between_cells( size_t coface , size_t face )
- {
- //first get the counters for coface and face:
- std::vector<unsigned> coface_counter = this->compute_counter_for_given_cell( coface );
- std::vector<unsigned> face_counter = this->compute_counter_for_given_cell( face );
-
- //coface_counter and face_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 != coface_counter.size() ; ++i )
- {
- if ( (coface_counter[i]%2 == 1)&&(number_of_position_in_which_counters_do_not_agree==-1) )
- {
- ++number_of_full_faces_that_comes_before;
- }
- if ( coface_counter[i] != face_counter[i] )
- {
- if ( number_of_position_in_which_counters_do_not_agree != -1 )
- {
- std::cout << "Cells given to compute_incidence_between_cells procedure do not form a pair of coface-face.\n";
- throw std::logic_error("Cells given to compute_incidence_between_cells procedure do not form a pair of coface-face.");
- }
- number_of_position_in_which_counters_do_not_agree = i;
- }
- }
-
- int incidence = 1;
- if ( number_of_full_faces_that_comes_before%2 )incidence = -1;
- //if the face cell is on the right from coface cell:
- if ( (coface_counter[number_of_position_in_which_counters_do_not_agree]+1 ==
- face_counter[number_of_position_in_which_counters_do_not_agree])
- ||
- (
- (coface_counter[number_of_position_in_which_counters_do_not_agree] != 1)
- &&
- (face_counter[number_of_position_in_which_counters_do_not_agree]==0)
- )
- )
- {
- incidence *= -1;
- }
-
- return incidence;
+ virtual int compute_incidence_between_cells(size_t coface, size_t face) {
+ // first get the counters for coface and face:
+ std::vector<unsigned> coface_counter = this->compute_counter_for_given_cell(coface);
+ std::vector<unsigned> face_counter = this->compute_counter_for_given_cell(face);
+
+ // coface_counter and face_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 != coface_counter.size(); ++i) {
+ if ((coface_counter[i] % 2 == 1) && (number_of_position_in_which_counters_do_not_agree == -1)) {
+ ++number_of_full_faces_that_comes_before;
+ }
+ if (coface_counter[i] != face_counter[i]) {
+ if (number_of_position_in_which_counters_do_not_agree != -1) {
+ std::cout << "Cells given to compute_incidence_between_cells procedure do not form a pair of coface-face.\n";
+ throw std::logic_error(
+ "Cells given to compute_incidence_between_cells procedure do not form a pair of coface-face.");
+ }
+ number_of_position_in_which_counters_do_not_agree = i;
+ }
+ }
+
+ int incidence = 1;
+ if (number_of_full_faces_that_comes_before % 2) incidence = -1;
+ // if the face cell is on the right from coface cell:
+ if ((coface_counter[number_of_position_in_which_counters_do_not_agree] + 1 ==
+ face_counter[number_of_position_in_which_counters_do_not_agree]) ||
+ ((coface_counter[number_of_position_in_which_counters_do_not_agree] != 1) &&
+ (face_counter[number_of_position_in_which_counters_do_not_agree] == 0))) {
+ incidence *= -1;
+ }
+
+ return incidence;
}
-
protected:
- std::vector< bool > directions_in_which_periodic_b_cond_are_to_be_imposed;
+ std::vector<bool> directions_in_which_periodic_b_cond_are_to_be_imposed;
void set_up_containers(const std::vector<unsigned>& sizes) {
unsigned multiplier = 1;
@@ -190,19 +182,19 @@ class Bitmap_cubical_complex_periodic_boundary_conditions_base : public Bitmap_c
Bitmap_cubical_complex_periodic_boundary_conditions_base(const std::vector<unsigned>& sizes);
Bitmap_cubical_complex_periodic_boundary_conditions_base(const std::vector<unsigned>& dimensions,
const std::vector<T>& topDimensionalCells);
-
+
/**
* A procedure used to construct the data structures in the class.
- **/
- void construct_complex_based_on_top_dimensional_cells(const std::vector<unsigned>& dimensions,
- const std::vector<T>& topDimensionalCells,
- const std::vector<bool>& directions_in_which_periodic_b_cond_are_to_be_imposed);
+ **/
+ void construct_complex_based_on_top_dimensional_cells(
+ const std::vector<unsigned>& dimensions, const std::vector<T>& topDimensionalCells,
+ const std::vector<bool>& directions_in_which_periodic_b_cond_are_to_be_imposed);
};
template <typename T>
-void Bitmap_cubical_complex_periodic_boundary_conditions_base<T>::construct_complex_based_on_top_dimensional_cells(const std::vector<unsigned>& dimensions,
- const std::vector<T>& topDimensionalCells,
- const std::vector<bool>& directions_in_which_periodic_b_cond_are_to_be_imposed) {
+void Bitmap_cubical_complex_periodic_boundary_conditions_base<T>::construct_complex_based_on_top_dimensional_cells(
+ const std::vector<unsigned>& dimensions, const std::vector<T>& topDimensionalCells,
+ const std::vector<bool>& directions_in_which_periodic_b_cond_are_to_be_imposed) {
this->directions_in_which_periodic_b_cond_are_to_be_imposed = directions_in_which_periodic_b_cond_are_to_be_imposed;
this->set_up_containers(dimensions);
@@ -215,14 +207,16 @@ void Bitmap_cubical_complex_periodic_boundary_conditions_base<T>::construct_comp
}
template <typename T>
-Bitmap_cubical_complex_periodic_boundary_conditions_base<T>::Bitmap_cubical_complex_periodic_boundary_conditions_base(const std::vector<unsigned>& sizes,
- const std::vector<bool>& directions_in_which_periodic_b_cond_are_to_be_imposed) {
+Bitmap_cubical_complex_periodic_boundary_conditions_base<T>::Bitmap_cubical_complex_periodic_boundary_conditions_base(
+ const std::vector<unsigned>& sizes,
+ const std::vector<bool>& directions_in_which_periodic_b_cond_are_to_be_imposed) {
this->directions_in_which_periodic_b_cond_are_to_be_imposed(directions_in_which_periodic_b_cond_are_to_be_imposed);
this->set_up_containers(sizes);
}
template <typename T>
-Bitmap_cubical_complex_periodic_boundary_conditions_base<T>::Bitmap_cubical_complex_periodic_boundary_conditions_base(const char* perseus_style_file) {
+Bitmap_cubical_complex_periodic_boundary_conditions_base<T>::Bitmap_cubical_complex_periodic_boundary_conditions_base(
+ const char* perseus_style_file) {
// for Perseus style files:
bool dbg = false;
@@ -251,14 +245,12 @@ Bitmap_cubical_complex_periodic_boundary_conditions_base<T>::Bitmap_cubical_comp
while (!inFiltration.eof()) {
double filtrationLevel;
inFiltration >> filtrationLevel;
- if (inFiltration.eof())break;
+ if (inFiltration.eof()) break;
if (dbg) {
- std::cerr << "Cell of an index : "
- << it.compute_index_in_bitmap()
- << " and dimension: "
- << this->get_dimension_of_a_cell(it.compute_index_in_bitmap())
- << " get the value : " << filtrationLevel << std::endl;
+ std::cerr << "Cell of an index : " << it.compute_index_in_bitmap()
+ << " and dimension: " << this->get_dimension_of_a_cell(it.compute_index_in_bitmap())
+ << " get the value : " << filtrationLevel << std::endl;
}
this->get_cell_data(*it) = filtrationLevel;
++it;
@@ -268,24 +260,24 @@ Bitmap_cubical_complex_periodic_boundary_conditions_base<T>::Bitmap_cubical_comp
}
template <typename T>
-Bitmap_cubical_complex_periodic_boundary_conditions_base<T>::Bitmap_cubical_complex_periodic_boundary_conditions_base(const std::vector<unsigned>& sizes) {
+Bitmap_cubical_complex_periodic_boundary_conditions_base<T>::Bitmap_cubical_complex_periodic_boundary_conditions_base(
+ const std::vector<unsigned>& sizes) {
this->directions_in_which_periodic_b_cond_are_to_be_imposed = std::vector<bool>(sizes.size(), false);
this->set_up_containers(sizes);
}
template <typename T>
-Bitmap_cubical_complex_periodic_boundary_conditions_base<T>::Bitmap_cubical_complex_periodic_boundary_conditions_base(const std::vector<unsigned>& dimensions,
- const std::vector<T>& topDimensionalCells) {
+Bitmap_cubical_complex_periodic_boundary_conditions_base<T>::Bitmap_cubical_complex_periodic_boundary_conditions_base(
+ const std::vector<unsigned>& dimensions, const std::vector<T>& topDimensionalCells) {
std::vector<bool> directions_in_which_periodic_b_cond_are_to_be_imposed = std::vector<bool>(dimensions.size(), false);
this->construct_complex_based_on_top_dimensional_cells(dimensions, topDimensionalCells,
directions_in_which_periodic_b_cond_are_to_be_imposed);
}
template <typename T>
-Bitmap_cubical_complex_periodic_boundary_conditions_base<T>::
-Bitmap_cubical_complex_periodic_boundary_conditions_base(const std::vector<unsigned>& dimensions,
- const std::vector<T>& topDimensionalCells,
- const std::vector<bool>& directions_in_which_periodic_b_cond_are_to_be_imposed) {
+Bitmap_cubical_complex_periodic_boundary_conditions_base<T>::Bitmap_cubical_complex_periodic_boundary_conditions_base(
+ const std::vector<unsigned>& dimensions, const std::vector<T>& topDimensionalCells,
+ const std::vector<bool>& directions_in_which_periodic_b_cond_are_to_be_imposed) {
this->construct_complex_based_on_top_dimensional_cells(dimensions, topDimensionalCells,
directions_in_which_periodic_b_cond_are_to_be_imposed);
}
@@ -293,83 +285,76 @@ Bitmap_cubical_complex_periodic_boundary_conditions_base(const std::vector<unsig
// ***********************Methods************************ //
template <typename T>
-std::vector< size_t > Bitmap_cubical_complex_periodic_boundary_conditions_base<T>::get_boundary_of_a_cell(size_t cell) const {
+std::vector<size_t> Bitmap_cubical_complex_periodic_boundary_conditions_base<T>::get_boundary_of_a_cell(
+ size_t cell) const {
bool dbg = false;
if (dbg) {
std::cerr << "Computations of boundary of a cell : " << cell << std::endl;
- }
+ }
- std::vector< size_t > boundary_elements;
- boundary_elements.reserve(this->dimension()*2);
+ std::vector<size_t> boundary_elements;
+ boundary_elements.reserve(this->dimension() * 2);
size_t cell1 = cell;
size_t sum_of_dimensions = 0;
-
+
for (size_t i = this->multipliers.size(); i != 0; --i) {
unsigned position = cell1 / this->multipliers[i - 1];
// this cell have a nonzero length in this direction, therefore we can compute its boundary in this direction.
if (position % 2 == 1) {
// if there are no periodic boundary conditions in this direction, we do not have to do anything.
- if (!directions_in_which_periodic_b_cond_are_to_be_imposed[i - 1]) {
- //std::cerr << "A\n";
- if ( sum_of_dimensions%2 )
- {
- boundary_elements.push_back(cell - this->multipliers[ i - 1 ]);
- boundary_elements.push_back(cell + this->multipliers[ i - 1 ]);
- }
- else
- {
- boundary_elements.push_back(cell + this->multipliers[ i - 1 ]);
- boundary_elements.push_back(cell - this->multipliers[ i - 1 ]);
- }
+ if (!directions_in_which_periodic_b_cond_are_to_be_imposed[i - 1]) {
+ // std::cerr << "A\n";
+ if (sum_of_dimensions % 2) {
+ boundary_elements.push_back(cell - this->multipliers[i - 1]);
+ boundary_elements.push_back(cell + this->multipliers[i - 1]);
+ } else {
+ boundary_elements.push_back(cell + this->multipliers[i - 1]);
+ boundary_elements.push_back(cell - this->multipliers[i - 1]);
+ }
if (dbg) {
- std::cerr << cell - this->multipliers[ i - 1 ] << " " << cell + this->multipliers[ i - 1 ] << " ";
+ std::cerr << cell - this->multipliers[i - 1] << " " << cell + this->multipliers[i - 1] << " ";
}
} else {
// in this direction we have to do boundary conditions. Therefore, we need to check if we are not at the end.
- if (position != 2 * this->sizes[ i - 1 ] - 1) {
- //std::cerr << "B\n";
- if ( sum_of_dimensions%2 )
- {
- boundary_elements.push_back(cell - this->multipliers[ i - 1 ]);
- boundary_elements.push_back(cell + this->multipliers[ i - 1 ]);
- }
- else
- {
- boundary_elements.push_back(cell + this->multipliers[ i - 1 ]);
- boundary_elements.push_back(cell - this->multipliers[ i - 1 ]);
- }
+ if (position != 2 * this->sizes[i - 1] - 1) {
+ // std::cerr << "B\n";
+ if (sum_of_dimensions % 2) {
+ boundary_elements.push_back(cell - this->multipliers[i - 1]);
+ boundary_elements.push_back(cell + this->multipliers[i - 1]);
+ } else {
+ boundary_elements.push_back(cell + this->multipliers[i - 1]);
+ boundary_elements.push_back(cell - this->multipliers[i - 1]);
+ }
if (dbg) {
- std::cerr << cell - this->multipliers[ i - 1 ] << " " << cell + this->multipliers[ i - 1 ] << " ";
+ std::cerr << cell - this->multipliers[i - 1] << " " << cell + this->multipliers[i - 1] << " ";
}
} else {
- //std::cerr << "C\n";
- if ( sum_of_dimensions%2 )
- {
- boundary_elements.push_back(cell - this->multipliers[ i - 1 ]);
- boundary_elements.push_back(cell - (2 * this->sizes[ i - 1 ] - 1) * this->multipliers[ i - 1 ]);
- }
- else
- {
- boundary_elements.push_back(cell - (2 * this->sizes[ i - 1 ] - 1) * this->multipliers[ i - 1 ]);
- boundary_elements.push_back(cell - this->multipliers[ i - 1 ]);
- }
+ // std::cerr << "C\n";
+ if (sum_of_dimensions % 2) {
+ boundary_elements.push_back(cell - this->multipliers[i - 1]);
+ boundary_elements.push_back(cell - (2 * this->sizes[i - 1] - 1) * this->multipliers[i - 1]);
+ } else {
+ boundary_elements.push_back(cell - (2 * this->sizes[i - 1] - 1) * this->multipliers[i - 1]);
+ boundary_elements.push_back(cell - this->multipliers[i - 1]);
+ }
if (dbg) {
- std::cerr << cell - this->multipliers[ i - 1 ] << " " <<
- cell - (2 * this->sizes[ i - 1 ] - 1) * this->multipliers[ i - 1 ] << " ";
+ std::cerr << cell - this->multipliers[i - 1] << " "
+ << cell - (2 * this->sizes[i - 1] - 1) * this->multipliers[i - 1] << " ";
}
}
}
++sum_of_dimensions;
}
cell1 = cell1 % this->multipliers[i - 1];
- }
+ }
return boundary_elements;
}
template <typename T>
-std::vector< size_t > Bitmap_cubical_complex_periodic_boundary_conditions_base<T>::get_coboundary_of_a_cell(size_t cell) const {
+std::vector<size_t> Bitmap_cubical_complex_periodic_boundary_conditions_base<T>::get_coboundary_of_a_cell(
+ size_t cell) const {
std::vector<unsigned> counter = this->compute_counter_for_given_cell(cell);
- std::vector< size_t > coboundary_elements;
+ std::vector<size_t> coboundary_elements;
size_t cell1 = cell;
for (size_t i = this->multipliers.size(); i != 0; --i) {
unsigned position = cell1 / this->multipliers[i - 1];
@@ -391,13 +376,13 @@ std::vector< size_t > Bitmap_cubical_complex_periodic_boundary_conditions_base<T
} else {
// in this case counter[i-1] == 0.
coboundary_elements.push_back(cell + this->multipliers[i - 1]);
- coboundary_elements.push_back(cell + (2 * this->sizes[ i - 1 ] - 1) * this->multipliers[i - 1]);
+ coboundary_elements.push_back(cell + (2 * this->sizes[i - 1] - 1) * this->multipliers[i - 1]);
}
}
}
cell1 = cell1 % this->multipliers[i - 1];
- }
+ }
return coboundary_elements;
}
diff --git a/src/Bitmap_cubical_complex/test/Bitmap_test.cpp b/src/Bitmap_cubical_complex/test/Bitmap_test.cpp
index 8bc2bfab..41b2baba 100644
--- a/src/Bitmap_cubical_complex/test/Bitmap_test.cpp
+++ b/src/Bitmap_cubical_complex/test/Bitmap_test.cpp
@@ -33,19 +33,16 @@
#include <sstream>
#include <vector>
-
typedef Gudhi::cubical_complex::Bitmap_cubical_complex_base<double> Bitmap_cubical_complex_base;
typedef Gudhi::cubical_complex::Bitmap_cubical_complex<Bitmap_cubical_complex_base> Bitmap_cubical_complex;
typedef Gudhi::cubical_complex::Bitmap_cubical_complex_periodic_boundary_conditions_base<double>
-Bitmap_cubical_complex_periodic_boundary_conditions_base;
+ Bitmap_cubical_complex_periodic_boundary_conditions_base;
typedef Gudhi::cubical_complex::Bitmap_cubical_complex<Bitmap_cubical_complex_periodic_boundary_conditions_base>
-Bitmap_cubical_complex_periodic_boundary_conditions;
-
-
+ Bitmap_cubical_complex_periodic_boundary_conditions;
BOOST_AUTO_TEST_CASE(check_dimension) {
- std::vector< double > increasingFiltrationOfTopDimensionalCells({1, 2, 3, 4, 5, 6, 7, 8, 9});
+ std::vector<double> increasingFiltrationOfTopDimensionalCells({1, 2, 3, 4, 5, 6, 7, 8, 9});
std::vector<unsigned> dimensions({3, 3});
@@ -54,29 +51,28 @@ BOOST_AUTO_TEST_CASE(check_dimension) {
}
BOOST_AUTO_TEST_CASE(topDimensionalCellsIterator_test) {
- std::vector< double > expectedFiltrationValues1({0, 0, 0, 0, 100, 0, 0, 0, 0});
+ std::vector<double> expectedFiltrationValues1({0, 0, 0, 0, 100, 0, 0, 0, 0});
- std::vector< double > expectedFiltrationValues2({1, 2, 3, 4, 5, 6, 7, 8, 9});
+ std::vector<double> expectedFiltrationValues2({1, 2, 3, 4, 5, 6, 7, 8, 9});
- std::vector< double > increasingFiltrationOfTopDimensionalCells({1, 2, 3, 4, 5, 6, 7, 8, 9});
+ std::vector<double> increasingFiltrationOfTopDimensionalCells({1, 2, 3, 4, 5, 6, 7, 8, 9});
- std::vector< double > oneDimensionalCycle({0, 0, 0, 0, 100, 0, 0, 0, 0});
+ std::vector<double> oneDimensionalCycle({0, 0, 0, 0, 100, 0, 0, 0, 0});
std::vector<unsigned> dimensions({3, 3});
Bitmap_cubical_complex increasing(dimensions, increasingFiltrationOfTopDimensionalCells);
Bitmap_cubical_complex hole(dimensions, oneDimensionalCycle);
-
int i = 0;
- for (Bitmap_cubical_complex::Top_dimensional_cells_iterator
- it = increasing.top_dimensional_cells_iterator_begin(); it != increasing.top_dimensional_cells_iterator_end(); ++it) {
+ for (Bitmap_cubical_complex::Top_dimensional_cells_iterator it = increasing.top_dimensional_cells_iterator_begin();
+ it != increasing.top_dimensional_cells_iterator_end(); ++it) {
BOOST_CHECK(increasing.get_cell_data(*it) == expectedFiltrationValues2[i]);
++i;
}
i = 0;
- for (Bitmap_cubical_complex::Top_dimensional_cells_iterator
- it = hole.top_dimensional_cells_iterator_begin(); it != hole.top_dimensional_cells_iterator_end(); ++it) {
+ for (Bitmap_cubical_complex::Top_dimensional_cells_iterator it = hole.top_dimensional_cells_iterator_begin();
+ it != hole.top_dimensional_cells_iterator_end(); ++it) {
BOOST_CHECK(hole.get_cell_data(*it) == expectedFiltrationValues1[i]);
++i;
}
@@ -216,7 +212,7 @@ BOOST_AUTO_TEST_CASE(compute_boundary_test_1) {
boundary47.push_back(46);
boundary47.push_back(48);
std::vector<double> boundary48;
- std::vector< std::vector<double> > boundaries;
+ std::vector<std::vector<double> > boundaries;
boundaries.push_back(boundary0);
boundaries.push_back(boundary1);
boundaries.push_back(boundary2);
@@ -267,31 +263,26 @@ BOOST_AUTO_TEST_CASE(compute_boundary_test_1) {
boundaries.push_back(boundary47);
boundaries.push_back(boundary48);
-
-
- std::vector< double > increasingFiltrationOfTopDimensionalCells({1, 2, 3, 4, 5, 6, 7, 8, 9});
+ std::vector<double> increasingFiltrationOfTopDimensionalCells({1, 2, 3, 4, 5, 6, 7, 8, 9});
std::vector<unsigned> dimensions({3, 3});
Bitmap_cubical_complex increasing(dimensions, increasingFiltrationOfTopDimensionalCells);
for (size_t i = 0; i != increasing.size(); ++i) {
- std::vector< size_t > bd = increasing.get_boundary_of_a_cell(i);
+ std::vector<size_t> bd = increasing.get_boundary_of_a_cell(i);
for (size_t j = 0; j != bd.size(); ++j) {
- BOOST_CHECK(boundaries[i][j] == bd[j]);
- }
+ BOOST_CHECK(boundaries[i][j] == bd[j]);
+ }
}
}
-
-
BOOST_AUTO_TEST_CASE(compute_boundary_test_2) {
- std::vector< double > increasingFiltrationOfTopDimensionalCells({1, 2, 3, 4, 5, 6, 7, 8, 9});
+ std::vector<double> increasingFiltrationOfTopDimensionalCells({1, 2, 3, 4, 5, 6, 7, 8, 9});
std::vector<unsigned> dimensions({3, 3});
Bitmap_cubical_complex increasing(dimensions, increasingFiltrationOfTopDimensionalCells);
-
std::vector<double> coboundaryElements;
coboundaryElements.push_back(7);
coboundaryElements.push_back(1);
@@ -377,21 +368,19 @@ BOOST_AUTO_TEST_CASE(compute_boundary_test_2) {
coboundaryElements.push_back(40);
coboundaryElements.push_back(41);
coboundaryElements.push_back(47);
-
+
size_t number = 0;
for (size_t i = 0; i != increasing.size(); ++i) {
- std::vector< size_t > bd = increasing.get_coboundary_of_a_cell(i);
+ std::vector<size_t> bd = increasing.get_coboundary_of_a_cell(i);
for (size_t j = 0; j != bd.size(); ++j) {
BOOST_CHECK(coboundaryElements[number] == bd[j]);
- ++number;
- }
+ ++number;
+ }
}
}
-
-
BOOST_AUTO_TEST_CASE(compute_boundary_test_3) {
- std::vector< double > increasingFiltrationOfTopDimensionalCells({1, 2, 3, 4, 5, 6, 7, 8, 9});
+ std::vector<double> increasingFiltrationOfTopDimensionalCells({1, 2, 3, 4, 5, 6, 7, 8, 9});
std::vector<unsigned> dimensions({3, 3});
@@ -454,13 +443,13 @@ BOOST_AUTO_TEST_CASE(compute_boundary_test_3) {
}
BOOST_AUTO_TEST_CASE(Filtration_simplex_iterator_test) {
- std::vector< double > increasingFiltrationOfTopDimensionalCells({1, 2, 3, 4, 5, 6, 7, 8, 9});
+ std::vector<double> increasingFiltrationOfTopDimensionalCells({1, 2, 3, 4, 5, 6, 7, 8, 9});
std::vector<unsigned> dimensions({3, 3});
Bitmap_cubical_complex increasing(dimensions, increasingFiltrationOfTopDimensionalCells);
- std::vector< unsigned > dim;
+ std::vector<unsigned> dim;
dim.push_back(0);
dim.push_back(0);
dim.push_back(0);
@@ -562,7 +551,6 @@ BOOST_AUTO_TEST_CASE(Filtration_simplex_iterator_test) {
fil.push_back(9);
fil.push_back(9);
-
Bitmap_cubical_complex::Filtration_simplex_range range = increasing.filtration_simplex_range();
size_t position = 0;
for (Bitmap_cubical_complex::Filtration_simplex_iterator it = range.begin(); it != range.end(); ++it) {
@@ -573,7 +561,7 @@ BOOST_AUTO_TEST_CASE(Filtration_simplex_iterator_test) {
}
BOOST_AUTO_TEST_CASE(boudary_operator_2d_bitmap_with_periodic_bcond) {
- std::vector< double > filtration({0, 0, 0, 0});
+ std::vector<double> filtration({0, 0, 0, 0});
std::vector<unsigned> dimensions({2, 2});
@@ -582,7 +570,6 @@ BOOST_AUTO_TEST_CASE(boudary_operator_2d_bitmap_with_periodic_bcond) {
Bitmap_cubical_complex_periodic_boundary_conditions cmplx(dimensions, filtration, periodic_directions);
BOOST_CHECK(cmplx.dimension() == 2);
-
std::vector<double> boundary0;
std::vector<double> boundary1;
boundary1.push_back(2);
@@ -632,7 +619,7 @@ BOOST_AUTO_TEST_CASE(boudary_operator_2d_bitmap_with_periodic_bcond) {
boundary15.push_back(14);
boundary15.push_back(12);
- std::vector< std::vector<double> > boundaries;
+ std::vector<std::vector<double> > boundaries;
boundaries.push_back(boundary0);
boundaries.push_back(boundary1);
boundaries.push_back(boundary2);
@@ -651,15 +638,15 @@ BOOST_AUTO_TEST_CASE(boudary_operator_2d_bitmap_with_periodic_bcond) {
boundaries.push_back(boundary15);
for (size_t i = 0; i != cmplx.size(); ++i) {
- std::vector< size_t > bd = cmplx.get_boundary_of_a_cell(i);
+ std::vector<size_t> bd = cmplx.get_boundary_of_a_cell(i);
for (size_t j = 0; j != bd.size(); ++j) {
BOOST_CHECK(boundaries[i][j] == bd[j]);
- }
+ }
}
}
BOOST_AUTO_TEST_CASE(coboudary_operator_2d_bitmap_with_periodic_bcond) {
- std::vector< double > filtration({0, 0, 0, 0});
+ std::vector<double> filtration({0, 0, 0, 0});
std::vector<unsigned> dimensions({2, 2});
@@ -668,7 +655,6 @@ BOOST_AUTO_TEST_CASE(coboudary_operator_2d_bitmap_with_periodic_bcond) {
Bitmap_cubical_complex_periodic_boundary_conditions cmplx(dimensions, filtration, periodic_directions);
BOOST_CHECK(cmplx.dimension() == 2);
-
std::vector<double> coboundary0;
coboundary0.push_back(4);
coboundary0.push_back(12);
@@ -718,7 +704,7 @@ BOOST_AUTO_TEST_CASE(coboudary_operator_2d_bitmap_with_periodic_bcond) {
coboundary14.push_back(15);
std::vector<double> coboundary15;
- std::vector< std::vector<double> > coboundaries;
+ std::vector<std::vector<double> > coboundaries;
coboundaries.push_back(coboundary0);
coboundaries.push_back(coboundary1);
coboundaries.push_back(coboundary2);
@@ -737,7 +723,7 @@ BOOST_AUTO_TEST_CASE(coboudary_operator_2d_bitmap_with_periodic_bcond) {
coboundaries.push_back(coboundary15);
for (size_t i = 0; i != cmplx.size(); ++i) {
- std::vector< size_t > cbd = cmplx.get_coboundary_of_a_cell(i);
+ std::vector<size_t> cbd = cmplx.get_coboundary_of_a_cell(i);
for (size_t j = 0; j != cbd.size(); ++j) {
BOOST_CHECK(coboundaries[i][j] == cbd[j]);
}
@@ -745,7 +731,7 @@ BOOST_AUTO_TEST_CASE(coboudary_operator_2d_bitmap_with_periodic_bcond) {
}
BOOST_AUTO_TEST_CASE(bitmap_2d_with_periodic_bcond_filtration) {
- std::vector< double > filtrationOrg({0, 1, 2, 3});
+ std::vector<double> filtrationOrg({0, 1, 2, 3});
std::vector<unsigned> dimensions({2, 2});
@@ -754,7 +740,6 @@ BOOST_AUTO_TEST_CASE(bitmap_2d_with_periodic_bcond_filtration) {
Bitmap_cubical_complex_periodic_boundary_conditions cmplx(dimensions, filtrationOrg, periodic_directions);
BOOST_CHECK(cmplx.dimension() == 2);
-
std::vector<double> filtration;
filtration.push_back(0); // 0
filtration.push_back(0); // 1
@@ -773,902 +758,821 @@ BOOST_AUTO_TEST_CASE(bitmap_2d_with_periodic_bcond_filtration) {
filtration.push_back(2); // 14
filtration.push_back(3); // 15
-
for (size_t i = 0; i != cmplx.size(); ++i) {
BOOST_CHECK(filtration[i] == cmplx.get_cell_data(i));
}
}
+BOOST_AUTO_TEST_CASE(all_cells_iterator_and_boundary_iterators_in_Bitmap_cubical_complex_base_check) {
+ std::vector<double> expected_filtration;
+ expected_filtration.push_back(0);
+ expected_filtration.push_back(0);
+ expected_filtration.push_back(0);
+ expected_filtration.push_back(1);
+ expected_filtration.push_back(1);
+ expected_filtration.push_back(0);
+ expected_filtration.push_back(0);
+ expected_filtration.push_back(0);
+ expected_filtration.push_back(1);
+ expected_filtration.push_back(1);
+ expected_filtration.push_back(0);
+ expected_filtration.push_back(0);
+ expected_filtration.push_back(0);
+ expected_filtration.push_back(1);
+ expected_filtration.push_back(1);
+ expected_filtration.push_back(2);
+ expected_filtration.push_back(2);
+ expected_filtration.push_back(2);
+ expected_filtration.push_back(3);
+ expected_filtration.push_back(3);
+ expected_filtration.push_back(2);
+ expected_filtration.push_back(2);
+ expected_filtration.push_back(2);
+ expected_filtration.push_back(3);
+ expected_filtration.push_back(3);
+
+ std::vector<unsigned> expected_dimension;
+ expected_dimension.push_back(0);
+ expected_dimension.push_back(1);
+ expected_dimension.push_back(0);
+ expected_dimension.push_back(1);
+ expected_dimension.push_back(0);
+ expected_dimension.push_back(1);
+ expected_dimension.push_back(2);
+ expected_dimension.push_back(1);
+ expected_dimension.push_back(2);
+ expected_dimension.push_back(1);
+ expected_dimension.push_back(0);
+ expected_dimension.push_back(1);
+ expected_dimension.push_back(0);
+ expected_dimension.push_back(1);
+ expected_dimension.push_back(0);
+ expected_dimension.push_back(1);
+ expected_dimension.push_back(2);
+ expected_dimension.push_back(1);
+ expected_dimension.push_back(2);
+ expected_dimension.push_back(1);
+ expected_dimension.push_back(0);
+ expected_dimension.push_back(1);
+ expected_dimension.push_back(0);
+ expected_dimension.push_back(1);
+ expected_dimension.push_back(0);
+
+ std::vector<size_t> expected_boundary;
+ expected_boundary.push_back(0);
+ expected_boundary.push_back(2);
+ expected_boundary.push_back(2);
+ expected_boundary.push_back(4);
+ expected_boundary.push_back(0);
+ expected_boundary.push_back(10);
+ expected_boundary.push_back(1);
+ expected_boundary.push_back(11);
+ expected_boundary.push_back(7);
+ expected_boundary.push_back(5);
+ expected_boundary.push_back(2);
+ expected_boundary.push_back(12);
+ expected_boundary.push_back(3);
+ expected_boundary.push_back(13);
+ expected_boundary.push_back(9);
+ expected_boundary.push_back(7);
+ expected_boundary.push_back(4);
+ expected_boundary.push_back(14);
+ expected_boundary.push_back(10);
+ expected_boundary.push_back(12);
+ expected_boundary.push_back(12);
+ expected_boundary.push_back(14);
+ expected_boundary.push_back(10);
+ expected_boundary.push_back(20);
+ expected_boundary.push_back(11);
+ expected_boundary.push_back(21);
+ expected_boundary.push_back(17);
+ expected_boundary.push_back(15);
+ expected_boundary.push_back(12);
+ expected_boundary.push_back(22);
+ expected_boundary.push_back(13);
+ expected_boundary.push_back(23);
+ expected_boundary.push_back(19);
+ expected_boundary.push_back(17);
+ expected_boundary.push_back(14);
+ expected_boundary.push_back(24);
+ expected_boundary.push_back(20);
+ expected_boundary.push_back(22);
+ expected_boundary.push_back(22);
+ expected_boundary.push_back(24);
+
+ std::vector<size_t> expected_coboundary;
+ expected_coboundary.push_back(5);
+ expected_coboundary.push_back(1);
+ expected_coboundary.push_back(6);
+ expected_coboundary.push_back(7);
+ expected_coboundary.push_back(1);
+ expected_coboundary.push_back(3);
+ expected_coboundary.push_back(8);
+ expected_coboundary.push_back(9);
+ expected_coboundary.push_back(3);
+ expected_coboundary.push_back(6);
+ expected_coboundary.push_back(6);
+ expected_coboundary.push_back(8);
+ expected_coboundary.push_back(8);
+ expected_coboundary.push_back(5);
+ expected_coboundary.push_back(15);
+ expected_coboundary.push_back(11);
+ expected_coboundary.push_back(6);
+ expected_coboundary.push_back(16);
+ expected_coboundary.push_back(7);
+ expected_coboundary.push_back(17);
+ expected_coboundary.push_back(11);
+ expected_coboundary.push_back(13);
+ expected_coboundary.push_back(8);
+ expected_coboundary.push_back(18);
+ expected_coboundary.push_back(9);
+ expected_coboundary.push_back(19);
+ expected_coboundary.push_back(13);
+ expected_coboundary.push_back(16);
+ expected_coboundary.push_back(16);
+ expected_coboundary.push_back(18);
+ expected_coboundary.push_back(18);
+ expected_coboundary.push_back(15);
+ expected_coboundary.push_back(21);
+ expected_coboundary.push_back(16);
+ expected_coboundary.push_back(17);
+ expected_coboundary.push_back(21);
+ expected_coboundary.push_back(23);
+ expected_coboundary.push_back(18);
+ expected_coboundary.push_back(19);
+ expected_coboundary.push_back(23);
+
+ std::vector<unsigned> sizes(2);
+ sizes[0] = 2;
+ sizes[1] = 2;
+
+ std::vector<double> data(4);
+ data[0] = 0;
+ data[1] = 1;
+ data[2] = 2;
+ data[3] = 3;
+
+ Bitmap_cubical_complex_base ba(sizes, data);
+ int i = 0;
+ int bd_it = 0;
+ int cbd_it = 0;
+ for (Bitmap_cubical_complex_base::All_cells_iterator it = ba.all_cells_iterator_begin();
+ it != ba.all_cells_iterator_end(); ++it) {
+ BOOST_CHECK(expected_filtration[i] == ba.get_cell_data(*it));
+ BOOST_CHECK(expected_dimension[i] == ba.get_dimension_of_a_cell(*it));
+
+ Bitmap_cubical_complex_base::Boundary_range bdrange = ba.boundary_range(*it);
+ for (Bitmap_cubical_complex_base::Boundary_iterator bd = bdrange.begin(); bd != bdrange.end(); ++bd) {
+ BOOST_CHECK(expected_boundary[bd_it] == *bd);
+ ++bd_it;
+ }
-BOOST_AUTO_TEST_CASE(all_cells_iterator_and_boundary_iterators_in_Bitmap_cubical_complex_base_check)
-{
- std::vector< double > expected_filtration;
- expected_filtration.push_back(0);
- expected_filtration.push_back(0);
- expected_filtration.push_back(0);
- expected_filtration.push_back(1);
- expected_filtration.push_back(1);
- expected_filtration.push_back(0);
- expected_filtration.push_back(0);
- expected_filtration.push_back(0);
- expected_filtration.push_back(1);
- expected_filtration.push_back(1);
- expected_filtration.push_back(0);
- expected_filtration.push_back(0);
- expected_filtration.push_back(0);
- expected_filtration.push_back(1);
- expected_filtration.push_back(1);
- expected_filtration.push_back(2);
- expected_filtration.push_back(2);
- expected_filtration.push_back(2);
- expected_filtration.push_back(3);
- expected_filtration.push_back(3);
- expected_filtration.push_back(2);
- expected_filtration.push_back(2);
- expected_filtration.push_back(2);
- expected_filtration.push_back(3);
- expected_filtration.push_back(3);
-
- std::vector<unsigned> expected_dimension;
- expected_dimension.push_back(0);
- expected_dimension.push_back(1);
- expected_dimension.push_back(0);
- expected_dimension.push_back(1);
- expected_dimension.push_back(0);
- expected_dimension.push_back(1);
- expected_dimension.push_back(2);
- expected_dimension.push_back(1);
- expected_dimension.push_back(2);
- expected_dimension.push_back(1);
- expected_dimension.push_back(0);
- expected_dimension.push_back(1);
- expected_dimension.push_back(0);
- expected_dimension.push_back(1);
- expected_dimension.push_back(0);
- expected_dimension.push_back(1);
- expected_dimension.push_back(2);
- expected_dimension.push_back(1);
- expected_dimension.push_back(2);
- expected_dimension.push_back(1);
- expected_dimension.push_back(0);
- expected_dimension.push_back(1);
- expected_dimension.push_back(0);
- expected_dimension.push_back(1);
- expected_dimension.push_back(0);
-
- std::vector<size_t> expected_boundary;
- expected_boundary.push_back(0);
- expected_boundary.push_back(2);
- expected_boundary.push_back(2);
- expected_boundary.push_back(4);
- expected_boundary.push_back(0);
- expected_boundary.push_back(10);
- expected_boundary.push_back(1);
- expected_boundary.push_back(11);
- expected_boundary.push_back(7);
- expected_boundary.push_back(5);
- expected_boundary.push_back(2);
- expected_boundary.push_back(12);
- expected_boundary.push_back(3);
- expected_boundary.push_back(13);
- expected_boundary.push_back(9);
- expected_boundary.push_back(7);
- expected_boundary.push_back(4);
- expected_boundary.push_back(14);
- expected_boundary.push_back(10);
- expected_boundary.push_back(12);
- expected_boundary.push_back(12);
- expected_boundary.push_back(14);
- expected_boundary.push_back(10);
- expected_boundary.push_back(20);
- expected_boundary.push_back(11);
- expected_boundary.push_back(21);
- expected_boundary.push_back(17);
- expected_boundary.push_back(15);
- expected_boundary.push_back(12);
- expected_boundary.push_back(22);
- expected_boundary.push_back(13);
- expected_boundary.push_back(23);
- expected_boundary.push_back(19);
- expected_boundary.push_back(17);
- expected_boundary.push_back(14);
- expected_boundary.push_back(24);
- expected_boundary.push_back(20);
- expected_boundary.push_back(22);
- expected_boundary.push_back(22);
- expected_boundary.push_back(24);
-
-
- std::vector<size_t> expected_coboundary;
- expected_coboundary.push_back(5);
- expected_coboundary.push_back(1);
- expected_coboundary.push_back(6);
- expected_coboundary.push_back(7);
- expected_coboundary.push_back(1);
- expected_coboundary.push_back(3);
- expected_coboundary.push_back(8);
- expected_coboundary.push_back(9);
- expected_coboundary.push_back(3);
- expected_coboundary.push_back(6);
- expected_coboundary.push_back(6);
- expected_coboundary.push_back(8);
- expected_coboundary.push_back(8);
- expected_coboundary.push_back(5);
- expected_coboundary.push_back(15);
- expected_coboundary.push_back(11);
- expected_coboundary.push_back(6);
- expected_coboundary.push_back(16);
- expected_coboundary.push_back(7);
- expected_coboundary.push_back(17);
- expected_coboundary.push_back(11);
- expected_coboundary.push_back(13);
- expected_coboundary.push_back(8);
- expected_coboundary.push_back(18);
- expected_coboundary.push_back(9);
- expected_coboundary.push_back(19);
- expected_coboundary.push_back(13);
- expected_coboundary.push_back(16);
- expected_coboundary.push_back(16);
- expected_coboundary.push_back(18);
- expected_coboundary.push_back(18);
- expected_coboundary.push_back(15);
- expected_coboundary.push_back(21);
- expected_coboundary.push_back(16);
- expected_coboundary.push_back(17);
- expected_coboundary.push_back(21);
- expected_coboundary.push_back(23);
- expected_coboundary.push_back(18);
- expected_coboundary.push_back(19);
- expected_coboundary.push_back(23);
-
-
-
- std::vector< unsigned > sizes(2);
- sizes[0] = 2;
- sizes[1] = 2;
-
- std::vector< double > data(4);
- data[0] = 0;
- data[1] = 1;
- data[2] = 2;
- data[3] = 3;
-
- Bitmap_cubical_complex_base ba( sizes , data );
- int i = 0;
- int bd_it = 0;
- int cbd_it = 0;
- for ( Bitmap_cubical_complex_base::All_cells_iterator it = ba.all_cells_iterator_begin() ; it != ba.all_cells_iterator_end() ; ++it )
- {
- BOOST_CHECK( expected_filtration[i] == ba.get_cell_data( *it ) );
- BOOST_CHECK( expected_dimension[i] == ba.get_dimension_of_a_cell( *it ) );
-
- Bitmap_cubical_complex_base::Boundary_range bdrange = ba.boundary_range(*it);
- for ( Bitmap_cubical_complex_base::Boundary_iterator bd = bdrange.begin() ; bd != bdrange.end() ; ++bd )
- {
- BOOST_CHECK( expected_boundary[bd_it] == *bd );
- ++bd_it;
- }
-
- Bitmap_cubical_complex_base::Coboundary_range cbdrange = ba.coboundary_range(*it);
- for ( Bitmap_cubical_complex_base::Coboundary_iterator cbd = cbdrange.begin() ; cbd != cbdrange.end() ; ++cbd )
- {
- BOOST_CHECK( expected_coboundary[cbd_it] == *cbd );
- ++cbd_it;
- }
- ++i;
+ Bitmap_cubical_complex_base::Coboundary_range cbdrange = ba.coboundary_range(*it);
+ for (Bitmap_cubical_complex_base::Coboundary_iterator cbd = cbdrange.begin(); cbd != cbdrange.end(); ++cbd) {
+ BOOST_CHECK(expected_coboundary[cbd_it] == *cbd);
+ ++cbd_it;
}
+ ++i;
+ }
}
+BOOST_AUTO_TEST_CASE(all_cells_iterator_and_boundary_iterators_in_Bitmap_cubical_complex_base_check_range_check_2) {
+ std::vector<double> expected_filtration;
+ expected_filtration.push_back(0);
+ expected_filtration.push_back(0);
+ expected_filtration.push_back(0);
+ expected_filtration.push_back(1);
+ expected_filtration.push_back(1);
+ expected_filtration.push_back(0);
+ expected_filtration.push_back(0);
+ expected_filtration.push_back(0);
+ expected_filtration.push_back(1);
+ expected_filtration.push_back(1);
+ expected_filtration.push_back(0);
+ expected_filtration.push_back(0);
+ expected_filtration.push_back(0);
+ expected_filtration.push_back(1);
+ expected_filtration.push_back(1);
+ expected_filtration.push_back(2);
+ expected_filtration.push_back(2);
+ expected_filtration.push_back(2);
+ expected_filtration.push_back(3);
+ expected_filtration.push_back(3);
+ expected_filtration.push_back(2);
+ expected_filtration.push_back(2);
+ expected_filtration.push_back(2);
+ expected_filtration.push_back(3);
+ expected_filtration.push_back(3);
+
+ std::vector<unsigned> expected_dimension;
+ expected_dimension.push_back(0);
+ expected_dimension.push_back(1);
+ expected_dimension.push_back(0);
+ expected_dimension.push_back(1);
+ expected_dimension.push_back(0);
+ expected_dimension.push_back(1);
+ expected_dimension.push_back(2);
+ expected_dimension.push_back(1);
+ expected_dimension.push_back(2);
+ expected_dimension.push_back(1);
+ expected_dimension.push_back(0);
+ expected_dimension.push_back(1);
+ expected_dimension.push_back(0);
+ expected_dimension.push_back(1);
+ expected_dimension.push_back(0);
+ expected_dimension.push_back(1);
+ expected_dimension.push_back(2);
+ expected_dimension.push_back(1);
+ expected_dimension.push_back(2);
+ expected_dimension.push_back(1);
+ expected_dimension.push_back(0);
+ expected_dimension.push_back(1);
+ expected_dimension.push_back(0);
+ expected_dimension.push_back(1);
+ expected_dimension.push_back(0);
+
+ std::vector<size_t> expected_boundary;
+ expected_boundary.push_back(0);
+ expected_boundary.push_back(2);
+ expected_boundary.push_back(2);
+ expected_boundary.push_back(4);
+ expected_boundary.push_back(0);
+ expected_boundary.push_back(10);
+ expected_boundary.push_back(1);
+ expected_boundary.push_back(11);
+ expected_boundary.push_back(7);
+ expected_boundary.push_back(5);
+ expected_boundary.push_back(2);
+ expected_boundary.push_back(12);
+ expected_boundary.push_back(3);
+ expected_boundary.push_back(13);
+ expected_boundary.push_back(9);
+ expected_boundary.push_back(7);
+ expected_boundary.push_back(4);
+ expected_boundary.push_back(14);
+ expected_boundary.push_back(10);
+ expected_boundary.push_back(12);
+ expected_boundary.push_back(12);
+ expected_boundary.push_back(14);
+ expected_boundary.push_back(10);
+ expected_boundary.push_back(20);
+ expected_boundary.push_back(11);
+ expected_boundary.push_back(21);
+ expected_boundary.push_back(17);
+ expected_boundary.push_back(15);
+ expected_boundary.push_back(12);
+ expected_boundary.push_back(22);
+ expected_boundary.push_back(13);
+ expected_boundary.push_back(23);
+ expected_boundary.push_back(19);
+ expected_boundary.push_back(17);
+ expected_boundary.push_back(14);
+ expected_boundary.push_back(24);
+ expected_boundary.push_back(20);
+ expected_boundary.push_back(22);
+ expected_boundary.push_back(22);
+ expected_boundary.push_back(24);
+
+ std::vector<size_t> expected_coboundary;
+ expected_coboundary.push_back(5);
+ expected_coboundary.push_back(1);
+ expected_coboundary.push_back(6);
+ expected_coboundary.push_back(7);
+ expected_coboundary.push_back(1);
+ expected_coboundary.push_back(3);
+ expected_coboundary.push_back(8);
+ expected_coboundary.push_back(9);
+ expected_coboundary.push_back(3);
+ expected_coboundary.push_back(6);
+ expected_coboundary.push_back(6);
+ expected_coboundary.push_back(8);
+ expected_coboundary.push_back(8);
+ expected_coboundary.push_back(5);
+ expected_coboundary.push_back(15);
+ expected_coboundary.push_back(11);
+ expected_coboundary.push_back(6);
+ expected_coboundary.push_back(16);
+ expected_coboundary.push_back(7);
+ expected_coboundary.push_back(17);
+ expected_coboundary.push_back(11);
+ expected_coboundary.push_back(13);
+ expected_coboundary.push_back(8);
+ expected_coboundary.push_back(18);
+ expected_coboundary.push_back(9);
+ expected_coboundary.push_back(19);
+ expected_coboundary.push_back(13);
+ expected_coboundary.push_back(16);
+ expected_coboundary.push_back(16);
+ expected_coboundary.push_back(18);
+ expected_coboundary.push_back(18);
+ expected_coboundary.push_back(15);
+ expected_coboundary.push_back(21);
+ expected_coboundary.push_back(16);
+ expected_coboundary.push_back(17);
+ expected_coboundary.push_back(21);
+ expected_coboundary.push_back(23);
+ expected_coboundary.push_back(18);
+ expected_coboundary.push_back(19);
+ expected_coboundary.push_back(23);
+
+ std::vector<unsigned> sizes(2);
+ sizes[0] = 2;
+ sizes[1] = 2;
+
+ std::vector<double> data(4);
+ data[0] = 0;
+ data[1] = 1;
+ data[2] = 2;
+ data[3] = 3;
+
+ Bitmap_cubical_complex_base ba(sizes, data);
+ int i = 0;
+ int bd_it = 0;
+ int cbd_it = 0;
+
+ Bitmap_cubical_complex_base::All_cells_range range(&ba);
+ for (Bitmap_cubical_complex_base::All_cells_iterator it = range.begin(); it != range.end(); ++it) {
+ BOOST_CHECK(expected_filtration[i] == ba.get_cell_data(*it));
+ BOOST_CHECK(expected_dimension[i] == ba.get_dimension_of_a_cell(*it));
+
+ Bitmap_cubical_complex_base::Boundary_range bdrange = ba.boundary_range(*it);
+ for (Bitmap_cubical_complex_base::Boundary_iterator bd = bdrange.begin(); bd != bdrange.end(); ++bd) {
+ BOOST_CHECK(expected_boundary[bd_it] == *bd);
+ ++bd_it;
+ }
-
-
-
-
-
-
-BOOST_AUTO_TEST_CASE(all_cells_iterator_and_boundary_iterators_in_Bitmap_cubical_complex_base_check_range_check_2)
-{
- std::vector< double > expected_filtration;
- expected_filtration.push_back(0);
- expected_filtration.push_back(0);
- expected_filtration.push_back(0);
- expected_filtration.push_back(1);
- expected_filtration.push_back(1);
- expected_filtration.push_back(0);
- expected_filtration.push_back(0);
- expected_filtration.push_back(0);
- expected_filtration.push_back(1);
- expected_filtration.push_back(1);
- expected_filtration.push_back(0);
- expected_filtration.push_back(0);
- expected_filtration.push_back(0);
- expected_filtration.push_back(1);
- expected_filtration.push_back(1);
- expected_filtration.push_back(2);
- expected_filtration.push_back(2);
- expected_filtration.push_back(2);
- expected_filtration.push_back(3);
- expected_filtration.push_back(3);
- expected_filtration.push_back(2);
- expected_filtration.push_back(2);
- expected_filtration.push_back(2);
- expected_filtration.push_back(3);
- expected_filtration.push_back(3);
-
- std::vector<unsigned> expected_dimension;
- expected_dimension.push_back(0);
- expected_dimension.push_back(1);
- expected_dimension.push_back(0);
- expected_dimension.push_back(1);
- expected_dimension.push_back(0);
- expected_dimension.push_back(1);
- expected_dimension.push_back(2);
- expected_dimension.push_back(1);
- expected_dimension.push_back(2);
- expected_dimension.push_back(1);
- expected_dimension.push_back(0);
- expected_dimension.push_back(1);
- expected_dimension.push_back(0);
- expected_dimension.push_back(1);
- expected_dimension.push_back(0);
- expected_dimension.push_back(1);
- expected_dimension.push_back(2);
- expected_dimension.push_back(1);
- expected_dimension.push_back(2);
- expected_dimension.push_back(1);
- expected_dimension.push_back(0);
- expected_dimension.push_back(1);
- expected_dimension.push_back(0);
- expected_dimension.push_back(1);
- expected_dimension.push_back(0);
-
- std::vector<size_t> expected_boundary;
- expected_boundary.push_back(0);
- expected_boundary.push_back(2);
- expected_boundary.push_back(2);
- expected_boundary.push_back(4);
- expected_boundary.push_back(0);
- expected_boundary.push_back(10);
- expected_boundary.push_back(1);
- expected_boundary.push_back(11);
- expected_boundary.push_back(7);
- expected_boundary.push_back(5);
- expected_boundary.push_back(2);
- expected_boundary.push_back(12);
- expected_boundary.push_back(3);
- expected_boundary.push_back(13);
- expected_boundary.push_back(9);
- expected_boundary.push_back(7);
- expected_boundary.push_back(4);
- expected_boundary.push_back(14);
- expected_boundary.push_back(10);
- expected_boundary.push_back(12);
- expected_boundary.push_back(12);
- expected_boundary.push_back(14);
- expected_boundary.push_back(10);
- expected_boundary.push_back(20);
- expected_boundary.push_back(11);
- expected_boundary.push_back(21);
- expected_boundary.push_back(17);
- expected_boundary.push_back(15);
- expected_boundary.push_back(12);
- expected_boundary.push_back(22);
- expected_boundary.push_back(13);
- expected_boundary.push_back(23);
- expected_boundary.push_back(19);
- expected_boundary.push_back(17);
- expected_boundary.push_back(14);
- expected_boundary.push_back(24);
- expected_boundary.push_back(20);
- expected_boundary.push_back(22);
- expected_boundary.push_back(22);
- expected_boundary.push_back(24);
-
-
- std::vector<size_t> expected_coboundary;
- expected_coboundary.push_back(5);
- expected_coboundary.push_back(1);
- expected_coboundary.push_back(6);
- expected_coboundary.push_back(7);
- expected_coboundary.push_back(1);
- expected_coboundary.push_back(3);
- expected_coboundary.push_back(8);
- expected_coboundary.push_back(9);
- expected_coboundary.push_back(3);
- expected_coboundary.push_back(6);
- expected_coboundary.push_back(6);
- expected_coboundary.push_back(8);
- expected_coboundary.push_back(8);
- expected_coboundary.push_back(5);
- expected_coboundary.push_back(15);
- expected_coboundary.push_back(11);
- expected_coboundary.push_back(6);
- expected_coboundary.push_back(16);
- expected_coboundary.push_back(7);
- expected_coboundary.push_back(17);
- expected_coboundary.push_back(11);
- expected_coboundary.push_back(13);
- expected_coboundary.push_back(8);
- expected_coboundary.push_back(18);
- expected_coboundary.push_back(9);
- expected_coboundary.push_back(19);
- expected_coboundary.push_back(13);
- expected_coboundary.push_back(16);
- expected_coboundary.push_back(16);
- expected_coboundary.push_back(18);
- expected_coboundary.push_back(18);
- expected_coboundary.push_back(15);
- expected_coboundary.push_back(21);
- expected_coboundary.push_back(16);
- expected_coboundary.push_back(17);
- expected_coboundary.push_back(21);
- expected_coboundary.push_back(23);
- expected_coboundary.push_back(18);
- expected_coboundary.push_back(19);
- expected_coboundary.push_back(23);
-
-
-
- std::vector< unsigned > sizes(2);
- sizes[0] = 2;
- sizes[1] = 2;
-
- std::vector< double > data(4);
- data[0] = 0;
- data[1] = 1;
- data[2] = 2;
- data[3] = 3;
-
- Bitmap_cubical_complex_base ba( sizes , data );
- int i = 0;
- int bd_it = 0;
- int cbd_it = 0;
-
- Bitmap_cubical_complex_base::All_cells_range range(&ba);
- for ( Bitmap_cubical_complex_base::All_cells_iterator it = range.begin() ; it != range.end() ; ++it )
- {
- BOOST_CHECK( expected_filtration[i] == ba.get_cell_data( *it ) );
- BOOST_CHECK( expected_dimension[i] == ba.get_dimension_of_a_cell( *it ) );
-
- Bitmap_cubical_complex_base::Boundary_range bdrange = ba.boundary_range(*it);
- for ( Bitmap_cubical_complex_base::Boundary_iterator bd = bdrange.begin() ; bd != bdrange.end() ; ++bd )
- {
- BOOST_CHECK( expected_boundary[bd_it] == *bd );
- ++bd_it;
- }
-
- Bitmap_cubical_complex_base::Coboundary_range cbdrange = ba.coboundary_range(*it);
- for ( Bitmap_cubical_complex_base::Coboundary_iterator cbd = cbdrange.begin() ; cbd != cbdrange.end() ; ++cbd )
- {
- BOOST_CHECK( expected_coboundary[cbd_it] == *cbd );
- ++cbd_it;
- }
- ++i;
+ Bitmap_cubical_complex_base::Coboundary_range cbdrange = ba.coboundary_range(*it);
+ for (Bitmap_cubical_complex_base::Coboundary_iterator cbd = cbdrange.begin(); cbd != cbdrange.end(); ++cbd) {
+ BOOST_CHECK(expected_coboundary[cbd_it] == *cbd);
+ ++cbd_it;
}
+ ++i;
+ }
}
-
-
-
-
-
-BOOST_AUTO_TEST_CASE(all_cells_iterator_and_boundary_iterators_in_Bitmap_cubical_complex_base_check_range_check)
-{
- std::vector< double > expected_filtration;
- expected_filtration.push_back(0);
- expected_filtration.push_back(0);
- expected_filtration.push_back(0);
- expected_filtration.push_back(1);
- expected_filtration.push_back(1);
- expected_filtration.push_back(0);
- expected_filtration.push_back(0);
- expected_filtration.push_back(0);
- expected_filtration.push_back(1);
- expected_filtration.push_back(1);
- expected_filtration.push_back(0);
- expected_filtration.push_back(0);
- expected_filtration.push_back(0);
- expected_filtration.push_back(1);
- expected_filtration.push_back(1);
- expected_filtration.push_back(2);
- expected_filtration.push_back(2);
- expected_filtration.push_back(2);
- expected_filtration.push_back(3);
- expected_filtration.push_back(3);
- expected_filtration.push_back(2);
- expected_filtration.push_back(2);
- expected_filtration.push_back(2);
- expected_filtration.push_back(3);
- expected_filtration.push_back(3);
-
- std::vector<unsigned> expected_dimension;
- expected_dimension.push_back(0);
- expected_dimension.push_back(1);
- expected_dimension.push_back(0);
- expected_dimension.push_back(1);
- expected_dimension.push_back(0);
- expected_dimension.push_back(1);
- expected_dimension.push_back(2);
- expected_dimension.push_back(1);
- expected_dimension.push_back(2);
- expected_dimension.push_back(1);
- expected_dimension.push_back(0);
- expected_dimension.push_back(1);
- expected_dimension.push_back(0);
- expected_dimension.push_back(1);
- expected_dimension.push_back(0);
- expected_dimension.push_back(1);
- expected_dimension.push_back(2);
- expected_dimension.push_back(1);
- expected_dimension.push_back(2);
- expected_dimension.push_back(1);
- expected_dimension.push_back(0);
- expected_dimension.push_back(1);
- expected_dimension.push_back(0);
- expected_dimension.push_back(1);
- expected_dimension.push_back(0);
-
- std::vector<size_t> expected_boundary;
- expected_boundary.push_back(0);
- expected_boundary.push_back(2);
- expected_boundary.push_back(2);
- expected_boundary.push_back(4);
- expected_boundary.push_back(0);
- expected_boundary.push_back(10);
- expected_boundary.push_back(1);
- expected_boundary.push_back(11);
- expected_boundary.push_back(7);
- expected_boundary.push_back(5);
- expected_boundary.push_back(2);
- expected_boundary.push_back(12);
- expected_boundary.push_back(3);
- expected_boundary.push_back(13);
- expected_boundary.push_back(9);
- expected_boundary.push_back(7);
- expected_boundary.push_back(4);
- expected_boundary.push_back(14);
- expected_boundary.push_back(10);
- expected_boundary.push_back(12);
- expected_boundary.push_back(12);
- expected_boundary.push_back(14);
- expected_boundary.push_back(10);
- expected_boundary.push_back(20);
- expected_boundary.push_back(11);
- expected_boundary.push_back(21);
- expected_boundary.push_back(17);
- expected_boundary.push_back(15);
- expected_boundary.push_back(12);
- expected_boundary.push_back(22);
- expected_boundary.push_back(13);
- expected_boundary.push_back(23);
- expected_boundary.push_back(19);
- expected_boundary.push_back(17);
- expected_boundary.push_back(14);
- expected_boundary.push_back(24);
- expected_boundary.push_back(20);
- expected_boundary.push_back(22);
- expected_boundary.push_back(22);
- expected_boundary.push_back(24);
-
-
- std::vector<size_t> expected_coboundary;
- expected_coboundary.push_back(5);
- expected_coboundary.push_back(1);
- expected_coboundary.push_back(6);
- expected_coboundary.push_back(7);
- expected_coboundary.push_back(1);
- expected_coboundary.push_back(3);
- expected_coboundary.push_back(8);
- expected_coboundary.push_back(9);
- expected_coboundary.push_back(3);
- expected_coboundary.push_back(6);
- expected_coboundary.push_back(6);
- expected_coboundary.push_back(8);
- expected_coboundary.push_back(8);
- expected_coboundary.push_back(5);
- expected_coboundary.push_back(15);
- expected_coboundary.push_back(11);
- expected_coboundary.push_back(6);
- expected_coboundary.push_back(16);
- expected_coboundary.push_back(7);
- expected_coboundary.push_back(17);
- expected_coboundary.push_back(11);
- expected_coboundary.push_back(13);
- expected_coboundary.push_back(8);
- expected_coboundary.push_back(18);
- expected_coboundary.push_back(9);
- expected_coboundary.push_back(19);
- expected_coboundary.push_back(13);
- expected_coboundary.push_back(16);
- expected_coboundary.push_back(16);
- expected_coboundary.push_back(18);
- expected_coboundary.push_back(18);
- expected_coboundary.push_back(15);
- expected_coboundary.push_back(21);
- expected_coboundary.push_back(16);
- expected_coboundary.push_back(17);
- expected_coboundary.push_back(21);
- expected_coboundary.push_back(23);
- expected_coboundary.push_back(18);
- expected_coboundary.push_back(19);
- expected_coboundary.push_back(23);
-
-
-
- std::vector< unsigned > sizes(2);
- sizes[0] = 2;
- sizes[1] = 2;
-
- std::vector< double > data(4);
- data[0] = 0;
- data[1] = 1;
- data[2] = 2;
- data[3] = 3;
-
- Bitmap_cubical_complex_base ba( sizes , data );
- int i = 0;
- int bd_it = 0;
- int cbd_it = 0;
-
- Bitmap_cubical_complex_base::All_cells_range range = ba.all_cells_range();
- for ( Bitmap_cubical_complex_base::All_cells_iterator it = range.begin() ; it != range.end() ; ++it )
- {
- BOOST_CHECK( expected_filtration[i] == ba.get_cell_data( *it ) );
- BOOST_CHECK( expected_dimension[i] == ba.get_dimension_of_a_cell( *it ) );
-
- Bitmap_cubical_complex_base::Boundary_range bdrange = ba.boundary_range(*it);
- for ( Bitmap_cubical_complex_base::Boundary_iterator bd = bdrange.begin() ; bd != bdrange.end() ; ++bd )
- {
- BOOST_CHECK( expected_boundary[bd_it] == *bd );
- ++bd_it;
- }
-
- Bitmap_cubical_complex_base::Coboundary_range cbdrange = ba.coboundary_range(*it);
- for ( Bitmap_cubical_complex_base::Coboundary_iterator cbd = cbdrange.begin() ; cbd != cbdrange.end() ; ++cbd )
- {
- BOOST_CHECK( expected_coboundary[cbd_it] == *cbd );
- ++cbd_it;
- }
- ++i;
+BOOST_AUTO_TEST_CASE(all_cells_iterator_and_boundary_iterators_in_Bitmap_cubical_complex_base_check_range_check) {
+ std::vector<double> expected_filtration;
+ expected_filtration.push_back(0);
+ expected_filtration.push_back(0);
+ expected_filtration.push_back(0);
+ expected_filtration.push_back(1);
+ expected_filtration.push_back(1);
+ expected_filtration.push_back(0);
+ expected_filtration.push_back(0);
+ expected_filtration.push_back(0);
+ expected_filtration.push_back(1);
+ expected_filtration.push_back(1);
+ expected_filtration.push_back(0);
+ expected_filtration.push_back(0);
+ expected_filtration.push_back(0);
+ expected_filtration.push_back(1);
+ expected_filtration.push_back(1);
+ expected_filtration.push_back(2);
+ expected_filtration.push_back(2);
+ expected_filtration.push_back(2);
+ expected_filtration.push_back(3);
+ expected_filtration.push_back(3);
+ expected_filtration.push_back(2);
+ expected_filtration.push_back(2);
+ expected_filtration.push_back(2);
+ expected_filtration.push_back(3);
+ expected_filtration.push_back(3);
+
+ std::vector<unsigned> expected_dimension;
+ expected_dimension.push_back(0);
+ expected_dimension.push_back(1);
+ expected_dimension.push_back(0);
+ expected_dimension.push_back(1);
+ expected_dimension.push_back(0);
+ expected_dimension.push_back(1);
+ expected_dimension.push_back(2);
+ expected_dimension.push_back(1);
+ expected_dimension.push_back(2);
+ expected_dimension.push_back(1);
+ expected_dimension.push_back(0);
+ expected_dimension.push_back(1);
+ expected_dimension.push_back(0);
+ expected_dimension.push_back(1);
+ expected_dimension.push_back(0);
+ expected_dimension.push_back(1);
+ expected_dimension.push_back(2);
+ expected_dimension.push_back(1);
+ expected_dimension.push_back(2);
+ expected_dimension.push_back(1);
+ expected_dimension.push_back(0);
+ expected_dimension.push_back(1);
+ expected_dimension.push_back(0);
+ expected_dimension.push_back(1);
+ expected_dimension.push_back(0);
+
+ std::vector<size_t> expected_boundary;
+ expected_boundary.push_back(0);
+ expected_boundary.push_back(2);
+ expected_boundary.push_back(2);
+ expected_boundary.push_back(4);
+ expected_boundary.push_back(0);
+ expected_boundary.push_back(10);
+ expected_boundary.push_back(1);
+ expected_boundary.push_back(11);
+ expected_boundary.push_back(7);
+ expected_boundary.push_back(5);
+ expected_boundary.push_back(2);
+ expected_boundary.push_back(12);
+ expected_boundary.push_back(3);
+ expected_boundary.push_back(13);
+ expected_boundary.push_back(9);
+ expected_boundary.push_back(7);
+ expected_boundary.push_back(4);
+ expected_boundary.push_back(14);
+ expected_boundary.push_back(10);
+ expected_boundary.push_back(12);
+ expected_boundary.push_back(12);
+ expected_boundary.push_back(14);
+ expected_boundary.push_back(10);
+ expected_boundary.push_back(20);
+ expected_boundary.push_back(11);
+ expected_boundary.push_back(21);
+ expected_boundary.push_back(17);
+ expected_boundary.push_back(15);
+ expected_boundary.push_back(12);
+ expected_boundary.push_back(22);
+ expected_boundary.push_back(13);
+ expected_boundary.push_back(23);
+ expected_boundary.push_back(19);
+ expected_boundary.push_back(17);
+ expected_boundary.push_back(14);
+ expected_boundary.push_back(24);
+ expected_boundary.push_back(20);
+ expected_boundary.push_back(22);
+ expected_boundary.push_back(22);
+ expected_boundary.push_back(24);
+
+ std::vector<size_t> expected_coboundary;
+ expected_coboundary.push_back(5);
+ expected_coboundary.push_back(1);
+ expected_coboundary.push_back(6);
+ expected_coboundary.push_back(7);
+ expected_coboundary.push_back(1);
+ expected_coboundary.push_back(3);
+ expected_coboundary.push_back(8);
+ expected_coboundary.push_back(9);
+ expected_coboundary.push_back(3);
+ expected_coboundary.push_back(6);
+ expected_coboundary.push_back(6);
+ expected_coboundary.push_back(8);
+ expected_coboundary.push_back(8);
+ expected_coboundary.push_back(5);
+ expected_coboundary.push_back(15);
+ expected_coboundary.push_back(11);
+ expected_coboundary.push_back(6);
+ expected_coboundary.push_back(16);
+ expected_coboundary.push_back(7);
+ expected_coboundary.push_back(17);
+ expected_coboundary.push_back(11);
+ expected_coboundary.push_back(13);
+ expected_coboundary.push_back(8);
+ expected_coboundary.push_back(18);
+ expected_coboundary.push_back(9);
+ expected_coboundary.push_back(19);
+ expected_coboundary.push_back(13);
+ expected_coboundary.push_back(16);
+ expected_coboundary.push_back(16);
+ expected_coboundary.push_back(18);
+ expected_coboundary.push_back(18);
+ expected_coboundary.push_back(15);
+ expected_coboundary.push_back(21);
+ expected_coboundary.push_back(16);
+ expected_coboundary.push_back(17);
+ expected_coboundary.push_back(21);
+ expected_coboundary.push_back(23);
+ expected_coboundary.push_back(18);
+ expected_coboundary.push_back(19);
+ expected_coboundary.push_back(23);
+
+ std::vector<unsigned> sizes(2);
+ sizes[0] = 2;
+ sizes[1] = 2;
+
+ std::vector<double> data(4);
+ data[0] = 0;
+ data[1] = 1;
+ data[2] = 2;
+ data[3] = 3;
+
+ Bitmap_cubical_complex_base ba(sizes, data);
+ int i = 0;
+ int bd_it = 0;
+ int cbd_it = 0;
+
+ Bitmap_cubical_complex_base::All_cells_range range = ba.all_cells_range();
+ for (Bitmap_cubical_complex_base::All_cells_iterator it = range.begin(); it != range.end(); ++it) {
+ BOOST_CHECK(expected_filtration[i] == ba.get_cell_data(*it));
+ BOOST_CHECK(expected_dimension[i] == ba.get_dimension_of_a_cell(*it));
+
+ Bitmap_cubical_complex_base::Boundary_range bdrange = ba.boundary_range(*it);
+ for (Bitmap_cubical_complex_base::Boundary_iterator bd = bdrange.begin(); bd != bdrange.end(); ++bd) {
+ BOOST_CHECK(expected_boundary[bd_it] == *bd);
+ ++bd_it;
}
-}
-BOOST_AUTO_TEST_CASE(Top_dimensional_cells_iterator_range_check)
-{
- std::vector< double > expected_filtration;
- expected_filtration.push_back(0);
- expected_filtration.push_back(0);
- expected_filtration.push_back(0);
- expected_filtration.push_back(1);
- expected_filtration.push_back(1);
- expected_filtration.push_back(0);
- expected_filtration.push_back(0);
- expected_filtration.push_back(0);
- expected_filtration.push_back(1);
- expected_filtration.push_back(1);
- expected_filtration.push_back(0);
- expected_filtration.push_back(0);
- expected_filtration.push_back(0);
- expected_filtration.push_back(1);
- expected_filtration.push_back(1);
- expected_filtration.push_back(2);
- expected_filtration.push_back(2);
- expected_filtration.push_back(2);
- expected_filtration.push_back(3);
- expected_filtration.push_back(3);
- expected_filtration.push_back(2);
- expected_filtration.push_back(2);
- expected_filtration.push_back(2);
- expected_filtration.push_back(3);
- expected_filtration.push_back(3);
-
-
- std::vector< unsigned > sizes(2);
- sizes[0] = 2;
- sizes[1] = 2;
-
- std::vector< double > data(4);
- data[0] = 0;
- data[1] = 1;
- data[2] = 2;
- data[3] = 3;
-
- Bitmap_cubical_complex_base ba( sizes , data );
- int i = 0;
-
- Bitmap_cubical_complex_base::Top_dimensional_cells_range range = ba.top_dimensional_cells_range();
- for ( Bitmap_cubical_complex_base::Top_dimensional_cells_iterator it = range.begin() ; it != range.end() ; ++it )
- {
- BOOST_CHECK( data[i] == ba.get_cell_data( *it ) );
- BOOST_CHECK( ba.get_dimension_of_a_cell( *it ) == 2 );
- ++i;
+ Bitmap_cubical_complex_base::Coboundary_range cbdrange = ba.coboundary_range(*it);
+ for (Bitmap_cubical_complex_base::Coboundary_iterator cbd = cbdrange.begin(); cbd != cbdrange.end(); ++cbd) {
+ BOOST_CHECK(expected_coboundary[cbd_it] == *cbd);
+ ++cbd_it;
}
+ ++i;
+ }
}
+BOOST_AUTO_TEST_CASE(Top_dimensional_cells_iterator_range_check) {
+ std::vector<double> expected_filtration;
+ expected_filtration.push_back(0);
+ expected_filtration.push_back(0);
+ expected_filtration.push_back(0);
+ expected_filtration.push_back(1);
+ expected_filtration.push_back(1);
+ expected_filtration.push_back(0);
+ expected_filtration.push_back(0);
+ expected_filtration.push_back(0);
+ expected_filtration.push_back(1);
+ expected_filtration.push_back(1);
+ expected_filtration.push_back(0);
+ expected_filtration.push_back(0);
+ expected_filtration.push_back(0);
+ expected_filtration.push_back(1);
+ expected_filtration.push_back(1);
+ expected_filtration.push_back(2);
+ expected_filtration.push_back(2);
+ expected_filtration.push_back(2);
+ expected_filtration.push_back(3);
+ expected_filtration.push_back(3);
+ expected_filtration.push_back(2);
+ expected_filtration.push_back(2);
+ expected_filtration.push_back(2);
+ expected_filtration.push_back(3);
+ expected_filtration.push_back(3);
+
+ std::vector<unsigned> sizes(2);
+ sizes[0] = 2;
+ sizes[1] = 2;
+
+ std::vector<double> data(4);
+ data[0] = 0;
+ data[1] = 1;
+ data[2] = 2;
+ data[3] = 3;
+
+ Bitmap_cubical_complex_base ba(sizes, data);
+ int i = 0;
+ Bitmap_cubical_complex_base::Top_dimensional_cells_range range = ba.top_dimensional_cells_range();
+ for (Bitmap_cubical_complex_base::Top_dimensional_cells_iterator it = range.begin(); it != range.end(); ++it) {
+ BOOST_CHECK(data[i] == ba.get_cell_data(*it));
+ BOOST_CHECK(ba.get_dimension_of_a_cell(*it) == 2);
+ ++i;
+ }
+}
-
-BOOST_AUTO_TEST_CASE( check_if_boundary_of_boundary_is_zero_non_periodic_case_3_d )
-{
- std::vector< unsigned > sizes(3);
- sizes[0] = 5;
- sizes[1] = 5;
- sizes[2] = 5;
-
- std::vector< double > data(125 , 0);
-
- int number_of_all_elements = (2*sizes[0]+1)*(2*sizes[1]+1)*(2*sizes[2]+1);
- Bitmap_cubical_complex_base ba( sizes , data );
- for ( Bitmap_cubical_complex_base::All_cells_iterator it = ba.all_cells_iterator_begin() ; it != ba.all_cells_iterator_end() ; ++it )
- {
- std::vector< int > elems_in_boundary( number_of_all_elements,0 );
- int i = 1;
- Bitmap_cubical_complex_base::Boundary_range bdrange = ba.boundary_range(*it);
- for ( Bitmap_cubical_complex_base::Boundary_iterator bd = bdrange.begin() ; bd != bdrange.end() ; ++bd )
- {
- Bitmap_cubical_complex_base::Boundary_range second_bdrange = ba.boundary_range(*bd);
- int j = 1;
- for ( Bitmap_cubical_complex_base::Boundary_iterator bd2 = second_bdrange.begin() ; bd2 != second_bdrange.end() ; ++bd2 )
- {
- elems_in_boundary[ *bd2 ] += i*j;
- j *= -1;
- }
- i *= -1;
- }
- //check if there is anything nonzero in elems_in_boundary
- for ( size_t i = 0 ; i != elems_in_boundary.size() ; ++i )
- {
- BOOST_CHECK( elems_in_boundary[i] == 0 );
- }
+BOOST_AUTO_TEST_CASE(check_if_boundary_of_boundary_is_zero_non_periodic_case_3_d) {
+ std::vector<unsigned> sizes(3);
+ sizes[0] = 5;
+ sizes[1] = 5;
+ sizes[2] = 5;
+
+ std::vector<double> data(125, 0);
+
+ int number_of_all_elements = (2 * sizes[0] + 1) * (2 * sizes[1] + 1) * (2 * sizes[2] + 1);
+ Bitmap_cubical_complex_base ba(sizes, data);
+ for (Bitmap_cubical_complex_base::All_cells_iterator it = ba.all_cells_iterator_begin();
+ it != ba.all_cells_iterator_end(); ++it) {
+ std::vector<int> elems_in_boundary(number_of_all_elements, 0);
+ int i = 1;
+ Bitmap_cubical_complex_base::Boundary_range bdrange = ba.boundary_range(*it);
+ for (Bitmap_cubical_complex_base::Boundary_iterator bd = bdrange.begin(); bd != bdrange.end(); ++bd) {
+ Bitmap_cubical_complex_base::Boundary_range second_bdrange = ba.boundary_range(*bd);
+ int j = 1;
+ for (Bitmap_cubical_complex_base::Boundary_iterator bd2 = second_bdrange.begin(); bd2 != second_bdrange.end();
+ ++bd2) {
+ elems_in_boundary[*bd2] += i * j;
+ j *= -1;
+ }
+ i *= -1;
+ }
+ // check if there is anything nonzero in elems_in_boundary
+ for (size_t i = 0; i != elems_in_boundary.size(); ++i) {
+ BOOST_CHECK(elems_in_boundary[i] == 0);
}
+ }
}
-
-BOOST_AUTO_TEST_CASE( check_if_boundary_of_boundary_is_zero_non_periodic_case_4_d )
-{
- std::vector< unsigned > sizes(4);
- sizes[0] = 3;
- sizes[1] = 3;
- sizes[2] = 3;
- sizes[3] = 3;
-
- std::vector< double > data(81 , 0);
-
- int number_of_all_elements = (2*sizes[0]+1)*(2*sizes[1]+1)*(2*sizes[2]+1)*(2*sizes[3]+1);
- Bitmap_cubical_complex_base ba( sizes , data );
- for ( Bitmap_cubical_complex_base::All_cells_iterator it = ba.all_cells_iterator_begin() ; it != ba.all_cells_iterator_end() ; ++it )
- {
- std::vector< int > elems_in_boundary( number_of_all_elements,0 );
- int i = 1;
- Bitmap_cubical_complex_base::Boundary_range bdrange = ba.boundary_range(*it);
- for ( Bitmap_cubical_complex_base::Boundary_iterator bd = bdrange.begin() ; bd != bdrange.end() ; ++bd )
- {
- Bitmap_cubical_complex_base::Boundary_range second_bdrange = ba.boundary_range(*bd);
- int j = 1;
- for ( Bitmap_cubical_complex_base::Boundary_iterator bd2 = second_bdrange.begin() ; bd2 != second_bdrange.end() ; ++bd2 )
- {
- elems_in_boundary[ *bd2 ] += i*j;
- j *= -1;
- }
- i *= -1;
- }
- //check if there is anything nonzero in elems_in_boundary
- for ( size_t i = 0 ; i != elems_in_boundary.size() ; ++i )
- {
- BOOST_CHECK( elems_in_boundary[i] == 0 );
- }
+BOOST_AUTO_TEST_CASE(check_if_boundary_of_boundary_is_zero_non_periodic_case_4_d) {
+ std::vector<unsigned> sizes(4);
+ sizes[0] = 3;
+ sizes[1] = 3;
+ sizes[2] = 3;
+ sizes[3] = 3;
+
+ std::vector<double> data(81, 0);
+
+ int number_of_all_elements = (2 * sizes[0] + 1) * (2 * sizes[1] + 1) * (2 * sizes[2] + 1) * (2 * sizes[3] + 1);
+ Bitmap_cubical_complex_base ba(sizes, data);
+ for (Bitmap_cubical_complex_base::All_cells_iterator it = ba.all_cells_iterator_begin();
+ it != ba.all_cells_iterator_end(); ++it) {
+ std::vector<int> elems_in_boundary(number_of_all_elements, 0);
+ int i = 1;
+ Bitmap_cubical_complex_base::Boundary_range bdrange = ba.boundary_range(*it);
+ for (Bitmap_cubical_complex_base::Boundary_iterator bd = bdrange.begin(); bd != bdrange.end(); ++bd) {
+ Bitmap_cubical_complex_base::Boundary_range second_bdrange = ba.boundary_range(*bd);
+ int j = 1;
+ for (Bitmap_cubical_complex_base::Boundary_iterator bd2 = second_bdrange.begin(); bd2 != second_bdrange.end();
+ ++bd2) {
+ elems_in_boundary[*bd2] += i * j;
+ j *= -1;
+ }
+ i *= -1;
}
+ // check if there is anything nonzero in elems_in_boundary
+ for (size_t i = 0; i != elems_in_boundary.size(); ++i) {
+ BOOST_CHECK(elems_in_boundary[i] == 0);
+ }
+ }
}
+BOOST_AUTO_TEST_CASE(check_if_boundary_of_boundary_is_zero_periodic_case_2d) {
+ std::vector<unsigned> sizes(2);
+ sizes[0] = 10;
+ sizes[1] = 10;
+
+ std::vector<bool> directions_of_periodicity(2, true);
+ std::vector<double> data(100, 0);
+
+ int number_of_all_elements = (2 * sizes[0]) * (2 * sizes[1]); // *(2*sizes[2]);
+ Bitmap_cubical_complex_periodic_boundary_conditions ba(sizes, data, directions_of_periodicity);
+ for (Bitmap_cubical_complex_periodic_boundary_conditions::All_cells_iterator it = ba.all_cells_iterator_begin();
+ it != ba.all_cells_iterator_end(); ++it) {
+ std::vector<int> elems_in_boundary(number_of_all_elements, 0);
+ int i = 1;
+
+ // std::cout << "Element : " << *it << std::endl;
+
+ Bitmap_cubical_complex_periodic_boundary_conditions_base::Boundary_range bdrange = ba.boundary_range(*it);
+ for (Bitmap_cubical_complex_periodic_boundary_conditions::Boundary_iterator bd = bdrange.begin();
+ bd != bdrange.end(); ++bd) {
+ // std::cout << *bd << " ";
+ Bitmap_cubical_complex_periodic_boundary_conditions::Boundary_range second_bdrange = ba.boundary_range(*bd);
+ int j = 1;
+ for (Bitmap_cubical_complex_periodic_boundary_conditions::Boundary_iterator bd2 = second_bdrange.begin();
+ bd2 != second_bdrange.end(); ++bd2) {
+ elems_in_boundary[*bd2] += i * j;
+ j *= -1;
+ }
+ i *= -1;
+ }
+ // getchar();
-
-
-
-
-BOOST_AUTO_TEST_CASE( check_if_boundary_of_boundary_is_zero_periodic_case_2d )
-{
- std::vector< unsigned > sizes(2);
- sizes[0] = 10;
- sizes[1] = 10;
-
- std::vector<bool> directions_of_periodicity(2,true);
- std::vector< double > data(100 , 0);
-
- int number_of_all_elements = (2*sizes[0])*(2*sizes[1]);// *(2*sizes[2]);
- Bitmap_cubical_complex_periodic_boundary_conditions ba( sizes , data , directions_of_periodicity );
- for ( Bitmap_cubical_complex_periodic_boundary_conditions::All_cells_iterator it = ba.all_cells_iterator_begin() ; it != ba.all_cells_iterator_end() ; ++it )
- {
- std::vector< int > elems_in_boundary( number_of_all_elements,0 );
- int i = 1;
-
- //std::cout << "Element : " << *it << std::endl;
-
- Bitmap_cubical_complex_periodic_boundary_conditions_base::Boundary_range bdrange = ba.boundary_range(*it);
- for ( Bitmap_cubical_complex_periodic_boundary_conditions::Boundary_iterator bd = bdrange.begin() ; bd != bdrange.end() ; ++bd )
- {
- //std::cout << *bd << " ";
- Bitmap_cubical_complex_periodic_boundary_conditions::Boundary_range second_bdrange = ba.boundary_range(*bd);
- int j = 1;
- for ( Bitmap_cubical_complex_periodic_boundary_conditions::Boundary_iterator bd2 = second_bdrange.begin() ; bd2 != second_bdrange.end() ; ++bd2 )
- {
- elems_in_boundary[ *bd2 ] += i*j;
- j *= -1;
- }
- i *= -1;
- }
- //getchar();
-
- //check if there is anything nonzero in elems_in_boundary
- for ( size_t i = 0 ; i != elems_in_boundary.size() ; ++i )
- {
- BOOST_CHECK( elems_in_boundary[i] == 0 );
- }
+ // check if there is anything nonzero in elems_in_boundary
+ for (size_t i = 0; i != elems_in_boundary.size(); ++i) {
+ BOOST_CHECK(elems_in_boundary[i] == 0);
}
+ }
}
+BOOST_AUTO_TEST_CASE(check_if_boundary_of_boundary_is_zero_periodic_case_3d) {
+ std::vector<unsigned> sizes(3);
+ sizes[0] = 5;
+ sizes[1] = 5;
+ sizes[2] = 5;
+
+ std::vector<bool> directions_of_periodicity(3, true);
+
+ std::vector<double> data(125, 0);
+
+ int number_of_all_elements = (2 * sizes[0]) * (2 * sizes[1]) * (2 * sizes[2]);
+ Bitmap_cubical_complex_periodic_boundary_conditions ba(sizes, data, directions_of_periodicity);
+ for (Bitmap_cubical_complex_periodic_boundary_conditions::All_cells_iterator it = ba.all_cells_iterator_begin();
+ it != ba.all_cells_iterator_end(); ++it) {
+ // std::cout << "Element : " << *it << std::endl;
+
+ std::vector<int> elems_in_boundary(number_of_all_elements, 0);
+ int i = 1;
+
+ Bitmap_cubical_complex_periodic_boundary_conditions_base::Boundary_range bdrange = ba.boundary_range(*it);
+ for (Bitmap_cubical_complex_periodic_boundary_conditions::Boundary_iterator bd = bdrange.begin();
+ bd != bdrange.end(); ++bd) {
+ Bitmap_cubical_complex_periodic_boundary_conditions::Boundary_range second_bdrange = ba.boundary_range(*bd);
+ // std::cout << *bd << " ";
+ int j = 1;
+ for (Bitmap_cubical_complex_periodic_boundary_conditions::Boundary_iterator bd2 = second_bdrange.begin();
+ bd2 != second_bdrange.end(); ++bd2) {
+ elems_in_boundary[*bd2] += i * j;
+ j *= -1;
+ }
+ i *= -1;
+ }
+ // getchar();
-
-BOOST_AUTO_TEST_CASE( check_if_boundary_of_boundary_is_zero_periodic_case_3d )
-{
- std::vector< unsigned > sizes(3);
- sizes[0] = 5;
- sizes[1] = 5;
- sizes[2] = 5;
-
- std::vector<bool> directions_of_periodicity(3,true);
-
- std::vector< double > data(125 , 0);
-
- int number_of_all_elements = (2*sizes[0])*(2*sizes[1])*(2*sizes[2]);
- Bitmap_cubical_complex_periodic_boundary_conditions ba( sizes , data , directions_of_periodicity );
- for ( Bitmap_cubical_complex_periodic_boundary_conditions::All_cells_iterator it = ba.all_cells_iterator_begin() ; it != ba.all_cells_iterator_end() ; ++it )
- {
- //std::cout << "Element : " << *it << std::endl;
-
- std::vector< int > elems_in_boundary( number_of_all_elements,0 );
- int i = 1;
-
- Bitmap_cubical_complex_periodic_boundary_conditions_base::Boundary_range bdrange = ba.boundary_range(*it);
- for ( Bitmap_cubical_complex_periodic_boundary_conditions::Boundary_iterator bd = bdrange.begin() ; bd != bdrange.end() ; ++bd )
- {
- Bitmap_cubical_complex_periodic_boundary_conditions::Boundary_range second_bdrange = ba.boundary_range(*bd);
- //std::cout << *bd << " ";
- int j = 1;
- for ( Bitmap_cubical_complex_periodic_boundary_conditions::Boundary_iterator bd2 = second_bdrange.begin() ; bd2 != second_bdrange.end() ; ++bd2 )
- {
- elems_in_boundary[ *bd2 ] += i*j;
- j *= -1;
- }
- i *= -1;
- }
- //getchar();
-
- //check if there is anything nonzero in elems_in_boundary
- for ( size_t i = 0 ; i != elems_in_boundary.size() ; ++i )
- {
- BOOST_CHECK( elems_in_boundary[i] == 0 );
- }
+ // check if there is anything nonzero in elems_in_boundary
+ for (size_t i = 0; i != elems_in_boundary.size(); ++i) {
+ BOOST_CHECK(elems_in_boundary[i] == 0);
}
+ }
}
+BOOST_AUTO_TEST_CASE(check_if_boundary_of_boundary_is_zero_periodic_case_4d) {
+ std::vector<unsigned> sizes(4);
+ sizes[0] = 4;
+ sizes[1] = 4;
+ sizes[2] = 4;
+ sizes[3] = 4;
+
+ std::vector<bool> directions_of_periodicity(4, true);
+
+ std::vector<double> data(256, 0);
+
+ int number_of_all_elements = (2 * sizes[0]) * (2 * sizes[1]) * (2 * sizes[2]) * (2 * sizes[3]);
+ Bitmap_cubical_complex_periodic_boundary_conditions ba(sizes, data, directions_of_periodicity);
+ for (Bitmap_cubical_complex_periodic_boundary_conditions::All_cells_iterator it = ba.all_cells_iterator_begin();
+ it != ba.all_cells_iterator_end(); ++it) {
+ std::vector<int> elems_in_boundary(number_of_all_elements, 0);
+ int i = 1;
+
+ Bitmap_cubical_complex_periodic_boundary_conditions_base::Boundary_range bdrange = ba.boundary_range(*it);
+ for (Bitmap_cubical_complex_periodic_boundary_conditions::Boundary_iterator bd = bdrange.begin();
+ bd != bdrange.end(); ++bd) {
+ Bitmap_cubical_complex_periodic_boundary_conditions::Boundary_range second_bdrange = ba.boundary_range(*bd);
+ int j = 1;
+ for (Bitmap_cubical_complex_periodic_boundary_conditions::Boundary_iterator bd2 = second_bdrange.begin();
+ bd2 != second_bdrange.end(); ++bd2) {
+ elems_in_boundary[*bd2] += i * j;
+ j *= -1;
+ }
+ i *= -1;
+ }
-
-
-
-
-BOOST_AUTO_TEST_CASE( check_if_boundary_of_boundary_is_zero_periodic_case_4d )
-{
- std::vector< unsigned > sizes(4);
- sizes[0] = 4;
- sizes[1] = 4;
- sizes[2] = 4;
- sizes[3] = 4;
-
- std::vector<bool> directions_of_periodicity(4,true);
-
- std::vector< double > data(256 , 0);
-
- int number_of_all_elements = (2*sizes[0])*(2*sizes[1])*(2*sizes[2])*(2*sizes[3]);
- Bitmap_cubical_complex_periodic_boundary_conditions ba( sizes , data , directions_of_periodicity );
- for ( Bitmap_cubical_complex_periodic_boundary_conditions::All_cells_iterator it = ba.all_cells_iterator_begin() ; it != ba.all_cells_iterator_end() ; ++it )
- {
- std::vector< int > elems_in_boundary( number_of_all_elements,0 );
- int i = 1;
-
- Bitmap_cubical_complex_periodic_boundary_conditions_base::Boundary_range bdrange = ba.boundary_range(*it);
- for ( Bitmap_cubical_complex_periodic_boundary_conditions::Boundary_iterator bd = bdrange.begin() ; bd != bdrange.end() ; ++bd )
- {
- Bitmap_cubical_complex_periodic_boundary_conditions::Boundary_range second_bdrange = ba.boundary_range(*bd);
- int j = 1;
- for ( Bitmap_cubical_complex_periodic_boundary_conditions::Boundary_iterator bd2 = second_bdrange.begin() ; bd2 != second_bdrange.end() ; ++bd2 )
- {
- elems_in_boundary[ *bd2 ] += i*j;
- j *= -1;
- }
- i *= -1;
- }
-
- //check if there is anything nonzero in elems_in_boundary
- for ( size_t i = 0 ; i != elems_in_boundary.size() ; ++i )
- {
- BOOST_CHECK( elems_in_boundary[i] == 0 );
- }
+ // check if there is anything nonzero in elems_in_boundary
+ for (size_t i = 0; i != elems_in_boundary.size(); ++i) {
+ BOOST_CHECK(elems_in_boundary[i] == 0);
}
+ }
}
-
-
-
-BOOST_AUTO_TEST_CASE( compute_incidence_between_cells_test )
-{
- std::vector< unsigned > sizes(3);
- sizes[0] = 5;
- sizes[1] = 5;
- sizes[2] = 5;
-
- std::vector< double > data(125 , 0);
-
- int number_of_all_elements = (2*sizes[0]+1)*(2*sizes[1]+1)*(2*sizes[1]+1);
- Bitmap_cubical_complex_base ba( sizes , data );
- for ( Bitmap_cubical_complex_base::All_cells_iterator it = ba.all_cells_iterator_begin() ; it != ba.all_cells_iterator_end() ; ++it )
- {
- std::vector< int > elems_in_boundary( number_of_all_elements,0 );
- Bitmap_cubical_complex_base::Boundary_range bdrange = ba.boundary_range(*it);
- for ( Bitmap_cubical_complex_base::Boundary_iterator bd = bdrange.begin() ; bd != bdrange.end() ; ++bd )
- {
- Bitmap_cubical_complex_base::Boundary_range second_bdrange = ba.boundary_range(*bd);
- for ( Bitmap_cubical_complex_base::Boundary_iterator bd2 = second_bdrange.begin() ; bd2 != second_bdrange.end() ; ++bd2 )
- {
- elems_in_boundary[ *bd2 ] +=
- ba.compute_incidence_between_cells( *it , *bd ) *
- ba.compute_incidence_between_cells( *bd , *bd2 );
- }
- }
- //check if there is anything nonzero in elems_in_boundary
- for ( size_t i = 0 ; i != elems_in_boundary.size() ; ++i )
- {
- BOOST_CHECK( elems_in_boundary[i] == 0 );
- }
+BOOST_AUTO_TEST_CASE(compute_incidence_between_cells_test) {
+ std::vector<unsigned> sizes(3);
+ sizes[0] = 5;
+ sizes[1] = 5;
+ sizes[2] = 5;
+
+ std::vector<double> data(125, 0);
+
+ int number_of_all_elements = (2 * sizes[0] + 1) * (2 * sizes[1] + 1) * (2 * sizes[1] + 1);
+ Bitmap_cubical_complex_base ba(sizes, data);
+ for (Bitmap_cubical_complex_base::All_cells_iterator it = ba.all_cells_iterator_begin();
+ it != ba.all_cells_iterator_end(); ++it) {
+ std::vector<int> elems_in_boundary(number_of_all_elements, 0);
+ Bitmap_cubical_complex_base::Boundary_range bdrange = ba.boundary_range(*it);
+ for (Bitmap_cubical_complex_base::Boundary_iterator bd = bdrange.begin(); bd != bdrange.end(); ++bd) {
+ Bitmap_cubical_complex_base::Boundary_range second_bdrange = ba.boundary_range(*bd);
+ for (Bitmap_cubical_complex_base::Boundary_iterator bd2 = second_bdrange.begin(); bd2 != second_bdrange.end();
+ ++bd2) {
+ elems_in_boundary[*bd2] +=
+ ba.compute_incidence_between_cells(*it, *bd) * ba.compute_incidence_between_cells(*bd, *bd2);
+ }
}
+ // check if there is anything nonzero in elems_in_boundary
+ for (size_t i = 0; i != elems_in_boundary.size(); ++i) {
+ BOOST_CHECK(elems_in_boundary[i] == 0);
+ }
+ }
}
-
-
-
-BOOST_AUTO_TEST_CASE( compute_incidence_between_cells_test_periodic_boundary_conditions )
-{
- std::vector< unsigned > sizes(3);
- sizes[0] = 5;
- sizes[1] = 5;
- sizes[2] = 5;
-
- std::vector<bool> directions_of_periodicity(3,true);
- std::vector< double > data(125 , 0);
-
- int number_of_all_elements = (2*sizes[0])*(2*sizes[1])*(2*sizes[2]);
- Bitmap_cubical_complex_periodic_boundary_conditions ba( sizes , data , directions_of_periodicity );
- for ( Bitmap_cubical_complex_periodic_boundary_conditions::All_cells_iterator it = ba.all_cells_iterator_begin() ; it != ba.all_cells_iterator_end() ; ++it )
- {
- std::vector< int > elems_in_boundary( number_of_all_elements,0 );
- Bitmap_cubical_complex_periodic_boundary_conditions_base::Boundary_range bdrange = ba.boundary_range(*it);
- for ( Bitmap_cubical_complex_periodic_boundary_conditions::Boundary_iterator bd = bdrange.begin() ; bd != bdrange.end() ; ++bd )
- {
- //std::cout << *bd << " ";
- Bitmap_cubical_complex_periodic_boundary_conditions::Boundary_range second_bdrange = ba.boundary_range(*bd);
- for ( Bitmap_cubical_complex_periodic_boundary_conditions::Boundary_iterator bd2 = second_bdrange.begin() ; bd2 != second_bdrange.end() ; ++bd2 )
- {
- elems_in_boundary[ *bd2 ] +=
- ba.compute_incidence_between_cells( *it , *bd ) *
- ba.compute_incidence_between_cells( *bd , *bd2 );
- }
- }
- //check if there is anything nonzero in elems_in_boundary
- for ( size_t i = 0 ; i != elems_in_boundary.size() ; ++i )
- {
- BOOST_CHECK( elems_in_boundary[i] == 0 );
- }
+BOOST_AUTO_TEST_CASE(compute_incidence_between_cells_test_periodic_boundary_conditions) {
+ std::vector<unsigned> sizes(3);
+ sizes[0] = 5;
+ sizes[1] = 5;
+ sizes[2] = 5;
+
+ std::vector<bool> directions_of_periodicity(3, true);
+ std::vector<double> data(125, 0);
+
+ int number_of_all_elements = (2 * sizes[0]) * (2 * sizes[1]) * (2 * sizes[2]);
+ Bitmap_cubical_complex_periodic_boundary_conditions ba(sizes, data, directions_of_periodicity);
+ for (Bitmap_cubical_complex_periodic_boundary_conditions::All_cells_iterator it = ba.all_cells_iterator_begin();
+ it != ba.all_cells_iterator_end(); ++it) {
+ std::vector<int> elems_in_boundary(number_of_all_elements, 0);
+ Bitmap_cubical_complex_periodic_boundary_conditions_base::Boundary_range bdrange = ba.boundary_range(*it);
+ for (Bitmap_cubical_complex_periodic_boundary_conditions::Boundary_iterator bd = bdrange.begin();
+ bd != bdrange.end(); ++bd) {
+ // std::cout << *bd << " ";
+ Bitmap_cubical_complex_periodic_boundary_conditions::Boundary_range second_bdrange = ba.boundary_range(*bd);
+ for (Bitmap_cubical_complex_periodic_boundary_conditions::Boundary_iterator bd2 = second_bdrange.begin();
+ bd2 != second_bdrange.end(); ++bd2) {
+ elems_in_boundary[*bd2] +=
+ ba.compute_incidence_between_cells(*it, *bd) * ba.compute_incidence_between_cells(*bd, *bd2);
+ }
}
+ // check if there is anything nonzero in elems_in_boundary
+ for (size_t i = 0; i != elems_in_boundary.size(); ++i) {
+ BOOST_CHECK(elems_in_boundary[i] == 0);
+ }
+ }
}
-
-
-