[Lemon-commits] Alpar Juttner: Merge bugfixes #480, #481, #482 a...
Lemon HG
hg at lemon.cs.elte.hu
Mon Jul 7 12:00:10 CEST 2014
details: http://lemon.cs.elte.hu/hg/lemon/rev/d9e802637310
changeset: 1316:d9e802637310
user: Alpar Juttner <alpar [at] cs.elte.hu>
date: Mon Jul 07 11:57:45 2014 +0200
description:
Merge bugfixes #480, #481, #482 and #487 to branch 1.3
diffstat:
CMakeLists.txt | 6 ++++--
lemon/CMakeLists.txt | 7 ++++++-
lemon/dim2.h | 1 +
lemon/math.h | 2 +-
test/arc_look_up_test.cc | 1 -
tools/lgf-gen.cc | 41 +++++++++++++++++++++++++++--------------
6 files changed, 39 insertions(+), 19 deletions(-)
diffs (177 lines):
diff --git a/CMakeLists.txt b/CMakeLists.txt
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,5 +1,7 @@
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
+CMAKE_POLICY(SET CMP0048 OLD)
+
SET(PROJECT_NAME "LEMON")
PROJECT(${PROJECT_NAME})
@@ -186,11 +188,11 @@
"Flags used by the C compiler during maintainer builds."
)
SET( CMAKE_EXE_LINKER_FLAGS_MAINTAINER
- "-Wl,--warn-unresolved-symbols,--warn-once" CACHE STRING
+ "${CMAKE_EXE_LINKER_FLAGS_DEBUG}" CACHE STRING
"Flags used for linking binaries during maintainer builds."
)
SET( CMAKE_SHARED_LINKER_FLAGS_MAINTAINER
- "-Wl,--warn-unresolved-symbols,--warn-once" CACHE STRING
+ "${CMAKE_SHARED_LINKER_FLAGS_DEBUG}" CACHE STRING
"Flags used by the shared libraries linker during maintainer builds."
)
ENDIF()
diff --git a/lemon/CMakeLists.txt b/lemon/CMakeLists.txt
--- a/lemon/CMakeLists.txt
+++ b/lemon/CMakeLists.txt
@@ -55,8 +55,13 @@
ENDIF()
ADD_LIBRARY(lemon ${LEMON_SOURCES})
+
+TARGET_LINK_LIBRARIES(lemon
+ ${GLPK_LIBRARIES} ${COIN_LIBRARIES} ${ILOG_LIBRARIES} ${SOPLEX_LIBRARIES}
+ )
+
IF(UNIX)
- SET_TARGET_PROPERTIES(lemon PROPERTIES OUTPUT_NAME emon)
+ SET_TARGET_PROPERTIES(lemon PROPERTIES OUTPUT_NAME emon VERSION ${LEMON_VERSION} SOVERSION ${LEMON_VERSION})
ENDIF()
INSTALL(
diff --git a/lemon/dim2.h b/lemon/dim2.h
--- a/lemon/dim2.h
+++ b/lemon/dim2.h
@@ -20,6 +20,7 @@
#define LEMON_DIM2_H
#include <iostream>
+#include <algorithm>
///\ingroup geomdat
///\file
diff --git a/lemon/math.h b/lemon/math.h
--- a/lemon/math.h
+++ b/lemon/math.h
@@ -67,7 +67,7 @@
///Round a value to its closest integer
inline double round(double r) {
- return (r > 0.0) ? floor(r + 0.5) : ceil(r - 0.5);
+ return (r > 0.0) ? std::floor(r + 0.5) : std::ceil(r - 0.5);
}
/// @}
diff --git a/test/arc_look_up_test.cc b/test/arc_look_up_test.cc
--- a/test/arc_look_up_test.cc
+++ b/test/arc_look_up_test.cc
@@ -24,7 +24,6 @@
using namespace lemon;
-const int lgfn = 4;
const std::string lgf =
"@nodes\n"
"label\n"
diff --git a/tools/lgf-gen.cc b/tools/lgf-gen.cc
--- a/tools/lgf-gen.cc
+++ b/tools/lgf-gen.cc
@@ -246,7 +246,7 @@
struct BeachIt;
- typedef std::multimap<double, BeachIt> SpikeHeap;
+ typedef std::multimap<double, BeachIt*> SpikeHeap;
typedef std::multimap<Part, SpikeHeap::iterator, YLess> Beach;
@@ -329,6 +329,7 @@
Beach::iterator bit = beach.upper_bound(Part(site, site, site));
if (bit->second != spikeheap.end()) {
+ delete bit->second->second;
spikeheap.erase(bit->second);
}
@@ -342,8 +343,8 @@
if (prev != -1 &&
circle_form(points[prev], points[curr], points[site])) {
double x = circle_point(points[prev], points[curr], points[site]);
- pit = spikeheap.insert(std::make_pair(x, BeachIt(beach.end())));
- pit->second.it =
+ pit = spikeheap.insert(std::make_pair(x, new BeachIt(beach.end())));
+ pit->second->it =
beach.insert(std::make_pair(Part(prev, curr, site), pit));
} else {
beach.insert(std::make_pair(Part(prev, curr, site), pit));
@@ -355,8 +356,8 @@
if (next != -1 &&
circle_form(points[site], points[curr],points[next])) {
double x = circle_point(points[site], points[curr], points[next]);
- nit = spikeheap.insert(std::make_pair(x, BeachIt(beach.end())));
- nit->second.it =
+ nit = spikeheap.insert(std::make_pair(x, new BeachIt(beach.end())));
+ nit->second->it =
beach.insert(std::make_pair(Part(site, curr, next), nit));
} else {
beach.insert(std::make_pair(Part(site, curr, next), nit));
@@ -366,7 +367,7 @@
} else {
sweep = spit->first;
- Beach::iterator bit = spit->second.it;
+ Beach::iterator bit = spit->second->it;
int prev = bit->first.prev;
int curr = bit->first.curr;
@@ -399,10 +400,22 @@
Beach::iterator nbit = bit; ++nbit;
int nnt = nbit->first.next;
- if (bit->second != spikeheap.end()) spikeheap.erase(bit->second);
- if (pbit->second != spikeheap.end()) spikeheap.erase(pbit->second);
- if (nbit->second != spikeheap.end()) spikeheap.erase(nbit->second);
-
+ if (bit->second != spikeheap.end())
+ {
+ delete bit->second->second;
+ spikeheap.erase(bit->second);
+ }
+ if (pbit->second != spikeheap.end())
+ {
+ delete pbit->second->second;
+ spikeheap.erase(pbit->second);
+ }
+ if (nbit->second != spikeheap.end())
+ {
+ delete nbit->second->second;
+ spikeheap.erase(nbit->second);
+ }
+
beach.erase(nbit);
beach.erase(bit);
beach.erase(pbit);
@@ -412,8 +425,8 @@
circle_form(points[ppv], points[prev], points[next])) {
double x = circle_point(points[ppv], points[prev], points[next]);
if (x < sweep) x = sweep;
- pit = spikeheap.insert(std::make_pair(x, BeachIt(beach.end())));
- pit->second.it =
+ pit = spikeheap.insert(std::make_pair(x, new BeachIt(beach.end())));
+ pit->second->it =
beach.insert(std::make_pair(Part(ppv, prev, next), pit));
} else {
beach.insert(std::make_pair(Part(ppv, prev, next), pit));
@@ -424,8 +437,8 @@
circle_form(points[prev], points[next], points[nnt])) {
double x = circle_point(points[prev], points[next], points[nnt]);
if (x < sweep) x = sweep;
- nit = spikeheap.insert(std::make_pair(x, BeachIt(beach.end())));
- nit->second.it =
+ nit = spikeheap.insert(std::make_pair(x, new BeachIt(beach.end())));
+ nit->second->it =
beach.insert(std::make_pair(Part(prev, next, nnt), nit));
} else {
beach.insert(std::make_pair(Part(prev, next, nnt), nit));
More information about the Lemon-commits
mailing list