Stxxl  1.4.0
include/stxxl/bits/algo/sort_base.h
Go to the documentation of this file.
00001 /***************************************************************************
00002  *  include/stxxl/bits/algo/sort_base.h
00003  *
00004  *  Part of the STXXL. See http://stxxl.sourceforge.net
00005  *
00006  *  Copyright (C) 2009 Andreas Beckmann <beckmann@cs.uni-frankfurt.de>
00007  *
00008  *  Distributed under the Boost Software License, Version 1.0.
00009  *  (See accompanying file LICENSE_1_0.txt or copy at
00010  *  http://www.boost.org/LICENSE_1_0.txt)
00011  **************************************************************************/
00012 
00013 #ifndef STXXL_SORT_BASE_HEADER
00014 #define STXXL_SORT_BASE_HEADER
00015 
00016 #include <cmath>
00017 #include <stxxl/bits/common/types.h>
00018 
00019 
00020 #ifndef STXXL_NO_WARN_RECURSIVE_SORT
00021 #define STXXL_WARNMSG_RECURSIVE_SORT STXXL_ERRMSG
00022 #else
00023 #define STXXL_WARNMSG_RECURSIVE_SORT STXXL_VERBOSE
00024 #endif
00025 
00026 #ifndef STXXL_SORT_OPTIMAL_PREFETCHING
00027 #define STXXL_SORT_OPTIMAL_PREFETCHING 1
00028 #endif
00029 
00030 #ifndef STXXL_CHECK_ORDER_IN_SORTS
00031 #define STXXL_CHECK_ORDER_IN_SORTS 0
00032 #endif
00033 
00034 #ifndef STXXL_L2_SIZE
00035 #define STXXL_L2_SIZE  (512 * 1024)
00036 #endif
00037 
00038 __STXXL_BEGIN_NAMESPACE
00039 
00040 // Optimal merging: merge r = pow(nruns,1/ceil(log(nruns)/log(m))) runs at once
00041 inline unsigned_type optimal_merge_factor(unsigned_type num_runs, unsigned_type max_concurrent_runs)
00042 {
00043     return unsigned_type(ceil(pow(num_runs, 1. / ceil(log(double(num_runs)) / log(double(max_concurrent_runs))))));
00044 }
00045 
00046 __STXXL_END_NAMESPACE
00047 
00048 #endif // !STXXL_SORT_BASE_HEADER
00049 // vim: et:ts=4:sw=4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines