ENH: foamyHexMesh: Shift calculateLoadBalance to DistributedDelaunayMesh

This commit is contained in:
laurence
2013-07-29 15:38:30 +01:00
parent 60764c3941
commit 56421096d1
4 changed files with 41 additions and 46 deletions

View File

@ -747,6 +747,44 @@ void Foam::DistributedDelaunayMesh<Triangulation>::sync
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
template<class Triangulation>
Foam::scalar
Foam::DistributedDelaunayMesh<Triangulation>::calculateLoadUnbalance() const
{
label nRealVertices = 0;
for
(
Finite_vertices_iterator vit = Triangulation::finite_vertices_begin();
vit != Triangulation::finite_vertices_end();
++vit
)
{
// Only store real vertices that are not feature vertices
if (vit->real() && !vit->featurePoint())
{
nRealVertices++;
}
}
scalar globalNRealVertices = returnReduce
(
nRealVertices,
sumOp<label>()
);
scalar unbalance = returnReduce
(
mag(1.0 - nRealVertices/(globalNRealVertices/Pstream::nProcs())),
maxOp<scalar>()
);
Info<< " Processor unbalance " << unbalance << endl;
return unbalance;
}
template<class Triangulation>
bool Foam::DistributedDelaunayMesh<Triangulation>::distribute
(

View File

@ -153,6 +153,8 @@ public:
//- Use DelaunayMesh timeCheck function
using DelaunayMesh<Triangulation>::timeCheck;
scalar calculateLoadUnbalance() const;
// Member Functions

View File

@ -435,10 +435,6 @@ private:
// initialPointsMethod
void insertInitialPoints();
//- Calculate the worst load balance
template<class Triangulation>
scalar calculateLoadUnbalance(const Triangulation& mesh) const;
//- In parallel redistribute the backgroundMeshDecomposition and
// vertices to balance the number of vertices on each processor.
// Returns true if the background mesh changes as this removes all

View File

@ -27,47 +27,6 @@ License
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Triangulation>
Foam::scalar Foam::conformalVoronoiMesh::calculateLoadUnbalance
(
const Triangulation& mesh
) const
{
label nRealVertices = 0;
for
(
typename Triangulation::Finite_vertices_iterator vit
= mesh.finite_vertices_begin();
vit != mesh.finite_vertices_end();
++vit
)
{
// Only store real vertices that are not feature vertices
if (vit->real() && !vit->featurePoint())
{
nRealVertices++;
}
}
scalar globalNRealVertices = returnReduce
(
nRealVertices,
sumOp<label>()
);
scalar unbalance = returnReduce
(
mag(1.0 - nRealVertices/(globalNRealVertices/Pstream::nProcs())),
maxOp<scalar>()
);
Info<< " Processor unbalance " << unbalance << endl;
return unbalance;
}
template<class Triangulation>
bool Foam::conformalVoronoiMesh::distributeBackground(const Triangulation& mesh)
{
@ -86,7 +45,7 @@ bool Foam::conformalVoronoiMesh::distributeBackground(const Triangulation& mesh)
while (true)
{
scalar maxLoadUnbalance = calculateLoadUnbalance(mesh);
scalar maxLoadUnbalance = mesh.calculateLoadUnbalance();
if
(