Rewrite of parallel gather-write of immersed boundary patch data
This commit is contained in:
parent
328c75a101
commit
624b6a72b8
1 changed files with 53 additions and 18 deletions
|
@ -107,30 +107,65 @@ void Foam::immersedBoundaryFieldBase<Type>::writeField
|
||||||
if (Pstream::master())
|
if (Pstream::master())
|
||||||
{
|
{
|
||||||
// Assemble unique lists to correspond to a single surface
|
// Assemble unique lists to correspond to a single surface
|
||||||
pointField allPoints(0);
|
|
||||||
Field<Type> completeField(0);
|
|
||||||
faceList allFaces(0);
|
|
||||||
label prevProcPatchSize = 0;
|
|
||||||
|
|
||||||
forAll(procPoints, procI)
|
// Count points and faces; currently unmerged
|
||||||
|
label nAllPoints = 0;
|
||||||
|
label nAllFaces = 0;
|
||||||
|
|
||||||
|
forAll (procPoints, procI)
|
||||||
{
|
{
|
||||||
allPoints.append(procPoints[procI]);
|
nAllPoints += procPoints[procI].size();
|
||||||
completeField.append(procFields[procI]);
|
nAllFaces += procFaces[procI].size();
|
||||||
|
}
|
||||||
|
|
||||||
// Point labels in faces need to be incremented with respect to
|
pointField allPoints(nAllPoints);
|
||||||
// the size of the size of the previous processore patch
|
faceList allFaces(nAllFaces);
|
||||||
forAll(procFaces[procI], faceI)
|
Field<Type> completeField(nAllFaces);
|
||||||
|
|
||||||
|
// Reset counters
|
||||||
|
nAllPoints = 0;
|
||||||
|
nAllFaces = 0;
|
||||||
|
|
||||||
|
forAll (procPoints, procI)
|
||||||
|
{
|
||||||
|
const pointField& curPoints = procPoints[procI];
|
||||||
|
labelList renumberPoints(curPoints.size());
|
||||||
|
|
||||||
|
forAll (curPoints, cpI)
|
||||||
{
|
{
|
||||||
face curFace = procFaces[procI][faceI];
|
allPoints[nAllPoints] = curPoints[cpI];
|
||||||
forAll(curFace, pointI)
|
renumberPoints[cpI] = nAllPoints;
|
||||||
{
|
nAllPoints++;
|
||||||
curFace[pointI] += prevProcPatchSize;
|
|
||||||
}
|
|
||||||
allFaces.append(curFace);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Increment the total number of points
|
const faceList& curFaces = procFaces[procI];
|
||||||
prevProcPatchSize += procPoints[procI].size();
|
const Field<Type>& curField = procFields[procI];
|
||||||
|
|
||||||
|
forAll (curFaces, cfI)
|
||||||
|
{
|
||||||
|
// Point labels in faces need to be renumbered with respect
|
||||||
|
// to the size of the size of the previous processore patch
|
||||||
|
const face& oldFace = curFaces[cfI];
|
||||||
|
|
||||||
|
// Make a copy of face to renumber
|
||||||
|
face renumberedFace(oldFace.size());
|
||||||
|
|
||||||
|
forAll (oldFace, fpI)
|
||||||
|
{
|
||||||
|
renumberedFace[fpI] = renumberPoints[oldFace[fpI]];
|
||||||
|
}
|
||||||
|
|
||||||
|
allFaces[nAllFaces] = renumberedFace;
|
||||||
|
completeField[nAllFaces] = curField[cfI];
|
||||||
|
nAllFaces++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nAllPoints != allPoints.size() || nAllFaces != allFaces.size())
|
||||||
|
{
|
||||||
|
FatalErrorInFunction
|
||||||
|
<< "Problem with merge of immersed boundary patch data"
|
||||||
|
<< abort(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
writerPtr->write
|
writerPtr->write
|
||||||
|
|
Reference in a new issue