36 #ifdef OGDF_SYSTEM_UNIX 40 #ifdef OGDF_FME_KERNEL_USE_SSE 45 namespace fast_multipole_embedder {
58 #ifdef OGDF_FME_KERNEL_USE_SSE 59 std::cout <<
"OGDF_FME_KERNEL_USE_SSE" << std::endl;
61 #ifdef OGDF_FME_PARALLEL_QUADTREE_SORT 62 std::cout <<
"OGDF_FME_PARALLEL_QUADTREE_SORT" << std::endl;
64 #ifdef OGDF_FME_KERNEL_USE_SSE_DIRECT 65 std::cout <<
"OGDF_FME_KERNEL_USE_SSE_DIRECT" << std::endl;
75 return !(((size_t)(
void*)ptr) & 0x0F);
81 return (T*)(((size_t)((
void*)t))&~ 0x0F);
87 return (T*)((((size_t)((
void*)t)) + 15)&~ 0x0F);
90 #ifdef OGDF_SYSTEM_UNIX 91 inline timeval GetDiffTime(timeval _then,
double& dtime)
93 timeval then = (timeval) _then;
95 gettimeofday(&now,
nullptr);
98 diff.tv_sec = now.tv_sec - then.tv_sec;
99 diff.tv_usec = now.tv_usec - then.tv_usec;
100 while(diff.tv_usec < 0)
103 diff.tv_usec = 1000000 + now.tv_usec - then.tv_usec;
106 dtime = (double) diff.tv_sec;
107 dtime += (
double) diff.tv_usec / 1e6;
109 return (timeval) now;
113 inline void printProfiledTime(
double t,
const char* text) { std::cout << t <<
"s\t" << text << std::endl; }
114 inline void printProfiledTime(
double t,
double sum,
const char* text) { std::cout << t <<
"s\t" << text <<
"\t" << (t /
sum)*100.0 <<
"%"<< std::endl; }
117 #define OGDF_MALLOC_16(s) System::alignedMemoryAlloc16((s)) 120 #define OGDF_FREE_16(ptr) System::alignedMemoryFree((ptr)) 123 template<
typename MNR_T,
typename C_T>
129 const unsigned int BIT_LENGTH =
static_cast<unsigned int>(
sizeof(MNR_T)) << 3;
134 for (
unsigned int i = (BIT_LENGTH >> 1);i>0; i = i >> 1) {
136 mask = mask ^ (mask << i);
137 x = (x | (x << i)) & mask;
138 y = (y | (y << i)) & mask;
145 template<
typename MNR_T,
typename C_T>
149 unsigned int BIT_LENGTH =
static_cast<unsigned int>(
sizeof(C_T)) << 3;
154 for (
unsigned int i=0; i < BIT_LENGTH; i++)
156 x = (C_T)(x | (mnr & mask));
158 y = (C_T)(y | (mnr & mask));
167 uint32_t BIT_LENGTH =
static_cast<uint32_t
>(
sizeof(T)) << 3;
169 mask = mask << (BIT_LENGTH - 1);
170 for (uint32_t i = 0; i < BIT_LENGTH; i++)
183 return 0x1 << (msb - 1);
263 for (
int j=1; j<m; j++)
266 G.
newEdge(topRow[j-1], topRow[j]);
268 for (
int i=1; i<n; i++)
273 for (
int j=1; j<m; j++)
287 int numberOfNodesToDelete = (int)((
double)G.
numberOfNodes() * missinNodesPercentage);
290 for(
int i=0; i<numberOfNodesToDelete;i++)
303 explicit BinCoeff(
unsigned int n) : m_max_n(n) { init_array(); }
312 m_binCoeffs =
new ptr[m_max_n+1];
313 for(i = 0;i<= m_max_n ;i++)
315 m_binCoeffs[i]=
new TYP[i+1];
319 for (i = 0; i <= m_max_n;i++)
321 m_binCoeffs[i][0] = m_binCoeffs[i][i] = 1;
324 for (i = 2; i <= m_max_n; i ++)
326 for (j = 1; j < i; j++)
328 m_binCoeffs[i][j] = m_binCoeffs[i-1][j-1]+m_binCoeffs[i-1][j];
337 for(i = 0;i<= m_max_n;i++)
339 delete[] m_binCoeffs[i];
341 delete[] m_binCoeffs;
345 inline TYP
value(
unsigned int n,
unsigned int k)
const 347 return m_binCoeffs[n][k];
364 template<
typename FunctionType,
375 FuncInvoker(FunctionType f, ArgType1 _arg1, ArgType2 _arg2, ArgType3 _arg3, ArgType4 _arg4, ArgType5 _arg5, ArgType6 _arg6, ArgType7 _arg7, ArgType8 _arg8) :
376 function(f), arg1(_arg1), arg2(_arg2), arg3(_arg3), arg4(_arg4), arg5(_arg5), arg6(_arg6), arg7(_arg7), arg8(_arg8) { }
378 inline void operator()() {
function(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); }
380 FunctionType
function;
395 template<
typename FunctionType,
typename ArgType1,
typename ArgType2,
typename ArgType3,
typename ArgType4,
typename ArgType5,
typename ArgType6,
typename ArgType7>
398 FuncInvoker(FunctionType f, ArgType1 _arg1, ArgType2 _arg2, ArgType3 _arg3, ArgType4 _arg4, ArgType5 _arg5, ArgType6 _arg6, ArgType7 _arg7) :
399 function(f), arg1(_arg1), arg2(_arg2), arg3(_arg3), arg4(_arg4), arg5(_arg5), arg6(_arg6), arg7(_arg7) { }
401 inline void operator()() {
function(arg1, arg2, arg3, arg4, arg5, arg6, arg7); }
403 FunctionType
function;
416 template<
typename FunctionType,
typename ArgType1,
typename ArgType2,
typename ArgType3,
typename ArgType4,
typename ArgType5,
typename ArgType6>
419 FuncInvoker(FunctionType f, ArgType1 _arg1, ArgType2 _arg2, ArgType3 _arg3, ArgType4 _arg4, ArgType5 _arg5, ArgType6 _arg6) :
420 function(f), arg1(_arg1), arg2(_arg2), arg3(_arg3), arg4(_arg4), arg5(_arg5), arg6(_arg6) { }
422 inline void operator()() {
function(arg1, arg2, arg3, arg4, arg5, arg6); }
424 FunctionType
function;
436 template<
typename FunctionType,
typename ArgType1,
typename ArgType2,
typename ArgType3,
typename ArgType4,
typename ArgType5>
439 FuncInvoker(FunctionType f, ArgType1 _arg1, ArgType2 _arg2, ArgType3 _arg3, ArgType4 _arg4, ArgType5 _arg5) :
440 function(f), arg1(_arg1), arg2(_arg2), arg3(_arg3), arg4(_arg4), arg5(_arg5) { }
442 inline void operator()() {
function(arg1, arg2, arg3, arg4, arg5); }
444 FunctionType
function;
455 template<
typename FunctionType,
typename ArgType1,
typename ArgType2,
typename ArgType3,
typename ArgType4>
458 FuncInvoker(FunctionType f, ArgType1 _arg1, ArgType2 _arg2, ArgType3 _arg3, ArgType4 _arg4) :
459 function(f), arg1(_arg1), arg2(_arg2), arg3(_arg3), arg4(_arg4) { }
461 inline void operator()() {
function(arg1, arg2, arg3, arg4); }
463 FunctionType
function;
473 template<
typename FunctionType,
typename ArgType1,
typename ArgType2,
typename ArgType3>
476 FuncInvoker(FunctionType f, ArgType1 _arg1, ArgType2 _arg2, ArgType3 _arg3) :
477 function(f), arg1(_arg1), arg2(_arg2), arg3(_arg3) { }
481 FunctionType
function;
490 template<
typename FunctionType,
typename ArgType1,
typename ArgType2>
494 function(f), arg1(_arg1), arg2(_arg2) { }
498 FunctionType
function;
506 template<
typename FunctionType,
typename ArgType1>
510 function(f), arg1(_arg1) { }
514 FunctionType
function;
521 template<
typename FunctionType>
529 FunctionType
function;
533 template<
typename FunctionType,
typename ArgType1,
typename ArgType2,
typename ArgType3,
typename ArgType4,
typename ArgType5,
typename ArgType6,
typename ArgType7,
typename ArgType8>
535 createFuncInvoker(FunctionType func, ArgType1 _arg1, ArgType2 _arg2, ArgType3 _arg3, ArgType4 _arg4, ArgType5 _arg5, ArgType6 _arg6, ArgType7 _arg7, ArgType8 _arg8)
537 return FuncInvoker<FunctionType, ArgType1, ArgType2, ArgType3, ArgType4, ArgType5, ArgType6, ArgType7, ArgType8>(func, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8);
540 template<
typename FunctionType,
typename ArgType1,
typename ArgType2,
typename ArgType3,
typename ArgType4,
typename ArgType5,
typename ArgType6,
typename ArgType7,
typename ArgType8>
542 createFuncInvoker(FunctionType func, ArgType1 _arg1, ArgType2 _arg2, ArgType3 _arg3, ArgType4 _arg4, ArgType5 _arg5, ArgType6 _arg6, ArgType7 _arg7)
544 return FuncInvoker<FunctionType, ArgType1, ArgType2, ArgType3, ArgType4, ArgType5, ArgType6, ArgType7, EmptyArgType>(func, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7);
547 template<
typename FunctionType,
typename ArgType1,
typename ArgType2,
typename ArgType3,
typename ArgType4,
typename ArgType5,
typename ArgType6>
549 createFuncInvoker(FunctionType func, ArgType1 _arg1, ArgType2 _arg2, ArgType3 _arg3, ArgType4 _arg4, ArgType5 _arg5, ArgType6 _arg6)
551 return FuncInvoker<FunctionType, ArgType1, ArgType2, ArgType3, ArgType4, ArgType5, ArgType6>(func, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6);
554 template<
typename FunctionType,
typename ArgType1,
typename ArgType2,
typename ArgType3,
typename ArgType4,
typename ArgType5>
556 createFuncInvoker(FunctionType func, ArgType1 _arg1, ArgType2 _arg2, ArgType3 _arg3, ArgType4 _arg4, ArgType5 _arg5)
558 return FuncInvoker<FunctionType, ArgType1, ArgType2, ArgType3, ArgType4, ArgType5>(func, _arg1, _arg2, _arg3, _arg4, _arg5);
561 template<
typename FunctionType,
typename ArgType1,
typename ArgType2,
typename ArgType3,
typename ArgType4>
563 createFuncInvoker(FunctionType func, ArgType1 _arg1, ArgType2 _arg2, ArgType3 _arg3, ArgType4 _arg4)
568 template<
typename FunctionType,
typename ArgType1,
typename ArgType2,
typename ArgType3>
575 template<
typename FunctionType,
typename ArgType1,
typename ArgType2>
582 template<
typename FunctionType,
typename ArgType1>
589 template<
typename FunctionType>
bool isAvailable(node v) const
Declaration of class GraphAttributes which extends a Graph by additional attributes.
T * align_16_prev_ptr(T *t)
utility class to select multiple nodes randomly
FuncInvoker(FunctionType f, ArgType1 _arg1, ArgType2 _arg2, ArgType3 _arg3)
virtual void clear()
Removes all nodes and all edges from the graph.
Data type for general directed graphs (adjacency list representation).
virtual void delNode(node v)
Removes node v and all incident edges from the graph.
void init()
Reinitializes the array. Associates the array with no graph.
void randomGridGraph(Graph &G, int n, int m, double missinNodesPercentage=0.03)
int randomNumber(int low, int high)
Returns random integer between low and high (including).
FuncInvoker(FunctionType f, ArgType1 _arg1)
node * m_array
the set of all nodes (at the end the available nodes)
FuncInvoker(FunctionType f, ArgType1 _arg1, ArgType2 _arg2, ArgType3 _arg3, ArgType4 _arg4, ArgType5 _arg5, ArgType6 _arg6, ArgType7 _arg7, ArgType8 _arg8)
void removeNode(node v)
removes a node from available nodes (assumes v is available) in O(1)
FuncInvoker(FunctionType f, ArgType1 _arg1, ArgType2 _arg2, ArgType3 _arg3, ArgType4 _arg4)
int m_numNodesChoosen
num available nodes
const Graph & m_graph
the graph
T * align_16_next_ptr(T *t)
RandomNodeSet(const Graph &G)
init the random node set with the given graph. takes O(n)
FuncInvoker(FunctionType f)
NodeArray< int > m_nodeIndex
the index in the array of the nodes
FuncInvoker(FunctionType f, ArgType1 _arg1, ArgType2 _arg2, ArgType3 _arg3, ArgType4 _arg4, ArgType5 _arg5, ArgType6 _arg6)
~RandomNodeSet()
destructor
edge newEdge(node v, node w)
Creates a new edge (v,w) and returns it.
FuncInvoker(FunctionType f, ArgType1 _arg1, ArgType2 _arg2, ArgType3 _arg3, ArgType4 _arg4, ArgType5 _arg5, ArgType6 _arg6, ArgType7 _arg7)
void init_array()
Init BK -matrix for values n, k in 0 to t.
void free_array()
Free space for BK.
MNR_T mortonNumber(C_T ix, C_T iy)
common template for bit-interleaving to compute the morton number assumes sizeOf(MNR_T) = 2*sizeOf(C_...
Class for the representation of nodes.
uint32_t mostSignificantBit(T n)
returns the index of the most signficant bit set. 0 = most signif, bitlength-1 = least signif ...
void mortonNumberInv(MNR_T mnr, C_T &x, C_T &y)
common template for extracting the coordinates from a morton number assumes sizeOf(MNR_T) = 2*sizeOf(...
TYP value(unsigned int n, unsigned int k) const
uint32_t prevPowerOfTwo(uint32_t n)
returns the prev power of two
Include of header files for SSE-intrinsics.
FuncInvoker(FunctionType f, ArgType1 _arg1, ArgType2 _arg2)
int m_numNodes
total num nodes
int nodesLeft() const
number of nodes available
FuncInvoker(FunctionType f, ArgType1 _arg1, ArgType2 _arg2, ArgType3 _arg3, ArgType4 _arg4, ArgType5 _arg5)
FuncInvoker< FunctionType, ArgType1, ArgType2, ArgType3, ArgType4, ArgType5, ArgType6, ArgType7, ArgType8 > createFuncInvoker(FunctionType func, ArgType1 _arg1, ArgType2 _arg2, ArgType3 _arg3, ArgType4 _arg4, ArgType5 _arg5, ArgType6 _arg6, ArgType7 _arg7, ArgType8 _arg8)
The namespace for all OGDF objects.
void gridGraph(Graph &G, int n, int m)
binomial coeffs from Hachuls FMMM
TYP ** m_binCoeffs
holds the binominal coefficients
void printProfiledTime(double t, const char *text)
int numberOfNodes() const
Returns the number of nodes in the graph.
node newNode()
Creates a new node and returns it.
Container::value_type sum(const Container &values)
Returns the sum of an iterable container of given values.
internal::GraphObjectContainer< NodeElement > nodes
The container containing all node objects.
node chooseNode() const
chooses a node from the available nodes in O(1)
void OGDF_FME_Print_Config()