summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaron Kent-Dobias <jaron@kent-dobias.com>2019-10-23 15:25:00 -0400
committerJaron Kent-Dobias <jaron@kent-dobias.com>2019-10-23 15:25:00 -0400
commitba4a31df421ff47de1f8c3dc86daea2cacd942ed (patch)
treee966ef50205068f7c42f676043a13bc41da6a1bc
parented8dff8dd7b8c27d06dea9de0e72767129b720de (diff)
downloadfuse_networks-ba4a31df421ff47de1f8c3dc86daea2cacd942ed.tar.gz
fuse_networks-ba4a31df421ff47de1f8c3dc86daea2cacd942ed.tar.bz2
fuse_networks-ba4a31df421ff47de1f8c3dc86daea2cacd942ed.zip
added new contains uses
-rw-r--r--CMakeLists.txt6
-rw-r--r--lib/src/network.cpp24
2 files changed, 11 insertions, 19 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f7477fa..0060968 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -3,10 +3,10 @@ cmake_minimum_required(VERSION 3.8)
project(fracture)
-set(CMAKE_CXX_FLAGS_DEBUG "-g -Wall -std=c++2a")
-set(CMAKE_CXX_FLAGS_RELEASE "-O3 -flto -Wall -march=native -std=c++2a")
+set(CMAKE_CXX_FLAGS_DEBUG "-g -Wall -std=c++2a -stdlib=libc++")
+set(CMAKE_CXX_FLAGS_RELEASE "-O3 -flto -Wall -march=native -std=c++2a -stdlib=libc++")
-set (CMAKE_CXX_STANDARD 17)
+set (CMAKE_CXX_STANDARD 20)
set (CMAKE_C_STANDARD 11)
include(GNUInstallDirs)
diff --git a/lib/src/network.cpp b/lib/src/network.cpp
index 98c6eb0..05fc0dd 100644
--- a/lib/src/network.cpp
+++ b/lib/src/network.cpp
@@ -82,8 +82,7 @@ void network::get_cycle_edges_helper(std::set<unsigned>& cycle_edges,
unsigned vn = e[0] == v_cur ? e[1] : e[0];
if (vn != v_prev) {
- auto it = seen_vertices.find(vn);
- if (it != seen_vertices.end()) {
+ if (seen_vertices.contains(vn)) {
cycle_edges.insert(ei);
} else {
this->get_cycle_edges_helper(cycle_edges, seen_vertices, v_cur, vn);
@@ -106,8 +105,7 @@ bool network::find_cycle_helper(std::array<unsigned, 2>& sig, const std::set<uns
unsigned vPrev, unsigned vCur, unsigned vEnd) const {
for (unsigned ei : G.dual_vertices[vCur].ne) {
if (fuses[ei]) {
- auto it = cycle_edges.find(ei);
- if (it == cycle_edges.end()) {
+ if (!cycle_edges.contains(ei)) {
const std::array<unsigned, 2>& e = G.dual_edges[ei].v;
unsigned vn = e[0] == vCur ? e[1] : e[0];
if (vn != vPrev) {
@@ -145,8 +143,7 @@ bool network::get_cycle_helper(std::array<unsigned, 2>& sig, std::set<unsigned>&
unsigned vPrev, unsigned vCur, unsigned vEnd) const {
for (unsigned ei : G.dual_vertices[vCur].ne) {
if (fuses[ei]) {
- auto it = cycle_edges.find(ei);
- if (it == cycle_edges.end()) {
+ if (!cycle_edges.contains(ei)) {
const std::array<unsigned, 2>& e = G.dual_edges[ei].v;
unsigned vn = e[0] == vCur ? e[1] : e[0];
if (vn != vPrev) {
@@ -186,8 +183,7 @@ std::pair<std::array<unsigned, 2>, std::set<unsigned>> network::get_cycle(const
void network::get_cluster_edges_helper(std::set<unsigned>& seen_edges, unsigned v) const {
for (unsigned ei : G.vertices[v].ne) {
if (!backbone[ei]) {
- auto it = seen_edges.find(ei);
- if (it == seen_edges.end()) {
+ if (!seen_edges.contains(ei)) {
const std::array<unsigned, 2>& e = G.edges[ei].v;
unsigned vn = e[0] == v ? e[1] : e[0];
@@ -208,8 +204,7 @@ void network::get_tie_flaps_helper(std::set<unsigned>& added_edges, unsigned v0,
unsigned vCur) const {
for (unsigned ei : G.vertices[vCur].ne) {
if (!backbone[ei]) {
- auto it = added_edges.find(ei);
- if (it == added_edges.end()) {
+ if (!added_edges.contains(ei)) {
const std::array<unsigned, 2>& e = G.edges[ei].v;
unsigned vn = e[0] == vCur ? e[1] : e[0];
@@ -229,8 +224,7 @@ std::list<std::set<unsigned>> network::get_tie_flaps(unsigned v0) const {
if (!backbone[ei]) {
bool seen_edge = false;
for (const std::set<unsigned>& flap : tie_flaps) {
- auto it = flap.find(ei);
- if (it != flap.end()) {
+ if (flap.contains(ei)) {
seen_edge = true;
break;
}
@@ -257,8 +251,7 @@ void network::update_backbone(const std::vector<double>& c) {
// First, we will check for lollipops!
for (unsigned i = 0; i < G.edges.size(); i++) {
if ((!backbone[i]) && C.same_component(G.dual_edges[i].v[0], G.dual_edges[i].v[1])) {
- auto it_search = seen_pairs.find({G.dual_edges[i].v[0], G.dual_edges[i].v[1]});
- if (it_search == seen_pairs.end()) {
+ if (!seen_pairs.contains({G.dual_edges[i].v[0], G.dual_edges[i].v[1]})) {
// This is a candidate lollipop stem. First, we will identify any
// cycles in the dual cluster that impinges on the stem and mark them
// by an edge that uniquely severs each.
@@ -377,8 +370,7 @@ void network::update_backbone(const std::vector<double>& c) {
if (C.same_component(G.vertices[v].nd[i], G.vertices[v].nd[l])) {
unsigned il = i < l ? i : l;
unsigned ig = i < l ? l : i;
- auto it_search = seen_pairs.find({G.vertices[v].nd[il], G.vertices[v].nd[ig]});
- if (it_search == seen_pairs.end()) {
+ if (!seen_pairs.contains({G.vertices[v].nd[il], G.vertices[v].nd[ig]})) {
bool any_intervening1 = false;
bool any_intervening2 = false;
unsigned ie1 = 0;