From dfb161cb17a546329921ce27e1d9c4fa93e2a506 Mon Sep 17 00:00:00 2001 From: Arnur Nigmetov Date: Tue, 18 Feb 2020 18:48:26 +0100 Subject: Rename enum. --- matching/include/bifiltration.h | 6 +++--- matching/include/matching_distance.h | 4 +--- matching/include/simplex.h | 4 ++-- matching/src/bifiltration.cpp | 12 ++++++------ matching/src/main.cpp | 4 ++-- matching/src/simplex.cpp | 10 +++++----- matching/src/test_generator.cpp | 2 +- matching/src/tests/test_bifiltration.cpp | 2 +- matching/src/tests/test_common.cpp | 2 -- matching/src/tests/test_matching_distance.cpp | 4 ++-- 10 files changed, 23 insertions(+), 27 deletions(-) diff --git a/matching/include/bifiltration.h b/matching/include/bifiltration.h index 2b4950f..bdb7a4e 100644 --- a/matching/include/bifiltration.h +++ b/matching/include/bifiltration.h @@ -85,12 +85,12 @@ namespace md { void rivet_format_reader(std::ifstream&); - void rene_format_reader(std::ifstream&); + void phat_like_format_reader(std::ifstream&); // in Rene format each simplex knows IDs of its boundary facets - // postprocess_rene_format fills vector of IDs of boundary facets + // postprocess_phat_like_format fills vector of IDs of boundary facets // in each simplex - void postprocess_rene_format(); + void postprocess_phat_like_format(); // in Rivet format each simplex knows its vertices, // postprocess_rivet_format fills vector of IDs of boundary facets diff --git a/matching/include/matching_distance.h b/matching/include/matching_distance.h index 72743a4..bb1dfea 100644 --- a/matching/include/matching_distance.h +++ b/matching/include/matching_distance.h @@ -77,13 +77,11 @@ namespace md { #endif }; + template class DistanceCalculator { -// using DiagramProvider = md::Bifiltration; -// using DiagramProvider = md::ModulePresentation; using DualBox = md::DualBox; - using CellValueVector = std::vector; public: diff --git a/matching/include/simplex.h b/matching/include/simplex.h index e0a654b..e9d0e30 100644 --- a/matching/include/simplex.h +++ b/matching/include/simplex.h @@ -12,7 +12,7 @@ namespace md { class Bifiltration; enum class BifiltrationFormat { - rene, rivet + phat_like, rivet }; class AbstractSimplex { @@ -85,7 +85,7 @@ namespace md { void init_rivet(std::string s); - void init_rene(std::string s); + void init_phat_like(std::string s); Index id() const { return id_; } diff --git a/matching/src/bifiltration.cpp b/matching/src/bifiltration.cpp index b0d4248..676b0cc 100644 --- a/matching/src/bifiltration.cpp +++ b/matching/src/bifiltration.cpp @@ -42,8 +42,8 @@ namespace md { case BifiltrationFormat::rivet : rivet_format_reader(ifstr); break; - case BifiltrationFormat::rene : - rene_format_reader(ifstr); + case BifiltrationFormat::phat_like : + phat_like_format_reader(ifstr); break; } init(); @@ -64,9 +64,9 @@ namespace md { } } - void Bifiltration::rene_format_reader(std::ifstream& ifstr) + void Bifiltration::phat_like_format_reader(std::ifstream& ifstr) { - spd::debug("Enter rene_format_reader"); + spd::debug("Enter phat_like_format_reader"); // read stream line by line; do not use >> operator std::string s; std::getline(ifstr, s); @@ -74,7 +74,7 @@ namespace md { for(Index index = 0; index < n_simplices; index++) { std::getline(ifstr, s); - simplices_.emplace_back(index, s, BifiltrationFormat::rene); + simplices_.emplace_back(index, s, BifiltrationFormat::phat_like); } spd::debug("Read {} simplices from file", n_simplices); } @@ -245,7 +245,7 @@ namespace md { case BifiltrationFormat::rivet: throw std::runtime_error("Not implemented"); break; - case BifiltrationFormat::rene: { + case BifiltrationFormat::phat_like: { std::ofstream f(filename); if (not f.good()) { std::cerr << "Bifiltration::save: cannot open file " << filename << std::endl; diff --git a/matching/src/main.cpp b/matching/src/main.cpp index 34c4240..7e74475 100644 --- a/matching/src/main.cpp +++ b/matching/src/main.cpp @@ -176,8 +176,8 @@ int main(int argc, char** argv) auto bounds_list = split_by_delim(bounds_list_str, ','); auto traverse_list = split_by_delim(traverse_list_str, ','); - Bifiltration bif_a(fname_a, BifiltrationFormat::rene); - Bifiltration bif_b(fname_b, BifiltrationFormat::rene); + Bifiltration bif_a(fname_a, BifiltrationFormat::phat_like); + Bifiltration bif_b(fname_b, BifiltrationFormat::phat_like); bif_a.sanity_check(); bif_b.sanity_check(); diff --git a/matching/src/simplex.cpp b/matching/src/simplex.cpp index 661dcb1..b490db0 100644 --- a/matching/src/simplex.cpp +++ b/matching/src/simplex.cpp @@ -76,16 +76,16 @@ namespace md { dim++; vertices_.push_back(vertex); } - // + // std::sort(vertices_.begin(), vertices_.end()); assert(dim > 0); - + std::stringstream pos_ss(pos_str); // TODO: get rid of 1-criticaltiy assumption pos_ss >> pos_.x >> pos_.y; } - void Simplex::init_rene(std::string s) + void Simplex::init_phat_like(std::string s) { facet_indices_.clear(); std::stringstream ss(s); @@ -104,8 +104,8 @@ namespace md { :id_(_id) { switch (input_format) { - case BifiltrationFormat::rene : - init_rene(s); + case BifiltrationFormat::phat_like : + init_phat_like(s); break; case BifiltrationFormat::rivet : init_rivet(s); diff --git a/matching/src/test_generator.cpp b/matching/src/test_generator.cpp index a0d8fc7..e8f128f 100644 --- a/matching/src/test_generator.cpp +++ b/matching/src/test_generator.cpp @@ -201,7 +201,7 @@ int main(int argc, char** argv) auto bif1 = get_random_bifiltration(n_vertices, max_dim, n_top_simplices); std::cout << "Generated bifiltration." << std::endl; - bif1.save(fname, md::BifiltrationFormat::rene); + bif1.save(fname, md::BifiltrationFormat::phat_like); std::cout << "Saved to file " << fname << std::endl; return 0; } diff --git a/matching/src/tests/test_bifiltration.cpp b/matching/src/tests/test_bifiltration.cpp index caa50ac..742dab8 100644 --- a/matching/src/tests/test_bifiltration.cpp +++ b/matching/src/tests/test_bifiltration.cpp @@ -11,7 +11,7 @@ using namespace md; //TEST_CASE("Small check", "[bifiltration][dim2]") //{ -// Bifiltration bif("/home/narn/code/matching_distance/code/src/tests/test_bifiltration_full_triangle_rene.txt", BifiltrationFormat::rene); +// Bifiltration bif("/home/narn/code/matching_distance/code/src/tests/test_bifiltration_full_triangle_phat_like.txt", BifiltrationFormat::phat_like); // auto simplices = bif.simplices(); // bif.sanity_check(); // diff --git a/matching/src/tests/test_common.cpp b/matching/src/tests/test_common.cpp index 30465e4..c55577e 100644 --- a/matching/src/tests/test_common.cpp +++ b/matching/src/tests/test_common.cpp @@ -167,8 +167,6 @@ TEST_CASE("Flat Line with positive slope", "[flat_line]") Point p_4(6, 4.5); Point p_5(2, 2); - std::cout << "AHOY " << l_flat.y_from_x(p_2.x) << std::endl; - REQUIRE((not l_flat.contains(p_1) and not l_flat.contains(p_2) and not l_flat.contains(p_3) and diff --git a/matching/src/tests/test_matching_distance.cpp b/matching/src/tests/test_matching_distance.cpp index caf32cd..90baa0f 100644 --- a/matching/src/tests/test_matching_distance.cpp +++ b/matching/src/tests/test_matching_distance.cpp @@ -115,8 +115,8 @@ TEST_CASE("Bifiltrations from file", "[matching_distance][small_example][lesnick fname_a = "/home/narn/code/matching_distance/code/python_scripts/prism_1_lesnick.bif"; fname_b = "/home/narn/code/matching_distance/code/python_scripts/prism_2_lesnick.bif"; - Bifiltration bif_a(fname_a, BifiltrationFormat::rene); - Bifiltration bif_b(fname_b, BifiltrationFormat::rene); + Bifiltration bif_a(fname_a, BifiltrationFormat::phat_like); + Bifiltration bif_b(fname_b, BifiltrationFormat::phat_like); CalculationParams params; -- cgit v1.2.3