MP-Gadget  5.0.1.dev1-76bc7d4726-dirty
fof.h
Go to the documentation of this file.
1 #ifndef FOF_H
2 #define FOF_H
3 
4 #include "forcetree.h"
5 #include "utils/paramset.h"
6 #include "timestep.h"
7 #include "slotsmanager.h"
8 
10 
11 void fof_init(double DMMeanSeparation);
12 
13 struct BaseGroup {
16  int Length;
17  int GrNr;
19  int MinIDTask;
20  /* Note: this is in the translated frame,
21  * subtract CurrentParticleOffset to get the physical frame.*/
22  float FirstPos[3];
23 };
24 
25 struct Group
26 {
27  struct BaseGroup base;
28  int Length;
29  int LenType[6];
30  double MassType[6];
31  double Mass;
32  /* Note: this is in the translated frame,
33  * subtract CurrentParticleOffset to get the physical frame.*/
34  double CM[3];
35  double Vel[3];
36 
37  double Imom[3][3]; /* sum M r_j r_k */
38  double Jmom[3]; /* sum M R_i x V_i */
39 
40  double Sfr;
41  /* Metal masses. These are the total mass in metals in the gas and stars respectively,
42  * and then the species specific breakdowns for stars and gas.
43  * You can obtain metallicities by dividing them by the type-specific masses.*/
44  double GasMetalMass;
48 
49  /* Number of gas particles in the halo which have had helium ionization happen to them*/
51  /*These are used for storing black hole properties*/
52  double BH_Mass;
53  double BH_Mdot;
54  double MaxDens;
55 
57  int seed_task;
58 };
59 
60 /* Structure to hold all allocated FOF groups*/
61 typedef struct FOFGroups
62 {
63  struct Group * Group;
64  /* Ngroups is maximally NumPart,
65  * so can be 32-bit*/
66  int Ngroups;
67  int64_t TotNgroups;
69 
70 /* Computes the Group structure, saved as a global array below.
71  * If StoreGrNr is true, this writes to GrNr in partmanager.h.
72  * Note this over-writes PeanoKey and means the tree cannot be rebuilt.*/
73 FOFGroups fof_fof(DomainDecomp * ddecomp, const int StoreGrNr, MPI_Comm Comm);
74 
75 /*Frees the Group structure*/
76 void fof_finish(FOFGroups * fof);
77 
78 /*Uses the Group structure to seed blackholes.
79  * The active particle struct is used only because we may need to reallocate it. */
80 void fof_seed(FOFGroups * fof, ActiveParticles * act, double atime, MPI_Comm Comm);
81 
82 /*Saves the Group structure to disc.*/
83 void fof_save_groups(FOFGroups * fof, const char * OutputDir, const char * FOFFileBase, int num, Cosmology * CP, double atime, const double * MassTable, int MetalReturnOn, int BlackholeOn, MPI_Comm Comm);
84 /* Does the actual saving of the particles*/
85 void fof_save_particles(FOFGroups * fof, const char * OutputDir, const char * FOFFileBase, int num, int SaveParticles, Cosmology * CP, double atime, const double * MassTable, int MetalReturnOn, int BlackholeOn, MPI_Comm Comm);
86 
87 #endif
void fof_save_groups(FOFGroups *fof, const char *OutputDir, const char *FOFFileBase, int num, Cosmology *CP, double atime, const double *MassTable, int MetalReturnOn, int BlackholeOn, MPI_Comm Comm)
Definition: fof.c:1113
struct FOFGroups FOFGroups
void set_fof_params(ParameterSet *ps)
Definition: fof.c:50
void fof_init(double DMMeanSeparation)
Definition: fof.c:66
void fof_save_particles(FOFGroups *fof, const char *OutputDir, const char *FOFFileBase, int num, int SaveParticles, Cosmology *CP, double atime, const double *MassTable, int MetalReturnOn, int BlackholeOn, MPI_Comm Comm)
Definition: fofpetaio.c:32
void fof_finish(FOFGroups *fof)
Definition: fof.c:257
void fof_seed(FOFGroups *fof, ActiveParticles *act, double atime, MPI_Comm Comm)
Definition: fof.c:1290
FOFGroups fof_fof(DomainDecomp *ddecomp, const int StoreGrNr, MPI_Comm Comm)
Definition: fof.c:151
static Cosmology * CP
Definition: power.c:27
#define NMETALS
Definition: slotsmanager.h:60
Definition: fof.h:13
MyIDType MinID
Definition: fof.h:18
int Length
Definition: fof.h:16
float FirstPos[3]
Definition: fof.h:22
int OriginalTask
Definition: fof.h:14
int GrNr
Definition: fof.h:17
int OriginalIndex
Definition: fof.h:15
int MinIDTask
Definition: fof.h:19
Definition: fof.h:62
struct Group * Group
Definition: fof.h:63
int Ngroups
Definition: fof.h:66
int64_t TotNgroups
Definition: fof.h:67
Definition: fof.h:26
double Sfr
Definition: fof.h:40
struct BaseGroup base
Definition: fof.h:27
double MaxDens
Definition: fof.h:54
double GasMetalMass
Definition: fof.h:44
float GasMetalElemMass[NMETALS]
Definition: fof.h:47
double StellarMetalMass
Definition: fof.h:45
double Imom[3][3]
Definition: fof.h:37
double BH_Mdot
Definition: fof.h:53
int seed_index
Definition: fof.h:56
double CM[3]
Definition: fof.h:34
int Length
Definition: fof.h:28
double Jmom[3]
Definition: fof.h:38
double MassType[6]
Definition: fof.h:30
float MassHeIonized
Definition: fof.h:50
double BH_Mass
Definition: fof.h:52
float StellarMetalElemMass[NMETALS]
Definition: fof.h:46
int seed_task
Definition: fof.h:57
int LenType[6]
Definition: fof.h:29
double Vel[3]
Definition: fof.h:35
double Mass
Definition: fof.h:31
uint64_t MyIDType
Definition: types.h:10