Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Volker Springel
Gadget4
Commits
6abe36fa
Commit
6abe36fa
authored
Jun 15, 2021
by
Volker Springel
Browse files
fix compilation problem when LIGHTCONE_PARTICLES is used without MERGERTREE
parent
829c5113
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/lightcone/lightcone_particle_io.cc
View file @
6abe36fa
...
...
@@ -41,14 +41,20 @@
* For init_field( arguments read the documentation of init_field(.
* Don't forget to add the new IO_FLAG to io_private.h
*/
#ifdef MERGERTREE
lightcone_particle_io
::
lightcone_particle_io
(
lcparticles
*
Lp_ptr
,
lightcone
*
LightCone_ptr
,
mergertree
*
MergerTree_ptr
,
MPI_Comm
comm
,
int
format
)
:
IO_Def
(
comm
,
format
)
#else
lightcone_particle_io
::
lightcone_particle_io
(
lcparticles
*
Lp_ptr
,
lightcone
*
LightCone_ptr
,
MPI_Comm
comm
,
int
format
)
:
IO_Def
(
comm
,
format
)
#endif
{
Lp
=
Lp_ptr
;
LightCone
=
LightCone_ptr
;
Lp
=
Lp_ptr
;
LightCone
=
LightCone_ptr
;
#ifdef MERGERTREE
MergerTree
=
MergerTree_ptr
;
#endif
this
->
N_IO_Fields
=
0
;
this
->
N_DataGroups
=
NTYPES
+
2
;
...
...
@@ -113,12 +119,14 @@ lightcone_particle_io::lightcone_particle_io(lcparticles *Lp_ptr, lightcone *Lig
1
,
0.
,
0.
,
0.
,
0.
,
1.
,
All
.
UnitVelocity_in_cm_per_s
);
#endif
#ifdef MERGERTREE
init_field
(
"MTRL"
,
"ParticleCount"
,
MEM_INT
,
FILE_INT
,
SKIP_ON_READ
,
1
,
A_TT
,
&
MergerTree
->
TreeTable
[
0
].
HaloCount
,
NULL
,
TREETABLE
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
true
);
init_field
(
"MTRS"
,
"ParticleFirst"
,
MEM_INT64
,
FILE_INT64
,
SKIP_ON_READ
,
1
,
A_TT
,
&
MergerTree
->
TreeTable
[
0
].
FirstHalo
,
NULL
,
TREETABLE
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
true
);
init_field
(
"MTRI"
,
"TreeID"
,
MEM_INT64
,
FILE_INT64
,
SKIP_ON_READ
,
1
,
A_TT
,
&
MergerTree
->
TreeTable
[
0
].
TreeID
,
NULL
,
TREETABLE
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
true
);
#endif
init_field
(
"HPHT"
,
"ParticleCount"
,
MEM_INT
,
FILE_INT
,
SKIP_ON_READ
,
1
,
A_MM
,
&
Lp
->
HealPixTab_PartCount
[
0
],
NULL
,
HEALPIXTAB
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
true
);
...
...
@@ -268,7 +276,12 @@ void lightcone_particle_io::fill_file_header(int writeTask, int lastTask, long l
if
(
Lp
->
P
[
n
].
getType
()
<
NTYPES
)
n_type
[
Lp
->
P
[
n
].
getType
()]
++
;
#ifdef MERGERTREE
n_type
[
NTYPES
+
0
]
=
MergerTree
->
Ntrees
;
#else
n_type
[
NTYPES
+
0
]
=
0
;
#endif
n_type
[
NTYPES
+
1
]
=
Lp
->
NpixLoc
;
/* determine particle numbers of each type in file */
...
...
@@ -304,9 +317,12 @@ void lightcone_particle_io::fill_file_header(int writeTask, int lastTask, long l
if
(
reorder_flag
)
{
header
.
Ntrees
=
ntot_type
[
NTYPES
];
header
.
Ntrees
=
ntot_type
[
NTYPES
];
#ifdef MERGERTREE
header
.
TotNtrees
=
MergerTree
->
TotNtrees
;
#else
header
.
TotNtrees
=
0
;
#endif
header
.
Npix
=
0
;
header
.
TotNpix
=
0
;
}
...
...
@@ -365,8 +381,10 @@ void *lightcone_particle_io::get_base_address_of_structure(enum arrays array, in
case
A_PS
:
return
(
void
*
)(
Lp
->
PS
+
index
);
#ifdef MERGERTREE
case
A_TT
:
return
(
void
*
)(
MergerTree
->
TreeTable
+
index
);
#endif
case
A_MM
:
return
(
void
*
)(
Lp
->
HealPixTab_PartCount
+
index
);
...
...
src/lightcone/lightcone_particle_io.h
View file @
6abe36fa
...
...
@@ -25,7 +25,11 @@
class
lightcone_particle_io
:
public
IO_Def
{
public:
#ifdef MERGERTREE
lightcone_particle_io
(
lcparticles
*
Lp_ptr
,
lightcone
*
LightCone_ptr
,
mergertree
*
MergerTree_ptr
,
MPI_Comm
comm
,
int
format
);
#else
lightcone_particle_io
(
lcparticles
*
Lp_ptr
,
lightcone
*
LightCone_ptr
,
MPI_Comm
comm
,
int
format
);
#endif
void
lightcone_save
(
int
num
,
int
conenr
,
bool
reordered_flag
);
void
lightcone_read
(
int
num
,
int
conenr
);
...
...
@@ -64,7 +68,9 @@ class lightcone_particle_io : public IO_Def
private:
lcparticles
*
Lp
;
lightcone
*
LightCone
;
#ifdef MERGERTREE
mergertree
*
MergerTree
;
#endif
int
cone
;
bool
reorder_flag
;
...
...
src/main/run.cc
View file @
6abe36fa
...
...
@@ -680,9 +680,12 @@ void sim::create_snapshot_if_desired(void)
#endif
{
#ifdef MERGERTREE
MergerTree
.
Ntrees
=
0
;
lightcone_particle_io
Lcone
(
&
Lp
,
&
LightCone
,
&
MergerTree
,
Communicator
,
All
.
SnapFormat
);
/* get an I/O object */
#else
lightcone_particle_io
Lcone
(
&
Lp
,
&
LightCone
,
Communicator
,
All
.
SnapFormat
);
/* get an I/O object */
#endif
long
long
NumLP_tot
=
Lp
.
NumPart
;
MPI_Allreduce
(
MPI_IN_PLACE
,
&
NumLP_tot
,
1
,
MPI_LONG_LONG
,
MPI_SUM
,
Communicator
);
mpi_printf
(
"
\n
LIGHTCONE: writing particle lightcone conesnap files #%d ... (NumLP_tot = %lld)
\n
"
,
All
.
LightconeFileCount
,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment