GADGET-4
mmparticles.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 MMPART_H
13#define MMPART_H
14
15/* mass map particle */
16
17#if defined(LIGHTCONE) && defined(LIGHTCONE_MASSMAPS)
18
19#include <math.h>
20
21#include "../data/constants.h"
22#include "../data/dtypes.h"
23#include "../data/intposconvert.h"
24#include "../data/lightcone_massmap_data.h"
25#include "../data/macros.h"
26#include "../data/mymalloc.h"
27#include "../mpi_utils/setcomm.h"
28#include "../system/system.h"
29#include "../time_integration/timestep.h"
30#include "gadgetconfig.h"
31
32class mmparticles : public setcomm
33{
34 public:
35 mmparticles(MPI_Comm comm) : setcomm(comm) {}
36
37 int NumPart;
38 int MaxPart;
40 int Npix; /* total number of pixels of Healpix tessellation of lightcone */
41 int FirstPix;
42 int NpixLoc;
43
44 lightcone_massmap_data *P;
46 void allocate_memory(void)
47 {
48 P = (lightcone_massmap_data *)Mem.mymalloc_movable_clear(&P, "P", MaxPart * sizeof(lightcone_massmap_data));
49 }
50
51 void reallocate_memory_maxpart(int maxpartNew)
52 {
53 MaxPart = maxpartNew;
54
55 P = (lightcone_massmap_data *)Mem.myrealloc_movable(P, MaxPart * sizeof(lightcone_massmap_data));
56
57 if(NumPart > MaxPart)
58 Terminate("NumPart=%d > MaxPart=%d", NumPart, MaxPart);
59 }
60};
61
62#endif
63
64#endif
#define Terminate(...)
Definition: macros.h:15
memory Mem
Definition: main.cc:44