untangle function object code for stxxl comperators

This commit is contained in:
Dennis Luxen 2014-08-29 12:07:00 +02:00
parent becb6cf5bf
commit d1454075ab
5 changed files with 24 additions and 16 deletions

View File

@ -52,3 +52,10 @@ ExternalMemoryNode ExternalMemoryNode::max_value()
false, false,
false); false);
} }
bool ExternalMemoryNodeSTXXLCompare::operator()(const ExternalMemoryNode &left, const ExternalMemoryNode &right) const
{
return left.node_id < right.node_id;
}
ExternalMemoryNodeSTXXLCompare::value_type ExternalMemoryNodeSTXXLCompare::max_value() { return ExternalMemoryNode::max_value(); }
ExternalMemoryNodeSTXXLCompare::value_type ExternalMemoryNodeSTXXLCompare::min_value() { return ExternalMemoryNode::min_value(); }

View File

@ -25,8 +25,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#ifndef IMPORTNODE_H_ #ifndef EXTERNAL_MEMORY_NODE_H__
#define IMPORTNODE_H_ #define EXTERNAL_MEMORY_NODE_H__
#include "QueryNode.h" #include "QueryNode.h"
@ -34,7 +34,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
struct ExternalMemoryNode : NodeInfo struct ExternalMemoryNode : NodeInfo
{ {
ExternalMemoryNode(int lat, int lon, unsigned int id, bool bollard, bool traffic_light); ExternalMemoryNode(int lat, int lon, NodeID id, bool bollard, bool traffic_light);
ExternalMemoryNode(); ExternalMemoryNode();
@ -46,4 +46,12 @@ struct ExternalMemoryNode : NodeInfo
bool trafficLight; bool trafficLight;
}; };
#endif /* IMPORTNODE_H_ */ struct ExternalMemoryNodeSTXXLCompare
{
using value_type = ExternalMemoryNode;
bool operator()(const ExternalMemoryNode &left, const ExternalMemoryNode &right) const;
value_type max_value();
value_type min_value();
};
#endif /* EXTERNAL_MEMORY_NODE_H__ */

View File

@ -82,7 +82,10 @@ void ExtractionContainers::PrepareData(const std::string &output_file_name,
std::cout << "[extractor] Sorting all nodes ... " << std::flush; std::cout << "[extractor] Sorting all nodes ... " << std::flush;
TIMER_START(sorting_nodes); TIMER_START(sorting_nodes);
stxxl::sort(all_nodes_list.begin(), all_nodes_list.end(), CmpNodeByID(), stxxl_memory); stxxl::sort(all_nodes_list.begin(),
all_nodes_list.end(),
ExternalMemoryNodeSTXXLCompare(),
stxxl_memory);
TIMER_STOP(sorting_nodes); TIMER_STOP(sorting_nodes);
std::cout << "ok, after " << TIMER_SEC(sorting_nodes) << "s" << std::endl; std::cout << "ok, after " << TIMER_SEC(sorting_nodes) << "s" << std::endl;

View File

@ -30,6 +30,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "InternalExtractorEdge.h" #include "InternalExtractorEdge.h"
#include "ExtractorStructs.h" #include "ExtractorStructs.h"
#include "../DataStructures/ExternalMemoryNode.h"
#include "../DataStructures/Restriction.h" #include "../DataStructures/Restriction.h"
#include "../Util/FingerPrint.h" #include "../Util/FingerPrint.h"

View File

@ -89,15 +89,4 @@ struct Cmp
value_type min_value() { return 0x0; } value_type min_value() { return 0x0; }
}; };
struct CmpNodeByID
{
using value_type = ExternalMemoryNode;
bool operator()(const ExternalMemoryNode &left, const ExternalMemoryNode &right) const
{
return left.node_id < right.node_id;
}
value_type max_value() { return ExternalMemoryNode::max_value(); }
value_type min_value() { return ExternalMemoryNode::min_value(); }
};
#endif /* EXTRACTORSTRUCTS_H_ */ #endif /* EXTRACTORSTRUCTS_H_ */