summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2017-02-28 12:12:39 +0000
committervrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2017-02-28 12:12:39 +0000
commit42451e635474bfbbf866927707d2acfb7e426928 (patch)
tree818fe133c0823b75017c1ce096c84fd905d64e91
parent5709f808d1a3cf0960cccd4c91a2ffde44a5867b (diff)
Fix CppCheck
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/relaxed-witness@2116 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 39094c55b9ccb3f09e344a6eff474c3373b13292
-rw-r--r--src/Witness_complex/example/example_nearest_landmark_table.cpp31
-rw-r--r--src/Witness_complex/include/gudhi/Active_witness/Active_witness.h6
-rw-r--r--src/Witness_complex/include/gudhi/Active_witness/Active_witness_iterator.h18
-rw-r--r--src/Witness_complex/include/gudhi/Witness_complex/all_faces_in.h6
4 files changed, 34 insertions, 27 deletions
diff --git a/src/Witness_complex/example/example_nearest_landmark_table.cpp b/src/Witness_complex/example/example_nearest_landmark_table.cpp
index becf74e7..b3883248 100644
--- a/src/Witness_complex/example/example_nearest_landmark_table.cpp
+++ b/src/Witness_complex/example/example_nearest_landmark_table.cpp
@@ -20,26 +20,33 @@
#include <list>
int main(int argc, char * const argv[]) {
- typedef std::vector<std::pair<std::size_t, double>> Nearest_landmark_range;
- typedef std::vector<Nearest_landmark_range> Nearest_landmark_table;
- typedef Gudhi::witness_complex::Witness_complex<Nearest_landmark_table> Witness_complex;
-
- Gudhi::Simplex_tree<> simplex_tree;
+ using Nearest_landmark_range = std::vector<std::pair<std::size_t, double>>;
+ using Nearest_landmark_table = std::vector<Nearest_landmark_range>;
+ using Witness_complex = Gudhi::witness_complex::Witness_complex<Nearest_landmark_table>;
+ using Simplex_tree = Gudhi::Simplex_tree<>;
+
+ Simplex_tree simplex_tree;
Nearest_landmark_table nlt;
// Example contains 5 witnesses and 5 landmarks
- Nearest_landmark_range w0 = {std::make_pair(0,0), std::make_pair(1,1), std::make_pair(2,2), std::make_pair(3,3), std::make_pair(4,4)}; nlt.push_back(w0);
- Nearest_landmark_range w1 = {std::make_pair(1,0), std::make_pair(2,1), std::make_pair(3,2), std::make_pair(4,3), std::make_pair(0,4)}; nlt.push_back(w1);
- Nearest_landmark_range w2 = {std::make_pair(2,0), std::make_pair(3,1), std::make_pair(4,2), std::make_pair(0,3), std::make_pair(1,4)}; nlt.push_back(w2);
- Nearest_landmark_range w3 = {std::make_pair(3,0), std::make_pair(4,1), std::make_pair(0,2), std::make_pair(1,3), std::make_pair(2,4)}; nlt.push_back(w3);
- Nearest_landmark_range w4 = {std::make_pair(4,0), std::make_pair(0,1), std::make_pair(1,2), std::make_pair(2,3), std::make_pair(3,4)}; nlt.push_back(w4);
+ Nearest_landmark_range w0 = {std::make_pair(0, 0), std::make_pair(1, 1), std::make_pair(2, 2),
+ std::make_pair(3, 3), std::make_pair(4, 4)}; nlt.push_back(w0);
+ Nearest_landmark_range w1 = {std::make_pair(1, 0), std::make_pair(2, 1), std::make_pair(3, 2),
+ std::make_pair(4, 3), std::make_pair(0, 4)}; nlt.push_back(w1);
+ Nearest_landmark_range w2 = {std::make_pair(2, 0), std::make_pair(3, 1), std::make_pair(4, 2),
+ std::make_pair(0, 3), std::make_pair(1, 4)}; nlt.push_back(w2);
+ Nearest_landmark_range w3 = {std::make_pair(3, 0), std::make_pair(4, 1), std::make_pair(0, 2),
+ std::make_pair(1, 3), std::make_pair(2, 4)}; nlt.push_back(w3);
+ Nearest_landmark_range w4 = {std::make_pair(4, 0), std::make_pair(0, 1), std::make_pair(1, 2),
+ std::make_pair(2, 3), std::make_pair(3, 4)}; nlt.push_back(w4);
Witness_complex witness_complex(nlt);
witness_complex.create_complex(simplex_tree, 4.1);
std::cout << "Number of simplices: " << simplex_tree.num_simplices() << std::endl;
-
- Gudhi::persistent_cohomology::Persistent_cohomology<Gudhi::Simplex_tree<>, Gudhi::persistent_cohomology::Field_Zp > pcoh(simplex_tree);
+
+ using Field_Zp = Gudhi::persistent_cohomology::Field_Zp;
+ Gudhi::persistent_cohomology::Persistent_cohomology<Simplex_tree, Field_Zp > pcoh(simplex_tree);
// initializes the coefficient field for homology
pcoh.init_coefficients(11);
diff --git a/src/Witness_complex/include/gudhi/Active_witness/Active_witness.h b/src/Witness_complex/include/gudhi/Active_witness/Active_witness.h
index c9f506d9..ffc1750f 100644
--- a/src/Witness_complex/include/gudhi/Active_witness/Active_witness.h
+++ b/src/Witness_complex/include/gudhi/Active_witness/Active_witness.h
@@ -20,8 +20,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef ACTIVE_WITNESS_H_
-#define ACTIVE_WITNESS_H_
+#ifndef ACTIVE_WITNESS_ACTIVE_WITNESS_H_
+#define ACTIVE_WITNESS_ACTIVE_WITNESS_H_
#include <gudhi/Active_witness/Active_witness_iterator.h>
#include <vector>
@@ -68,4 +68,4 @@ public:
}
}
-#endif
+#endif // ACTIVE_WITNESS_ACTIVE_WITNESS_H_
diff --git a/src/Witness_complex/include/gudhi/Active_witness/Active_witness_iterator.h b/src/Witness_complex/include/gudhi/Active_witness/Active_witness_iterator.h
index 7f48faa4..69a335fa 100644
--- a/src/Witness_complex/include/gudhi/Active_witness/Active_witness_iterator.h
+++ b/src/Witness_complex/include/gudhi/Active_witness/Active_witness_iterator.h
@@ -20,8 +20,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef ACTIVE_WITNESS_ITERATOR_H_
-#define ACTIVE_WITNESS_ITERATOR_H_
+#ifndef ACTIVE_WITNESS_ACTIVE_WITNESS_ITERATOR_H_
+#define ACTIVE_WITNESS_ACTIVE_WITNESS_ITERATOR_H_
#include <boost/iterator/iterator_facade.hpp>
#include <vector>
@@ -67,9 +67,9 @@ public:
{
is_end_ = false;
if (lh_ == aw_->nearest_landmark_table_.end()) {
- if (aw_->iterator_next_ == aw_->iterator_end_)
+ if (aw_->iterator_next_ == aw_->iterator_end_) {
is_end_ = true;
- else {
+ } else {
aw_->nearest_landmark_table_.push_back(*aw_->iterator_next_);
lh_ = --aw_->nearest_landmark_table_.end();
++(aw_->iterator_next_);
@@ -97,9 +97,9 @@ private :
lh_++;
if (lh_ == aw_->nearest_landmark_table_.end()) {
- if (aw_->iterator_next_ == aw_->iterator_end_)
+ if (aw_->iterator_next_ == aw_->iterator_end_) {
is_end_ = true;
- else {
+ } else {
aw_->nearest_landmark_table_.push_back(*aw_->iterator_next_);
lh_ = std::prev(aw_->nearest_landmark_table_.end());
++(aw_->iterator_next_);
@@ -108,7 +108,7 @@ private :
}
};
-}
-}
+} // namespace witness_complex
+} // namespace Gudhi
-#endif
+#endif // ACTIVE_WITNESS_ACTIVE_WITNESS_ITERATOR_H_
diff --git a/src/Witness_complex/include/gudhi/Witness_complex/all_faces_in.h b/src/Witness_complex/include/gudhi/Witness_complex/all_faces_in.h
index b69719a3..d009caca 100644
--- a/src/Witness_complex/include/gudhi/Witness_complex/all_faces_in.h
+++ b/src/Witness_complex/include/gudhi/Witness_complex/all_faces_in.h
@@ -1,5 +1,5 @@
-#ifndef ALL_FACES_IN_H_
-#define ALL_FACES_IN_H_
+#ifndef WITNESS_COMPLEX_ALL_FACES_IN_H_
+#define WITNESS_COMPLEX_ALL_FACES_IN_H_
/* \brief Check if the facets of the k-dimensional simplex witnessed
* by witness witness_id are already in the complex.
@@ -32,4 +32,4 @@ template < typename SimplicialComplexForWitness,
return true;
}
-#endif
+#endif // WITNESS_COMPLEX_ALL_FACES_IN_H_