Temporary bugfix in decomposeMesh

Needs clean-up and refactorization
This commit is contained in:
Vuko Vukcevic 2019-02-01 09:43:40 +01:00
parent 957235997b
commit 21154aa132

View file

@ -168,6 +168,10 @@ void Foam::domainDecomposition::decomposeMesh(const bool filterEmptyPatches)
// that will be created in decomposition when running in parallel
forAll (patches, patchI)
{
// VV Comment: Why do we need to check whether the neighbour data
// exists? If it is a processorPolyPatch, shouldn't it be impossible
// for the data not to exist?
// Check the processor patch for which neighbour data exists
if
(
@ -178,6 +182,10 @@ void Foam::domainDecomposition::decomposeMesh(const bool filterEmptyPatches)
const processorPolyPatch& procPatch =
refCast<const processorPolyPatch>(patches[patchI]);
// VV Comment: Shouldn't we make sure that the "new" slave is
// handled here only, and not the "old" slave? E.g. check
// whether ownerProc < neighbourProc?
// DO ONLY SLAVE SIDE
if (!procPatch.master())
{
@ -274,6 +282,27 @@ void Foam::domainDecomposition::decomposeMesh(const bool filterEmptyPatches)
}
}
Pout<< "_________________________________________________" << endl;
Pout<< "SLAVE FINISHED" << endl;
forAll (interProcBoundaries, procI)
{
Pout<< "Inter processor boundary for proc: " << procI << nl
<< "Neighbouring processors: ";
const SLList<label> nbrProcs = interProcBoundaries[procI];
for
(
SLList<label>::const_iterator iter = nbrProcs.cbegin();
iter != nbrProcs.cend();
++iter
)
{
Pout<< iter() << ", ";
}
Pout<< endl;
}
Pout<< "_________________________________________________" << endl;
// Internal mesh faces
forAll (neighbour, faceI)
{
@ -288,6 +317,7 @@ void Foam::domainDecomposition::decomposeMesh(const bool filterEmptyPatches)
// Search algorithm repeated in processor patches. Reconsider
// HJ, 11/Apr/2018
// Handle owner
SLList<label>::iterator curInterProcBdrsOwnIter =
interProcBoundaries[ownerProc].begin();
@ -314,6 +344,24 @@ void Foam::domainDecomposition::decomposeMesh(const bool filterEmptyPatches)
interProcBouFound = true;
curInterProcBFacesOwnIter().append(faceI);
}
if (interProcBouFound) break;
}
if (!interProcBouFound)
{
// inter - processor boundaries do not exist and need to
// be created
// set the new addressing information
// Add owner side
interProcBoundaries[ownerProc].append(neighbourProc);
interProcBFaces[ownerProc].append(SLList<label>(faceI));
}
// Handle neighbour
SLList<label>::iterator curInterProcBdrsNeiIter =
interProcBoundaries[neighbourProc].begin();
@ -363,30 +411,29 @@ void Foam::domainDecomposition::decomposeMesh(const bool filterEmptyPatches)
);
}
}
if (interProcBouFound) break;
}
if (!interProcBouFound)
Pout<< "_________________________________________________" << endl;
Pout<< "INTERNAL FACES FINISHED" << endl;
forAll (interProcBoundaries, procI)
{
// inter - processor boundaries do not exist and need to
// be created
// set the new addressing information
// Add owner side
interProcBoundaries[ownerProc].append(neighbourProc);
interProcBFaces[ownerProc].append(SLList<label>(faceI));
// Add neighbour side
interProcBoundaries[neighbourProc].append(ownerProc);
interProcBFaces[neighbourProc].append
Pout<< "Inter processor boundary for proc: " << procI << nl
<< "Neighbouring processors: ";
const SLList<label> nbrProcs = interProcBoundaries[procI];
for
(
SLList<label>(faceI)
);
}
SLList<label>::const_iterator iter = nbrProcs.cbegin();
iter != nbrProcs.cend();
++iter
)
{
Pout<< iter() << ", ";
}
Pout<< endl;
}
Pout<< "_________________________________________________" << endl;
// Dump current processor patch faces into new processor patches
// that will be created in decomposition when running in parallel
@ -498,6 +545,28 @@ void Foam::domainDecomposition::decomposeMesh(const bool filterEmptyPatches)
}
}
Pout<< "_________________________________________________" << endl;
Pout<< "MASTER FINISHED" << endl;
forAll (interProcBoundaries, procI)
{
Pout<< "Inter processor boundary for proc: " << procI << nl
<< "Neighbouring processors: ";
const SLList<label> nbrProcs = interProcBoundaries[procI];
for
(
SLList<label>::const_iterator iter = nbrProcs.cbegin();
iter != nbrProcs.cend();
++iter
)
{
Pout<< iter() << ", ";
}
Pout<< endl;
}
Pout<< "_________________________________________________" << endl;
// Loop through patches. For cyclic boundaries detect inter-processor
// faces; for all other, add faces to the face list and remember start
// and size of all patches.
@ -775,6 +844,28 @@ void Foam::domainDecomposition::decomposeMesh(const bool filterEmptyPatches)
}
}
Pout<< "_________________________________________________" << endl;
Pout<< "CYCLICS FINISHED" << endl;
forAll (interProcBoundaries, procI)
{
Pout<< "Inter processor boundary for proc: " << procI << nl
<< "Neighbouring processors: ";
const SLList<label> nbrProcs = interProcBoundaries[procI];
for
(
SLList<label>::const_iterator iter = nbrProcs.cbegin();
iter != nbrProcs.cend();
++iter
)
{
Pout<< iter() << ", ";
}
Pout<< endl;
}
Pout<< "_________________________________________________" << endl;
// Face zone treatment. HJ, 27/Mar/2009
// Face zones identified as global will be present on all CPUs
List<SLList<label> > procZoneFaceList(nProcs_);
@ -836,6 +927,29 @@ void Foam::domainDecomposition::decomposeMesh(const bool filterEmptyPatches)
}
}
// VV Comment: Probably need to sort linked lists here. Since we have
// visited patch faces patch by patch and were looking at new neighbour
// and new owner processor index, it is possible that the ordering of
// neighbours won't be good.
Pout<< "_________________________________________________" << endl;
Pout<< "ALL STAGES FINISHED" << endl;
forAll (interProcBoundaries, procI)
{
Pout<< "Inter processor boundary for proc: " << procI << nl
<< "Neighbouring processors: ";
const SLList<label> nbrProcs = interProcBoundaries[procI];
for
(
SLList<label>::const_iterator iter = nbrProcs.cbegin();
iter != nbrProcs.cend();
++iter
)
{
Pout<< iter() << ", ";
}
Pout<< endl;
}
Pout<< "_________________________________________________" << endl;
// Convert linked lists into normal lists
// Add inter-processor boundaries and remember start indices