GADGET-4
tree< node, partset, point_data, foreign_point_data > Class Template Referenceabstract

#include <tree.h>

Classes

struct  fetch_data
 
struct  index_data
 
struct  node_count_info
 
struct  node_req
 
struct  workstack_data
 

Public Types

enum  ftype { FETCH_GRAVTREE , FETCH_SPH_DENSITY , FETCH_SPH_HYDRO , FETCH_SPH_TREETIMESTEP }
 
typedef decltype(Tp->P) pdata
 

Public Member Functions

void tree_add_to_fetch_stack (node *nop, int nodetoopen, unsigned char shmrank)
 
void tree_add_to_work_stack (int target, int no, unsigned char shmrank, int mintopleafnode)
 
void prepare_shared_memory_access (void)
 
void cleanup_shared_memory_access (void)
 
void tree_fetch_foreign_nodes (enum ftype fetch_type)
 
void tree_initialize_leaf_node_access_info (void)
 
foreign_point_data * get_foreignpointsp (int n, unsigned char shmrank)
 
subfind_dataget_PSp (int n, unsigned char shmrank)
 
pdata get_Pp (int n, unsigned char shmrank)
 
sph_particle_dataget_SphPp (int n, unsigned char shmrank)
 
 tree ()
 
int treebuild (int ninsert, int *indexlist)
 
void treefree (void)
 
void treeallocate (int max_partindex, partset *Pptr, domain< partset > *Dptr)
 
void treeallocate_share_topnode_addresses (void)
 
void tree_export_node_threads (int no, int i, thread_data *thread, offset_tuple off=0)
 
void tree_export_node_threads_by_task_and_node (int task, int nodeindex, int i, thread_data *thread, offset_tuple off=0)
 
virtual void update_node_recursive (int no, int sib, int mode)=0
 
virtual void exchange_topleafdata (void)=0
 
virtual void report_log_message (void)=0
 
virtual void fill_in_export_points (point_data *exp_point, int i, int no)=0
 
node * get_nodep (int no)
 
node * get_nodep (int no, unsigned char shmrank)
 
int * get_nextnodep (unsigned char shmrank)
 
point_data * get_pointsp (int no, unsigned char shmrank)
 
void tree_get_node_and_task (int i, int &no, int &task)
 

Static Public Member Functions

static bool compare_ghostrank (const fetch_data &a, const fetch_data &b)
 
static bool compare_workstack (const workstack_data &a, const workstack_data &b)
 

Public Attributes

domain< partset > * D
 
partset * Tp
 
int * Father
 
int * Nextnode
 
int * NodeSibling
 
int * NodeIndex
 
node * TopNodes
 
node * Nodes
 
node * Foreign_Nodes
 
foreign_point_data * Foreign_Points
 
ptrdiff_t * TreeNodes_offsets
 
ptrdiff_t * TreePoints_offsets
 
ptrdiff_t * TreeNextnode_offsets
 
ptrdiff_t * TreeForeign_Nodes_offsets
 
ptrdiff_t * TreeForeign_Points_offsets
 
ptrdiff_t * TreeP_offsets
 
ptrdiff_t * TreeSphP_offsets
 
ptrdiff_t * TreePS_offsets
 
void ** TreeSharedMemBaseAddr
 
unsigned char * NodeLevel
 
point_data * Points
 
int * IndexList
 
int * ResultIndexList
 
int * Send_offset
 
int * Send_count
 
int * Recv_count
 
int * Recv_offset
 
int MaxPart
 
int MaxNodes
 
int NumNodes
 
int NumPartImported
 
int NumPartExported
 
int NumForeignNodes
 
int MaxForeignNodes
 
int NumForeignPoints
 
int MaxForeignPoints
 
long long sum_NumForeignNodes
 
long long sum_NumForeignPoints
 
int FirstNonTopLevelNode
 
int EndOfTreePoints
 
int EndOfForeignNodes
 
int ImportedNodeOffset
 
int Ninsert
 
int NextFreeNode
 
MPI_Comm TreeSharedMemComm
 
int TreeSharedMem_ThisTask
 
int TreeSharedMem_NTask
 
int TreeInfoHandle
 
double Buildtime
 
int NumOnFetchStack
 
int MaxOnFetchStack
 
fetch_dataStackToFetch
 
int NumOnWorkStack
 
int MaxOnWorkStack
 
int NewOnWorkStack
 
int AllocWorkStackBaseLow
 
int AllocWorkStackBaseHigh
 
workstack_dataWorkStack
 

Detailed Description

template<typename node, typename partset, typename point_data, typename foreign_point_data>
class tree< node, partset, point_data, foreign_point_data >

Definition at line 90 of file tree.h.

Member Typedef Documentation

◆ pdata

typedef decltype(Tp->P) pdata

Definition at line 285 of file tree.h.

Member Enumeration Documentation

◆ ftype

enum ftype
Enumerator
FETCH_GRAVTREE 
FETCH_SPH_DENSITY 
FETCH_SPH_HYDRO 
FETCH_SPH_TREETIMESTEP 

Definition at line 264 of file tree.h.

Constructor & Destructor Documentation

◆ tree()

tree ( )
inline

Gives next node in tree walk for the "particle" nodes. Entries 0 – MaxPart-1 are the real particles, and the "pseudoparticles" are indexed by the node number-MaxNodes. Gives previous node in tree walk for the leaf (particle) nodes. Entries 0 – MaxPart-1 are the real particles, and the "pseudoparticles" are indexed by the node number-MaxNodes.

Definition at line 307 of file tree.h.

Member Function Documentation

◆ cleanup_shared_memory_access()

void cleanup_shared_memory_access ( void  )

Definition at line 970 of file tree.cc.

◆ compare_ghostrank()

static bool compare_ghostrank ( const fetch_data a,
const fetch_data b 
)
inlinestatic

Definition at line 180 of file tree.h.

◆ compare_workstack()

static bool compare_workstack ( const workstack_data a,
const workstack_data b 
)
inlinestatic

Definition at line 197 of file tree.h.

◆ exchange_topleafdata()

virtual void exchange_topleafdata ( void  )
pure virtual

Implemented in foftree< partset >, and ngbtree.

◆ fill_in_export_points()

virtual void fill_in_export_points ( point_data *  exp_point,
int  i,
int  no 
)
pure virtual

Implemented in foftree< partset >, and ngbtree.

◆ get_foreignpointsp()

foreign_point_data * get_foreignpointsp ( int  n,
unsigned char  shmrank 
)
inline

Definition at line 275 of file tree.h.

◆ get_nextnodep()

int * get_nextnodep ( unsigned char  shmrank)
inline

Definition at line 371 of file tree.h.

◆ get_nodep() [1/2]

node * get_nodep ( int  no)
inline

Definition at line 334 of file tree.h.

◆ get_nodep() [2/2]

node * get_nodep ( int  no,
unsigned char  shmrank 
)
inline

Definition at line 348 of file tree.h.

◆ get_pointsp()

point_data * get_pointsp ( int  no,
unsigned char  shmrank 
)
inline

Definition at line 376 of file tree.h.

◆ get_Pp()

pdata get_Pp ( int  n,
unsigned char  shmrank 
)
inline

Definition at line 287 of file tree.h.

◆ get_PSp()

subfind_data * get_PSp ( int  n,
unsigned char  shmrank 
)
inline

Definition at line 280 of file tree.h.

◆ get_SphPp()

sph_particle_data * get_SphPp ( int  n,
unsigned char  shmrank 
)
inline

Definition at line 292 of file tree.h.

◆ prepare_shared_memory_access()

void prepare_shared_memory_access ( void  )

Definition at line 909 of file tree.cc.

◆ report_log_message()

virtual void report_log_message ( void  )
pure virtual

Implemented in foftree< partset >, and ngbtree.

◆ tree_add_to_fetch_stack()

void tree_add_to_fetch_stack ( node *  nop,
int  nodetoopen,
unsigned char  shmrank 
)
inline

Definition at line 207 of file tree.h.

◆ tree_add_to_work_stack()

void tree_add_to_work_stack ( int  target,
int  no,
unsigned char  shmrank,
int  mintopleafnode 
)
inline

Definition at line 232 of file tree.h.

◆ tree_export_node_threads()

void tree_export_node_threads ( int  no,
int  i,
thread_data thread,
offset_tuple  off = 0 
)

Definition at line 1301 of file tree.cc.

◆ tree_export_node_threads_by_task_and_node()

void tree_export_node_threads_by_task_and_node ( int  task,
int  nodeindex,
int  i,
thread_data thread,
offset_tuple  off = 0 
)

Definition at line 1311 of file tree.cc.

◆ tree_fetch_foreign_nodes()

void tree_fetch_foreign_nodes ( enum ftype  fetch_type)

Definition at line 983 of file tree.cc.

◆ tree_get_node_and_task()

void tree_get_node_and_task ( int  i,
int &  no,
int &  task 
)
inline

Definition at line 381 of file tree.h.

◆ tree_initialize_leaf_node_access_info()

void tree_initialize_leaf_node_access_info ( void  )

Definition at line 174 of file tree.cc.

◆ treeallocate()

void treeallocate ( int  max_partindex,
partset *  Tp_ptr,
domain< partset > *  Dptr 
)

This function allocates the memory used for storage of the tree nodes. Usually, the number of required nodes is of order 0.7*maxpart, but if this is insufficient, the code will try to allocated more space by increasing TreeAllocFactor.

Definition at line 776 of file tree.cc.

◆ treeallocate_share_topnode_addresses()

void treeallocate_share_topnode_addresses ( void  )

Definition at line 890 of file tree.cc.

◆ treebuild()

int treebuild ( int  ninsert,
int *  indexlist 
)

public functions

This file contains the construction of the tree used for calculating the gravitational force and the neighbor tree for SPH. The type of tree implemented is a geometrical oct-tree, starting from a cube encompassing all particles. This cube is automatically found in the domain decomposition, which also splits up the global "top-level" tree along node boundaries, moving the particles of different parts of the tree to separate processors. In the present version of the code, the tree construction may be repeated without a renewed domain decomposition. In this case, if particles are on the "wrong" processor because a new domain decomposition has not been carried out, they are sent as temporary points to the right insertion processor according to the layout of the top-level nodes.

This function is a driver routine for constructing the oct-tree.

Returns
number of local nodes (including top level nodes) of the constructed tree

Definition at line 52 of file tree.cc.

◆ treefree()

void treefree ( void  )

This function frees the memory allocated for the tree, i.e. it frees the space allocated by the function force_treeallocate().

Definition at line 1232 of file tree.cc.

◆ update_node_recursive()

virtual void update_node_recursive ( int  no,
int  sib,
int  mode 
)
pure virtual

Implemented in foftree< partset >, and ngbtree.

Member Data Documentation

◆ AllocWorkStackBaseHigh

int AllocWorkStackBaseHigh

Definition at line 186 of file tree.h.

◆ AllocWorkStackBaseLow

int AllocWorkStackBaseLow

Definition at line 185 of file tree.h.

◆ Buildtime

double Buildtime

Definition at line 167 of file tree.h.

◆ D

domain<partset>* D

Definition at line 101 of file tree.h.

◆ EndOfForeignNodes

int EndOfForeignNodes

Definition at line 155 of file tree.h.

◆ EndOfTreePoints

int EndOfTreePoints

Definition at line 154 of file tree.h.

◆ Father

int* Father

Definition at line 104 of file tree.h.

◆ FirstNonTopLevelNode

int FirstNonTopLevelNode

Definition at line 152 of file tree.h.

◆ Foreign_Nodes

node* Foreign_Nodes

Definition at line 111 of file tree.h.

◆ Foreign_Points

foreign_point_data* Foreign_Points

Definition at line 112 of file tree.h.

◆ ImportedNodeOffset

int ImportedNodeOffset

Definition at line 157 of file tree.h.

◆ IndexList

int* IndexList

Definition at line 128 of file tree.h.

◆ MaxForeignNodes

int MaxForeignNodes

Definition at line 143 of file tree.h.

◆ MaxForeignPoints

int MaxForeignPoints

Definition at line 146 of file tree.h.

◆ MaxNodes

int MaxNodes

Definition at line 137 of file tree.h.

◆ MaxOnFetchStack

int MaxOnFetchStack

Definition at line 170 of file tree.h.

◆ MaxOnWorkStack

int MaxOnWorkStack

Definition at line 183 of file tree.h.

◆ MaxPart

int MaxPart

Definition at line 136 of file tree.h.

◆ NewOnWorkStack

int NewOnWorkStack

Definition at line 184 of file tree.h.

◆ NextFreeNode

int NextFreeNode

Definition at line 159 of file tree.h.

◆ Nextnode

int* Nextnode

Definition at line 105 of file tree.h.

◆ Ninsert

int Ninsert

Definition at line 158 of file tree.h.

◆ NodeIndex

int* NodeIndex

Definition at line 107 of file tree.h.

◆ NodeLevel

unsigned char* NodeLevel

Definition at line 125 of file tree.h.

◆ Nodes

node* Nodes

Definition at line 110 of file tree.h.

◆ NodeSibling

int* NodeSibling

Definition at line 106 of file tree.h.

◆ NumForeignNodes

int NumForeignNodes

Definition at line 142 of file tree.h.

◆ NumForeignPoints

int NumForeignPoints

Definition at line 145 of file tree.h.

◆ NumNodes

int NumNodes

Definition at line 138 of file tree.h.

◆ NumOnFetchStack

int NumOnFetchStack

Definition at line 169 of file tree.h.

◆ NumOnWorkStack

int NumOnWorkStack

Definition at line 182 of file tree.h.

◆ NumPartExported

int NumPartExported

Definition at line 140 of file tree.h.

◆ NumPartImported

int NumPartImported

Definition at line 139 of file tree.h.

◆ Points

point_data* Points

Definition at line 127 of file tree.h.

◆ Recv_count

int* Recv_count

Definition at line 133 of file tree.h.

◆ Recv_offset

int* Recv_offset

Definition at line 134 of file tree.h.

◆ ResultIndexList

int* ResultIndexList

Definition at line 129 of file tree.h.

◆ Send_count

int* Send_count

Definition at line 132 of file tree.h.

◆ Send_offset

int* Send_offset

Definition at line 131 of file tree.h.

◆ StackToFetch

fetch_data* StackToFetch

Definition at line 178 of file tree.h.

◆ sum_NumForeignNodes

long long sum_NumForeignNodes

Definition at line 149 of file tree.h.

◆ sum_NumForeignPoints

long long sum_NumForeignPoints

Definition at line 150 of file tree.h.

◆ TopNodes

node* TopNodes

Definition at line 109 of file tree.h.

◆ Tp

partset* Tp

Definition at line 102 of file tree.h.

◆ TreeForeign_Nodes_offsets

ptrdiff_t* TreeForeign_Nodes_offsets

Definition at line 117 of file tree.h.

◆ TreeForeign_Points_offsets

ptrdiff_t* TreeForeign_Points_offsets

Definition at line 118 of file tree.h.

◆ TreeInfoHandle

int TreeInfoHandle

Definition at line 165 of file tree.h.

◆ TreeNextnode_offsets

ptrdiff_t* TreeNextnode_offsets

Definition at line 116 of file tree.h.

◆ TreeNodes_offsets

ptrdiff_t* TreeNodes_offsets

Definition at line 114 of file tree.h.

◆ TreeP_offsets

ptrdiff_t* TreeP_offsets

Definition at line 119 of file tree.h.

◆ TreePoints_offsets

ptrdiff_t* TreePoints_offsets

Definition at line 115 of file tree.h.

◆ TreePS_offsets

ptrdiff_t* TreePS_offsets

Definition at line 121 of file tree.h.

◆ TreeSharedMem_NTask

int TreeSharedMem_NTask

Definition at line 163 of file tree.h.

◆ TreeSharedMem_ThisTask

int TreeSharedMem_ThisTask

Definition at line 162 of file tree.h.

◆ TreeSharedMemBaseAddr

void** TreeSharedMemBaseAddr

Definition at line 123 of file tree.h.

◆ TreeSharedMemComm

MPI_Comm TreeSharedMemComm

Definition at line 161 of file tree.h.

◆ TreeSphP_offsets

ptrdiff_t* TreeSphP_offsets

Definition at line 120 of file tree.h.

◆ WorkStack

workstack_data* WorkStack

Definition at line 195 of file tree.h.


The documentation for this class was generated from the following files: