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
SWIFT
SWIFTsim
Commits
77aab979
Commit
77aab979
authored
Oct 20, 2015
by
Matthieu Schaller
Browse files
Formatting...
parent
78251d0b
Changes
9
Hide whitespace changes
Inline
Side-by-side
src/debug.c
View file @
77aab979
...
...
@@ -45,7 +45,8 @@ void printParticle(struct part *parts, long long int id, int N) {
"## Particle[%d]: id=%lld, x=[%.16e,%.16e,%.16e], "
"v=[%.3e,%.3e,%.3e], a=[%.3e,%.3e,%.3e], h=%.3e, h_dt=%.3e, "
"wcount=%.3e, m=%.3e, rho=%.3e, rho_dh=%.3e, div_v=%.3e, u=%.3e, "
"dudt=%.3e, bals=%.3e, POrho2=%.3e, v_sig=%.3e, t_begin=%.3e, t_end=%.3e
\n
"
,
"dudt=%.3e, bals=%.3e, POrho2=%.3e, v_sig=%.3e, t_begin=%.3e, "
"t_end=%.3e
\n
"
,
i
,
parts
[
i
].
id
,
parts
[
i
].
x
[
0
],
parts
[
i
].
x
[
1
],
parts
[
i
].
x
[
2
],
parts
[
i
].
v
[
0
],
parts
[
i
].
v
[
1
],
parts
[
i
].
v
[
2
],
parts
[
i
].
a
[
0
],
parts
[
i
].
a
[
1
],
parts
[
i
].
a
[
2
],
parts
[
i
].
h
,
parts
[
i
].
force
.
h_dt
,
...
...
@@ -68,7 +69,8 @@ void printgParticle(struct gpart *parts, long long int id, int N) {
if
(
parts
[
i
].
id
==
-
id
||
(
parts
[
i
].
id
>
0
&&
parts
[
i
].
part
->
id
==
id
))
{
printf
(
"## gParticle[%d]: id=%lld, x=[%.16e,%.16e,%.16e], "
"v=[%.3e,%.3e,%.3e], a=[%.3e,%.3e,%.3e], m=%.3e, t_begin=%.3e, t_end=%.3e
\n
"
,
"v=[%.3e,%.3e,%.3e], a=[%.3e,%.3e,%.3e], m=%.3e, t_begin=%.3e, "
"t_end=%.3e
\n
"
,
i
,
(
parts
[
i
].
id
<
0
)
?
-
parts
[
i
].
id
:
parts
[
i
].
part
->
id
,
parts
[
i
].
x
[
0
],
parts
[
i
].
x
[
1
],
parts
[
i
].
x
[
2
],
parts
[
i
].
v
[
0
],
parts
[
i
].
v
[
1
],
parts
[
i
].
v
[
2
],
parts
[
i
].
a
[
0
],
parts
[
i
].
a
[
1
],
...
...
src/engine.c
View file @
77aab979
...
...
@@ -109,12 +109,11 @@ void engine_mkghosts(struct engine *e, struct cell *c, struct cell *super) {
c
->
drift
=
scheduler_addtask
(
s
,
task_type_drift
,
task_subtype_none
,
0
,
0
,
c
,
NULL
,
0
);
/* Add the init task. */
c
->
init
=
scheduler_addtask
(
s
,
task_type_init
,
task_subtype_none
,
0
,
0
,
c
,
NULL
,
0
);
c
->
init
=
scheduler_addtask
(
s
,
task_type_init
,
task_subtype_none
,
0
,
0
,
c
,
NULL
,
0
);
/* Add the kick task. */
c
->
kick
=
scheduler_addtask
(
s
,
task_type_kick
,
task_subtype_none
,
0
,
0
,
c
,
NULL
,
0
);
c
->
kick
=
scheduler_addtask
(
s
,
task_type_kick
,
task_subtype_none
,
0
,
0
,
c
,
NULL
,
0
);
}
}
...
...
@@ -595,7 +594,6 @@ void engine_repartition(struct engine *e) {
#endif
}
/* /\** */
/* * @brief Add up/down gravity tasks to a cell hierarchy. */
/* * */
...
...
@@ -605,7 +603,8 @@ void engine_repartition(struct engine *e) {
/* * @param down The downward gravity #task. */
/* *\/ */
/* void engine_addtasks_grav(struct engine *e, struct cell *c, struct task *up, */
/* void engine_addtasks_grav(struct engine *e, struct cell *c, struct task *up,
*/
/* struct task *down) { */
/* /\* Link the tasks to this cell. *\/ */
...
...
@@ -1031,11 +1030,13 @@ void engine_maketasks(struct engine *e) {
/* /\* Add the gravity mm tasks. *\/ */
/* for (i = 0; i < nr_cells; i++) */
/* if (cells[i].gcount > 0) { */
/* scheduler_addtask(sched, task_type_grav_mm, task_subtype_none, -1, 0, */
/* scheduler_addtask(sched, task_type_grav_mm, task_subtype_none, -1, 0,
*/
/* &cells[i], NULL, 0); */
/* for (j = i + 1; j < nr_cells; j++) */
/* if (cells[j].gcount > 0) */
/* scheduler_addtask(sched, task_type_grav_mm, task_subtype_none, -1, 0, */
/* scheduler_addtask(sched, task_type_grav_mm, task_subtype_none, -1,
* 0, */
/* &cells[i], &cells[j], 0); */
/* } */
...
...
@@ -1050,16 +1051,19 @@ void engine_maketasks(struct engine *e) {
error
(
"Failed to allocate cell-task links."
);
e
->
nr_links
=
0
;
/* /\* Add the gravity up/down tasks at the top-level cells and push them down. *\/ */
/* /\* Add the gravity up/down tasks at the top-level cells and push them
* down. *\/ */
/* for (k = 0; k < nr_cells; k++) */
/* if (cells[k].nodeID == nodeID && cells[k].gcount > 0) { */
/* /\* Create tasks at top level. *\/ */
/* struct task *up = */
/* scheduler_addtask(sched, task_type_grav_up, task_subtype_none, 0, 0, */
/* scheduler_addtask(sched, task_type_grav_up, task_subtype_none, 0,
* 0, */
/* &cells[k], NULL, 0); */
/* struct task *down = */
/* scheduler_addtask(sched, task_type_grav_down, task_subtype_none, 0, 0, */
/* scheduler_addtask(sched, task_type_grav_down, task_subtype_none, 0,
* 0, */
/* &cells[k], NULL, 0); */
/* /\* Push tasks down the cell hierarchy. *\/ */
...
...
@@ -1754,14 +1758,15 @@ void engine_step(struct engine *e) {
/* Send off the runners. */
TIMER_TIC
engine_launch
(
e
,
e
->
nr_threads
,
(
1
<<
task_type_sort
)
|
(
1
<<
task_type_self
)
|
(
1
<<
task_type_pair
)
|
(
1
<<
task_type_sub
)
|
(
1
<<
task_type_ghost
)
|
(
1
<<
task_type_kick
)
|
(
1
<<
task_type_send
)
|
(
1
<<
task_type_recv
)
|
/* (1 << task_type_grav_pp) | (1 << task_type_grav_mm) | */
/* (1 << task_type_grav_up) | (1 << task_type_grav_down) | */
(
1
<<
task_type_link
));
engine_launch
(
e
,
e
->
nr_threads
,
(
1
<<
task_type_sort
)
|
(
1
<<
task_type_self
)
|
(
1
<<
task_type_pair
)
|
(
1
<<
task_type_sub
)
|
(
1
<<
task_type_ghost
)
|
(
1
<<
task_type_kick
)
|
(
1
<<
task_type_send
)
|
(
1
<<
task_type_recv
)
|
/* (1 << task_type_grav_pp) | (1 << task_type_grav_mm) | */
/* (1 << task_type_grav_up) | (1 << task_type_grav_down) | */
(
1
<<
task_type_link
));
TIMER_TOC
(
timer_runners
);
...
...
@@ -1861,21 +1866,24 @@ if ( e->nodeID == 0 )
/* s->parts[k].dt = dt; */
/* s->xparts[k].dt_curr = dt; */
/* } */
/* // message( "dt_min=%.3e, adjusting time step to dt=%e." , dt_min , e->dt */
/* // message( "dt_min=%.3e, adjusting time step to dt=%e." , dt_min ,
* e->dt */
/* // ); */
/* } else { */
/* while (dt_min < dt) { */
/* dt *= 0.5; */
/* e->step *= 2; */
/* e->nullstep *= 2; */
/* // message( "dt_min dropped below time step, adjusting to dt=%e." , */
/* // message( "dt_min dropped below time step, adjusting to dt=%e." ,
*/
/* // e->dt ); */
/* } */
/* while (dt_min > 2 * dt && (e->step & 1) == 0) { */
/* dt *= 2.0; */
/* e->step /= 2; */
/* e->nullstep /= 2; */
/* // message( "dt_min is larger than twice the time step, adjusting to */
/* // message( "dt_min is larger than twice the time step, adjusting to
*/
/* // dt=%e." , e->dt ); */
/* } */
/* } */
...
...
@@ -2050,7 +2058,8 @@ void engine_split(struct engine *e, int *grid) {
*/
void
engine_init
(
struct
engine
*
e
,
struct
space
*
s
,
float
dt
,
int
nr_threads
,
int
nr_queues
,
int
nr_nodes
,
int
nodeID
,
int
policy
,
float
timeBegin
,
float
timeEnd
)
{
int
nr_queues
,
int
nr_nodes
,
int
nodeID
,
int
policy
,
float
timeBegin
,
float
timeEnd
)
{
int
k
;
#if defined(HAVE_SETAFFINITY)
...
...
@@ -2145,7 +2154,8 @@ void engine_init(struct engine *e, struct space *s, float dt, int nr_threads,
/* scheduler_reset(&e->sched, s->tot_cells); */
/* for (k = 0; k < s->nr_cells; k++) */
/* s->cells[k].kick1 = */
/* scheduler_addtask(&e->sched, task_type_kick1, task_subtype_none, 0, 0, */
/* scheduler_addtask(&e->sched, task_type_kick1, task_subtype_none, 0,
* 0, */
/* &s->cells[k], NULL, 0); */
/* scheduler_ranktasks(&e->sched); */
...
...
src/engine.h
View file @
77aab979
...
...
@@ -135,7 +135,7 @@ struct engine {
void
engine_barrier
(
struct
engine
*
e
,
int
tid
);
void
engine_init
(
struct
engine
*
e
,
struct
space
*
s
,
float
dt
,
int
nr_threads
,
int
nr_queues
,
int
nr_nodes
,
int
nodeID
,
int
policy
,
float
timeBegin
,
float
timeEnd
);
float
timeBegin
,
float
timeEnd
);
void
engine_prepare
(
struct
engine
*
e
);
void
engine_step
(
struct
engine
*
e
);
void
engine_maketasks
(
struct
engine
*
e
);
...
...
src/error.h
View file @
77aab979
...
...
@@ -61,8 +61,6 @@ extern int engine_rank;
#define message(s, ...) printf("%s: " s "\n", __FUNCTION__, ##__VA_ARGS__)
#endif
/**
* @brief Assertion macro compatible with MPI
*
...
...
src/runner.c
View file @
77aab979
...
...
@@ -492,10 +492,6 @@ void runner_dogsort(struct runner *r, struct cell *c, int flags, int clock) {
#endif
}
/**
* @brief Initialize the particles before the density calculation
*
...
...
@@ -820,11 +816,9 @@ void runner_dodrift(struct runner *r, struct cell *c, int timer) {
/* Predict gradient term */
p
->
force
.
POrho2
=
u
*
(
const_hydro_gamma
-
1
.
0
f
)
/
(
rho
*
xp
->
omega
);
}
}
if
(
timer
)
{
#ifdef TIMER_VERBOSE
message
(
"runner %02i: %i parts at depth %i took %.3f ms."
,
r
->
id
,
c
->
count
,
...
...
@@ -834,7 +828,6 @@ void runner_dodrift(struct runner *r, struct cell *c, int timer) {
TIMER_TOC
(
timer_drift
);
#endif
}
}
/**
...
...
@@ -851,7 +844,7 @@ void runner_dokick(struct runner *r, struct cell *c, int timer) {
float
new_dt
=
0
.
0
f
,
new_dt_hydro
=
0
.
0
f
,
new_dt_grav
=
0
.
0
f
,
current_dt
=
0
.
0
f
;
float
t_start
,
t_end
,
t_current
=
r
->
e
->
time
,
t_end_min
=
FLT_MAX
,
t_end_max
=
0
.,
dt
;
t_end_max
=
0
.,
dt
;
float
dt_max_timeline
=
r
->
e
->
timeEnd
-
r
->
e
->
timeBegin
,
dt_timeline
;
float
dt_min
=
r
->
e
->
dt_min
,
dt_max
=
r
->
e
->
dt_max
;
float
h_max
,
dx_max
;
...
...
@@ -880,8 +873,8 @@ void runner_dokick(struct runner *r, struct cell *c, int timer) {
x
[
0
]
=
p
->
x
[
0
],
x
[
1
]
=
p
->
x
[
1
],
x
[
2
]
=
p
->
x
[
2
];
if
(
p
->
id
==
0
)
message
(
"Kick ! t_beg=%f t_end=%f t_cur=%f"
,
p
->
t_begin
,
p
->
t_end
,
t_current
);
message
(
"Kick ! t_beg=%f t_end=%f t_cur=%f"
,
p
->
t_begin
,
p
->
t_end
,
t_current
);
/* If particle needs to be kicked */
if
(
p
->
t_end
<=
t_current
)
{
...
...
@@ -1037,9 +1030,6 @@ void runner_dokick(struct runner *r, struct cell *c, int timer) {
}
}
/**
* @brief The #runner main thread routine.
*
...
...
@@ -1131,10 +1121,10 @@ void *runner_main(void *data) {
runner_doghost
(
r
,
ci
);
break
;
case
task_type_drift
:
runner_dodrift
(
r
,
ci
,
1
);
runner_dodrift
(
r
,
ci
,
1
);
break
;
case
task_type_kick
:
runner_dokick
(
r
,
ci
,
1
);
runner_dokick
(
r
,
ci
,
1
);
break
;
case
task_type_send
:
break
;
...
...
src/scheduler.c
View file @
77aab979
...
...
@@ -137,24 +137,21 @@ void scheduler_splittasks(struct scheduler *s) {
}
/* Non-local kick task? */
if
((
t
->
type
==
task_type_kick
)
&&
t
->
ci
->
nodeID
!=
s
->
nodeID
)
{
if
((
t
->
type
==
task_type_kick
)
&&
t
->
ci
->
nodeID
!=
s
->
nodeID
)
{
t
->
type
=
task_type_none
;
t
->
skip
=
1
;
continue
;
}
/* Non-local drift task? */
if
((
t
->
type
==
task_type_drift
)
&&
t
->
ci
->
nodeID
!=
s
->
nodeID
)
{
if
((
t
->
type
==
task_type_drift
)
&&
t
->
ci
->
nodeID
!=
s
->
nodeID
)
{
t
->
type
=
task_type_none
;
t
->
skip
=
1
;
continue
;
}
/* Non-local init task? */
if
((
t
->
type
==
task_type_init
)
&&
t
->
ci
->
nodeID
!=
s
->
nodeID
)
{
if
((
t
->
type
==
task_type_init
)
&&
t
->
ci
->
nodeID
!=
s
->
nodeID
)
{
t
->
type
=
task_type_none
;
t
->
skip
=
1
;
continue
;
...
...
src/serial_io.c
View file @
77aab979
...
...
@@ -87,8 +87,7 @@ void readArrayBackEnd(hid_t grp, char* name, enum DATA_TYPE type, int N,
if
(
importance
==
COMPULSORY
)
{
error
(
"Compulsory data set '%s' not present in the file."
,
name
);
}
else
{
for
(
i
=
0
;
i
<
N
;
++
i
)
memset
(
part_c
+
i
*
partSize
,
0
,
copySize
);
for
(
i
=
0
;
i
<
N
;
++
i
)
memset
(
part_c
+
i
*
partSize
,
0
,
copySize
);
return
;
}
}
...
...
@@ -212,11 +211,11 @@ void read_ic_serial(char* fileName, double dim[3], struct part** parts, int* N,
int
*
periodic
,
int
mpi_rank
,
int
mpi_size
,
MPI_Comm
comm
,
MPI_Info
info
)
{
hid_t
h_file
=
0
,
h_grp
=
0
;
double
boxSize
[
3
]
=
{
0
.
0
,
-
1
.
0
,
-
1
.
0
};
/* GADGET has only cubic boxes (in cosmological mode) */
int
numParticles
[
6
]
=
{
0
};
/* GADGET has 6 particle types. We only keep the type 0*/
int
numParticles_highWord
[
6
]
=
{
0
};
double
boxSize
[
3
]
=
{
0
.
0
,
-
1
.
0
,
-
1
.
0
};
/* GADGET has only cubic boxes (in cosmological mode) */
int
numParticles
[
6
]
=
{
0
};
/* GADGET has 6 particle types. We only keep the type 0*/
int
numParticles_highWord
[
6
]
=
{
0
};
long
long
offset
=
0
;
long
long
N_total
=
0
;
int
rank
;
...
...
@@ -251,8 +250,8 @@ void read_ic_serial(char* fileName, double dim[3], struct part** parts, int* N,
readAttribute
(
h_grp
,
"NumPart_Total"
,
UINT
,
numParticles
);
readAttribute
(
h_grp
,
"NumPart_Total_HighWord"
,
UINT
,
numParticles_highWord
);
N_total
=
((
long
long
)
numParticles
[
0
])
+
((
long
long
)
numParticles_highWord
[
0
]
<<
32
);
N_total
=
((
long
long
)
numParticles
[
0
])
+
((
long
long
)
numParticles_highWord
[
0
]
<<
32
);
dim
[
0
]
=
boxSize
[
0
];
dim
[
1
]
=
(
boxSize
[
1
]
<
0
)
?
boxSize
[
0
]
:
boxSize
[
1
];
dim
[
2
]
=
(
boxSize
[
2
]
<
0
)
?
boxSize
[
0
]
:
boxSize
[
2
];
...
...
@@ -518,9 +517,9 @@ void write_output_serial(struct engine* e, struct UnitSystem* us, int mpi_rank,
hid_t
h_file
=
0
,
h_grp
=
0
;
int
N
=
e
->
s
->
nr_parts
;
int
periodic
=
e
->
s
->
periodic
;
int
numParticles
[
6
]
=
{
N
,
0
};
int
numParticlesHighWord
[
6
]
=
{
0
};
unsigned
int
flagEntropy
[
6
]
=
{
0
};
int
numParticles
[
6
]
=
{
N
,
0
};
int
numParticlesHighWord
[
6
]
=
{
0
};
unsigned
int
flagEntropy
[
6
]
=
{
0
};
long
long
N_total
=
0
,
offset
=
0
;
double
offset_d
=
0
.,
N_d
=
0
.,
N_total_d
=
0
.;
int
numFiles
=
1
;
...
...
@@ -535,7 +534,7 @@ void write_output_serial(struct engine* e, struct UnitSystem* us, int mpi_rank,
/* Compute offset in the file and total number of particles */
/* Done using double to allow for up to 2^50=10^15 particles */
N_d
=
(
double
)
N
;
N_d
=
(
double
)
N
;
MPI_Exscan
(
&
N_d
,
&
offset_d
,
1
,
MPI_DOUBLE
,
MPI_SUM
,
comm
);
N_total_d
=
offset_d
+
N_d
;
MPI_Bcast
(
&
N_total_d
,
1
,
MPI_DOUBLE
,
mpi_size
-
1
,
comm
);
...
...
@@ -543,8 +542,8 @@ void write_output_serial(struct engine* e, struct UnitSystem* us, int mpi_rank,
error
(
"Error while computing the offest for parallel output: Simulation has "
"more than 10^15 particles.
\n
"
);
N_total
=
(
long
long
)
N_total_d
;
offset
=
(
long
long
)
offset_d
;
N_total
=
(
long
long
)
N_total_d
;
offset
=
(
long
long
)
offset_d
;
/* Do common stuff first */
if
(
mpi_rank
==
0
)
{
...
...
@@ -587,13 +586,13 @@ void write_output_serial(struct engine* e, struct UnitSystem* us, int mpi_rank,
writeAttribute
(
h_grp
,
"Time"
,
DOUBLE
,
&
dblTime
,
1
);
/* GADGET-2 legacy values */
numParticles
[
0
]
=
(
unsigned
int
)
N_total
;
numParticles
[
0
]
=
(
unsigned
int
)
N_total
;
writeAttribute
(
h_grp
,
"NumPart_ThisFile"
,
UINT
,
numParticles
,
6
);
writeAttribute
(
h_grp
,
"NumPart_Total"
,
UINT
,
numParticles
,
6
);
numParticlesHighWord
[
0
]
=
(
unsigned
int
)(
N_total
>>
32
);
writeAttribute
(
h_grp
,
"NumPart_Total_HighWord"
,
UINT
,
numParticlesHighWord
,
6
);
double
MassTable
[
6
]
=
{
0
.,
0
.,
0
.,
0
.,
0
.,
0
.
};
double
MassTable
[
6
]
=
{
0
.,
0
.,
0
.,
0
.,
0
.,
0
.};
writeAttribute
(
h_grp
,
"MassTable"
,
DOUBLE
,
MassTable
,
6
);
writeAttribute
(
h_grp
,
"Flag_Entropy_ICs"
,
UINT
,
flagEntropy
,
6
);
writeAttribute
(
h_grp
,
"NumFilesPerSnapshot"
,
INT
,
&
numFiles
,
1
);
...
...
src/single_io.c
View file @
77aab979
...
...
@@ -83,8 +83,7 @@ void readArrayBackEnd(hid_t grp, char* name, enum DATA_TYPE type, int N,
/* message("Optional data set '%s' not present. Zeroing this particle
* field...", name); */
for
(
i
=
0
;
i
<
N
;
++
i
)
memset
(
part_c
+
i
*
partSize
,
0
,
copySize
);
for
(
i
=
0
;
i
<
N
;
++
i
)
memset
(
part_c
+
i
*
partSize
,
0
,
copySize
);
return
;
}
...
...
@@ -167,10 +166,10 @@ void readArrayBackEnd(hid_t grp, char* name, enum DATA_TYPE type, int N,
void
read_ic_single
(
char
*
fileName
,
double
dim
[
3
],
struct
part
**
parts
,
int
*
N
,
int
*
periodic
)
{
hid_t
h_file
=
0
,
h_grp
=
0
;
double
boxSize
[
3
]
=
{
0
.
0
,
-
1
.
0
,
-
1
.
0
};
/* GADGET has only cubic boxes (in cosmological mode) */
int
numParticles
[
6
]
=
{
0
};
/* GADGET has 6 particle types. We only keep the type 0*/
double
boxSize
[
3
]
=
{
0
.
0
,
-
1
.
0
,
-
1
.
0
};
/* GADGET has only cubic boxes (in cosmological mode) */
int
numParticles
[
6
]
=
{
0
};
/* GADGET has 6 particle types. We only keep the type 0*/
/* Open file */
/* message("Opening file '%s' as IC.", fileName); */
...
...
@@ -230,7 +229,7 @@ void read_ic_single(char* fileName, double dim[3], struct part** parts, int* N,
readArray
(
h_grp
,
"SmoothingLength"
,
FLOAT
,
*
N
,
1
,
*
parts
,
h
,
COMPULSORY
);
readArray
(
h_grp
,
"InternalEnergy"
,
FLOAT
,
*
N
,
1
,
*
parts
,
u
,
COMPULSORY
);
readArray
(
h_grp
,
"ParticleIDs"
,
ULONGLONG
,
*
N
,
1
,
*
parts
,
id
,
COMPULSORY
);
//readArray(h_grp, "TimeStep", FLOAT, *N, 1, *parts, dt, OPTIONAL);
//
readArray(h_grp, "TimeStep", FLOAT, *N, 1, *parts, dt, OPTIONAL);
readArray
(
h_grp
,
"Acceleration"
,
FLOAT
,
*
N
,
3
,
*
parts
,
a
,
OPTIONAL
);
readArray
(
h_grp
,
"Density"
,
FLOAT
,
*
N
,
1
,
*
parts
,
rho
,
OPTIONAL
);
...
...
@@ -385,8 +384,8 @@ void write_output_single(struct engine* e, struct UnitSystem* us) {
hid_t
h_file
=
0
,
h_grp
=
0
;
int
N
=
e
->
s
->
nr_parts
;
int
periodic
=
e
->
s
->
periodic
;
int
numParticles
[
6
]
=
{
N
,
0
};
int
numParticlesHighWord
[
6
]
=
{
0
};
int
numParticles
[
6
]
=
{
N
,
0
};
int
numParticlesHighWord
[
6
]
=
{
0
};
int
numFiles
=
1
;
struct
part
*
parts
=
e
->
s
->
parts
;
FILE
*
xmfFile
=
0
;
...
...
@@ -438,7 +437,7 @@ void write_output_single(struct engine* e, struct UnitSystem* us) {
writeAttribute
(
h_grp
,
"NumPart_Total"
,
UINT
,
numParticles
,
6
);
writeAttribute
(
h_grp
,
"NumPart_Total_HighWord"
,
UINT
,
numParticlesHighWord
,
6
);
double
MassTable
[
6
]
=
{
0
.,
0
.,
0
.,
0
.,
0
.,
0
.
};
double
MassTable
[
6
]
=
{
0
.,
0
.,
0
.,
0
.,
0
.,
0
.};
writeAttribute
(
h_grp
,
"MassTable"
,
DOUBLE
,
MassTable
,
6
);
writeAttribute
(
h_grp
,
"Flag_Entropy_ICs"
,
UINT
,
numParticlesHighWord
,
6
);
writeAttribute
(
h_grp
,
"NumFilesPerSnapshot"
,
INT
,
&
numFiles
,
1
);
...
...
@@ -473,7 +472,8 @@ void write_output_single(struct engine* e, struct UnitSystem* us) {
us
,
UNIT_CONV_ENERGY_PER_UNIT_MASS
);
writeArray
(
h_grp
,
fileName
,
xmfFile
,
"ParticleIDs"
,
ULONGLONG
,
N
,
1
,
parts
,
id
,
us
,
UNIT_CONV_NO_UNITS
);
/* writeArray(h_grp, fileName, xmfFile, "TimeStep", FLOAT, N, 1, parts, dt, us, */
/* writeArray(h_grp, fileName, xmfFile, "TimeStep", FLOAT, N, 1, parts, dt,
* us, */
/* UNIT_CONV_TIME); */
writeArray
(
h_grp
,
fileName
,
xmfFile
,
"Acceleration"
,
FLOAT
,
N
,
3
,
parts
,
a
,
us
,
UNIT_CONV_ACCELERATION
);
...
...
src/space.c
View file @
77aab979
...
...
@@ -280,7 +280,7 @@ void space_regrid(struct space *s, double cell_max, int verbose) {
s
->
cells
[
k
].
count
=
0
;
s
->
cells
[
k
].
gcount
=
0
;
s
->
cells
[
k
].
init
=
NULL
;
s
->
cells
[
k
].
ghost
=
NULL
;
s
->
cells
[
k
].
ghost
=
NULL
;
s
->
cells
[
k
].
drift
=
NULL
;
s
->
cells
[
k
].
kick
=
NULL
;
s
->
cells
[
k
].
super
=
&
s
->
cells
[
k
];
...
...
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