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

View File

@ -38,6 +38,7 @@ License
#include "cellSet.H"
#include "faceSet.H"
#include "pointSet.H"
#include "uniformDimensionedFields.H"
// * * * * * * * * * * * * * 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 totProcFaces = 0;
label maxProcPatches = 0;
@ -767,8 +822,28 @@ bool Foam::domainDecomposition::writeDecomposition(const bool decomposeSets)
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)
{
forAll(cellSets, i)
@ -813,25 +888,67 @@ bool Foam::domainDecomposition::writeDecomposition(const bool decomposeSets)
}
// Write points if pointsInstance differing from facesInstance
if (facesInstancePointsPtr_.valid())
// hexRef8 data
if (cellLevelPtr.valid())
{
pointIOField pointsInstancePoints
labelIOList
(
IOobject
(
"points",
pointsInstance(),
cellLevelPtr().name(),
facesInstance(),
polyMesh::meshSubDir,
procMesh,
IOobject::NO_READ,
IOobject::NO_WRITE,
false
IOobject::AUTO_WRITE
),
xferMove(procPoints)
);
pointsInstancePoints.write();
UIndirectList<label>
(
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
<< "Processor " << procI << nl