GADGET-4
gwalk.h
Go to the documentation of this file.
1
/*******************************************************************************
2
* \copyright This file is part of the GADGET4 N-body/SPH code developed
3
* \copyright by Volker Springel. Copyright (C) 2014-2020 by Volker Springel
4
* \copyright (vspringel@mpa-garching.mpg.de) and all contributing authors.
5
*******************************************************************************/
6
12
#ifndef GRAVTREE_WALK_H
13
#define GRAVTREE_WALK_H
14
15
#include "../mpi_utils/shared_mem_handler.h"
16
17
class
gwalk
:
public
gravtree
<simparticles>
18
{
19
public
:
20
void
gravity_tree
(
int
timebin);
21
22
private
:
23
long
long
interactioncountPP;
24
long
long
interactioncountPN;
25
26
MyReal
theta2;
27
MyReal
thetamax2;
28
MyReal
errTolForceAcc;
29
30
#ifdef PRESERVE_SHMEM_BINARY_INVARIANCE
31
bool
skip_actual_force_computation;
32
#endif
33
34
struct
pinfo
35
{
36
MyIntPosType
*intpos;
37
MyReal
aold;
38
MyReal
h_i;
39
int
Type;
40
#if NSOFTCLASSES > 1
41
int
SofteningClass;
42
#endif
43
#if defined(PMGRID) && defined(PLACEHIGHRESREGION)
44
int
InsideOutsideFlag;
45
#endif
46
47
vector<MyFloat>
*acc;
48
MyFloat
*pot;
49
int
*GravCost;
50
};
51
52
inline
int
get_pinfo(
int
i, pinfo &pdat)
53
{
54
int
ptype;
55
56
if
(i < Tp->NumPart)
57
{
58
ptype =
NODE_TYPE_LOCAL_PARTICLE
;
59
60
pdat.intpos =
Tp
->
P
[i].
IntPos
;
61
62
pdat.Type =
Tp
->
P
[i].
getType
();
63
#if NSOFTCLASSES > 1
64
pdat.SofteningClass =
Tp
->
P
[i].
getSofteningClass
();
65
#endif
66
pdat.aold =
Tp
->
P
[i].
OldAcc
;
67
#if defined(PMGRID) && defined(PLACEHIGHRESREGION)
68
pdat.InsideOutsideFlag =
Tp
->
P
[i].InsideOutsideFlag;
69
#endif
70
71
pdat.acc = &
Tp
->
P
[i].
GravAccel
;
72
#ifdef EVALPOTENTIAL
73
pdat.pot = &
Tp
->
P
[i].Potential;
74
#endif
75
pdat.
GravCost
= &
Tp
->
P
[i].
GravCost
;
76
}
77
else
78
{
79
ptype =
NODE_TYPE_TREEPOINT_PARTICLE
;
80
81
int
n = i -
ImportedNodeOffset
;
82
83
pdat.intpos =
Points
[n].
IntPos
;
84
85
pdat.Type =
Points
[n].
Type
;
86
#if NSOFTCLASSES > 1
87
pdat.SofteningClass =
Points
[n].
SofteningClass
;
88
#endif
89
pdat.aold =
Points
[n].
OldAcc
;
90
#if defined(PMGRID) && defined(PLACEHIGHRESREGION)
91
pdat.InsideOutsideFlag =
Points
[n].InsideOutsideFlag;
92
#endif
93
94
int
idx =
ResultIndexList
[n];
95
pdat.acc = &
ResultsActiveImported
[idx].GravAccel;
96
#ifdef EVALPOTENTIAL
97
pdat.pot = &
ResultsActiveImported
[idx].Potential;
98
#endif
99
pdat.GravCost = &
ResultsActiveImported
[idx].GravCost;
100
}
101
102
#if NSOFTCLASSES > 1
103
pdat.h_i =
All
.
ForceSoftening
[pdat.SofteningClass];
104
#else
105
pdat.h_i =
All
.
ForceSoftening
[0];
106
#endif
107
108
return
ptype;
109
}
110
111
inline
void
gwalk_open_node(
const
pinfo &pdat,
int
i,
char
ptype,
gravnode
*nop,
int
mintopleafnode,
int
committed);
112
void
gravity_force_interact(
const
pinfo &pdat,
int
i,
int
no,
char
ptype,
char
no_type,
unsigned
char
shmrank,
int
mintopleafnode,
113
int
committed);
114
115
inline
int
evaluate_particle_node_opening_criterion_and_interaction(
const
pinfo &pdat,
gravnode
*nop);
116
inline
void
evaluate_particle_particle_interaction(
const
pinfo &pdat,
const
int
no,
const
char
jtype,
int
no_task);
117
};
118
119
#endif
All
global_data_all_processes All
Definition:
main.cc:40
gravtree
Definition:
gravtree.h:205
gravtree< simparticles >::ResultsActiveImported
resultsactiveimported_data * ResultsActiveImported
Definition:
gravtree.h:293
gwalk
Definition:
gwalk.h:18
gwalk::gravity_tree
void gravity_tree(int timebin)
This function computes the gravitational forces for all active particles.
Definition:
gwalk.cc:600
simparticles::P
particle_data * P
Definition:
simparticles.h:54
tree< gravnode, simparticles, gravpoint_data, foreign_gravpoint_data >::Points
gravpoint_data * Points
Definition:
tree.h:127
tree< gravnode, simparticles, gravpoint_data, foreign_gravpoint_data >::Tp
simparticles * Tp
Definition:
tree.h:102
tree< gravnode, simparticles, gravpoint_data, foreign_gravpoint_data >::ResultIndexList
int * ResultIndexList
Definition:
tree.h:129
tree< gravnode, simparticles, gravpoint_data, foreign_gravpoint_data >::ImportedNodeOffset
int ImportedNodeOffset
Definition:
tree.h:157
vector
Definition:
symtensors.h:104
MyFloat
float MyFloat
Definition:
dtypes.h:86
MyIntPosType
uint32_t MyIntPosType
Definition:
dtypes.h:35
MyReal
double MyReal
Definition:
dtypes.h:82
NODE_TYPE_TREEPOINT_PARTICLE
#define NODE_TYPE_TREEPOINT_PARTICLE
Definition:
gravtree.h:30
NODE_TYPE_LOCAL_PARTICLE
#define NODE_TYPE_LOCAL_PARTICLE
Definition:
gravtree.h:29
global_data_all_processes::ForceSoftening
double ForceSoftening[NSOFTCLASSES+NSOFTCLASSES_HYDRO+2]
Definition:
allvars.h:258
gravnode
Definition:
gravtree.h:64
gravpoint_data::Type
unsigned char Type
Definition:
gravtree.h:107
gravpoint_data::SofteningClass
unsigned char SofteningClass
Definition:
gravtree.h:109
gravpoint_data::OldAcc
float OldAcc
Definition:
gravtree.h:104
gravpoint_data::IntPos
MyIntPosType IntPos[3]
Definition:
gravtree.h:102
particle_data::getSofteningClass
unsigned char getSofteningClass(void)
Definition:
particle_data.h:196
particle_data::GravCost
int GravCost
Definition:
particle_data.h:62
particle_data::getType
unsigned char getType(void)
Definition:
particle_data.h:140
particle_data::OldAcc
float OldAcc
Definition:
particle_data.h:61
particle_data::GravAccel
vector< MyFloat > GravAccel
Definition:
particle_data.h:55
particle_data::IntPos
MyIntPosType IntPos[3]
Definition:
particle_data.h:53
src
gravtree
gwalk.h
Generated by
1.9.2