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())
|
||||
{
|
||||
// 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)
|
||||
{
|
||||
allPoints.append(procPoints[procI]);
|
||||
completeField.append(procFields[procI]);
|
||||
// Count points and faces; currently unmerged
|
||||
label nAllPoints = 0;
|
||||
label nAllFaces = 0;
|
||||
|
||||
// Point labels in faces need to be incremented with respect to
|
||||
// the size of the size of the previous processore patch
|
||||
forAll(procFaces[procI], faceI)
|
||||
forAll (procPoints, procI)
|
||||
{
|
||||
face curFace = procFaces[procI][faceI];
|
||||
forAll(curFace, pointI)
|
||||
{
|
||||
curFace[pointI] += prevProcPatchSize;
|
||||
}
|
||||
allFaces.append(curFace);
|
||||
nAllPoints += procPoints[procI].size();
|
||||
nAllFaces += procFaces[procI].size();
|
||||
}
|
||||
|
||||
// Increment the total number of points
|
||||
prevProcPatchSize += procPoints[procI].size();
|
||||
pointField allPoints(nAllPoints);
|
||||
faceList allFaces(nAllFaces);
|
||||
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)
|
||||
{
|
||||
allPoints[nAllPoints] = curPoints[cpI];
|
||||
renumberPoints[cpI] = nAllPoints;
|
||||
nAllPoints++;
|
||||
}
|
||||
|
||||
const faceList& curFaces = procFaces[procI];
|
||||
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
|
||||
|
|
Reference in a new issue