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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SWIFT
SWIFTsim
Commits
40edb635
Commit
40edb635
authored
9 years ago
by
Pedro Gonnet
Browse files
Options
Downloads
Patches
Plain Diff
add utility functions to re-link parts/gparts.
parent
415d6432
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!118
One major change to replace all gpart id/parts with the new id_or_neg_offset.
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/part.c
+28
-0
28 additions, 0 deletions
src/part.c
src/part.h
+2
-0
2 additions, 0 deletions
src/part.h
with
30 additions
and
0 deletions
src/part.c
+
28
−
0
View file @
40edb635
...
@@ -28,6 +28,34 @@
...
@@ -28,6 +28,34 @@
/* This object's header. */
/* This object's header. */
#include
"part.h"
#include
"part.h"
/**
* @brief Re-link the #gparts associated with the list of #parts.
*
* @param parts The list of #part.
* @param N The number of particles to re-link;
* @param offset The offset of #parts relative to the global parts list.
*/
void
part_relink_gparts
(
struct
part
*
parts
,
size_t
N
,
ptrdiff_t
offset
)
{
for
(
size_t
k
=
0
;
k
<
N
;
k
++
)
{
parts
[
k
]
->
gpart
->
id_or_neg_offset
=
-
(
k
+
offset
);
}
}
/**
* @brief Re-link the #gparts associated with the list of #parts.
*
* @param gparts The list of #gpart.
* @param N The number of particles to re-link;
* @param parts The global part array in which to find the #gpart offsets.
*/
void
part_relink_parts
(
struct
gpart
*
gparts
,
size_t
N
,
struct
part
*
parts
)
{
for
(
size_t
k
=
0
;
k
<
N
;
k
++
)
{
if
(
gparts
[
k
].
id_or_neg_offset
<
0
)
{
parts
[
-
gparts
[
k
].
id_or_neg_offset
].
gpart
=
&
gparts
[
k
];
}
}
}
#ifdef WITH_MPI
#ifdef WITH_MPI
/**
/**
* @brief Registers and returns an MPI type for the particles
* @brief Registers and returns an MPI type for the particles
...
...
This diff is collapsed.
Click to expand it.
src/part.h
+
2
−
0
View file @
40edb635
...
@@ -51,6 +51,8 @@
...
@@ -51,6 +51,8 @@
#include
"./gravity/Default/gravity_part.h"
#include
"./gravity/Default/gravity_part.h"
void
part_relink_gparts
(
struct
parts
*
parts
,
size_t
N
,
ptrdiff_t
offset
);
void
part_relink_parts
(
struct
gparts
*
parts
,
size_t
N
);
#ifdef WITH_MPI
#ifdef WITH_MPI
void
part_create_mpi_type
(
MPI_Datatype
*
part_type
);
void
part_create_mpi_type
(
MPI_Datatype
*
part_type
);
void
xpart_create_mpi_type
(
MPI_Datatype
*
xpart_type
);
void
xpart_create_mpi_type
(
MPI_Datatype
*
xpart_type
);
...
...
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
register
or
sign in
to comment