MP-Gadget  5.0.1.dev1-76bc7d4726-dirty
Classes | Typedefs | Functions
fof.h File Reference
#include "forcetree.h"
#include "utils/paramset.h"
#include "timestep.h"
#include "slotsmanager.h"
Include dependency graph for fof.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  BaseGroup
 
struct  Group
 
struct  FOFGroups
 

Typedefs

typedef struct FOFGroups FOFGroups
 

Functions

void set_fof_params (ParameterSet *ps)
 
void fof_init (double DMMeanSeparation)
 
FOFGroups fof_fof (DomainDecomp *ddecomp, const int StoreGrNr, MPI_Comm Comm)
 
void fof_finish (FOFGroups *fof)
 
void fof_seed (FOFGroups *fof, ActiveParticles *act, double atime, MPI_Comm Comm)
 
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)
 
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)
 

Typedef Documentation

◆ FOFGroups

typedef struct FOFGroups FOFGroups

Function Documentation

◆ fof_finish()

void fof_finish ( FOFGroups fof)

Definition at line 257 of file fof.c.

258 {
259  myfree(fof->Group);
260 
261  message(0, "Finished computing FoF groups. (presently allocated=%g MB)\n",
262  mymalloc_usedbytes() / (1024.0 * 1024.0));
263 
264  walltime_measure("/FOF/MISC");
265 
266  MPI_Type_free(&MPI_TYPE_GROUP);
267 }
void message(int where, const char *fmt,...)
Definition: endrun.c:175
static MPI_Datatype MPI_TYPE_GROUP
Definition: fof.c:142
#define mymalloc_usedbytes()
Definition: mymalloc.h:32
#define myfree(x)
Definition: mymalloc.h:19
struct Group * Group
Definition: fof.h:63
#define walltime_measure(name)
Definition: walltime.h:8

References FOFGroups::Group, message(), MPI_TYPE_GROUP, myfree, mymalloc_usedbytes, and walltime_measure.

Referenced by run(), runfof(), and test_fof().

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

◆ fof_fof()

FOFGroups fof_fof ( DomainDecomp ddecomp,
const int  StoreGrNr,
MPI_Comm  Comm 
)

Definition at line 151 of file fof.c.

152 {
153  int i;
154 
155  message(0, "Begin to compute FoF group catalogues. (allocated: %g MB)\n",
156  mymalloc_usedbytes() / (1024.0 * 1024.0));
157 
158  walltime_measure("/Misc");
159 
160  message(0, "Comoving linking length: %g\n", fof_params.FOFHaloComovingLinkingLength);
161 
162  struct fof_particle_list * HaloLabel = (struct fof_particle_list *) mymalloc("HaloLabel", PartManager->NumPart * sizeof(struct fof_particle_list));
163 
164  /* HaloLabel stores the MinID and MinIDTask of particles, this pair serves as a halo label. */
165  #pragma omp parallel for
166  for(i = 0; i < PartManager->NumPart; i++) {
167  HaloLabel[i].Pindex = i;
168  }
169 
170  /* We only need a tree containing primary linking particles only. No moments*/
171  ForceTree dmtree = {0};
172  force_tree_rebuild_mask(&dmtree, ddecomp, fof_params.FOFPrimaryLinkTypes, 0, NULL);
173 
174  /* Fill FOFP_List of primary */
175  fof_label_primary(HaloLabel, &dmtree, Comm);
176 
177  MPIU_Barrier(Comm);
178  message(0, "Group finding done.\n");
179  walltime_measure("/FOF/Primary");
180 
181  /* Fill FOFP_List of secondary */
182  fof_label_secondary(HaloLabel, &dmtree);
183  force_tree_free(&dmtree);
184 
185  MPIU_Barrier(Comm);
186  message(0, "Attached gas and star particles to nearest dm particles.\n");
187 
188  walltime_measure("/FOF/Secondary");
189 
190  /* sort HaloLabel according to MinID, because we need that for compiling catalogues */
192 
193  int NgroupsExt = 0;
194 
195  for(i = 0; i < PartManager->NumPart; i ++) {
196  if(i == 0 || HaloLabel[i].MinID != HaloLabel[i - 1].MinID) NgroupsExt ++;
197  }
198 
199  /* The first round is to eliminate groups that are too short. */
200  /* We create the smaller 'BaseGroup' data set for this. */
201  struct BaseGroup * base = (struct BaseGroup *) mymalloc("BaseGroup", sizeof(struct BaseGroup) * NgroupsExt);
202 
203  NgroupsExt = fof_compile_base(base, NgroupsExt, HaloLabel, Comm);
204 
205  MPIU_Barrier(Comm);
206  message(0, "Compiled local group data and catalogue.\n");
207 
208  walltime_measure("/FOF/Compile");
209 
210  fof_assign_grnr(base, NgroupsExt, Comm);
211 
212  /*Store the group number in the particle struct*/
213  if(StoreGrNr) {
214  #pragma omp parallel for
215  for(i = 0; i < PartManager->NumPart; i++)
216  P[i].GrNr = -1; /* will mark particles that are not in any group */
217 
218  int64_t start = 0;
219  for(i = 0; i < NgroupsExt; i++)
220  {
221  for(;start < PartManager->NumPart; start++) {
222  if (HaloLabel[start].MinID >= base[i].MinID)
223  break;
224  }
225 
226  for(;start < PartManager->NumPart; start++) {
227  if (HaloLabel[start].MinID != base[i].MinID)
228  break;
229  P[HaloLabel[start].Pindex].GrNr = base[i].GrNr;
230  }
231  }
232  }
233 
234  /*Initialise the Group object from the BaseGroup*/
235  FOFGroups fof;
236  MPI_Type_contiguous(sizeof(fof.Group[0]), MPI_BYTE, &MPI_TYPE_GROUP);
237  MPI_Type_commit(&MPI_TYPE_GROUP);
238 
239  fof.Group = fof_alloc_group(base, NgroupsExt);
240 
241  myfree(base);
242 
243  fof_compile_catalogue(&fof, NgroupsExt, HaloLabel, Comm);
244 
245  MPIU_Barrier(Comm);
246  message(0, "Finished FoF. Group properties are now allocated.. (presently allocated=%g MB)\n",
247  mymalloc_usedbytes() / (1024.0 * 1024.0));
248 
249  walltime_measure("/FOF/Prop");
250 
251  myfree(HaloLabel);
252 
253  return fof;
254 }
static void fof_compile_catalogue(FOFGroups *fof, const int NgroupsExt, struct fof_particle_list *HaloLabel, MPI_Comm Comm)
Definition: fof.c:835
static struct Group * fof_alloc_group(const struct BaseGroup *base, const int NgroupsExt)
Definition: fof.c:819
static int fof_compare_HaloLabel_MinID(const void *a, const void *b)
Definition: fof.c:1404
static int fof_compile_base(struct BaseGroup *base, int NgroupsExt, struct fof_particle_list *HaloLabel, MPI_Comm Comm)
Definition: fof.c:761
static void fof_label_secondary(struct fof_particle_list *HaloLabel, ForceTree *tree)
Definition: fof.c:1207
void fof_label_primary(struct fof_particle_list *HaloLabel, ForceTree *tree, MPI_Comm Comm)
Definition: fof.c:369
static void fof_assign_grnr(struct BaseGroup *base, const int NgroupsExt, MPI_Comm Comm)
Definition: fof.c:1062
struct FOFParams fof_params
void force_tree_rebuild_mask(ForceTree *tree, DomainDecomp *ddecomp, int mask, const int HybridNuGrav, const char *EmergencyOutputDir)
Definition: forcetree.c:161
void force_tree_free(ForceTree *tree)
Definition: forcetree.c:1409
#define mymalloc(name, size)
Definition: mymalloc.h:15
struct part_manager_type PartManager[1]
Definition: partmanager.c:11
#define P
Definition: partmanager.h:88
Definition: fof.h:13
MyIDType MinID
Definition: fof.h:18
int GrNr
Definition: fof.h:17
Definition: fof.h:62
double FOFHaloComovingLinkingLength
Definition: fof.c:43
int FOFPrimaryLinkTypes
Definition: fof.c:45
int Pindex
Definition: fof.c:94
MyIDType MinID
Definition: fof.c:92
#define MPIU_Barrier(comm)
Definition: system.h:103
#define qsort_openmp
Definition: test_exchange.c:14

References fof_alloc_group(), fof_assign_grnr(), fof_compare_HaloLabel_MinID(), fof_compile_base(), fof_compile_catalogue(), fof_label_primary(), fof_label_secondary(), fof_params, FOFParams::FOFHaloComovingLinkingLength, FOFParams::FOFPrimaryLinkTypes, force_tree_free(), force_tree_rebuild_mask(), BaseGroup::GrNr, FOFGroups::Group, message(), fof_particle_list::MinID, BaseGroup::MinID, MPI_TYPE_GROUP, MPIU_Barrier, myfree, mymalloc, mymalloc_usedbytes, part_manager_type::NumPart, P, PartManager, fof_particle_list::Pindex, qsort_openmp, and walltime_measure.

Referenced by run(), runfof(), and test_fof().

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

◆ fof_init()

void fof_init ( double  DMMeanSeparation)

Definition at line 66 of file fof.c.

67 {
69 }
double FOFHaloLinkingLength
Definition: fof.c:42

References fof_params, FOFParams::FOFHaloComovingLinkingLength, and FOFParams::FOFHaloLinkingLength.

Referenced by init().

Here is the caller graph for this function:

◆ fof_save_groups()

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 at line 1113 of file fof.c.

1114 {
1115  fof_save_particles(fof, OutputDir, FOFFileBase, num, fof_params.FOFSaveParticles, CP, atime, MassTable, MetalReturnOn, BlackholeOn, Comm);
1116 }
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
static Cosmology * CP
Definition: power.c:27
int FOFSaveParticles
Definition: fof.c:39

References CP, fof_params, fof_save_particles(), and FOFParams::FOFSaveParticles.

Referenced by run(), and runfof().

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

◆ fof_save_particles()

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 at line 32 of file fofpetaio.c.

32  {
33  int i;
34  struct IOTable FOFIOTable = {0};
35  char * fname = fastpm_strdup_printf("%s/%s_%03d", OutputDir, FOFFileBase, num);
36  message(0, "Saving particle groups into %s\n", fname);
37 
38  fof_register_io_blocks(MetalReturnOn, BlackholeOn, &FOFIOTable);
39  /* sort the groups according to group-number */
40  mpsort_mpi(fof->Group, fof->Ngroups, sizeof(struct Group),
41  fof_radix_Group_GrNr, 8, NULL, Comm);
42 
43  BigFile bf = {0};
44  if(0 != big_file_mpi_create(&bf, fname, Comm)) {
45  endrun(0, "Failed to open file at %s\n", fname);
46  }
47  myfree(fname);
48  struct conversions conv = {0};
49  conv.atime = atime;
50  conv.hubble = hubble_function(CP, atime);
51 
52  MPIU_Barrier(Comm);
53  fof_write_header(&bf, fof->TotNgroups, atime, MassTable, CP, Comm);
54 
55  for(i = 0; i < FOFIOTable.used; i ++) {
56  /* only process the particle blocks */
57  char blockname[128];
58  int ptype = FOFIOTable.ent[i].ptype;
59  BigArray array = {0};
60  if(ptype == PTYPE_FOF_GROUP) {
61  sprintf(blockname, "FOFGroups/%s", FOFIOTable.ent[i].name);
62  build_buffer_fof(fof, &array, &FOFIOTable.ent[i], &conv);
63  message(0, "Writing Block %s\n", blockname);
64 
65  petaio_save_block(&bf, blockname, &array, 1);
66  petaio_destroy_buffer(&array);
67  }
68  }
69  destroy_io_blocks(&FOFIOTable);
70  walltime_measure("/FOF/IO/WriteFOF");
71 
72  if(SaveParticles) {
73  struct IOTable IOTable = {0};
74  register_io_blocks(&IOTable, 1, MetalReturnOn);
75  struct part_manager_type halo_pman = {0};
76  struct slots_manager_type halo_sman = {0};
77  if(fof_distribute_particles(&halo_pman, &halo_sman, Comm)) {
78  myfree(halo_sman.Base);
79  myfree(halo_pman.Base);
81  return;
82  }
83 
84  int * selection = (int *) mymalloc("Selection", sizeof(int) * halo_pman.NumPart);
85 
86  int ptype_offset[6]={0};
87  int ptype_count[6]={0};
88  petaio_build_selection(selection, ptype_offset, ptype_count, halo_pman.Base, halo_pman.NumPart, NULL);
89 
90  walltime_measure("/FOF/IO/argind");
91 
92  for(i = 0; i < IOTable.used; i ++) {
93  /* only process the particle blocks */
94  char blockname[128];
95  int ptype = IOTable.ent[i].ptype;
96  BigArray array = {0};
97  if(ptype < 6 && ptype >= 0) {
98  sprintf(blockname, "%d/%s", ptype, IOTable.ent[i].name);
99  petaio_build_buffer(&array, &IOTable.ent[i], selection + ptype_offset[ptype], ptype_count[ptype], halo_pman.Base, &halo_sman, &conv);
100 
101  message(0, "Writing Block %s\n", blockname);
102 
103  petaio_save_block(&bf, blockname, &array, 1);
104  petaio_destroy_buffer(&array);
105  }
106  }
107  myfree(selection);
108  myfree(halo_sman.Base);
109  myfree(halo_pman.Base);
110  walltime_measure("/FOF/IO/WriteParticles");
112  }
113 
114  big_file_mpi_close(&bf, Comm);
115 
116  message(0, "Group catalogues saved.\n");
117 }
double hubble_function(const Cosmology *CP, double a)
Definition: cosmology.c:58
void endrun(int where, const char *fmt,...)
Definition: endrun.c:147
static void build_buffer_fof(FOFGroups *fof, BigArray *array, IOTableEntry *ent, struct conversions *conv)
Definition: fofpetaio.c:333
static int fof_distribute_particles(struct part_manager_type *halo_pman, struct slots_manager_type *halo_sman, MPI_Comm Comm)
Definition: fofpetaio.c:249
static void fof_write_header(BigFile *bf, int64_t TotNgroups, const double atime, const double *MassTable, Cosmology *CP, MPI_Comm Comm)
Definition: fofpetaio.c:347
static void fof_register_io_blocks(int MetalReturnOn, int BlackHoleOn, struct IOTable *IOTable)
Definition: fofpetaio.c:468
static void fof_radix_Group_GrNr(const void *a, void *radix, void *arg)
Definition: fofpetaio.c:26
#define mpsort_mpi(base, nmemb, elsize, radix, rsize, arg, comm)
Definition: mpsort.h:26
void petaio_destroy_buffer(BigArray *array)
Definition: petaio.c:557
void destroy_io_blocks(struct IOTable *IOTable)
Definition: petaio.c:1034
void register_io_blocks(struct IOTable *IOTable, int WriteGroupID, int MetalReturnOn)
Definition: petaio.c:909
void petaio_build_selection(int *selection, int *ptype_offset, int *ptype_count, const struct particle_data *Parts, const int NumPart, int(*select_func)(int i, const struct particle_data *Parts))
Definition: petaio.c:113
void petaio_build_buffer(BigArray *array, IOTableEntry *ent, const int *selection, const int NumSelection, struct particle_data *Parts, struct slots_manager_type *SlotsManager, struct conversions *conv)
Definition: petaio.c:521
void petaio_save_block(BigFile *bf, const char *blockname, BigArray *array, int verbose)
Definition: petaio.c:587
#define PTYPE_FOF_GROUP
Definition: petaio.h:66
char * fastpm_strdup_printf(const char *fmt,...)
Definition: string.c:41
int Ngroups
Definition: fof.h:66
int64_t TotNgroups
Definition: fof.h:67
Definition: fof.h:26
int ptype
Definition: petaio.h:52
char name[64]
Definition: petaio.h:51
Definition: petaio.h:60
int used
Definition: petaio.h:62
IOTableEntry * ent
Definition: petaio.h:61
double atime
Definition: petaio.h:41
double hubble
Definition: petaio.h:42
struct particle_data * Base
Definition: partmanager.h:74
static enum TransferType ptype
Definition: zeldovich.c:146

References conversions::atime, part_manager_type::Base, slots_manager_type::Base, build_buffer_fof(), CP, destroy_io_blocks(), endrun(), IOTable::ent, fastpm_strdup_printf(), fof_distribute_particles(), fof_radix_Group_GrNr(), fof_register_io_blocks(), fof_write_header(), FOFGroups::Group, conversions::hubble, hubble_function(), message(), MPIU_Barrier, mpsort_mpi, myfree, mymalloc, IOTableEntry::name, FOFGroups::Ngroups, part_manager_type::NumPart, petaio_build_buffer(), petaio_build_selection(), petaio_destroy_buffer(), petaio_save_block(), IOTableEntry::ptype, ptype, PTYPE_FOF_GROUP, register_io_blocks(), FOFGroups::TotNgroups, IOTable::used, and walltime_measure.

Referenced by fof_save_groups().

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

◆ fof_seed()

void fof_seed ( FOFGroups fof,
ActiveParticles act,
double  atime,
MPI_Comm  Comm 
)

Definition at line 1290 of file fof.c.

1291 {
1292  int i, j, n, ntot;
1293 
1294  int NTask;
1295  MPI_Comm_size(Comm, &NTask);
1296 
1297  char * Marked = (char *) mymalloc2("SeedMark", fof->Ngroups);
1298 
1299  int Nexport = 0;
1300  #pragma omp parallel for reduction(+:Nexport)
1301  for(i = 0; i < fof->Ngroups; i++)
1302  {
1303  Marked[i] =
1305  && (fof->Group[i].MassType[4] >= fof_params.MinMStarForNewSeed)
1306  && (fof->Group[i].LenType[5] == 0)
1307  && (fof->Group[i].seed_index >= 0);
1308 
1309  if(Marked[i]) Nexport ++;
1310  }
1311  struct Group * ExportGroups = (struct Group *) mymalloc("Export", sizeof(fof->Group[0]) * Nexport);
1312  j = 0;
1313  for(i = 0; i < fof->Ngroups; i ++) {
1314  if(Marked[i]) {
1315  ExportGroups[j] = fof->Group[i];
1316  j++;
1317  }
1318  }
1319  myfree(Marked);
1320 
1321  qsort_openmp(ExportGroups, Nexport, sizeof(ExportGroups[0]), cmp_seed_task);
1322 
1323  int * Send_count = ta_malloc("Send_count", int, NTask);
1324  int * Recv_count = ta_malloc("Recv_count", int, NTask);
1325 
1326  memset(Send_count, 0, NTask * sizeof(int));
1327  for(i = 0; i < Nexport; i++) {
1328  Send_count[ExportGroups[i].seed_task]++;
1329  }
1330 
1331  MPI_Alltoall(Send_count, 1, MPI_INT, Recv_count, 1, MPI_INT, Comm);
1332 
1333  int Nimport = 0;
1334 
1335  for(j = 0; j < NTask; j++)
1336  {
1337  Nimport += Recv_count[j];
1338  }
1339 
1340  struct Group * ImportGroups = (struct Group *)
1341  mymalloc2("ImportGroups", Nimport * sizeof(struct Group));
1342 
1343  MPI_Alltoallv_smart(ExportGroups, Send_count, NULL, MPI_TYPE_GROUP,
1344  ImportGroups, Recv_count, NULL, MPI_TYPE_GROUP,
1345  Comm);
1346 
1347  myfree(ExportGroups);
1348  ta_free(Recv_count);
1349  ta_free(Send_count);
1350 
1351  MPI_Allreduce(&Nimport, &ntot, 1, MPI_INT, MPI_SUM, Comm);
1352 
1353  message(0, "Making %d new black hole particles.\n", ntot);
1354 
1355  /* Do we have enough black hole slots to create this many black holes?
1356  * If not, allocate more slots. */
1357  if(Nimport + SlotsManager->info[5].size > SlotsManager->info[5].maxsize)
1358  {
1359  int *ActiveParticle_tmp=NULL;
1360  /* This is only called on a PM step, so the condition should never be true*/
1361  if(act->ActiveParticle) {
1362  ActiveParticle_tmp = (int *) mymalloc2("ActiveParticle_tmp", act->NumActiveParticle * sizeof(int));
1363  memmove(ActiveParticle_tmp, act->ActiveParticle, act->NumActiveParticle * sizeof(int));
1364  myfree(act->ActiveParticle);
1365  }
1366 
1367  /*Now we can extend the slots! */
1368  int64_t atleast[6];
1369  int64_t i;
1370  for(i = 0; i < 6; i++)
1371  atleast[i] = SlotsManager->info[i].maxsize;
1372  atleast[5] += ntot*1.1;
1373  slots_reserve(1, atleast, SlotsManager);
1374 
1375  /*And now we need our memory back in the right place*/
1376  if(ActiveParticle_tmp) {
1377  act->ActiveParticle = (int *) mymalloc("ActiveParticle", sizeof(int)*(act->NumActiveParticle + PartManager->MaxPart - PartManager->NumPart));
1378  memmove(act->ActiveParticle, ActiveParticle_tmp, act->NumActiveParticle * sizeof(int));
1379  myfree(ActiveParticle_tmp);
1380  }
1381  }
1382 
1383  int ThisTask;
1384  MPI_Comm_rank(Comm, &ThisTask);
1385 
1386  for(n = 0; n < Nimport; n++)
1387  {
1388  fof_seed_make_one(&ImportGroups[n], ThisTask, atime);
1389  }
1390 
1391  myfree(ImportGroups);
1392 
1393  walltime_measure("/FOF/Seeding");
1394 }
static void fof_seed_make_one(struct Group *g, int ThisTask, const double atime)
Definition: fof.c:1396
static int cmp_seed_task(const void *c1, const void *c2)
Definition: fof.c:1282
#define ta_malloc(name, type, nele)
Definition: mymalloc.h:25
#define ta_free(p)
Definition: mymalloc.h:28
#define mymalloc2(name, size)
Definition: mymalloc.h:16
size_t slots_reserve(int where, int64_t atleast[6], struct slots_manager_type *sman)
Definition: slotsmanager.c:475
struct slots_manager_type SlotsManager[1]
Definition: slotsmanager.c:7
int * ActiveParticle
Definition: timestep.h:13
int64_t NumActiveParticle
Definition: timestep.h:12
double MinFoFMassForNewSeed
Definition: fof.c:40
double MinMStarForNewSeed
Definition: fof.c:41
int seed_index
Definition: fof.h:56
double MassType[6]
Definition: fof.h:30
int seed_task
Definition: fof.h:57
int LenType[6]
Definition: fof.h:29
double Mass
Definition: fof.h:31
int64_t maxsize
Definition: slotsmanager.h:11
int64_t size
Definition: slotsmanager.h:12
struct slot_info info[6]
Definition: slotsmanager.h:112
int MPI_Alltoallv_smart(void *sendbuf, int *sendcnts, int *sdispls, MPI_Datatype sendtype, void *recvbuf, int *recvcnts, int *rdispls, MPI_Datatype recvtype, MPI_Comm comm)
Definition: system.c:278
int ThisTask
Definition: test_exchange.c:23
int NTask
Definition: test_exchange.c:23

References ActiveParticles::ActiveParticle, cmp_seed_task(), fof_params, fof_seed_make_one(), FOFGroups::Group, slots_manager_type::info, Group::LenType, Group::Mass, Group::MassType, part_manager_type::MaxPart, slot_info::maxsize, message(), FOFParams::MinFoFMassForNewSeed, FOFParams::MinMStarForNewSeed, MPI_Alltoallv_smart(), MPI_TYPE_GROUP, myfree, mymalloc, mymalloc2, FOFGroups::Ngroups, NTask, ActiveParticles::NumActiveParticle, part_manager_type::NumPart, PartManager, qsort_openmp, Group::seed_index, Group::seed_task, slot_info::size, slots_reserve(), SlotsManager, ta_free, ta_malloc, ThisTask, and walltime_measure.

Referenced by run().

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

◆ set_fof_params()

void set_fof_params ( ParameterSet ps)

Definition at line 50 of file fof.c.

51 {
52  int ThisTask;
53  MPI_Comm_rank(MPI_COMM_WORLD, &ThisTask);
54  if(ThisTask == 0) {
55  fof_params.FOFSaveParticles = param_get_int(ps, "FOFSaveParticles");
56  fof_params.FOFHaloLinkingLength = param_get_double(ps, "FOFHaloLinkingLength");
57  fof_params.FOFHaloMinLength = param_get_int(ps, "FOFHaloMinLength");
58  fof_params.MinFoFMassForNewSeed = param_get_double(ps, "MinFoFMassForNewSeed");
59  fof_params.MinMStarForNewSeed = param_get_double(ps, "MinMStarForNewSeed");
60  fof_params.FOFPrimaryLinkTypes = param_get_int(ps, "FOFPrimaryLinkTypes");
61  fof_params.FOFSecondaryLinkTypes = param_get_int(ps, "FOFSecondaryLinkTypes");
62  }
63  MPI_Bcast(&fof_params, sizeof(struct FOFParams), MPI_BYTE, 0, MPI_COMM_WORLD);
64 }
double param_get_double(ParameterSet *ps, const char *name)
Definition: paramset.c:336
int param_get_int(ParameterSet *ps, const char *name)
Definition: paramset.c:368
Definition: fof.c:38
int FOFSecondaryLinkTypes
Definition: fof.c:46
int FOFHaloMinLength
Definition: fof.c:44

References fof_params, FOFParams::FOFHaloLinkingLength, FOFParams::FOFHaloMinLength, FOFParams::FOFPrimaryLinkTypes, FOFParams::FOFSaveParticles, FOFParams::FOFSecondaryLinkTypes, FOFParams::MinFoFMassForNewSeed, FOFParams::MinMStarForNewSeed, param_get_double(), param_get_int(), and ThisTask.

Referenced by read_parameter_file().

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