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);
|
// Count points and faces; currently unmerged
|
||||||
faceList allFaces(0);
|
label nAllPoints = 0;
|
||||||
label prevProcPatchSize = 0;
|
label nAllFaces = 0;
|
||||||
|
|
||||||
forAll (procPoints, procI)
|
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
|
|
||||||
// the size of the size of the previous processore patch
|
|
||||||
forAll(procFaces[procI], faceI)
|
|
||||||
{
|
|
||||||
face curFace = procFaces[procI][faceI];
|
|
||||||
forAll(curFace, pointI)
|
|
||||||
{
|
|
||||||
curFace[pointI] += prevProcPatchSize;
|
|
||||||
}
|
|
||||||
allFaces.append(curFace);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Increment the total number of points
|
pointField allPoints(nAllPoints);
|
||||||
prevProcPatchSize += procPoints[procI].size();
|
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
|
writerPtr->write
|
||||||
|
|
Reference in a new issue