11 #ifndef BITMAP_CUBICAL_COMPLEX_COUNTER_H_ 12 #define BITMAP_CUBICAL_COMPLEX_COUNTER_H_ 20 namespace cubical_complex {
38 counter(
const std::vector<unsigned>& endd) : begin(endd.size(), 0), end(endd), current(endd.size(), 0) { }
44 counter(
const std::vector< unsigned >& beginn,
const std::vector< unsigned >& endd) : begin(beginn), end(endd), current(endd.size(), 0) {
45 if (beginn.size() != endd.size())
46 throw "In constructor of a counter, begin and end vectors do not have the same size. Program terminate";
56 while ((i != this->end.size()) && (this->current[i] == this->end[i])) {
60 if (i == this->end.size())
return false;
62 for (std::size_t j = 0; j != i; ++j) {
63 this->current[j] = this->begin[j];
72 for (std::size_t i = 0; i != this->current.size(); ++i) {
73 if (this->current[i] == this->end[i])
return true;
83 std::vector< unsigned >
find_opposite(
const std::vector< bool >& directionsForPeriodicBCond) {
84 std::vector< unsigned > result;
85 for (std::size_t i = 0; i != this->current.size(); ++i) {
86 if ((this->current[i] == this->end[i]) && (directionsForPeriodicBCond[i] ==
true)) {
87 result.push_back(this->begin[i]);
89 result.push_back(this->current[i]);
99 std::vector< bool > result;
100 for (std::size_t i = 0; i != this->current.size(); ++i) {
101 if (this->current[i] == this->end[i]) {
102 result.push_back(
true);
104 result.push_back(
false);
115 for (std::size_t i = 0; i != c.current.size(); ++i) {
116 out << c.current[i] <<
" ";
122 std::vector< unsigned > begin;
123 std::vector< unsigned > end;
124 std::vector< unsigned > current;
129 namespace Cubical_complex = cubical_complex;
133 #endif // BITMAP_CUBICAL_COMPLEX_COUNTER_H_ bool isFinal()
Definition: counter.h:71
bool increment()
Definition: counter.h:54
std::vector< unsigned > find_opposite(const std::vector< bool > &directionsForPeriodicBCond)
Definition: counter.h:83
Definition: SimplicialComplexForAlpha.h:14
This is an implementation of a counter being a vector of integers.
Definition: counter.h:32
counter(const std::vector< unsigned > &endd)
Definition: counter.h:38
friend std::ostream & operator<<(std::ostream &out, const counter &c)
Definition: counter.h:113
std::vector< bool > directions_of_finals()
Definition: counter.h:98
counter(const std::vector< unsigned > &beginn, const std::vector< unsigned > &endd)
Definition: counter.h:44