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
ff8efd63
Commit
ff8efd63
authored
6 years ago
by
Matthieu Schaller
Browse files
Options
Downloads
Patches
Plain Diff
Fixes for C++ compiler.
parent
19caade8
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/partition.c
+12
-8
12 additions, 8 deletions
src/partition.c
with
12 additions
and
8 deletions
src/partition.c
+
12
−
8
View file @
ff8efd63
...
...
@@ -42,10 +42,14 @@
#include
<mpi.h>
/* METIS/ParMETIS headers only used when MPI is also available. */
#ifdef HAVE_PARMETIS
#define __STDC_LIMIT_MACROS
#include
<parmetis.h>
#include
<stdint.h>
#endif
#ifdef HAVE_METIS
#define __STDC_LIMIT_MACROS
#include
<metis.h>
#include
<stdint.h>
#endif
#endif
...
...
@@ -290,8 +294,8 @@ static void split_metis(struct space *s, int nregions, int *celllist) {
struct
indexval
{
int
index
;
int
count
;
int
old
;
int
new
;
int
old
_val
;
int
new
_val
;
};
static
int
indexvalcmp
(
const
void
*
p1
,
const
void
*
p2
)
{
const
struct
indexval
*
iv1
=
(
const
struct
indexval
*
)
p1
;
...
...
@@ -329,8 +333,8 @@ void permute_regions(int *newlist, int *oldlist, int nregions, int ncells,
int
index
=
newlist
[
k
]
+
nregions
*
oldlist
[
k
];
ivs
[
index
].
count
++
;
ivs
[
index
].
index
=
index
;
ivs
[
index
].
old
=
oldlist
[
k
];
ivs
[
index
].
new
=
newlist
[
k
];
ivs
[
index
].
old
_val
=
oldlist
[
k
];
ivs
[
index
].
new
_val
=
newlist
[
k
];
}
qsort
(
ivs
,
indmax
,
sizeof
(
struct
indexval
),
indexvalcmp
);
...
...
@@ -340,7 +344,7 @@ void permute_regions(int *newlist, int *oldlist, int nregions, int ncells,
int
*
oldmap
=
NULL
;
int
*
newmap
=
NULL
;
oldmap
=
permlist
;
/* Reuse this */
if
((
newmap
=
malloc
(
sizeof
(
int
)
*
nregions
))
==
NULL
)
if
((
newmap
=
(
int
*
)
malloc
(
sizeof
(
int
)
*
nregions
))
==
NULL
)
error
(
"Failed to allocate newmap array"
);
for
(
int
k
=
0
;
k
<
nregions
;
k
++
)
{
...
...
@@ -354,9 +358,9 @@ void permute_regions(int *newlist, int *oldlist, int nregions, int ncells,
if
(
ivs
[
k
].
count
==
0
)
break
;
/* Store old and new IDs, if not already used. */
if
(
newmap
[
ivs
[
k
].
new
]
==
-
1
&&
oldmap
[
ivs
[
k
].
old
]
==
-
1
)
{
newmap
[
ivs
[
k
].
new
]
=
ivs
[
k
].
old
;
oldmap
[
ivs
[
k
].
old
]
=
ivs
[
k
].
new
;
if
(
newmap
[
ivs
[
k
].
new
_val
]
==
-
1
&&
oldmap
[
ivs
[
k
].
old
_val
]
==
-
1
)
{
newmap
[
ivs
[
k
].
new
_val
]
=
ivs
[
k
].
old
_val
;
oldmap
[
ivs
[
k
].
old
_val
]
=
ivs
[
k
].
new
_val
;
}
}
...
...
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