Skip to content

Commit

Permalink
Require C++11 (#155)
Browse files Browse the repository at this point in the history
  • Loading branch information
smmaurer authored Jan 4, 2021
1 parent de0b047 commit 87ef861
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 36 deletions.
2 changes: 1 addition & 1 deletion pandana/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from .network import Network

version = __version__ = '0.6'
version = __version__ = '0.6.1.dev0'
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def run(self):

if sys.platform.startswith('darwin'): # Mac

extra_compile_args += ['-D NO_TR1_MEMORY', '-stdlib=libc++']
extra_compile_args += ['-stdlib=libc++']
extra_link_args += ['-stdlib=libc++']

# The default compiler that ships with Macs doesn't support OpenMP multi-
Expand Down Expand Up @@ -126,7 +126,7 @@ def run(self):
## Standard setup
###############################################

version = '0.6'
version = '0.6.1.dev0'

packages = find_packages(exclude=["*.tests", "*.tests.*", "tests.*", "tests"])

Expand Down
30 changes: 9 additions & 21 deletions src/accessibility.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "accessibility.h"
#include <algorithm>
#include <cmath>
#include <functional>
#include <utility>
#include "graphalg.h"

Expand All @@ -18,22 +19,6 @@ bool distance_node_pair_comparator(const distance_node_pair& l,
{ return l.first < r.first; }


double exp_decay(const double &distance, const float &radius, const float &var)
{
return exp(-1*distance/radius) * var;
}

double linear_decay(const double &distance, const float &radius, const float &var)
{
return (1.0-distance/radius) * var;
}

double flat_decay(const double &distance, const float &radius, const float &var)
{
return var;
}


Accessibility::Accessibility(
int numnodes,
vector< vector<long>> edges,
Expand Down Expand Up @@ -401,14 +386,17 @@ Accessibility::aggregateAccessibilityVariable(
double sum = 0.0;
double sumsq = 0.0;

double (*sum_function_ptr)(const double &, const float &, const float &);
std::function<double(const double &, const float &, const float &)> sum_function;

if(decay == "exp")
sum_function_ptr = &exp_decay;
sum_function = [](const double &distance, const float &radius, const float &var)
{ return exp(-1*distance/radius) * var; };
if(decay == "linear")
sum_function_ptr = &linear_decay;
sum_function = [](const double &distance, const float &radius, const float &var)
{ return (1.0-distance/radius) * var; };
if(decay == "flat")
sum_function_ptr = &flat_decay;
sum_function = [](const double &distance, const float &radius, const float &var)
{ return var; };

for (int i = 0 ; i < distances.size() ; i++) {
int nodeid = distances[i].first;
Expand All @@ -419,7 +407,7 @@ Accessibility::aggregateAccessibilityVariable(

for (int j = 0 ; j < vars[nodeid].size() ; j++) {
cnt++; // count items
sum += (*sum_function_ptr)(distance, radius, vars[nodeid][j]);
sum += sum_function(distance, radius, vars[nodeid][j]);

// stddev is always flat
sumsq += vars[nodeid][j] * vars[nodeid][j];
Expand Down
13 changes: 1 addition & 12 deletions src/contraction_hierarchies/src/POIIndex/POIIndex.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,7 @@

#include <vector>

#if defined _WIN32 || defined NO_TR1_MEMORY
#include <memory>
#else
// can we get rid of this tr1 stuff and use c++11 now?
#include <tr1/memory>
#endif

#ifdef NO_TR1_MEMORY
using std::shared_ptr;
#else
#define shared_ptr tr1::shared_ptr
#endif
using std::shared_ptr;

#include "../BasicDefinitions.h"
#include "../DataStructures/BinaryHeap.h"
Expand Down

0 comments on commit 87ef861

Please sign in to comment.