15#if defined(LIGHTCONE) && defined(LIGHTCONE_PARTICLES)
19#include "gadgetconfig.h"
21#include "../data/constants.h"
22#include "../data/dtypes.h"
23#include "../data/intposconvert.h"
24#include "../data/lightcone_particle_data.h"
25#include "../data/macros.h"
26#include "../data/mymalloc.h"
27#include "../data/particle_data.h"
28#include "../data/sph_particle_data.h"
29#include "../mpi_utils/mpi_utils.h"
30#include "../mpi_utils/setcomm.h"
31#include "../system/system.h"
32#include "../time_integration/timestep.h"
37 lcparticles(MPI_Comm comm) :
setcomm(comm) {}
48 typedef lightcone_particle_data pdata;
53 lightcone_particle_data *P;
63 int *HealPixTab_PartCount;
73 void allocate_memory(
void)
78 P = (lightcone_particle_data *)
Mem.mymalloc_movable_clear(&P,
"P", MaxPart *
sizeof(lightcone_particle_data));
81 void free_memory(
void) {
Mem.myfree(P); }
83 void reallocate_memory_maxpart(
int maxpartNew)
90 P = (lightcone_particle_data *)
Mem.myrealloc_movable(P, MaxPart *
sizeof(lightcone_particle_data));
98 void reallocate_memory_maxpartsph(
int maxpartNew)
103 bool TestIfAboveFillFactor(
int SpMaxPart)
105 int max_in[2] = {NumPart, SpMaxPart}, max_out[2];
106 MPI_Allreduce(max_in, max_out, 2, MPI_INT, MPI_MAX, Communicator);
117 static bool compare_ID(
const lightcone_particle_data &a,
const lightcone_particle_data &b) {
return a.ID.get() < b.ID.get(); }
119 static bool compare_ipnest(
const lightcone_particle_data &a,
const lightcone_particle_data &b) {
return a.ipnest < b.ipnest; }
121#ifdef REARRANGE_OPTION
122 static bool compare_TreeID_ID(
const lightcone_particle_data &a,
const lightcone_particle_data &b)
124 if(a.TreeID < b.TreeID)
127 if(a.TreeID > b.TreeID)
130 return a.ID.get() < b.ID.get();
134 void dump_particles(
void) {}
141 inline MyFloat get_Hsml(
int i) {
return 0; }
143 inline MyFloat get_DtHsml(
int i) {
return 0; }
145 inline MyFloat get_OldAcc(
int i) {
return 0; }
147 inline MyFloat get_Csnd(
int i) {
return 0; }
149 inline double get_utherm_from_entropy(
int i) {
return 0; }
151 inline int getTimeBinSynchronized(
int bin) {
return 1; }
153 void fill_active_gravity_list_with_all_particles(
void) {}
157 int *Head, *Len, *Next, *Tail, *MinIDTask;
160#if defined(LIGHTCONE_PARTICLES_GROUPS)
161 double *DistanceOrigin;
166 unsigned char Nonlocal : 2, MinIDChanged : 2, Marked : 2, Changed : 2;
171 void link_two_particles(
int target,
int j)
173 if(Head[target] != Head[j])
176 if(Len[Head[target]] > Len[Head[j]])
186 Next[Tail[Head[p]]] = Head[s];
188 Tail[Head[p]] = Tail[Head[s]];
190 Len[Head[p]] += Len[Head[s]];
192 if(MinID[Head[s]].get() < MinID[Head[p]].get())
194 MinID[Head[p]] = MinID[Head[s]];
195 MinIDTask[Head[p]] = MinIDTask[Head[s]];
198#if defined(LIGHTCONE_PARTICLES_GROUPS)
199 if(DistanceOrigin[Head[p]] < DistanceOrigin[Head[s]])
200 DistanceOrigin[Head[s]] = DistanceOrigin[Head[p]];
202 DistanceOrigin[Head[p]] = DistanceOrigin[Head[s]];
208 while((ss = Next[ss]) >= 0);
213 struct nearest_r2_data
global_data_all_processes All
#define LIGHTCONE_MAX_FILLFACTOR
void sumup_large_ints(int n, int *src, long long *res, MPI_Comm comm)