43 #ifdef OGDF_SYSTEM_UNIX
44 # include <sys/time.h>
47 #ifdef OGDF_FME_KERNEL_USE_SSE
52 namespace fast_multipole_embedder {
63 #ifndef OGDF_SSE3_EXTENSIONS
65 # undef OGDF_FME_KERNEL_USE_SSE
66 # undef OGDF_FME_KERNEL_USE_SSE_DIRECT
71 #ifdef OGDF_FME_KERNEL_USE_SSE
72 std::cout <<
"OGDF_FME_KERNEL_USE_SSE" << std::endl;
74 #ifdef OGDF_FME_PARALLEL_QUADTREE_SORT
75 std::cout <<
"OGDF_FME_PARALLEL_QUADTREE_SORT" << std::endl;
77 #ifdef OGDF_FME_KERNEL_USE_SSE_DIRECT
78 std::cout <<
"OGDF_FME_KERNEL_USE_SSE_DIRECT" << std::endl;
87 return !(((size_t)(
void*)ptr) & 0x0F);
92 return (T*)(((size_t)((
void*)t)) & ~0x0F);
97 return (T*)((((size_t)((
void*)t)) + 15) & ~0x0F);
100 #ifdef OGDF_SYSTEM_UNIX
101 inline timeval GetDiffTime(timeval _then,
double& dtime) {
102 timeval then = (timeval)_then;
104 gettimeofday(&now,
nullptr);
107 diff.tv_sec = now.tv_sec - then.tv_sec;
108 diff.tv_usec = now.tv_usec - then.tv_usec;
109 while (diff.tv_usec < 0) {
111 diff.tv_usec = 1000000 + now.tv_usec - then.tv_usec;
114 dtime = (double)diff.tv_sec;
115 dtime += (
double)diff.tv_usec / 1e6;
122 std::cout << t <<
"s\t" << text << std::endl;
126 std::cout << t <<
"s\t" << text <<
"\t" << (t / sum) * 100.0 <<
"%" << std::endl;
130 #define OGDF_MALLOC_16(s) System::alignedMemoryAlloc16((s))
133 #define OGDF_FREE_16(ptr) System::alignedMemoryFree((ptr))
136 template<
typename MNR_T,
typename C_T>
141 const unsigned int BIT_LENGTH =
static_cast<unsigned int>(
sizeof(MNR_T)) << 3;
146 for (
unsigned int i = (BIT_LENGTH >> 1); i > 0; i = i >> 1) {
148 mask = mask ^ (mask << i);
149 x = (x | (x << i)) & mask;
150 y = (y | (y << i)) & mask;
156 template<
typename MNR_T,
typename C_T>
159 unsigned int BIT_LENGTH =
static_cast<unsigned int>(
sizeof(C_T)) << 3;
164 for (
unsigned int i = 0; i < BIT_LENGTH; i++) {
165 x = (C_T)(x | (mnr & mask));
167 y = (C_T)(y | (mnr & mask));
175 uint32_t BIT_LENGTH =
static_cast<uint32_t
>(
sizeof(T)) << 3;
177 mask = mask << (BIT_LENGTH - 1);
178 for (uint32_t i = 0; i < BIT_LENGTH; i++) {
190 return 0x1 << (msb - 1);
262 topRow[0] = G.newNode();
263 for (
int j = 1; j < m; j++) {
264 topRow[j] = G.newNode();
265 G.newEdge(topRow[j - 1], topRow[j]);
267 for (
int i = 1; i < n; i++) {
269 G.newEdge(topRow[0], v);
271 for (
int j = 1; j < m; j++) {
273 G.newEdge(topRow[j - 1], v);
274 G.newEdge(topRow[j], v);
283 int numberOfNodesToDelete = (int)((
double)G.numberOfNodes() * missinNodesPercentage);
286 for (
int i = 0; i < numberOfNodesToDelete; i++) {
306 for (i = 0; i <=
m_max_n; i++) {
311 for (i = 0; i <=
m_max_n; i++) {
315 for (i = 2; i <=
m_max_n; i++) {
316 for (j = 1; j < i; j++) {
325 for (i = 0; i <=
m_max_n; i++) {
352 FuncInvoker(FunctionType f, ArgType1 _arg1, ArgType2 _arg2, ArgType3 _arg3, ArgType4 _arg4,
353 ArgType5 _arg5, ArgType6 _arg6, ArgType7 _arg7, ArgType8 _arg8)
366 FunctionType
function;
380 template<
typename FunctionType,
typename ArgType1,
typename ArgType2,
typename ArgType3,
381 typename ArgType4,
typename ArgType5,
typename ArgType6,
typename ArgType7>
382 struct FuncInvoker<FunctionType, ArgType1, ArgType2, ArgType3, ArgType4, ArgType5, ArgType6,
384 FuncInvoker(FunctionType f, ArgType1 _arg1, ArgType2 _arg2, ArgType3 _arg3, ArgType4 _arg4,
385 ArgType5 _arg5, ArgType6 _arg6, ArgType7 _arg7)
397 FunctionType
function;
410 template<
typename FunctionType,
typename ArgType1,
typename ArgType2,
typename ArgType3,
411 typename ArgType4,
typename ArgType5,
typename ArgType6>
412 struct FuncInvoker<FunctionType, ArgType1, ArgType2, ArgType3, ArgType4, ArgType5, ArgType6,
414 FuncInvoker(FunctionType f, ArgType1 _arg1, ArgType2 _arg2, ArgType3 _arg3, ArgType4 _arg4,
415 ArgType5 _arg5, ArgType6 _arg6)
420 FunctionType
function;
432 template<
typename FunctionType,
typename ArgType1,
typename ArgType2,
typename ArgType3,
433 typename ArgType4,
typename ArgType5>
436 FuncInvoker(FunctionType f, ArgType1 _arg1, ArgType2 _arg2, ArgType3 _arg3, ArgType4 _arg4,
442 FunctionType
function;
453 template<
typename FunctionType,
typename ArgType1,
typename ArgType2,
typename ArgType3,
typename ArgType4>
456 FuncInvoker(FunctionType f, ArgType1 _arg1, ArgType2 _arg2, ArgType3 _arg3, ArgType4 _arg4)
461 FunctionType
function;
471 template<
typename FunctionType,
typename ArgType1,
typename ArgType2,
typename ArgType3>
474 FuncInvoker(FunctionType f, ArgType1 _arg1, ArgType2 _arg2, ArgType3 _arg3)
479 FunctionType
function;
488 template<
typename FunctionType,
typename ArgType1,
typename ArgType2>
496 FunctionType
function;
504 template<
typename FunctionType,
typename ArgType1>
511 FunctionType
function;
518 template<
typename FunctionType>
525 FunctionType
function;
528 template<
typename FunctionType,
typename ArgType1,
typename ArgType2,
typename ArgType3,
529 typename ArgType4,
typename ArgType5,
typename ArgType6,
typename ArgType7,
typename ArgType8>
531 createFuncInvoker(FunctionType func, ArgType1 _arg1, ArgType2 _arg2, ArgType3 _arg3, ArgType4 _arg4,
532 ArgType5 _arg5, ArgType6 _arg6, ArgType7 _arg7, ArgType8 _arg8) {
533 return FuncInvoker<FunctionType, ArgType1, ArgType2, ArgType3, ArgType4, ArgType5, ArgType6,
534 ArgType7, ArgType8>(func, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8);
537 template<
typename FunctionType,
typename ArgType1,
typename ArgType2,
typename ArgType3,
538 typename ArgType4,
typename ArgType5,
typename ArgType6,
typename ArgType7,
typename ArgType8>
539 FuncInvoker<FunctionType, ArgType1, ArgType2, ArgType3, ArgType4, ArgType5, ArgType6, ArgType7, ArgType8>
540 createFuncInvoker(FunctionType func, ArgType1 _arg1, ArgType2 _arg2, ArgType3 _arg3, ArgType4 _arg4,
541 ArgType5 _arg5, ArgType6 _arg6, ArgType7 _arg7) {
542 return FuncInvoker<FunctionType, ArgType1, ArgType2, ArgType3, ArgType4, ArgType5, ArgType6,
543 ArgType7,
EmptyArgType>(func, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7);
546 template<
typename FunctionType,
typename ArgType1,
typename ArgType2,
typename ArgType3,
547 typename ArgType4,
typename ArgType5,
typename ArgType6>
548 FuncInvoker<FunctionType, ArgType1, ArgType2, ArgType3, ArgType4, ArgType5, ArgType6>
549 createFuncInvoker(FunctionType func, ArgType1 _arg1, ArgType2 _arg2, ArgType3 _arg3, ArgType4 _arg4,
550 ArgType5 _arg5, ArgType6 _arg6) {
552 func, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6);
555 template<
typename FunctionType,
typename ArgType1,
typename ArgType2,
typename ArgType3,
556 typename ArgType4,
typename ArgType5>
558 FunctionType func, ArgType1 _arg1, ArgType2 _arg2, ArgType3 _arg3, ArgType4 _arg4,
561 _arg2, _arg3, _arg4, _arg5);
564 template<
typename FunctionType,
typename ArgType1,
typename ArgType2,
typename ArgType3,
typename ArgType4>
566 FunctionType func, ArgType1 _arg1, ArgType2 _arg2, ArgType3 _arg3, ArgType4 _arg4) {
571 template<
typename FunctionType,
typename ArgType1,
typename ArgType2,
typename ArgType3>
573 ArgType1 _arg1, ArgType2 _arg2, ArgType3 _arg3) {
577 template<
typename FunctionType,
typename ArgType1,
typename ArgType2>
583 template<
typename FunctionType,
typename ArgType1>
588 template<
typename FunctionType>