42namespace fast_multipole_embedder {
66#define OGDF_FME_KERNEL_USE_OLD
68#define OGDF_FME_KERNEL_COMPUTE_FORCE_PROTECTION_FACTOR 0.25f
70#define OGDF_FME_KERNEL_MM_COMPUTE_FORCE(dx, dy, s) \
72 _mm_max_ps(_mm_mul_ps((s), _mm_set1_ps(OGDF_FME_KERNEL_COMPUTE_FORCE_PROTECTION_FACTOR)), \
73 _mm_add_ps(_mm_mul_ps((dx), (dx)), _mm_mul_ps((dy), (dy)))))
74#define OGDF_FME_KERNEL_COMPUTE_FORCE(dx, dy, s) \
75 (s / (max<float>(s * OGDF_FME_KERNEL_COMPUTE_FORCE_PROTECTION_FACTOR, (dx) * (dx) + (dy) * (dy))))
78 const float* fx,
const float* fy,
const float t) {
80 for (
uint32_t i = begin; i <= end; i++) {
81 double dsq = fx[i] * fx[i] + fy[i] * fy[i];
94 for (
uint32_t i = begin; i <= end; i++) {
101 float dx = x[a] - x[b];
102 float dy = y[a] - y[b];
103 float dsq = dx * dx + dy * dy;
115inline void eval_direct(
float* x,
float* y,
float* s,
float* fx,
float* fy,
size_t n) {
118 float dx = x[i] - x[
j];
119 float dy = y[i] - y[
j];
120#ifdef OGDF_FME_KERNEL_USE_OLD
121 float s_sum = s[i] + s[
j];
123 float s_sum = s[i] * s[
j];
136 float* x2,
float*
y2,
float* s2,
float*
fx2,
float*
fy2,
size_t n2) {
139 float dx = x1[i] - x2[
j];
140 float dy =
y1[i] -
y2[
j];
141#ifdef OGDF_FME_KERNEL_USE_OLD
142 float s_sum = s1[i] + s2[
j];
144 float s_sum = s1[i] * s2[
j];
156#ifndef OGDF_FME_KERNEL_USE_SSE_DIRECT
158inline void eval_direct_fast(
float* x,
float* y,
float* s,
float* fx,
float* fy,
size_t n) {
164 float* x2,
float*
y2,
float* s2,
float*
fx2,
float*
fy2,
size_t n2) {
165 eval_direct(x1,
y1, s1,
fx1,
fy1,
n1, x2,
y2, s2,
fx2,
fy2,
n2);
170void eval_direct_fast(
float* x,
float* y,
float* s,
float* fx,
float* fy,
size_t n);
173 float*
y2,
float* s2,
float*
fx2,
float*
fy2,
size_t n2);
178 double centerY,
float x,
float y,
float q,
float& fx,
float& fy);
181 double centerY,
float x,
float y,
float q);
202 return moveNodes(graph, fx, fy, timeStep);
207 return moveNodes(graph, fx, fy, timeStep);
212 bool earlyExit =
false;
Declaration of class ArrayGraph.
#define OGDF_FME_KERNEL_COMPUTE_FORCE(dx, dy, s)
Declaration of class FMEThread.
Definition of utility functions for FME layout.
#define OGDF_MALLOC_16(s)
16-byte aligned memory allocation macro
#define OGDF_FREE_16(ptr)
16-byte aligned memory deallocation macro
Basic declarations, included by all source files.
float * nodeXPos()
Returns the x coord array for all nodes.
uint32_t numEdges() const
Returns the number of edges.
EdgeAdjInfo & edgeInfo(uint32_t i)
Returns the adjacency information for the edge at index i in m_edgeAdj.
float * nodeYPos()
Returns the y coord array for all nodes.
NodeAdjInfo & nodeInfo(uint32_t i)
Returns the adjacency information for the node at index i in m_nodeAdj.
float * nodeSize()
Returns the node size array for all nodes.
uint32_t numNodes() const
Returns the number of nodes.
float * desiredEdgeLength()
Returns the edge length array for all edges.
uint32_t a
First node of the pair.
double simpleEdgeIteration(ArrayGraph &graph, float *fx, float *fy, float timeStep)
void edgeForces(const ArrayGraph &graph, float *fx, float *fy)
double moveNodes(ArrayGraph &graph, float *fx, float *fy, float timeStep)
double simpleIteration(ArrayGraph &graph, float *fx, float *fy, float timeStep)
void simpleForceDirected(ArrayGraph &graph, float timeStep, uint32_t minIt, uint32_t maxIt, uint32_t preProcIt, double threshold)
void repForces(ArrayGraph &graph, float *fx, float *fy)
FMEKernel(FMEThread *pThread)
bool isMainThread() const
returns true if this is the main thread ( the main thread is always the first thread )
uint32_t threadNr() const
returns the index of the thread ( 0.. numThreads()-1 )
bool isSingleThreaded() const
returns true if this run only uses one thread )
uint32_t numThreads() const
returns the total number of threads in the pool
void operator()(ArrayGraph &graph, float timeStep, uint32_t minIt, uint32_t maxIt, double threshold)
The fast multipole embedder work thread class.
bool isMainThread() const
returns true if this is the main thread ( the main thread is always the first thread )
void sync()
thread sync call
uint32_t numThreads() const
returns the total number of threads in the pool
uint32_t threadNr() const
returns the index of the thread ( 0.. numThreads()-1 )
static MultilevelBuilder * getDoubleFactoredZeroAdjustedMerger()
void updateMax(T &max, const T &newValue)
Stores the maximum of max and newValue in max.
void fast_multipole_p2m(double *mulitCoeffiecients, uint32_t numCoeffiecients, double centerX, double centerY, float x, float y, float q)
void eval_direct_fast(float *x, float *y, float *s, float *fx, float *fy, size_t n)
kernel function to evaluate forces between n points with coords x, y directly. result is stored in fx...
double move_nodes(float *x, float *y, const uint32_t begin, const uint32_t end, const float *fx, const float *fy, const float t)
void fast_multipole_l2p(double *localCoeffiecients, uint32_t numCoeffiecients, double centerX, double centerY, float x, float y, float q, float &fx, float &fy)
kernel function to evalute a local expansion at point x,y result is added to fx, fy
void eval_direct(float *x, float *y, float *s, float *fx, float *fy, size_t n)
kernel function to evaluate forces between n points with coords x, y directly. result is stored in fx...
void eval_edges(const ArrayGraph &graph, const uint32_t begin, const uint32_t end, float *fx, float *fy)
The namespace for all OGDF objects.