From f511af0f0ccb626a2f7b93b4ee0780ac09c10a59 Mon Sep 17 00:00:00 2001 From: Emil Tin Date: Sat, 26 Nov 2011 16:42:15 +0100 Subject: [PATCH] fix compilation on mac; openmp issues and an unneeded typename --- .gitignore | 2 +- Contractor/ContractionCleanup.h | 4 ---- Contractor/Contractor.h | 6 ++---- Contractor/EdgeBasedGraphFactory.cpp | 3 ++- DataStructures/Percent.h | 4 +--- Server/ServerFactory.h | 4 ---- Util/OpenMPReplacement.h | 17 +++++++++++++---- createHierarchy.cpp | 6 +----- extractor.cpp | 6 ------ routed.cpp | 7 +------ 10 files changed, 21 insertions(+), 38 deletions(-) diff --git a/.gitignore b/.gitignore index 2da9a1093..6ce0714bd 100644 --- a/.gitignore +++ b/.gitignore @@ -28,7 +28,7 @@ # OS generated files # ###################### -.DS_Store? +.DS_Store ehthumbs.db Icon? Thumbs.db diff --git a/Contractor/ContractionCleanup.h b/Contractor/ContractionCleanup.h index 5a7b0a9ee..2486a8e40 100644 --- a/Contractor/ContractionCleanup.h +++ b/Contractor/ContractionCleanup.h @@ -31,10 +31,6 @@ or see http://www.gnu.org/licenses/agpl.txt. #endif #include "Contractor.h" -#ifdef _OPENMP -#include -#endif - class ContractionCleanup { private: diff --git a/Contractor/Contractor.h b/Contractor/Contractor.h index a774d3e57..9daa36865 100644 --- a/Contractor/Contractor.h +++ b/Contractor/Contractor.h @@ -30,15 +30,13 @@ or see http://www.gnu.org/licenses/agpl.txt. #include "../DataStructures/DynamicGraph.h" #include "../DataStructures/Percent.h" #include "../DataStructures/BinaryHeap.h" +#include "../Util/OpenMPReplacement.h" #include #include #include #include #include #include -#ifdef _OPEMP -#include -#endif class Contractor { @@ -190,7 +188,7 @@ public: } ~Contractor() { } - + void Run() { const NodeID numberOfNodes = _graph->GetNumberOfNodes(); Percent p (numberOfNodes); diff --git a/Contractor/EdgeBasedGraphFactory.cpp b/Contractor/EdgeBasedGraphFactory.cpp index bb9b06554..e7499c722 100644 --- a/Contractor/EdgeBasedGraphFactory.cpp +++ b/Contractor/EdgeBasedGraphFactory.cpp @@ -25,6 +25,7 @@ #endif #include +#include "../Util/OpenMPReplacement.h" #include "EdgeBasedGraphFactory.h" template<> @@ -39,7 +40,7 @@ EdgeBasedGraphFactory::EdgeBasedGraphFactory(int nodes, std::vector edges; edges.reserve( 2 * inputEdges.size() ); - for ( typename std::vector< NodeBasedEdge >::const_iterator i = inputEdges.begin(), e = inputEdges.end(); i != e; ++i ) { + for ( std::vector< NodeBasedEdge >::const_iterator i = inputEdges.begin(), e = inputEdges.end(); i != e; ++i ) { _NodeBasedEdge edge; edge.source = i->source(); edge.target = i->target(); diff --git a/DataStructures/Percent.h b/DataStructures/Percent.h index fee385434..06735b20a 100644 --- a/DataStructures/Percent.h +++ b/DataStructures/Percent.h @@ -22,9 +22,7 @@ or see http://www.gnu.org/licenses/agpl.txt. #define PERCENT_H #include -#ifdef _OPENMP -#include -#endif + class Percent { diff --git a/Server/ServerFactory.h b/Server/ServerFactory.h index d548c89a6..aa1e53e88 100644 --- a/Server/ServerFactory.h +++ b/Server/ServerFactory.h @@ -27,10 +27,6 @@ or see http://www.gnu.org/licenses/agpl.txt. #include -#ifdef _OPENMP -#include -#endif - #include "Server.h" #include "ServerConfiguration.h" diff --git a/Util/OpenMPReplacement.h b/Util/OpenMPReplacement.h index c92324676..5f99cc28b 100644 --- a/Util/OpenMPReplacement.h +++ b/Util/OpenMPReplacement.h @@ -19,7 +19,16 @@ or see http://www.gnu.org/licenses/agpl.txt. */ -const int omp_get_num_procs() { return 1; } -const int omp_get_max_threads() { return 1; } -const int omp_get_thread_num() { return 0; } -const int omp_set_num_threads(int i) {} +#ifndef _OPENMPREPLACEMENTY_H +#define _OPENMPREPLACEMENTY_H + +#ifdef _OPENMP +#include +#else +inline const int omp_get_num_procs() { return 1; } +inline const int omp_get_max_threads() { return 1; } +inline const int omp_get_thread_num() { return 0; } +inline const int omp_set_num_threads(int i) {} +#endif + +#endif diff --git a/createHierarchy.cpp b/createHierarchy.cpp index c33bc0ca4..f2a1be972 100644 --- a/createHierarchy.cpp +++ b/createHierarchy.cpp @@ -36,12 +36,7 @@ or see http://www.gnu.org/licenses/agpl.txt. #include #include -#ifdef _OPENMP -#include -#else #include "Util/OpenMPReplacement.h" -#endif - #include "typedefs.h" #include "Contractor/Contractor.h" #include "Contractor/ContractionCleanup.h" @@ -52,6 +47,7 @@ or see http://www.gnu.org/licenses/agpl.txt. #include "Util/BaseConfiguration.h" #include "Util/InputFileUtil.h" #include "Util/GraphLoader.h" +#include "Util/OpenMPReplacement.h" using namespace std; diff --git a/extractor.cpp b/extractor.cpp index 995655bda..d919ba897 100644 --- a/extractor.cpp +++ b/extractor.cpp @@ -43,12 +43,6 @@ or see http://www.gnu.org/licenses/agpl.txt. #include #include -#ifdef _OPENMP -#include -#else -#include "Util/OpenMPReplacement.h" -#endif - #include "typedefs.h" #include "DataStructures/InputReaderFactory.h" #include "DataStructures/ExtractorCallBacks.h" diff --git a/routed.cpp b/routed.cpp index 7b299a362..ec8a5bc04 100644 --- a/routed.cpp +++ b/routed.cpp @@ -24,12 +24,6 @@ or see http://www.gnu.org/licenses/agpl.txt. #include #include -#ifdef _OPENMP -#include -#else -#include "Util/OpenMPReplacement.h" -#endif - #include "Server/ServerConfiguration.h" #include "Server/ServerFactory.h" @@ -39,6 +33,7 @@ or see http://www.gnu.org/licenses/agpl.txt. #include "Plugins/ObjectForPluginStruct.h" #include "Plugins/ViaRoutePlugin.h" #include "Util/InputFileUtil.h" +#include "Util/OpenMPReplacement.h" #ifndef _WIN32 #include "Util/LinuxStackTrace.h"