Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Houman Mirzaalian Dastjerdi
waLBerla
Commits
8d804824
Commit
8d804824
authored
May 03, 2018
by
Sebastian Eibl
Browse files
MetisAssignment functor now uses weighted edges
parent
cbc79ce4
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/pe/amr/weight_assignment/MetisAssignmentFunctor.h
View file @
8d804824
...
...
@@ -41,32 +41,37 @@ public:
{
for
(
auto
it
=
blockData
.
begin
();
it
!=
blockData
.
end
();
++
it
)
{
const
double
weight
=
double_c
(
ic_
->
find
(
it
->
first
->
getId
()
)
->
second
.
numberOfLocalBodies
)
+
baseWeight_
;
//const double commWeight = double_c( edgeWeightFactor * (double_c(ic_->find( it->first->getId() )->second.numberOfShadowBodies) + baseWeight_)) + 1;
const
PhantomBlock
*
block
=
it
->
first
;
//only change of one level is supported!
WALBERLA_ASSERT_LESS
(
abs
(
int_c
(
block
->
getLevel
())
-
int_c
(
block
->
getSourceLevel
())),
2
);
//all information is provided by info collection
auto
infoIt
=
ic_
->
find
(
block
->
getId
()
);
WALBERLA_CHECK_UNEQUAL
(
infoIt
,
ic_
->
end
()
);
const
double
weight
=
double_c
(
infoIt
->
second
.
numberOfLocalBodies
)
+
baseWeight_
;
blockforest
::
DynamicParMetisBlockInfo
info
(
0
);
info
.
setVertexWeight
(
int64_c
(
weight
)
);
info
.
setVertexSize
(
int64_c
(
weight
)
);
info
.
setVertexCoords
(
it
->
first
->
getAABB
().
center
()
);
for
(
uint_t
nb
=
uint_t
(
0
);
nb
<
it
->
first
->
getNeighborhoodSize
();
++
nb
)
{
info
.
setEdgeWeight
(
it
->
first
->
getNeighborId
(
nb
),
int64_c
(
edgeWeight_
)
);
const
double
dx
(
1.0
);
info
.
setEdgeWeight
(
it
->
first
->
getNeighborId
(
nb
),
int64_c
(
it
->
first
->
getAABB
().
intersectionVolume
(
it
->
first
->
getNeighborAABB
(
nb
).
getExtended
(
dx
)
))
);
}
it
->
second
=
info
;
continue
;
}
}
inline
void
setBaseWeight
(
const
double
weight
)
{
baseWeight_
=
weight
;}
inline
double
getBaseWeight
()
const
{
return
baseWeight_
;
}
inline
void
setEdgeWeight
(
const
double
weight
)
{
edgeWeight_
=
weight
;}
inline
double
getEdgeWeight
()
const
{
return
edgeWeight_
;
}
private:
shared_ptr
<
InfoCollection
>
ic_
;
///Base weight due to allocated data structures. A weight of zero for blocks is dangerous as empty blocks might accumulate on one process!
double
baseWeight_
=
10.0
;
double
edgeWeight_
=
1.0
;
};
}
...
...
src/pe/amr/weight_assignment/WeightAssignmentFunctor.h
View file @
8d804824
...
...
@@ -43,37 +43,11 @@ public:
{
const
PhantomBlock
*
block
=
it
->
first
;
//only change of one level is supported!
WALBERLA_
ASSERT
_LESS
(
int_c
(
block
->
getLevel
())
-
int_c
(
block
->
getSourceLevel
()),
2
);
WALBERLA_
CHECK
_LESS
(
abs
(
int_c
(
block
->
getLevel
())
-
int_c
(
block
->
getSourceLevel
())
)
,
2
);
if
(
block
->
sourceBlockIsLarger
())
{
auto
infoIt
=
ic_
->
find
(
block
->
getId
()
/*.getFatherId()*/
);
WALBERLA_ASSERT_UNEQUAL
(
infoIt
,
ic_
->
end
()
);
it
->
second
=
PhantomBlockWeight
(
double_c
(
infoIt
->
second
.
numberOfLocalBodies
)
+
baseWeight_
);
continue
;
}
if
(
block
->
sourceBlockHasTheSameSize
())
{
auto
infoIt
=
ic_
->
find
(
block
->
getId
()
);
WALBERLA_ASSERT_UNEQUAL
(
infoIt
,
ic_
->
end
()
);
it
->
second
=
PhantomBlockWeight
(
double_c
(
infoIt
->
second
.
numberOfLocalBodies
)
+
baseWeight_
);
continue
;
}
if
(
block
->
sourceBlockIsSmaller
())
{
double
weight
=
0
;
for
(
uint_t
child
=
0
;
child
<
8
;
++
child
)
{
blockforest
::
BlockID
childId
(
block
->
getId
(),
child
);
auto
childIt
=
ic_
->
find
(
childId
);
WALBERLA_ASSERT_UNEQUAL
(
childIt
,
ic_
->
end
()
);
weight
+=
double_c
(
childIt
->
second
.
numberOfLocalBodies
);
}
it
->
second
=
PhantomBlockWeight
(
weight
+
baseWeight_
);
continue
;
}
auto
infoIt
=
ic_
->
find
(
block
->
getId
()
/*.getFatherId()*/
);
WALBERLA_CHECK_UNEQUAL
(
infoIt
,
ic_
->
end
()
);
it
->
second
=
PhantomBlockWeight
(
double_c
(
infoIt
->
second
.
numberOfLocalBodies
)
+
baseWeight_
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment