Commit 5e861237 authored by Siqi Ling's avatar Siqi Ling

small change in MeshDistributor

parent 8cb3442e
......@@ -1448,7 +1448,7 @@ namespace AMDiS { namespace Parallel {
Parameters::get("parallel->repartitioning->imbalance",
imbalanceRepartitionBound);
//TODO:047
if (imbalanceFactor > imbalanceRepartitionBound)
repartitioning = 1;
......@@ -1481,9 +1481,6 @@ namespace AMDiS { namespace Parallel {
sumWeight += it->second;
}
//TODO:047
// elemWeights[0] = 10000.0;
mpi::globalMax(maxWeight);
mpi::globalAdd(sumWeight);
......@@ -1491,7 +1488,7 @@ namespace AMDiS { namespace Parallel {
}
void MeshDistributor::repartitionMesh()
bool MeshDistributor::repartitionMesh()
{
FUNCNAME("MeshDistributor::repartitionMesh()");
......@@ -1500,7 +1497,7 @@ namespace AMDiS { namespace Parallel {
// === First, check if the load is unbalanced on the ranks. ===
if (!isRepartitionNecessary())
return;
return false;
Timer t;
......@@ -1520,7 +1517,10 @@ namespace AMDiS { namespace Parallel {
// === Create new element weights. ===
calculateElemWeights();
int externalWeight = 0;
Parameters::get("parallel->use external weights", externalWeight);
if (!externalWeight)
calculateElemWeights();
// === Run mesh partitioner to calculate a new mesh partitioning. ===
......@@ -1535,8 +1535,7 @@ namespace AMDiS { namespace Parallel {
repartitioningFailed = repartitioningWaitAfterFail;;
MSG("Mesh partitioner created empty partition!\n");
MSG("Mesh repartitioning needed %.5f seconds\n", t.elapsed());
// sleep(1);
return;
return false;
}
......@@ -1549,9 +1548,8 @@ namespace AMDiS { namespace Parallel {
if (!partitioningSucceed || !partitioner->meshChanged()) {
mpiComm.Barrier();
repartitioningFailed = repartitioningWaitAfterFail;;
MSG("Mesh repartitioning needed %.5f seconds\n", t.elapsed());
// sleep(1);
return;
MSG("Mesh repartitioning needed %.5f seconds\n", t.elapsed());
return false;
}
}
......@@ -1598,12 +1596,17 @@ namespace AMDiS { namespace Parallel {
mpiComm.Barrier();
MSG("Mesh repartitioning needed %.5f seconds\n", t.elapsed());
return true;
}
void MeshDistributor::quickRepartition()
{
FUNCNAME("MeshDistributor::quickRepartition()");
#if (DEBUG != 0)
MSG("Run quickRepartition ...\n");
#endif
MPI::Intracomm &mpiComm = MPI::COMM_WORLD;
// === Create map that maps macro element indices to pointers to the ===
// === macro elements. ===
......@@ -1803,6 +1806,10 @@ namespace AMDiS { namespace Parallel {
{
FUNCNAME("MeshDistributor::fullRepartition()");
#if (DEBUG != 0)
MSG("Run fullRepartition ...\n");
#endif
TEST_EXIT(interchangeVectors.size() > 0)
("There are no interchange vectors defined!\n");
......
......@@ -115,7 +115,7 @@ namespace AMDiS { namespace Parallel {
/// Checks if is required to repartition the mesh. If this is the case, a new
/// partition will be created and the mesh will be redistributed between the
/// ranks.
void repartitionMesh();
bool repartitionMesh();
void quickRepartition();
......@@ -333,6 +333,11 @@ namespace AMDiS { namespace Parallel {
{
repartitioningAllowed = allowed;
}
void setElementWeights(std::map<int, double>& elWgts)
{
elemWeights = elWgts;
}
protected:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment