Skip to content
Snippets Groups Projects
Commit 5552c5f1 authored by mark's avatar mark
Browse files

ENH: provision for write boundaryProcAddressing, cellProcAddressing, etc.

- could be used for later reconstruction, but it is likely more stable
  to use logic similar to reconstructParMesh for more robustness.
parent 5d5aa01a
Branches
Tags
No related merge requests found
......@@ -160,6 +160,17 @@ protected:
//- Define/write mesh face information
void writeMeshFaces(const polyMesh&);
//- Define/write mesh proc-addressing
void writeMeshAddressing(const polyMesh&);
//- Define/write list of mesh zones
template<class ZoneMeshType>
void writeMeshZones
(
const fileName& zonePath,
const ZoneMeshType& zones
);
//- Define/write mesh points and face information
void writeMesh(const polyMesh&);
......
......@@ -92,7 +92,6 @@ void Foam::adiosCoreWrite::writeMeshFaces(const polyMesh& mesh)
writeIntVariable(varPath/"nFaces", mesh.nFaces());
writeIntVariable(varPath/"nInternalFaces", mesh.nInternalFaces());
const fileName facesPath = varPath/"faces";
// polyMesh/faces - save in compact form
......@@ -191,13 +190,112 @@ void Foam::adiosCoreWrite::writeMeshFaces(const polyMesh& mesh)
// polyMesh/boundary - byte-stream
writeStreamVariable(varPath/"boundary", mesh.boundaryMesh());
// processor addressing types
//
// polyMesh/boundaryProcAddressing
// polyMesh/cellProcAddressing
// polyMesh/faceProcAddressing
// polyMesh/pointProcAddressing
//
// save directly as polyMesh/addressing/boundary, ...
{
const fileName addrPath = varPath/"procAddressing";
const FixedList<word, 4> addressingTypes
{
"boundary", "cell", "face", "point"
};
const word facesInst = mesh.facesInstance();
for (const word& category : addressingTypes)
{
// label fields
labelIOList list
(
IOobject
(
category + "ProcAddressing",
facesInst,
polyMesh::meshSubDir,
mesh,
IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE,
false
)
);
// polyMesh/addressing/ - direct write
defineIntVariable(addrPath/category, list.size());
writeVariable(addrPath/category, list);
}
}
}
void Foam::adiosCoreWrite::writeMeshAddressing(const polyMesh& mesh)
{
const fileName varPath = adiosCore::meshPath(mesh.name());
// processor addressing types
//
// polyMesh/boundaryProcAddressing
// polyMesh/cellProcAddressing
// polyMesh/faceProcAddressing
// polyMesh/pointProcAddressing
// Q: Do we wish to handle cases with bad addressing?
// - ie, sanity check that the number of cells/boundaries etc make sense?
//
// Might be best to leave this to the reader-side of things instead.
const fileName addrPath = varPath/"procAddressing";
const FixedList<word, 4> addressingTypes
{
"boundary", "cell", "face", "point"
};
const word facesInst = mesh.facesInstance();
for (const word& category : addressingTypes)
{
labelIOList list
(
IOobject
(
category + "ProcAddressing",
facesInst,
polyMesh::meshSubDir,
mesh,
IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE,
false
)
);
// polyMesh/procAddressing/ - direct write
defineIntVariable(addrPath/category, list.size());
writeVariable(addrPath/category, list);
}
}
void Foam::adiosCoreWrite::writeMesh(const polyMesh& mesh)
{
const fileName varPath = adiosCore::meshPath(mesh.name());
writeMeshPoints(mesh);
writeMeshFaces(mesh);
// writeMeshAddressing(mesh);
// zones
writeMeshZones(varPath/"cellZones", mesh.cellZones());
writeMeshZones(varPath/"faceZones", mesh.faceZones());
writeMeshZones(varPath/"pointZones", mesh.pointZones());
// TODO?
// perhaps not really useful
// sets/ --> writeMeshSets(mesh);
}
......
......@@ -220,4 +220,22 @@ int64_t Foam::adiosCoreWrite::writeField
}
template<class ZoneMeshType>
void Foam::adiosCoreWrite::writeMeshZones
(
const fileName& zonePath,
const ZoneMeshType& zones
)
{
forAll(zones, zonei)
{
const zone& zn = zones[zonei];
const word& zoneName = zn.name();
defineIntVariable(zonePath/zoneName, zn.size());
writeVariable(zonePath/zoneName, zn);
}
}
// ************************************************************************* //
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment