ENH: decomposePar: decompose hexRef8 data (snappyHexMesh)

This commit is contained in:
mattijs
2013-10-08 14:57:22 +01:00
parent e45011f538
commit 61966615ee
2 changed files with 189 additions and 97 deletions

View File

@ -99,6 +99,40 @@ Usage
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
const labelIOList& procAddressing
(
const PtrList<fvMesh>& procMeshList,
const label procI,
const word& name,
PtrList<labelIOList>& procAddressingList
)
{
const fvMesh& procMesh = procMeshList[procI];
if (!procAddressingList.set(procI))
{
procAddressingList.set
(
procI,
new labelIOList
(
IOobject
(
name,
procMesh.facesInstance(),
procMesh.meshSubDir,
procMesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
)
)
);
}
return procAddressingList[procI];
}
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
argList::addNote argList::addNote
@ -805,74 +839,29 @@ int main(int argc, char *argv[])
} }
const fvMesh& procMesh = procMeshList[procI]; const fvMesh& procMesh = procMeshList[procI];
const labelIOList& faceProcAddressing = procAddressing
if (!faceProcAddressingList.set(procI))
{
faceProcAddressingList.set
( (
procMeshList,
procI, procI,
new labelIOList
(
IOobject
(
"faceProcAddressing", "faceProcAddressing",
procMesh.facesInstance(), faceProcAddressingList
procMesh.meshSubDir,
procMesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
)
)
); );
}
const labelIOList& faceProcAddressing =
faceProcAddressingList[procI];
const labelIOList& cellProcAddressing = procAddressing
if (!cellProcAddressingList.set(procI))
{
cellProcAddressingList.set
( (
procMeshList,
procI, procI,
new labelIOList
(
IOobject
(
"cellProcAddressing", "cellProcAddressing",
procMesh.facesInstance(), cellProcAddressingList
procMesh.meshSubDir,
procMesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
)
)
); );
}
const labelIOList& cellProcAddressing =
cellProcAddressingList[procI];
const labelIOList& boundaryProcAddressing = procAddressing
if (!boundaryProcAddressingList.set(procI))
{
boundaryProcAddressingList.set
( (
procMeshList,
procI, procI,
new labelIOList
(
IOobject
(
"boundaryProcAddressing", "boundaryProcAddressing",
procMesh.facesInstance(), boundaryProcAddressingList
procMesh.meshSubDir,
procMesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
)
)
); );
}
const labelIOList& boundaryProcAddressing =
boundaryProcAddressingList[procI];
// FV fields // FV fields
@ -959,27 +948,13 @@ int main(int argc, char *argv[])
|| pointTensorFields.size() || pointTensorFields.size()
) )
{ {
if (!pointProcAddressingList.set(procI)) const labelIOList& pointProcAddressing = procAddressing
{
pointProcAddressingList.set
( (
procMeshList,
procI, procI,
new labelIOList
(
IOobject
(
"pointProcAddressing", "pointProcAddressing",
procMesh.facesInstance(), pointProcAddressingList
procMesh.meshSubDir,
procMesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
)
)
); );
}
const labelIOList& pointProcAddressing =
pointProcAddressingList[procI];
const pointMesh& procPMesh = pointMesh::New(procMesh); const pointMesh& procPMesh = pointMesh::New(procMesh);

View File

@ -38,6 +38,7 @@ License
#include "cellSet.H" #include "cellSet.H"
#include "faceSet.H" #include "faceSet.H"
#include "pointSet.H" #include "pointSet.H"
#include "uniformDimensionedFields.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
@ -195,6 +196,60 @@ bool Foam::domainDecomposition::writeDecomposition(const bool decomposeSets)
} }
autoPtr<labelIOList> cellLevelPtr;
{
IOobject io
(
"cellLevel",
facesInstance(),
polyMesh::meshSubDir,
*this,
IOobject::MUST_READ,
IOobject::NO_WRITE
);
if (io.headerOk())
{
Info<< "Reading hexRef8 data : " << io.name() << endl;
cellLevelPtr.reset(new labelIOList(io));
}
}
autoPtr<labelIOList> pointLevelPtr;
{
IOobject io
(
"pointLevel",
facesInstance(),
polyMesh::meshSubDir,
*this,
IOobject::MUST_READ,
IOobject::NO_WRITE
);
if (io.headerOk())
{
Info<< "Reading hexRef8 data : " << io.name() << endl;
pointLevelPtr.reset(new labelIOList(io));
}
}
autoPtr<uniformDimensionedScalarField> level0EdgePtr;
{
IOobject io
(
"level0Edge",
facesInstance(),
polyMesh::meshSubDir,
*this,
IOobject::MUST_READ,
IOobject::NO_WRITE
);
if (io.headerOk())
{
Info<< "Reading hexRef8 data : " << io.name() << endl;
level0EdgePtr.reset(new uniformDimensionedScalarField(io));
}
}
label maxProcCells = 0; label maxProcCells = 0;
label totProcFaces = 0; label totProcFaces = 0;
label maxProcPatches = 0; label maxProcPatches = 0;
@ -767,8 +822,28 @@ bool Foam::domainDecomposition::writeDecomposition(const bool decomposeSets)
procMesh.write(); procMesh.write();
// Write points if pointsInstance differing from facesInstance
if (facesInstancePointsPtr_.valid())
{
pointIOField pointsInstancePoints
(
IOobject
(
"points",
pointsInstance(),
polyMesh::meshSubDir,
procMesh,
IOobject::NO_READ,
IOobject::NO_WRITE,
false
),
xferMove(procPoints)
);
pointsInstancePoints.write();
}
// Decompose any sets
if (decomposeSets) if (decomposeSets)
{ {
forAll(cellSets, i) forAll(cellSets, i)
@ -813,25 +888,67 @@ bool Foam::domainDecomposition::writeDecomposition(const bool decomposeSets)
} }
// Write points if pointsInstance differing from facesInstance // hexRef8 data
if (facesInstancePointsPtr_.valid()) if (cellLevelPtr.valid())
{ {
pointIOField pointsInstancePoints labelIOList
( (
IOobject IOobject
( (
"points", cellLevelPtr().name(),
pointsInstance(), facesInstance(),
polyMesh::meshSubDir, polyMesh::meshSubDir,
procMesh, procMesh,
IOobject::NO_READ, IOobject::NO_READ,
IOobject::NO_WRITE, IOobject::AUTO_WRITE
false
), ),
xferMove(procPoints) UIndirectList<label>
); (
pointsInstancePoints.write(); cellLevelPtr(),
procCellAddressing_[procI]
)()
).write();
} }
if (pointLevelPtr.valid())
{
labelIOList
(
IOobject
(
pointLevelPtr().name(),
facesInstance(),
polyMesh::meshSubDir,
procMesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
UIndirectList<label>
(
pointLevelPtr(),
procPointAddressing_[procI]
)()
).write();
}
if (level0EdgePtr.valid())
{
uniformDimensionedScalarField
(
IOobject
(
level0EdgePtr().name(),
facesInstance(),
polyMesh::meshSubDir,
procMesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
level0EdgePtr()
).write();
}
// Statistics
Info<< endl Info<< endl
<< "Processor " << procI << nl << "Processor " << procI << nl