23 #ifndef BITMAP_CUBICAL_COMPLEX_COUNTER_H_ 24 #define BITMAP_CUBICAL_COMPLEX_COUNTER_H_ 32 namespace cubical_complex {
50 counter(
const std::vector<unsigned>& endd) : begin(endd.size(), 0), end(endd), current(endd.size(), 0) { }
56 counter(
const std::vector< unsigned >& beginn,
const std::vector< unsigned >& endd) : begin(beginn), end(endd), current(endd.size(), 0) {
57 if (beginn.size() != endd.size())
58 throw "In constructor of a counter, begin and end vectors do not have the same size. Program terminate";
68 while ((i != this->end.size()) && (this->current[i] == this->end[i])) {
72 if (i == this->end.size())
return false;
74 for (std::size_t j = 0; j != i; ++j) {
75 this->current[j] = this->begin[j];
84 for (std::size_t i = 0; i != this->current.size(); ++i) {
85 if (this->current[i] == this->end[i])
return true;
95 std::vector< unsigned >
find_opposite(
const std::vector< bool >& directionsForPeriodicBCond) {
96 std::vector< unsigned > result;
97 for (std::size_t i = 0; i != this->current.size(); ++i) {
98 if ((this->current[i] == this->end[i]) && (directionsForPeriodicBCond[i] ==
true)) {
99 result.push_back(this->begin[i]);
101 result.push_back(this->current[i]);
111 std::vector< bool > result;
112 for (std::size_t i = 0; i != this->current.size(); ++i) {
113 if (this->current[i] == this->end[i]) {
114 result.push_back(
true);
116 result.push_back(
false);
127 for (std::size_t i = 0; i != c.current.size(); ++i) {
128 out << c.current[i] <<
" ";
134 std::vector< unsigned > begin;
135 std::vector< unsigned > end;
136 std::vector< unsigned > current;
141 namespace Cubical_complex = cubical_complex;
145 #endif // BITMAP_CUBICAL_COMPLEX_COUNTER_H_ bool isFinal()
Definition: counter.h:83
bool increment()
Definition: counter.h:66
std::vector< unsigned > find_opposite(const std::vector< bool > &directionsForPeriodicBCond)
Definition: counter.h:95
Definition: SimplicialComplexForAlpha.h:26
This is an implementation of a counter being a vector of integers.
Definition: counter.h:44
counter(const std::vector< unsigned > &endd)
Definition: counter.h:50
friend std::ostream & operator<<(std::ostream &out, const counter &c)
Definition: counter.h:125
std::vector< bool > directions_of_finals()
Definition: counter.h:110
counter(const std::vector< unsigned > &beginn, const std::vector< unsigned > &endd)
Definition: counter.h:56