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
efab2914
Commit
efab2914
authored
9 years ago
by
Matthieu Schaller
Browse files
Options
Downloads
Patches
Plain Diff
Safer addlink from Pedro's branch
parent
e4766c19
No related branches found
No related tags found
2 merge requests
!136
Master
,
!79
First version of the multiple time-stepping
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/engine.c
+8
-3
8 additions, 3 deletions
src/engine.c
src/engine.h
+1
-1
1 addition, 1 deletion
src/engine.h
with
9 additions
and
4 deletions
src/engine.c
+
8
−
3
View file @
efab2914
...
@@ -69,7 +69,11 @@ int engine_rank;
...
@@ -69,7 +69,11 @@ int engine_rank;
struct
link
*
engine_addlink
(
struct
engine
*
e
,
struct
link
*
l
,
struct
task
*
t
)
{
struct
link
*
engine_addlink
(
struct
engine
*
e
,
struct
link
*
l
,
struct
task
*
t
)
{
struct
link
*
res
=
&
e
->
links
[
atomic_inc
(
&
e
->
nr_links
)];
const
int
ind
=
atomic_inc
(
&
e
->
nr_links
);
if
(
ind
>=
e
->
size_links
)
{
error
(
"Link table overflow."
);
}
struct
link
*
res
=
&
e
->
links
[
ind
];
res
->
next
=
l
;
res
->
next
=
l
;
res
->
t
=
t
;
res
->
t
=
t
;
return
res
;
return
res
;
...
@@ -1058,8 +1062,9 @@ void engine_maketasks(struct engine *e) {
...
@@ -1058,8 +1062,9 @@ void engine_maketasks(struct engine *e) {
/* Allocate the list of cell-task links. The maximum number of links
/* Allocate the list of cell-task links. The maximum number of links
is the number of cells (s->tot_cells) times the number of neighbours (27)
is the number of cells (s->tot_cells) times the number of neighbours (27)
times the number of interaction types (2, density and force). */
times the number of interaction types (2, density and force). */
if
(
e
->
links
!=
NULL
)
free
(
e
->
links
);
free
(
e
->
links
);
if
((
e
->
links
=
malloc
(
sizeof
(
struct
link
)
*
s
->
tot_cells
*
27
*
2
))
==
NULL
)
e
->
size_links
=
s
->
tot_cells
*
27
*
2
;
if
((
e
->
links
=
malloc
(
sizeof
(
struct
link
)
*
e
->
size_links
))
==
NULL
)
error
(
"Failed to allocate cell-task links."
);
error
(
"Failed to allocate cell-task links."
);
e
->
nr_links
=
0
;
e
->
nr_links
=
0
;
...
...
This diff is collapsed.
Click to expand it.
src/engine.h
+
1
−
1
View file @
efab2914
...
@@ -128,7 +128,7 @@ struct engine {
...
@@ -128,7 +128,7 @@ struct engine {
/* Linked list for cell-task association. */
/* Linked list for cell-task association. */
struct
link
*
links
;
struct
link
*
links
;
int
nr_links
;
int
nr_links
,
size_links
;
};
};
/* Function prototypes. */
/* Function prototypes. */
...
...
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