MP-Gadget  5.0.1.dev1-76bc7d4726-dirty
Classes | Macros | Functions
gravshort.h File Reference
#include "partmanager.h"
#include "treewalk.h"
#include "gravity.h"
Include dependency graph for gravshort.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  TreeWalkNgbIterGravShort
 
struct  TreeWalkQueryGravShort
 
struct  TreeWalkResultGravShort
 
struct  GravShortPriv
 

Macros

#define GRAV_GET_PRIV(tw)   ((struct GravShortPriv *) ((tw)->priv))
 

Functions

static void grav_short_postprocess (int i, TreeWalk *tw)
 
static void grav_short_copy (int place, TreeWalkQueryGravShort *input, TreeWalk *tw)
 
static void grav_short_reduce (int place, TreeWalkResultGravShort *result, enum TreeWalkReduceMode mode, TreeWalk *tw)
 

Macro Definition Documentation

◆ GRAV_GET_PRIV

#define GRAV_GET_PRIV (   tw)    ((struct GravShortPriv *) ((tw)->priv))

Definition at line 55 of file gravshort.h.

Function Documentation

◆ grav_short_copy()

static void grav_short_copy ( int  place,
TreeWalkQueryGravShort input,
TreeWalk tw 
)
static

Definition at line 74 of file gravshort.h.

75 {
76  input->Soft = FORCE_SOFTENING(place, P[place].Type);
77  /*Compute old acceleration before we over-write things*/
78  double aold=0;
79  int i;
80  for(i = 0; i < 3; i++) {
81  double ax = P[place].GravAccel[i] + P[place].GravPM[i];
82  aold += ax*ax;
83  }
84 
85  input->OldAcc = sqrt(aold)/GRAV_GET_PRIV(tw)->G;
86 
87 }
double FORCE_SOFTENING(int i, int type)
#define GRAV_GET_PRIV(tw)
Definition: gravshort.h:55
#define P
Definition: partmanager.h:88

References FORCE_SOFTENING(), GRAV_GET_PRIV, TreeWalkQueryGravShort::OldAcc, P, and TreeWalkQueryGravShort::Soft.

Referenced by grav_short_pair(), and grav_short_tree().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ grav_short_postprocess()

static void grav_short_postprocess ( int  i,
TreeWalk tw 
)
static

Definition at line 58 of file gravshort.h.

59 {
60  double G = GRAV_GET_PRIV(tw)->G;
61  P[i].GravAccel[0] *= G;
62  P[i].GravAccel[1] *= G;
63  P[i].GravAccel[2] *= G;
64  /* calculate the potential */
65  /* remove self-potential */
66  P[i].Potential += P[i].Mass / (FORCE_SOFTENING(i, P[i].Type) / 2.8);
67 
68  P[i].Potential -= 2.8372975 * pow(P[i].Mass, 2.0 / 3) * GRAV_GET_PRIV(tw)->cbrtrho0;
69 
70  P[i].Potential *= G;
71 }
static const double G
Definition: test_gravity.c:35

References FORCE_SOFTENING(), G, GRAV_GET_PRIV, and P.

Referenced by grav_short_pair(), and grav_short_tree().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ grav_short_reduce()

static void grav_short_reduce ( int  place,
TreeWalkResultGravShort result,
enum TreeWalkReduceMode  mode,
TreeWalk tw 
)
static

Definition at line 89 of file gravshort.h.

90 {
91  int k;
92  for(k = 0; k < 3; k++)
93  TREEWALK_REDUCE(P[place].GravAccel[k], result->Acc[k]);
94 
95  TREEWALK_REDUCE(P[place].Potential, result->Potential);
96 }
#define TREEWALK_REDUCE(A, B)
Definition: treewalk.h:189

References TreeWalkResultGravShort::Acc, P, TreeWalkResultGravShort::Potential, and TREEWALK_REDUCE.

Referenced by grav_short_pair(), and grav_short_tree().

Here is the caller graph for this function: