Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SWIFTsim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SWIFT
SWIFTsim
Commits
72df8ebf
Commit
72df8ebf
authored
Jan 18, 2019
by
Matthieu Schaller
Browse files
Options
Downloads
Patches
Plain Diff
Add support for groupID i/o in DM-only runs on single nodes.
parent
21517ba2
No related branches found
No related tags found
2 merge requests
!721
Velociraptor outputs
,
!719
Velociraptor output strategy
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/single_io.c
+14
-0
14 additions, 0 deletions
src/single_io.c
src/swift_velociraptor_part.h
+7
-1
7 additions, 1 deletion
src/swift_velociraptor_part.h
src/velociraptor_interface.c
+1
-1
1 addition, 1 deletion
src/velociraptor_interface.c
src/velociraptor_io.h
+43
-0
43 additions, 0 deletions
src/velociraptor_io.h
with
65 additions
and
2 deletions
src/single_io.c
+
14
−
0
View file @
72df8ebf
...
@@ -53,6 +53,7 @@
...
@@ -53,6 +53,7 @@
#include
"stars_io.h"
#include
"stars_io.h"
#include
"tracers_io.h"
#include
"tracers_io.h"
#include
"units.h"
#include
"units.h"
#include
"velociraptor_io.h"
#include
"xmf.h"
#include
"xmf.h"
/**
/**
...
@@ -646,6 +647,8 @@ void write_output_single(struct engine* e, const char* baseName,
...
@@ -646,6 +647,8 @@ void write_output_single(struct engine* e, const char* baseName,
const
struct
spart
*
sparts
=
e
->
s
->
sparts
;
const
struct
spart
*
sparts
=
e
->
s
->
sparts
;
struct
swift_params
*
params
=
e
->
parameter_file
;
struct
swift_params
*
params
=
e
->
parameter_file
;
const
int
with_cosmology
=
e
->
policy
&
engine_policy_cosmology
;
const
int
with_cosmology
=
e
->
policy
&
engine_policy_cosmology
;
const
int
with_stf
=
(
e
->
policy
&
engine_policy_structure_finding
)
&&
(
e
->
s
->
gpart_group_data
!=
NULL
);
const
int
with_cooling
=
e
->
policy
&
engine_policy_cooling
;
const
int
with_cooling
=
e
->
policy
&
engine_policy_cooling
;
const
int
with_temperature
=
e
->
policy
&
engine_policy_temperature
;
const
int
with_temperature
=
e
->
policy
&
engine_policy_temperature
;
...
@@ -950,6 +953,11 @@ void write_output_single(struct engine* e, const char* baseName,
...
@@ -950,6 +953,11 @@ void write_output_single(struct engine* e, const char* baseName,
/* This is a DM-only run without inhibited particles */
/* This is a DM-only run without inhibited particles */
N
=
Ntot
;
N
=
Ntot
;
darkmatter_write_particles
(
gparts
,
list
,
&
num_fields
);
darkmatter_write_particles
(
gparts
,
list
,
&
num_fields
);
if
(
with_stf
)
{
#ifdef HAVE_VELOCIRAPTOR
num_fields
+=
velociraptor_write_gparts
(
gparts
,
list
+
num_fields
);
#endif
}
}
else
{
}
else
{
/* Ok, we need to fish out the particles we want */
/* Ok, we need to fish out the particles we want */
...
@@ -965,6 +973,12 @@ void write_output_single(struct engine* e, const char* baseName,
...
@@ -965,6 +973,12 @@ void write_output_single(struct engine* e, const char* baseName,
/* Write DM particles */
/* Write DM particles */
darkmatter_write_particles
(
gparts_written
,
list
,
&
num_fields
);
darkmatter_write_particles
(
gparts_written
,
list
,
&
num_fields
);
if
(
with_stf
)
{
#ifdef HAVE_VELOCIRAPTOR
num_fields
+=
velociraptor_write_gparts
(
gparts_written
,
list
+
num_fields
);
#endif
}
}
}
}
break
;
}
break
;
...
...
...
...
This diff is collapsed.
Click to expand it.
src/swift_velociraptor_part.h
+
7
−
1
View file @
72df8ebf
...
@@ -21,7 +21,13 @@
...
@@ -21,7 +21,13 @@
#include
"part_type.h"
#include
"part_type.h"
/* SWIFT/VELOCIraptor particle. */
/**
* @brief SWIFT/VELOCIraptor particle.
*
* This should match the structure Swift::swift_vel_part
* defined in the file NBodylib/src/NBody/SwiftParticle.h
* of the VELOCIraptor code.
*/
struct
swift_vel_part
{
struct
swift_vel_part
{
/*! Particle ID. */
/*! Particle ID. */
...
...
...
...
This diff is collapsed.
Click to expand it.
src/velociraptor_interface.c
+
1
−
1
View file @
72df8ebf
...
@@ -532,7 +532,7 @@ void velociraptor_invoke(struct engine *e, const int linked_with_snap) {
...
@@ -532,7 +532,7 @@ void velociraptor_invoke(struct engine *e, const int linked_with_snap) {
struct
velociraptor_gpart_data
*
data
=
s
->
gpart_group_data
;
struct
velociraptor_gpart_data
*
data
=
s
->
gpart_group_data
;
/* Zero the array (
#
gpart not in groups have an ID of 0) */
/* Zero the array (gpart
s
not in groups have an ID of 0) */
bzero
(
data
,
nr_gparts
*
sizeof
(
struct
velociraptor_gpart_data
));
bzero
(
data
,
nr_gparts
*
sizeof
(
struct
velociraptor_gpart_data
));
/* Copy the data at the right place */
/* Copy the data at the right place */
...
...
...
...
This diff is collapsed.
Click to expand it.
src/velociraptor_io.h
0 → 100644
+
43
−
0
View file @
72df8ebf
/*******************************************************************************
* This file is part of SWIFT.
* Copyright (c) 2019 Matthieu Schaller (schaller@strw.leidenuniv.nl)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
******************************************************************************/
#ifndef SWIFT_VELOCIRAPTOR_IO_H
#define SWIFT_VELOCIRAPTOR_IO_H
/* Config parameters. */
#include
"../config.h"
INLINE
static
void
velociraptor_convert_groupID
(
const
struct
engine
*
e
,
const
struct
gpart
*
gp
,
long
long
*
ret
)
{
const
ptrdiff_t
offset
=
gp
-
e
->
s
->
gparts
;
*
ret
=
(
e
->
s
->
gpart_group_data
+
offset
)
->
groupID
;
}
__attribute__
((
always_inline
))
INLINE
static
int
velociraptor_write_gparts
(
const
struct
gpart
*
gparts
,
struct
io_props
*
list
)
{
list
[
0
]
=
io_make_output_field_convert_gpart
(
"GroupID"
,
LONGLONG
,
1
,
UNIT_CONV_NO_UNITS
,
gparts
,
velociraptor_convert_groupID
);
return
1
;
}
#endif
/* SWIFT_VELOCIRAPTOR_IO_H */
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
sign in
to comment