ENH: Added write patch geometry to externalCoupled BC

This commit is contained in:
andy
2013-02-07 16:43:07 +00:00
parent 29b74534c7
commit d8d7a8a482
2 changed files with 62 additions and 0 deletions

View File

@ -30,6 +30,7 @@ License
#include "IFstream.H"
#include "OFstream.H"
#include "globalIndex.H"
#include "ListListOps.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -52,6 +53,62 @@ Foam::fileName Foam::externalCoupledMixedFvPatchField<Type>::baseDir() const
}
template<class Type>
void Foam::externalCoupledMixedFvPatchField<Type>::writeGeometry() const
{
int tag = Pstream::msgType() + 1;
const label procI = Pstream::myProcNo();
const polyPatch& p = this->patch().patch();
const polyMesh& mesh = p.boundaryMesh().mesh();
labelList pointToGlobal;
labelList uniquePointIDs;
(void)mesh.globalData().mergePoints
(
p.meshPoints(),
p.meshPointMap(),
pointToGlobal,
uniquePointIDs
);
List<pointField> allPoints(Pstream::nProcs());
allPoints[procI] = pointField(mesh.points(), uniquePointIDs);
Pstream::gatherList(allPoints, tag);
List<faceList> allFaces(Pstream::nProcs());
faceList& patchFaces = allFaces[procI];
patchFaces = p.localFaces();
forAll(patchFaces, faceI)
{
inplaceRenumber(pointToGlobal, patchFaces[faceI]);
}
Pstream::gatherList(allFaces, tag);
if (Pstream::master())
{
OFstream osPoints(baseDir()/"patchPoints");
if (log_)
{
Info<< "writing patch points to: " << osPoints.name() << endl;
}
osPoints<<
ListListOps::combine<pointField>(allPoints, accessOp<pointField>());
OFstream osFaces(baseDir()/"patchFaces");
if (log_)
{
Info<< "writing patch faces to: " << osFaces.name() << endl;
}
osFaces<<
ListListOps::combine<faceList>(allFaces, accessOp<faceList>());
}
}
template<class Type>
Foam::fileName Foam::externalCoupledMixedFvPatchField<Type>::lockFile() const
{
@ -346,6 +403,8 @@ Foam::externalCoupledMixedFvPatchField<Type>::externalCoupledMixedFvPatchField
this->refValue() = *this;
this->refGrad() = pTraits<Type>::zero;
this->valueFraction() = 1.0;
writeGeometry();
}

View File

@ -137,6 +137,9 @@ protected:
//- Return the file path to the base communications folder
fileName baseDir() const;
//- Write the geometry to the comms dir
void writeGeometry() const;
//- Return the file path to the lock file
fileName lockFile() const;