|
Open Graph Drawing Framework |
v. 2023.09 (Elderberry)
|
|
|
Go to the documentation of this file.
47 namespace fast_multipole_embedder {
53 template<
typename Func>
55 for (uint32_t i =
begin; i <=
end; i++) {
106 uint32_t o = s * chunkSize *
threadNr;
112 result.
end = o + s * chunkSize - 1;
129 if (partition.
begin > partition.
end) {
132 for (uint32_t i = partition.
begin; i <= partition.
end; i++) {
146 template<
typename T,
typename C>
154 template<
typename T,
typename C>
164 template<
typename T,
typename C>
165 inline void sort_parallel(T* ptr, uint32_t n, C comparer, uint32_t threadNrBegin,
173 uint32_t half = n >> 1;
175 if (this->
threadNr() < threadNrBegin + halfThreads) {
176 sort_parallel(ptr, half, comparer, threadNrBegin, halfThreads);
178 sort_parallel(ptr + half, n - half, comparer, threadNrBegin + halfThreads,
184 if (this->
threadNr() == threadNrBegin) {
185 std::inplace_merge(ptr, ptr + half, ptr + n, comparer);
FMELocalContext * m_pLocalContext
The namespace for all OGDF objects.
Declaration of class LinearQuadtree.
The fast multipole embedder work thread class.
void quadtreeConstruction(ArrayPartition &nodePointPartition)
sub procedure for quadtree construction
ArrayPartition arrayPartition(uint32_t n)
creates an array partition with a default chunksize of 16
void multipoleApproxSingleThreaded(ArrayPartition &nodePointPartition)
the single threaded version without fences
void for_loop(const ArrayPartition &partition, F func)
for loop on a partition
std::list< LinearQuadtree::NodeID > nodes
void sort_parallel(T *ptr, uint32_t n, C comparer)
lazy parallel sorting for num_threads = power of two
FMEMultipoleKernel(FMEThread *pThread)
Definitions of various auxiliary classes for FME layout.
static FMEGlobalContext * allocateContext(ArrayGraph *pGraph, FMEGlobalOptions *pOptions, uint32_t numThreads)
allocate the global and local contexts used by an instance of this kernel
void sort(T *array, int size, LessThan lt)
the main global options for a run
void for_tree_partition(F functor)
for loop on the tree partition
void operator()(FMEGlobalContext *globalContext)
main function of the kernel
ArrayPartition arrayPartition(uint32_t n, uint32_t threadNr, uint32_t numThreads, uint32_t chunkSize)
returns an array partition for the given threadNr and thread count
uint32_t threadNr() const
returns the index of the thread ( 0.. numThreads()-1 )
static void deallocateContext(FMEGlobalContext *globalContext)
free the global and local context
void sort_single(T *ptr, uint32_t n, C comparer)
sorting single threaded
uint32_t numThreads() const
returns the total number of threads in the pool
bool isMainThread() const
returns true if this is the main thread ( the main thread is always the first thread )
FMEGlobalContext * m_pGlobalContext
Declaration of FME kernel.
void for_loop(Func &func)
void multipoleApproxNoWSPDStructure(ArrayPartition &nodePointPartition)
new but slower method, parallel wspd computation without using the wspd structure
void sort_parallel(T *ptr, uint32_t n, C comparer, uint32_t threadNrBegin, uint32_t numThreads)
lazy parallel sorting for num_threads = power of two
void multipoleApproxFinal(ArrayPartition &nodePointPartition)
the final version, the wspd structure is only used for the top of the tree
void multipoleApproxSingleWSPD(ArrayPartition &nodePointPartition)
the original algorithm which runs the WSPD completely single threaded
FMETreePartition treePartition
tree partition assigned to the thread