23 #ifndef BITMAP_CUBICAL_COMPLEX_COUNTER_H_ 24 #define BITMAP_CUBICAL_COMPLEX_COUNTER_H_ 31 namespace cubical_complex {
49 counter(
const std::vector<unsigned>& endd) : begin(endd.size(), 0), end(endd), current(endd.size(), 0) { }
55 counter(
const std::vector< unsigned >& beginn,
const std::vector< unsigned >& endd) : begin(beginn), end(endd), current(endd.size(), 0) {
56 if (beginn.size() != endd.size())
57 throw "In constructor of a counter, begin and end vectors do not have the same size. Program terminate";
67 while ((i != this->end.size()) && (this->current[i] == this->end[i])) {
71 if (i == this->end.size())
return false;
73 for (
size_t j = 0; j != i; ++j) {
74 this->current[j] = this->begin[j];
83 for (
size_t i = 0; i != this->current.size(); ++i) {
84 if (this->current[i] == this->end[i])
return true;
94 std::vector< unsigned >
find_opposite(
const std::vector< bool >& directionsForPeriodicBCond) {
95 std::vector< unsigned > result;
96 for (
size_t i = 0; i != this->current.size(); ++i) {
97 if ((this->current[i] == this->end[i]) && (directionsForPeriodicBCond[i] ==
true)) {
98 result.push_back(this->begin[i]);
100 result.push_back(this->current[i]);
110 std::vector< bool > result;
111 for (
size_t i = 0; i != this->current.size(); ++i) {
112 if (this->current[i] == this->end[i]) {
113 result.push_back(
true);
115 result.push_back(
false);
126 for (
size_t i = 0; i != c.current.size(); ++i) {
127 out << c.current[i] <<
" ";
133 std::vector< unsigned > begin;
134 std::vector< unsigned > end;
135 std::vector< unsigned > current;
140 namespace Cubical_complex = cubical_complex;
144 #endif // BITMAP_CUBICAL_COMPLEX_COUNTER_H_ bool isFinal()
Definition: counter.h:82
bool increment()
Definition: counter.h:65
std::vector< unsigned > find_opposite(const std::vector< bool > &directionsForPeriodicBCond)
Definition: counter.h:94
Definition: SimplicialComplexForAlpha.h:26
This is an implementation of a counter being a vector of integers.
Definition: counter.h:43
counter(const std::vector< unsigned > &endd)
Definition: counter.h:49
friend std::ostream & operator<<(std::ostream &out, const counter &c)
Definition: counter.h:124
std::vector< bool > directions_of_finals()
Definition: counter.h:109
counter(const std::vector< unsigned > &beginn, const std::vector< unsigned > &endd)
Definition: counter.h:55