17#include "../data/symtensors.h"
18#include "../gravtree/gravtree.h"
20class fmm :
public gravtree<simparticles>
23 void gravity_fmm(
int timebin);
26 long long interactioncountPP;
27 long long interactioncountPN;
28 long long interactioncountNN;
31 long long interactioncountEffective;
33 char *Topnode_depends_on_local_mass;
39#ifdef PRESERVE_SHMEM_BINARY_INVARIANCE
40 bool skip_actual_force_computation;
47#if(MULTIPOLE_ORDER >= 2)
50#if(MULTIPOLE_ORDER >= 3)
53#if(MULTIPOLE_ORDER >= 4)
56#if(MULTIPOLE_ORDER >= 5)
67 taylor_data *TaylorCoeff;
69 struct fmm_workstack_data
73 unsigned char ShmRank1;
74 unsigned char ShmRank2;
78 fmm_workstack_data *FMM_WorkStack;
80 static bool compare_fmm_workstack(
const fmm_workstack_data &a,
const fmm_workstack_data &b)
82 if(a.MinTopLeafNode < b.MinTopLeafNode)
84 if(a.MinTopLeafNode > b.MinTopLeafNode)
87 return a.Node1 < b.Node1;
90 inline void fmm_add_to_work_stack(
int node1,
int node2,
unsigned char shmrank1,
unsigned char shmrank2,
int mintopleafnode)
92 if(NumOnWorkStack + NewOnWorkStack >= MaxOnWorkStack)
94 Terminate(
"we have run out of space: NumOnWorkStack=%d + NewOnWorkStack=%d >= MaxOnWorkStack=%d", NumOnWorkStack,
95 NewOnWorkStack, MaxOnWorkStack);
100 FMM_WorkStack[NumOnWorkStack +
NewOnWorkStack].ShmRank1 = shmrank1;
101 FMM_WorkStack[NumOnWorkStack +
NewOnWorkStack].ShmRank2 = shmrank2;
102 FMM_WorkStack[NumOnWorkStack +
NewOnWorkStack].MinTopLeafNode = mintopleafnode;
107 inline bool fmm_depends_on_local_mass(
int no,
unsigned char shmrank)
109 if(no >= MaxPart && no < FirstNonTopLevelNode)
111 if(Topnode_depends_on_local_mass[no])
116 else if(no >= FirstNonTopLevelNode && no < MaxPart + MaxNodes)
127 void fmm_force_interact(
int no_sink,
int no_source,
char type_sink,
char type_source,
unsigned char shmrank_sink,
128 unsigned char shmrank_source,
int mintopleafnode,
int committed);
130 void fmm_force_passdown(
int no,
unsigned char shmrank, taylor_data taylor_current);
131 void fmm_open_both(
gravnode *noptr_sink,
gravnode *noptr_source,
int mintopleafnode,
int committed);
133 void fmm_open_node(
int no_particle,
gravnode *nop,
char type_particle,
unsigned char shmrank_particle,
int mintopleafnode,
135 void fmm_particle_particle_interaction(
int no_sink,
int no_source,
int type_sink,
int type_source,
unsigned char shmrank_sink,
136 unsigned char shmrank_source);
138 void fmm_particle_node_interaction(
int no_sink,
int no_source,
int type_sink,
int type_source,
unsigned char shmrank_sink,
141 void fmm_node_node_interaction(
int no_sink,
int no_source,
int type_sink,
int type_source,
unsigned char shmrank_sink,
147 int fmm_evaluate_particle_node_opening_criterion(
int no_sink,
char type_sink,
unsigned char shmrank_sink,
gravnode *nop_source,
150 void fmm_determine_nodes_with_local_mass(
int no,
int sib);
long long sum_NumForeignPoints
long long sum_NumForeignNodes