mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: foamyHexMesh: Shift calculateLoadBalance to DistributedDelaunayMesh
This commit is contained in:
@ -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
|
||||
(
|
||||
|
||||
@ -153,6 +153,8 @@ public:
|
||||
//- Use DelaunayMesh timeCheck function
|
||||
using DelaunayMesh<Triangulation>::timeCheck;
|
||||
|
||||
scalar calculateLoadUnbalance() const;
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
(
|
||||
|
||||
Reference in New Issue
Block a user