From 2dbba971939606ec3cc2bbd07978ff61e9566d01 Mon Sep 17 00:00:00 2001 From: Stefan Huber Date: Tue, 19 Nov 2013 09:47:17 +0100 Subject: [PATCH] Renaming Simplex to simplex --- include/libstick-0.1/simplicialcomplex.h | 34 ++++++++++++------------ tests/persistence.h | 12 ++++----- tests/simplicialcomplex.h | 4 +-- 3 files changed, 25 insertions(+), 25 deletions(-) diff --git a/include/libstick-0.1/simplicialcomplex.h b/include/libstick-0.1/simplicialcomplex.h index 988c090..1183a92 100644 --- a/include/libstick-0.1/simplicialcomplex.h +++ b/include/libstick-0.1/simplicialcomplex.h @@ -36,7 +36,7 @@ class simplicial_complex { typedef VT value_type; /** A simplex of the complex. */ - struct Simplex { + struct simplex { /** Dimension of the simplex. */ int dim; /** The indices of the faces of the simplex. */ @@ -47,10 +47,10 @@ class simplicial_complex { /** Create a new simplex with dimension 'dim', (dim+1)-faces and * its value. If simpley is 0-dimensional, its face is * automatically set to one (-1)-dimensional simplex. */ - static Simplex create(int dim, index_type* faces, value_type value) { + static simplex create(int dim, index_type* faces, value_type value) { assert(0 <= dim && dim <= MAXDIM); - Simplex s; + simplex s; s.dim = dim; s.value = value; @@ -63,8 +63,8 @@ class simplicial_complex { } /** Create a (-1)-dimensional simplex. It has the lowest possible value. */ - static Simplex create_minusonedim_simplex() { - Simplex s; + static simplex create_minusonedim_simplex() { + simplex s; s.dim = -1; s.faces[0] = 0; @@ -116,7 +116,7 @@ class simplicial_complex { } /** Get i-th simplex in the simplex order. */ - const Simplex& get_simplex(index_type i) const { + const simplex& get_simplex(index_type i) const { assert(i < size()); return c.simplices[order.at(i)]; } @@ -195,7 +195,7 @@ class simplicial_complex { public: simplicial_complex() { // Add the one minus-one dimensional simplex - add_simplex(Simplex::create_minusonedim_simplex()); + add_simplex(simplex::create_minusonedim_simplex()); } /** Return number of simplices. */ @@ -207,7 +207,7 @@ class simplicial_complex { * dim-1, and they must already be part of the complex. Returns the * index of the added simplex. */ index_type add_simplex(int dim, index_type* faces, value_type value) { - return add_simplex(Simplex::create(dim, faces, value)); + return add_simplex(simplex::create(dim, faces, value)); } /** Add a simplex to the complex of at least dimension 1. The dimension @@ -219,7 +219,7 @@ class simplicial_complex { // Get max value of its faces VT value = simplices[faces[0]].value; - for (size_t i=0; i < Simplex::face_count_bydim(dim); ++i) + for (size_t i=0; i < simplex::face_count_bydim(dim); ++i) value = std::max(value, simplices[faces[i]].value); return add_simplex(dim, faces, value); @@ -228,7 +228,7 @@ class simplicial_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. Returns the * index of the added simplex. */ - index_type add_simplex(Simplex s) { + index_type add_simplex(simplex s) { // Check requirements for faces for (unsigned i=0; i < s.face_count(); ++i) { // Faces are already in complex. @@ -246,7 +246,7 @@ class simplicial_complex { } /** Add an array of simplices */ - void add_simplices(Simplex* sarray, size_t count) { + void add_simplices(simplex* sarray, size_t count) { for (unsigned i=0; i < count; ++i) add_simplex(sarray[i]); } @@ -256,13 +256,13 @@ class simplicial_complex { bool is_complex() const { for (unsigned i=0; i < size(); ++i) { - const Simplex &s = simplices[i]; + const simplex &s = simplices[i]; for (unsigned f=0; f < s.face_count(); ++f) { if (s.faces[f] >= size()) return false; - const Simplex &face = simplices[s.faces[f]]; + const simplex &face = simplices[s.faces[f]]; if (face.dim != s.dim-1) return false; } @@ -276,7 +276,7 @@ class simplicial_complex { bool is_monotone() const { assert(is_complex()); - typename std::vector::const_iterator it = ++simplices.begin(); + typename std::vector::const_iterator it = ++simplices.begin(); for (; it != simplices.end(); ++it) for (unsigned f=0; f < it->face_count(); ++f) if (simplices[it->faces[f]].value > it->value) @@ -297,8 +297,8 @@ class simplicial_complex { } bool operator()(index_type i, index_type j) { - const Simplex& si = c.simplices[i]; - const Simplex& sj = c.simplices[j]; + const simplex& si = c.simplices[i]; + const simplex& sj = c.simplices[j]; if (si.value < sj.value) return true; @@ -311,7 +311,7 @@ class simplicial_complex { public: /** A list of simplices */ - std::vector simplices; + std::vector simplices; }; } diff --git a/tests/persistence.h b/tests/persistence.h index f48c386..1a6600c 100644 --- a/tests/persistence.h +++ b/tests/persistence.h @@ -60,7 +60,7 @@ class persistence_TestSuite: public Test::Suite { // \ / // 9 - scomplex::Simplex ssring[] = { + scomplex::simplex ssring[] = { // dimension, faces, value... /* 1 */ {0, {}, 1}, /* 2 */ {0, {}, 2}, @@ -87,11 +87,11 @@ class persistence_TestSuite: public Test::Suite { /* 23 */ {2, {12, 13, 22}, 6.1201}, /* 24 */ {2, {8, 16, 22}, 6.1202} }; - const size_t cntssring = sizeof(ssring)/sizeof(scomplex::Simplex); + const size_t cntssring = sizeof(ssring)/sizeof(scomplex::simplex); ring.add_simplices(ssring, cntssring); oring.reset(); - scomplex::Simplex sstorus[] = { + scomplex::simplex sstorus[] = { // dimension, faces, value... /* 25 */ {0, {}, 7}, /* 26 */ {0, {}, 8}, @@ -124,12 +124,12 @@ class persistence_TestSuite: public Test::Suite { /* 53 */ {2, {10, 46, 44}, 9.1505}, /* 54 */ {2, {43, 46, 28}, 9.1506}, }; - const size_t cntsstorus = sizeof(sstorus)/sizeof(scomplex::Simplex); + const size_t cntsstorus = sizeof(sstorus)/sizeof(scomplex::simplex); torus = ring; torus.add_simplices(sstorus, cntsstorus); otorus.reset(); - scomplex::Simplex ssball[] = { + scomplex::simplex ssball[] = { // dimension, faces, value... {0, {}, 1}, {0, {}, 2}, @@ -155,7 +155,7 @@ class persistence_TestSuite: public Test::Suite { {3, {21, 14, 15, 19}, 22}, {3, {21, 16, 17, 20}, 23}, }; - const size_t cntssball = sizeof(ssball)/sizeof(scomplex::Simplex); + const size_t cntssball = sizeof(ssball)/sizeof(scomplex::simplex); ball.add_simplices(ssball, cntssball); oball.reset(); } diff --git a/tests/simplicialcomplex.h b/tests/simplicialcomplex.h index 6e63f54..6cab051 100644 --- a/tests/simplicialcomplex.h +++ b/tests/simplicialcomplex.h @@ -40,7 +40,7 @@ class simplicial_complex_TestSuite: public Test::Suite { return; setupcalled = true; - scomplex::Simplex ss[] = { + scomplex::simplex ss[] = { // dimension, faces, value... {0, {}, 1}, {0, {}, 2}, @@ -54,7 +54,7 @@ class simplicial_complex_TestSuite: public Test::Suite { {2, {7, 8, 9}, 10}, {2, {5, 6, 9}, 11} }; - const size_t cntss = sizeof(ss)/sizeof(scomplex::Simplex); + const size_t cntss = sizeof(ss)/sizeof(scomplex::simplex); c1.add_simplices(ss, cntss); // This is o1 This is o2 This is o3(b) -- 2.39.5