43 #ifdef OGDF_SYSTEM_UNIX
44 # include <sys/time.h>
47 #ifdef OGDF_FME_KERNEL_USE_SSE
52 namespace fast_multipole_embedder {
64 #ifdef OGDF_FME_KERNEL_USE_SSE
65 std::cout <<
"OGDF_FME_KERNEL_USE_SSE" << std::endl;
67 #ifdef OGDF_FME_PARALLEL_QUADTREE_SORT
68 std::cout <<
"OGDF_FME_PARALLEL_QUADTREE_SORT" << std::endl;
70 #ifdef OGDF_FME_KERNEL_USE_SSE_DIRECT
71 std::cout <<
"OGDF_FME_KERNEL_USE_SSE_DIRECT" << std::endl;
80 return !(((size_t)(
void*)ptr) & 0x0F);
85 return (T*)(((size_t)((
void*)t)) & ~0x0F);
90 return (T*)((((size_t)((
void*)t)) + 15) & ~0x0F);
93 #ifdef OGDF_SYSTEM_UNIX
94 inline timeval GetDiffTime(timeval _then,
double& dtime) {
95 timeval then = (timeval)_then;
97 gettimeofday(&now,
nullptr);
100 diff.tv_sec = now.tv_sec - then.tv_sec;
101 diff.tv_usec = now.tv_usec - then.tv_usec;
102 while (diff.tv_usec < 0) {
104 diff.tv_usec = 1000000 + now.tv_usec - then.tv_usec;
107 dtime = (double)diff.tv_sec;
108 dtime += (
double)diff.tv_usec / 1e6;
115 std::cout << t <<
"s\t" << text << std::endl;
119 std::cout << t <<
"s\t" << text <<
"\t" << (t / sum) * 100.0 <<
"%" << std::endl;
123 #define OGDF_MALLOC_16(s) System::alignedMemoryAlloc16((s))
126 #define OGDF_FREE_16(ptr) System::alignedMemoryFree((ptr))
129 template<
typename MNR_T,
typename C_T>
134 const unsigned int BIT_LENGTH =
static_cast<unsigned int>(
sizeof(MNR_T)) << 3;
139 for (
unsigned int i = (BIT_LENGTH >> 1); i > 0; i = i >> 1) {
141 mask = mask ^ (mask << i);
142 x = (x | (x << i)) & mask;
143 y = (y | (y << i)) & mask;
149 template<
typename MNR_T,
typename C_T>
152 unsigned int BIT_LENGTH =
static_cast<unsigned int>(
sizeof(C_T)) << 3;
157 for (
unsigned int i = 0; i < BIT_LENGTH; i++) {
158 x = (C_T)(x | (mnr & mask));
160 y = (C_T)(y | (mnr & mask));
168 uint32_t BIT_LENGTH =
static_cast<uint32_t
>(
sizeof(T)) << 3;
170 mask = mask << (BIT_LENGTH - 1);
171 for (uint32_t i = 0; i < BIT_LENGTH; i++) {
183 return 0x1 << (msb - 1);
255 topRow[0] = G.newNode();
256 for (
int j = 1; j < m; j++) {
257 topRow[j] = G.newNode();
258 G.newEdge(topRow[j - 1], topRow[j]);
260 for (
int i = 1; i < n; i++) {
262 G.newEdge(topRow[0], v);
264 for (
int j = 1; j < m; j++) {
266 G.newEdge(topRow[j - 1], v);
267 G.newEdge(topRow[j], v);
276 int numberOfNodesToDelete = (int)((
double)G.numberOfNodes() * missinNodesPercentage);
279 for (
int i = 0; i < numberOfNodesToDelete; i++) {
299 for (i = 0; i <=
m_max_n; i++) {
304 for (i = 0; i <=
m_max_n; i++) {
308 for (i = 2; i <=
m_max_n; i++) {
309 for (j = 1; j < i; j++) {
318 for (i = 0; i <=
m_max_n; i++) {
345 FuncInvoker(FunctionType f, ArgType1 _arg1, ArgType2 _arg2, ArgType3 _arg3, ArgType4 _arg4,
346 ArgType5 _arg5, ArgType6 _arg6, ArgType7 _arg7, ArgType8 _arg8)
359 FunctionType
function;
373 template<
typename FunctionType,
typename ArgType1,
typename ArgType2,
typename ArgType3,
374 typename ArgType4,
typename ArgType5,
typename ArgType6,
typename ArgType7>
375 struct FuncInvoker<FunctionType, ArgType1, ArgType2, ArgType3, ArgType4, ArgType5, ArgType6,
377 FuncInvoker(FunctionType f, ArgType1 _arg1, ArgType2 _arg2, ArgType3 _arg3, ArgType4 _arg4,
378 ArgType5 _arg5, ArgType6 _arg6, ArgType7 _arg7)
390 FunctionType
function;
403 template<
typename FunctionType,
typename ArgType1,
typename ArgType2,
typename ArgType3,
404 typename ArgType4,
typename ArgType5,
typename ArgType6>
405 struct FuncInvoker<FunctionType, ArgType1, ArgType2, ArgType3, ArgType4, ArgType5, ArgType6,
407 FuncInvoker(FunctionType f, ArgType1 _arg1, ArgType2 _arg2, ArgType3 _arg3, ArgType4 _arg4,
408 ArgType5 _arg5, ArgType6 _arg6)
413 FunctionType
function;
425 template<
typename FunctionType,
typename ArgType1,
typename ArgType2,
typename ArgType3,
426 typename ArgType4,
typename ArgType5>
429 FuncInvoker(FunctionType f, ArgType1 _arg1, ArgType2 _arg2, ArgType3 _arg3, ArgType4 _arg4,
435 FunctionType
function;
446 template<
typename FunctionType,
typename ArgType1,
typename ArgType2,
typename ArgType3,
typename ArgType4>
449 FuncInvoker(FunctionType f, ArgType1 _arg1, ArgType2 _arg2, ArgType3 _arg3, ArgType4 _arg4)
454 FunctionType
function;
464 template<
typename FunctionType,
typename ArgType1,
typename ArgType2,
typename ArgType3>
467 FuncInvoker(FunctionType f, ArgType1 _arg1, ArgType2 _arg2, ArgType3 _arg3)
472 FunctionType
function;
481 template<
typename FunctionType,
typename ArgType1,
typename ArgType2>
489 FunctionType
function;
497 template<
typename FunctionType,
typename ArgType1>
504 FunctionType
function;
511 template<
typename FunctionType>
518 FunctionType
function;
521 template<
typename FunctionType,
typename ArgType1,
typename ArgType2,
typename ArgType3,
522 typename ArgType4,
typename ArgType5,
typename ArgType6,
typename ArgType7,
typename ArgType8>
524 createFuncInvoker(FunctionType func, ArgType1 _arg1, ArgType2 _arg2, ArgType3 _arg3, ArgType4 _arg4,
525 ArgType5 _arg5, ArgType6 _arg6, ArgType7 _arg7, ArgType8 _arg8) {
526 return FuncInvoker<FunctionType, ArgType1, ArgType2, ArgType3, ArgType4, ArgType5, ArgType6,
527 ArgType7, ArgType8>(func, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8);
530 template<
typename FunctionType,
typename ArgType1,
typename ArgType2,
typename ArgType3,
531 typename ArgType4,
typename ArgType5,
typename ArgType6,
typename ArgType7,
typename ArgType8>
532 FuncInvoker<FunctionType, ArgType1, ArgType2, ArgType3, ArgType4, ArgType5, ArgType6, ArgType7, ArgType8>
533 createFuncInvoker(FunctionType func, ArgType1 _arg1, ArgType2 _arg2, ArgType3 _arg3, ArgType4 _arg4,
534 ArgType5 _arg5, ArgType6 _arg6, ArgType7 _arg7) {
535 return FuncInvoker<FunctionType, ArgType1, ArgType2, ArgType3, ArgType4, ArgType5, ArgType6,
536 ArgType7,
EmptyArgType>(func, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7);
539 template<
typename FunctionType,
typename ArgType1,
typename ArgType2,
typename ArgType3,
540 typename ArgType4,
typename ArgType5,
typename ArgType6>
541 FuncInvoker<FunctionType, ArgType1, ArgType2, ArgType3, ArgType4, ArgType5, ArgType6>
542 createFuncInvoker(FunctionType func, ArgType1 _arg1, ArgType2 _arg2, ArgType3 _arg3, ArgType4 _arg4,
543 ArgType5 _arg5, ArgType6 _arg6) {
545 func, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6);
548 template<
typename FunctionType,
typename ArgType1,
typename ArgType2,
typename ArgType3,
549 typename ArgType4,
typename ArgType5>
551 FunctionType func, ArgType1 _arg1, ArgType2 _arg2, ArgType3 _arg3, ArgType4 _arg4,
554 _arg2, _arg3, _arg4, _arg5);
557 template<
typename FunctionType,
typename ArgType1,
typename ArgType2,
typename ArgType3,
typename ArgType4>
559 FunctionType func, ArgType1 _arg1, ArgType2 _arg2, ArgType3 _arg3, ArgType4 _arg4) {
564 template<
typename FunctionType,
typename ArgType1,
typename ArgType2,
typename ArgType3>
566 ArgType1 _arg1, ArgType2 _arg2, ArgType3 _arg3) {
570 template<
typename FunctionType,
typename ArgType1,
typename ArgType2>
576 template<
typename FunctionType,
typename ArgType1>
581 template<
typename FunctionType>