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
844070d2
Commit
844070d2
authored
9 years ago
by
Pedro Gonnet
Browse files
Options
Downloads
Patches
Plain Diff
cleaned-up proxy.[ch], marked some things const.
parent
5311275d
No related branches found
No related tags found
2 merge requests
!136
Master
,
!123
Local variable cleanup
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/proxy.c
+8
-14
8 additions, 14 deletions
src/proxy.c
src/proxy.h
+2
-2
2 additions, 2 deletions
src/proxy.h
with
10 additions
and
16 deletions
src/proxy.c
+
8
−
14
View file @
844070d2
...
...
@@ -50,11 +50,9 @@ void proxy_cells_exch1(struct proxy *p) {
#ifdef WITH_MPI
int
k
,
ind
;
/* Get the number of pcells we will need to send. */
p
->
size_pcells_out
=
0
;
for
(
k
=
0
;
k
<
p
->
nr_cells_out
;
k
++
)
for
(
int
k
=
0
;
k
<
p
->
nr_cells_out
;
k
++
)
p
->
size_pcells_out
+=
p
->
cells_out
[
k
]
->
pcell_size
;
/* Send the number of pcells. */
...
...
@@ -70,7 +68,7 @@ void proxy_cells_exch1(struct proxy *p) {
if
((
p
->
pcells_out
=
malloc
(
sizeof
(
struct
pcell
)
*
p
->
size_pcells_out
))
==
NULL
)
error
(
"Failed to allocate pcell_out buffer."
);
for
(
ind
=
0
,
k
=
0
;
k
<
p
->
nr_cells_out
;
k
++
)
{
for
(
int
ind
=
0
,
k
=
0
;
k
<
p
->
nr_cells_out
;
k
++
)
{
memcpy
(
&
p
->
pcells_out
[
ind
],
p
->
cells_out
[
k
]
->
pcell
,
sizeof
(
struct
pcell
)
*
p
->
cells_out
[
k
]
->
pcell_size
);
ind
+=
p
->
cells_out
[
k
]
->
pcell_size
;
...
...
@@ -131,16 +129,14 @@ void proxy_cells_exch2(struct proxy *p) {
void
proxy_addcell_in
(
struct
proxy
*
p
,
struct
cell
*
c
)
{
int
k
;
struct
cell
**
temp
;
/* Check if the cell is already registered with the proxy. */
for
(
k
=
0
;
k
<
p
->
nr_cells_in
;
k
++
)
for
(
int
k
=
0
;
k
<
p
->
nr_cells_in
;
k
++
)
if
(
p
->
cells_in
[
k
]
==
c
)
return
;
/* Do we need to grow the number of in cells? */
if
(
p
->
nr_cells_in
==
p
->
size_cells_in
)
{
p
->
size_cells_in
*=
proxy_buffgrow
;
struct
cell
**
temp
;
if
((
temp
=
malloc
(
sizeof
(
struct
cell
*
)
*
p
->
size_cells_in
))
==
NULL
)
error
(
"Failed to allocate incoming cell list."
);
memcpy
(
temp
,
p
->
cells_in
,
sizeof
(
struct
cell
*
)
*
p
->
nr_cells_in
);
...
...
@@ -162,16 +158,14 @@ void proxy_addcell_in(struct proxy *p, struct cell *c) {
void
proxy_addcell_out
(
struct
proxy
*
p
,
struct
cell
*
c
)
{
int
k
;
struct
cell
**
temp
;
/* Check if the cell is already registered with the proxy. */
for
(
k
=
0
;
k
<
p
->
nr_cells_out
;
k
++
)
for
(
int
k
=
0
;
k
<
p
->
nr_cells_out
;
k
++
)
if
(
p
->
cells_out
[
k
]
==
c
)
return
;
/* Do we need to grow the number of out cells? */
if
(
p
->
nr_cells_out
==
p
->
size_cells_out
)
{
p
->
size_cells_out
*=
proxy_buffgrow
;
struct
cell
**
temp
;
if
((
temp
=
malloc
(
sizeof
(
struct
cell
*
)
*
p
->
size_cells_out
))
==
NULL
)
error
(
"Failed to allocate outgoing cell list."
);
memcpy
(
temp
,
p
->
cells_out
,
sizeof
(
struct
cell
*
)
*
p
->
nr_cells_out
);
...
...
@@ -278,8 +272,8 @@ void proxy_parts_exch2(struct proxy *p) {
* @param N The number of parts.
*/
void
proxy_parts_load
(
struct
proxy
*
p
,
struct
part
*
parts
,
struct
x
part
*
x
parts
,
int
N
)
{
void
proxy_parts_load
(
struct
proxy
*
p
,
const
struct
part
*
parts
,
const
struct
xpart
*
xparts
,
int
N
)
{
/* Is there enough space in the buffer? */
if
(
p
->
nr_parts_out
+
N
>
p
->
size_parts_out
)
{
...
...
This diff is collapsed.
Click to expand it.
src/proxy.h
+
2
−
2
View file @
844070d2
...
...
@@ -68,8 +68,8 @@ struct proxy {
/* Function prototypes. */
void
proxy_init
(
struct
proxy
*
p
,
int
mynodeID
,
int
nodeID
);
void
proxy_parts_load
(
struct
proxy
*
p
,
struct
part
*
parts
,
struct
x
part
*
x
parts
,
int
N
);
void
proxy_parts_load
(
struct
proxy
*
p
,
const
struct
part
*
parts
,
const
struct
xpart
*
xparts
,
int
N
);
void
proxy_parts_exch1
(
struct
proxy
*
p
);
void
proxy_parts_exch2
(
struct
proxy
*
p
);
void
proxy_addcell_in
(
struct
proxy
*
p
,
struct
cell
*
c
);
...
...
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