Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
gmsh
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Larry Price
gmsh
Commits
aca01fa6
Commit
aca01fa6
authored
12 years ago
by
Bruno Seny
Browse files
Options
Downloads
Patches
Plain Diff
update multi-constraint partitioning
parent
af362f91
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Mesh/meshPartition.cpp
+3
-3
3 additions, 3 deletions
Mesh/meshPartition.cpp
Mesh/meshPartitionObjects.h
+3
-26
3 additions, 26 deletions
Mesh/meshPartitionObjects.h
Mesh/meshPartitionOptions.h
+4
-2
4 additions, 2 deletions
Mesh/meshPartitionOptions.h
with
10 additions
and
31 deletions
Mesh/meshPartition.cpp
+
3
−
3
View file @
aca01fa6
...
...
@@ -443,7 +443,7 @@ int PartitionGraph(Graph &graph, meshPartitionOptions &options)
metisOptions
[
2
]
=
1
;
metisOptions
[
3
]
=
1
;
metisOptions
[
4
]
=
0
;
graph
.
fillWithMultipleWeights
(
options
.
ncon
,
options
.
getWeightMap
());
graph
.
fillWithMultipleWeights
(
options
.
ncon
,
options
.
getWeightMap
V
(),
options
.
getWeightMapE
());
METIS_mCPartGraphRecursive
(
&
n
,
&
options
.
ncon
,
&
graph
.
xadj
[
graph
.
section
[
iSec
]],
&
graph
.
adjncy
[
graph
.
section
[
iSec
]],
&
graph
.
vwgts
[
graph
.
section
[
iSec
]],
&
graph
.
adjwgts
[
graph
.
section
[
iSec
]],
&
wgtflag
,
&
numflag
,
...
...
@@ -459,9 +459,9 @@ int PartitionGraph(Graph &graph, meshPartitionOptions &options)
metisOptions
[
3
]
=
options
.
refine_algorithm
;
metisOptions
[
4
]
=
0
;
for
(
int
u
=
0
;
u
<
options
.
ncon
;
u
++
){
ubvec
[
u
]
=
1.
0
3
;
ubvec
[
u
]
=
1.3
;
}
graph
.
fillWithMultipleWeights
(
options
.
ncon
,
options
.
getWeightMap
());
graph
.
fillWithMultipleWeights
(
options
.
ncon
,
options
.
getWeightMap
V
(),
options
.
getWeightMapE
());
if
(
options
.
num_partitions
>
1
)
{
METIS_mCPartGraphKway
(
&
n
,
&
options
.
ncon
,
&
graph
.
xadj
[
graph
.
section
[
iSec
]],
...
...
This diff is collapsed.
Click to expand it.
Mesh/meshPartitionObjects.h
+
3
−
26
View file @
aca01fa6
...
...
@@ -154,29 +154,6 @@ class Graph
// Translated vertex numbers start from 1
c2w
[
grVertMapIt
->
second
.
index
]
=
i
+
1
;
}
void
computeLoads
(
int
numParts
,
int
numCon
){
loads
=
new
fullMatrix
<
int
>
(
numParts
,
numCon
);
for
(
int
i
=
0
;
i
<
numParts
;
i
++
){
for
(
int
j
=
0
;
j
<
partition
.
size
();
j
++
){
if
(
partition
[
j
]
==
i
){
for
(
int
k
=
0
;
k
<
numCon
;
k
++
){
(
*
loads
)(
i
,
k
)
+=
vwgts
[
j
*
numCon
+
k
];
}
}
}
}
}
void
checkLoads
(
int
numParts
,
int
numCon
){
printf
(
"*******************************************************
\n
"
);
for
(
int
i
=
0
;
i
<
numParts
;
i
++
){
printf
(
"------- PARTITION %d: ["
,
i
+
1
);
for
(
int
j
=
0
;
j
<
numCon
;
j
++
){
printf
(
" %d"
,
(
*
loads
)(
i
,
j
));
}
printf
(
"] -------
\n
"
);
}
printf
(
"*******************************************************
\n
"
);
}
void
fillWeights
(
std
::
vector
<
int
>
wgts
)
{
int
num
=
0
;
...
...
@@ -186,7 +163,7 @@ class Graph
}
}
// Add multiple weights on vertices of the graph given in a map between original element Numbers and their corresponding vector of weights
void
fillWithMultipleWeights
(
int
ncon
,
std
::
map
<
int
,
std
::
vector
<
int
>
>
w
eightMap
)
void
fillWithMultipleWeights
(
int
ncon
,
std
::
map
<
int
,
std
::
vector
<
int
>
>
vWeightMap
,
std
::
map
<
int
,
int
>
eW
eightMap
)
{
std
::
vector
<
MElement
*>::
iterator
eIt
;
vwgts
.
resize
(
element
.
size
()
*
ncon
);
...
...
@@ -194,10 +171,10 @@ class Graph
int
localElNum
=
0
;
for
(
eIt
=
element
.
begin
();
eIt
!=
element
.
end
();
eIt
++
){
for
(
int
i
=
0
;
i
<
ncon
;
i
++
){
vwgts
[
localElNum
*
ncon
+
i
]
=
w
eightMap
[(
*
eIt
)
->
getNum
()][
i
+
1
];
vwgts
[
localElNum
*
ncon
+
i
]
=
vW
eightMap
[(
*
eIt
)
->
getNum
()][
i
+
1
];
}
for
(
int
j
=
xadj
[
localElNum
];
j
<
xadj
[
localElNum
+
1
];
j
++
){
adjwgts
[
j
]
+=
w
eightMap
[(
*
eIt
)
->
getNum
()]
[
0
]
;
adjwgts
[
j
]
+=
eW
eightMap
[(
*
eIt
)
->
getNum
()];
}
localElNum
+=
1
;
}
...
...
This diff is collapsed.
Click to expand it.
Mesh/meshPartitionOptions.h
+
4
−
2
View file @
aca01fa6
...
...
@@ -81,7 +81,8 @@ class meshPartitionOptions
// NODAL WEIGHT
std
::
vector
<
int
>
nodalWeights
;
std
::
map
<
int
,
std
::
vector
<
int
>
>
weightMap
;
std
::
map
<
int
,
std
::
vector
<
int
>
>
vWeightMap
;
std
::
map
<
int
,
int
>
eWeightMap
;
std
::
vector
<
int
>
tolerance
;
public:
...
...
@@ -91,7 +92,8 @@ class meshPartitionOptions
int
getNumOfPartitions
(){
return
num_partitions
;
}
void
setNumConstraints
(
int
numConst
){
ncon
=
numConst
;
}
int
getNumConstraints
(){
return
ncon
;
}
std
::
map
<
int
,
std
::
vector
<
int
>
>
&
getWeightMap
(){
return
weightMap
;
}
std
::
map
<
int
,
std
::
vector
<
int
>
>
&
getWeightMapV
(){
return
vWeightMap
;
}
std
::
map
<
int
,
int
>
&
getWeightMapE
(){
return
eWeightMap
;
}
void
setDefaults
()
{
partitioner
=
2
;
...
...
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