projects
/
libstick.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Coding style cleanup
[libstick.git]
/
include
/
libstick-0.1
/
simplicialcomplex.h
diff --git
a/include/libstick-0.1/simplicialcomplex.h
b/include/libstick-0.1/simplicialcomplex.h
index 07080ed76a23617e2c87b99ca7aa3dc998640b2f..47a88c64907cb29054cb6d22d78c49df9e0bb08b 100644
(file)
--- a/
include/libstick-0.1/simplicialcomplex.h
+++ b/
include/libstick-0.1/simplicialcomplex.h
@@
-18,17
+18,17
@@
namespace libstick {
/** A simplicial complex is a std::vector of simplices such that each face is
* also part of the complex. Every simplex has dimension at most MAXDIM. The
* indices of simplices resp. their faces are of type IT. To each simplex a
/** A simplicial complex is a std::vector of simplices such that each face is
* also part of the complex. Every simplex has dimension at most MAXDIM. The
* indices of simplices resp. their faces are of type IT. To each simplex a
- * value is assigend, which is of type VT. When a
SimplicialC
omplex is
+ * value is assigend, which is of type VT. When a
simplicial_c
omplex is
* instantiated, a single (-1) dimensional simplex is automatically created.
* Each 0-dimensional simplex automatically has this simplex as its face.
* instantiated, a single (-1) dimensional simplex is automatically created.
* Each 0-dimensional simplex automatically has this simplex as its face.
- * Consequently, the innner class
SimplexO
rder gives the extended boundary
+ * Consequently, the innner class
simplex_o
rder gives the extended boundary
* matrix. */
template<int MAXDIM, class IT=uint32_t, class VT=double>
* matrix. */
template<int MAXDIM, class IT=uint32_t, class VT=double>
-class
SimplicialC
omplex {
+class
simplicial_c
omplex {
public:
/** The type of this class. */
public:
/** The type of this class. */
- typedef
SimplicialC
omplex<MAXDIM, IT, VT> simplcompltype;
+ typedef
simplicial_c
omplex<MAXDIM, IT, VT> simplcompltype;
/** Type of indices of simplices. */
typedef IT index_type;
/** To every simplex a function value is assigned according to which a
/** Type of indices of simplices. */
typedef IT index_type;
/** To every simplex a function value is assigned according to which a
@@
-55,7
+55,7
@@
class SimplicialComplex {
s.value = value;
if (dim > 0)
s.value = value;
if (dim > 0)
- memcpy(s.faces, faces, face
CountByD
im(dim)*sizeof(index_type));
+ memcpy(s.faces, faces, face
_count_byd
im(dim)*sizeof(index_type));
else
s.faces[0] = 0;
else
s.faces[0] = 0;
@@
-76,12
+76,12
@@
class SimplicialComplex {
}
/** Get number of faces. */
}
/** Get number of faces. */
- size_t face
C
ount() const {
- return face
CountByD
im(dim);
+ size_t face
_c
ount() const {
+ return face
_count_byd
im(dim);
}
/** Get number of faces of a dim-dimensional simplex. */
}
/** Get number of faces of a dim-dimensional simplex. */
- static size_t face
CountByD
im(int dim) {
+ static size_t face
_count_byd
im(int dim) {
assert(-1 <= dim && dim <= MAXDIM);
return dim + 1;
}
assert(-1 <= dim && dim <= MAXDIM);
return dim + 1;
}
@@
-89,13
+89,13
@@
class SimplicialComplex {
/** An order of the simplices of complex c. An order can be interpreted
* as a permuation of the complex's std::vector of simplices. */
/** An order of the simplices of complex c. An order can be interpreted
* as a permuation of the complex's std::vector of simplices. */
- class
SimplexO
rder {
+ class
simplex_o
rder {
public:
public:
- typedef
BooleanColRowMatrix<IT> BoundaryM
atrix;
+ typedef
boolean_colrowmatrix<IT> boundary_m
atrix;
/** Create a standard order of the complex c, i.e., the identity permutation. */
/** Create a standard order of the complex c, i.e., the identity permutation. */
-
SimplexO
rder(const simplcompltype &c) :
+
simplex_o
rder(const simplcompltype &c) :
c(c)
{
reset();
c(c)
{
reset();
@@
-116,63
+116,63
@@
class SimplicialComplex {
}
/** Get i-th simplex in the simplex order. */
}
/** Get i-th simplex in the simplex order. */
- const Simplex& get
S
implex(size_t i) const {
+ const Simplex& get
_s
implex(size_t i) const {
assert(i < size());
return c.simplices[order.at(i)];
}
/** Returns true iff the faces of simplex i are before i in this order. */
assert(i < size());
return c.simplices[order.at(i)];
}
/** Returns true iff the faces of simplex i are before i in this order. */
- bool is
F
iltration() const {
+ bool is
_f
iltration() const {
assert(size() == c.size());
for (unsigned i=0; i < size(); ++i)
assert(size() == c.size());
for (unsigned i=0; i < size(); ++i)
- for (unsigned f=0; f < get
Simplex(i).faceC
ount(); ++f)
- if (revorder[get
S
implex(i).faces[f]] >= i)
+ for (unsigned f=0; f < get
_simplex(i).face_c
ount(); ++f)
+ if (revorder[get
_s
implex(i).faces[f]] >= i)
return false;
return true;
}
return false;
return true;
}
- /** Returns true iff is
F
iltration() gives true and values of simplices
+ /** Returns true iff is
_f
iltration() gives true and values of simplices
* are monotone w.r.t. this order of simplices. */
* are monotone w.r.t. this order of simplices. */
- bool is
M
onotone() const {
+ bool is
_m
onotone() const {
assert(size() == c.size());
for (unsigned i=1; i < size(); ++i)
assert(size() == c.size());
for (unsigned i=1; i < size(); ++i)
- if (get
Simplex(i-1).value > getS
implex(i).value)
+ if (get
_simplex(i-1).value > get_s
implex(i).value)
return false;
return false;
- return is
F
iltration();
+ return is
_f
iltration();
}
}
- /** Sort simplices such that is
M
onotone() gives true. This
- * requires that the complex's is
M
onotone() gave true
+ /** Sort simplices such that is
_m
onotone() gives true. This
+ * requires that the complex's is
_m
onotone() gave true
* beforehand.*/
* beforehand.*/
- void make
MonotoneF
iltration() {
- assert(c.is
M
onotone());
+ void make
_monotone_f
iltration() {
+ assert(c.is
_m
onotone());
- sort(order.begin(), order.end(), cmp
MonotoneF
iltration(c));
- restore
RevorderFromO
rder();
+ sort(order.begin(), order.end(), cmp
_monotone_f
iltration(c));
+ restore
_revorder_from_o
rder();
- assert(c.is
M
onotone());
- assert(is
F
iltration());
- assert(is
M
onotone());
+ assert(c.is
_m
onotone());
+ assert(is
_f
iltration());
+ assert(is
_m
onotone());
}
/** Get the boundary matrix of the complex according to this order. */
}
/** Get the boundary matrix of the complex according to this order. */
-
BoundaryMatrix getBoundaryM
atrix() const {
-
BoundaryM
atrix mat(size());
+
boundary_matrix get_boundary_m
atrix() const {
+
boundary_m
atrix mat(size());
for (unsigned c=0; c < size(); ++c)
for (unsigned c=0; c < size(); ++c)
- for(unsigned r=0; r < get
Simplex(c).faceC
ount(); ++r)
- mat.set(revorder[get
S
implex(c).faces[r]], c, true);
+ for(unsigned r=0; r < get
_simplex(c).face_c
ount(); ++r)
+ mat.set(revorder[get
_s
implex(c).faces[r]], c, true);
return mat;
}
private:
/** Reconstruct 'revorder' by inverting the permutation given by 'order'. */
return mat;
}
private:
/** Reconstruct 'revorder' by inverting the permutation given by 'order'. */
- void restore
RevorderFromO
rder() {
+ void restore
_revorder_from_o
rder() {
// Make revorder * order the identity permutation
for (unsigned i=0; i < size(); ++i)
revorder[order[i]] = i;
// Make revorder * order the identity permutation
for (unsigned i=0; i < size(); ++i)
revorder[order[i]] = i;
@@
-193,9
+193,9
@@
class SimplicialComplex {
};
public:
};
public:
-
SimplicialC
omplex() {
+
simplicial_c
omplex() {
// Add the one minus-one dimensional simplex
// Add the one minus-one dimensional simplex
- add
S
implex(Simplex::create_minusonedim_simplex());
+ add
_s
implex(Simplex::create_minusonedim_simplex());
}
/** Return number of simplices. */
}
/** Return number of simplices. */
@@
-205,15
+205,15
@@
class SimplicialComplex {
/** Add a simplex to the complex. The dimension of the faces must be
* dim-1, and they must already be part of the complex. */
/** Add a simplex to the complex. The dimension of the faces must be
* dim-1, and they must already be part of the complex. */
- void add
S
implex(int dim, index_type* faces, value_type value) {
- add
S
implex(Simplex::create(dim, faces, value));
+ void add
_s
implex(int dim, index_type* faces, value_type value) {
+ add
_s
implex(Simplex::create(dim, faces, value));
}
/** Add a simplex to the complex. The dimension of the faces must be
* dim-1, and they must already be part of the complex. */
}
/** Add a simplex to the complex. The dimension of the faces must be
* dim-1, and they must already be part of the complex. */
- void add
S
implex(Simplex s) {
+ void add
_s
implex(Simplex s) {
// Check requirements for faces
// Check requirements for faces
- for (unsigned i=0; i < s.face
C
ount(); ++i) {
+ for (unsigned i=0; i < s.face
_c
ount(); ++i) {
// Faces are already in complex.
assert(s.faces[i] < size());
// Faces have dimension dim-1
// Faces are already in complex.
assert(s.faces[i] < size());
// Faces have dimension dim-1
@@
-225,11
+225,11
@@
class SimplicialComplex {
/** Return true iff for each simplex i with dimension dim it holds that
* the faces of i are contained in the complex and have dimension dim-1. */
/** Return true iff for each simplex i with dimension dim it holds that
* the faces of i are contained in the complex and have dimension dim-1. */
- bool is
C
omplex() const {
+ bool is
_c
omplex() const {
for (unsigned i=0; i < size(); ++i) {
const Simplex &s = simplices[i];
for (unsigned i=0; i < size(); ++i) {
const Simplex &s = simplices[i];
- for (unsigned f=0; f < s.face
C
ount(); ++f) {
+ for (unsigned f=0; f < s.face
_c
ount(); ++f) {
if (s.faces[f] >= size())
return false;
if (s.faces[f] >= size())
return false;
@@
-244,13
+244,13
@@
class SimplicialComplex {
/** Returns true iff simplex's values are monotone w.r.t.
* face-inclusion, i.e., for each simplex its value is not smaller than
/** Returns true iff simplex's values are monotone w.r.t.
* face-inclusion, i.e., for each simplex its value is not smaller than
- * the values of its faces. Requires that is
C
omplex() gives true. */
- bool is
M
onotone() const {
- assert(is
C
omplex());
+ * the values of its faces. Requires that is
_c
omplex() gives true. */
+ bool is
_m
onotone() const {
+ assert(is
_c
omplex());
typename std::vector<Simplex>::const_iterator it = ++simplices.begin();
for (; it != simplices.end(); ++it)
typename std::vector<Simplex>::const_iterator it = ++simplices.begin();
for (; it != simplices.end(); ++it)
- for (unsigned f=0; f < it->face
C
ount(); ++f)
+ for (unsigned f=0; f < it->face
_c
ount(); ++f)
if (simplices[it->faces[f]].value > it->value)
return false;
if (simplices[it->faces[f]].value > it->value)
return false;
@@
-259,12
+259,12
@@
class SimplicialComplex {
private:
/** Compares (operator<) two simplices (i.e. indices) in a
private:
/** Compares (operator<) two simplices (i.e. indices) in a
- *
SimplexO
rder w.r.t. lexicographical order on (value,
+ *
simplex_o
rder w.r.t. lexicographical order on (value,
* dimension)-tuples. */
* dimension)-tuples. */
- struct cmp
MonotoneF
iltration {
- const
SimplicialC
omplex &c;
+ struct cmp
_monotone_f
iltration {
+ const
simplicial_c
omplex &c;
- cmp
MonotoneFiltration(const SimplicialC
omplex &c) :
+ cmp
_monotone_filtration(const simplicial_c
omplex &c) :
c(c){
}
c(c){
}