mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Correction to the ordering of nsided and nfaced elements provided by
Francesco Del Citto.
This commit is contained in:
@ -428,7 +428,43 @@ void Foam::ensightMesh::writePrimsBinary
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::ensightMesh::writePolys
|
void Foam::ensightMesh::writePolysNFaces
|
||||||
|
(
|
||||||
|
const labelList& polys,
|
||||||
|
const cellList& cellFaces,
|
||||||
|
OFstream& ensightGeometryFile
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
forAll(polys, i)
|
||||||
|
{
|
||||||
|
ensightGeometryFile
|
||||||
|
<< setw(10) << cellFaces[polys[i]].size() << nl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::ensightMesh::writePolysNPointsPerFace
|
||||||
|
(
|
||||||
|
const labelList& polys,
|
||||||
|
const cellList& cellFaces,
|
||||||
|
const faceList& faces,
|
||||||
|
OFstream& ensightGeometryFile
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
forAll(polys, i)
|
||||||
|
{
|
||||||
|
const labelList& cf = cellFaces[polys[i]];
|
||||||
|
|
||||||
|
forAll(cf, faceI)
|
||||||
|
{
|
||||||
|
ensightGeometryFile
|
||||||
|
<< setw(10) << faces[cf[faceI]].size() << nl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::ensightMesh::writePolysPoints
|
||||||
(
|
(
|
||||||
const labelList& polys,
|
const labelList& polys,
|
||||||
const cellList& cellFaces,
|
const cellList& cellFaces,
|
||||||
@ -437,50 +473,190 @@ void Foam::ensightMesh::writePolys
|
|||||||
OFstream& ensightGeometryFile
|
OFstream& ensightGeometryFile
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
if (polys.size())
|
label po = pointOffset + 1;
|
||||||
|
|
||||||
|
forAll(polys, i)
|
||||||
{
|
{
|
||||||
ensightGeometryFile
|
const labelList& cf = cellFaces[polys[i]];
|
||||||
<< "nfaced" << nl << setw(10) << polys.size() << nl;
|
|
||||||
|
|
||||||
label po = pointOffset + 1;
|
forAll(cf, faceI)
|
||||||
|
|
||||||
forAll(polys, i)
|
|
||||||
{
|
{
|
||||||
ensightGeometryFile
|
const face& f = faces[cf[faceI]];
|
||||||
<< setw(10) << cellFaces[polys[i]].size() << nl;
|
|
||||||
}
|
|
||||||
|
|
||||||
forAll(polys, i)
|
forAll(f, pointI)
|
||||||
{
|
|
||||||
const labelList& cf = cellFaces[polys[i]];
|
|
||||||
|
|
||||||
forAll(cf, faceI)
|
|
||||||
{
|
{
|
||||||
ensightGeometryFile
|
ensightGeometryFile << setw(10) << f[pointI] + po;
|
||||||
<< setw(10) << faces[cf[faceI]].size() << nl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
forAll(polys, i)
|
|
||||||
{
|
|
||||||
const labelList& cf = cellFaces[polys[i]];
|
|
||||||
|
|
||||||
forAll(cf, faceI)
|
|
||||||
{
|
|
||||||
const face& f = faces[cf[faceI]];
|
|
||||||
|
|
||||||
forAll(f, pointI)
|
|
||||||
{
|
|
||||||
ensightGeometryFile << setw(10) << f[pointI] + po;
|
|
||||||
}
|
|
||||||
ensightGeometryFile << nl;
|
|
||||||
}
|
}
|
||||||
|
ensightGeometryFile << nl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::ensightMesh::writePolysBinary
|
void Foam::ensightMesh::writeAllPolys
|
||||||
|
(
|
||||||
|
const labelList& pointOffsets,
|
||||||
|
OFstream& ensightGeometryFile
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
if (meshCellSets_.nPolys)
|
||||||
|
{
|
||||||
|
const cellList& cellFaces = mesh_.cells();
|
||||||
|
const faceList& faces = mesh_.faces();
|
||||||
|
|
||||||
|
if (Pstream::master())
|
||||||
|
{
|
||||||
|
ensightGeometryFile
|
||||||
|
<< "nfaced" << nl << setw(10) << meshCellSets_.nPolys << nl;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Number of faces for each poly cell
|
||||||
|
if (Pstream::master())
|
||||||
|
{
|
||||||
|
// Master
|
||||||
|
writePolysNFaces
|
||||||
|
(
|
||||||
|
meshCellSets_.polys,
|
||||||
|
cellFaces,
|
||||||
|
ensightGeometryFile
|
||||||
|
);
|
||||||
|
// Slaves
|
||||||
|
for (int slave=1; slave<Pstream::nProcs(); slave++)
|
||||||
|
{
|
||||||
|
IPstream fromSlave(Pstream::scheduled, slave);
|
||||||
|
labelList polys(fromSlave);
|
||||||
|
cellList cellFaces(fromSlave);
|
||||||
|
|
||||||
|
writePolysNFaces
|
||||||
|
(
|
||||||
|
polys,
|
||||||
|
cellFaces,
|
||||||
|
ensightGeometryFile
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
|
||||||
|
toMaster<< meshCellSets_.polys << cellFaces;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Number of points for each face of the above list
|
||||||
|
if (Pstream::master())
|
||||||
|
{
|
||||||
|
// Master
|
||||||
|
writePolysNPointsPerFace
|
||||||
|
(
|
||||||
|
meshCellSets_.polys,
|
||||||
|
cellFaces,
|
||||||
|
faces,
|
||||||
|
ensightGeometryFile
|
||||||
|
);
|
||||||
|
// Slaves
|
||||||
|
for (int slave=1; slave<Pstream::nProcs(); slave++)
|
||||||
|
{
|
||||||
|
IPstream fromSlave(Pstream::scheduled, slave);
|
||||||
|
labelList polys(fromSlave);
|
||||||
|
cellList cellFaces(fromSlave);
|
||||||
|
faceList faces(fromSlave);
|
||||||
|
|
||||||
|
writePolysNPointsPerFace
|
||||||
|
(
|
||||||
|
polys,
|
||||||
|
cellFaces,
|
||||||
|
faces,
|
||||||
|
ensightGeometryFile
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
|
||||||
|
toMaster<< meshCellSets_.polys << cellFaces << faces;
|
||||||
|
}
|
||||||
|
|
||||||
|
// List of points id for each face of the above list
|
||||||
|
if (Pstream::master())
|
||||||
|
{
|
||||||
|
// Master
|
||||||
|
writePolysPoints
|
||||||
|
(
|
||||||
|
meshCellSets_.polys,
|
||||||
|
cellFaces,
|
||||||
|
faces,
|
||||||
|
0,
|
||||||
|
ensightGeometryFile
|
||||||
|
);
|
||||||
|
// Slaves
|
||||||
|
for (int slave=1; slave<Pstream::nProcs(); slave++)
|
||||||
|
{
|
||||||
|
IPstream fromSlave(Pstream::scheduled, slave);
|
||||||
|
labelList polys(fromSlave);
|
||||||
|
cellList cellFaces(fromSlave);
|
||||||
|
faceList faces(fromSlave);
|
||||||
|
|
||||||
|
writePolysPoints
|
||||||
|
(
|
||||||
|
polys,
|
||||||
|
cellFaces,
|
||||||
|
faces,
|
||||||
|
pointOffsets[slave-1],
|
||||||
|
ensightGeometryFile
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
|
||||||
|
toMaster<< meshCellSets_.polys << cellFaces << faces;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::ensightMesh::writePolysNFacesBinary
|
||||||
|
(
|
||||||
|
const labelList& polys,
|
||||||
|
const cellList& cellFaces,
|
||||||
|
std::ofstream& ensightGeometryFile
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
forAll(polys, i)
|
||||||
|
{
|
||||||
|
writeEnsDataBinary
|
||||||
|
(
|
||||||
|
cellFaces[polys[i]].size(),
|
||||||
|
ensightGeometryFile
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::ensightMesh::writePolysNPointsPerFaceBinary
|
||||||
|
(
|
||||||
|
const labelList& polys,
|
||||||
|
const cellList& cellFaces,
|
||||||
|
const faceList& faces,
|
||||||
|
std::ofstream& ensightGeometryFile
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
forAll(polys, i)
|
||||||
|
{
|
||||||
|
const labelList& cf = cellFaces[polys[i]];
|
||||||
|
|
||||||
|
forAll(cf, faceI)
|
||||||
|
{
|
||||||
|
writeEnsDataBinary
|
||||||
|
(
|
||||||
|
faces[cf[faceI]].size(),
|
||||||
|
ensightGeometryFile
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::ensightMesh::writePolysPointsBinary
|
||||||
(
|
(
|
||||||
const labelList& polys,
|
const labelList& polys,
|
||||||
const cellList& cellFaces,
|
const cellList& cellFaces,
|
||||||
@ -489,51 +665,142 @@ void Foam::ensightMesh::writePolysBinary
|
|||||||
std::ofstream& ensightGeometryFile
|
std::ofstream& ensightGeometryFile
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
if (polys.size())
|
label po = pointOffset + 1;
|
||||||
|
|
||||||
|
forAll(polys, i)
|
||||||
{
|
{
|
||||||
writeEnsDataBinary("nfaced",ensightGeometryFile);
|
const labelList& cf = cellFaces[polys[i]];
|
||||||
writeEnsDataBinary(polys.size(),ensightGeometryFile);
|
|
||||||
|
|
||||||
label po = pointOffset + 1;
|
forAll(cf, faceI)
|
||||||
|
|
||||||
//TODO No buffer at the moment. To be done for speed purposes!
|
|
||||||
forAll(polys, i)
|
|
||||||
{
|
{
|
||||||
writeEnsDataBinary
|
const face& f = faces[cf[faceI]];
|
||||||
(
|
|
||||||
cellFaces[polys[i]].size(),
|
forAll(f, pointI)
|
||||||
ensightGeometryFile
|
{
|
||||||
);
|
writeEnsDataBinary(f[pointI] + po,ensightGeometryFile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::ensightMesh::writeAllPolysBinary
|
||||||
|
(
|
||||||
|
const labelList& pointOffsets,
|
||||||
|
std::ofstream& ensightGeometryFile
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
if (meshCellSets_.nPolys)
|
||||||
|
{
|
||||||
|
const cellList& cellFaces = mesh_.cells();
|
||||||
|
const faceList& faces = mesh_.faces();
|
||||||
|
|
||||||
|
if (Pstream::master())
|
||||||
|
{
|
||||||
|
writeEnsDataBinary("nfaced",ensightGeometryFile);
|
||||||
|
writeEnsDataBinary(meshCellSets_.nPolys,ensightGeometryFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
forAll(polys, i)
|
// Number of faces for each poly cell
|
||||||
|
if (Pstream::master())
|
||||||
{
|
{
|
||||||
const labelList& cf = cellFaces[polys[i]];
|
// Master
|
||||||
|
writePolysNFacesBinary
|
||||||
forAll(cf, faceI)
|
(
|
||||||
|
meshCellSets_.polys,
|
||||||
|
cellFaces,
|
||||||
|
ensightGeometryFile
|
||||||
|
);
|
||||||
|
// Slaves
|
||||||
|
for (int slave=1; slave<Pstream::nProcs(); slave++)
|
||||||
{
|
{
|
||||||
writeEnsDataBinary
|
IPstream fromSlave(Pstream::scheduled, slave);
|
||||||
|
labelList polys(fromSlave);
|
||||||
|
cellList cellFaces(fromSlave);
|
||||||
|
|
||||||
|
writePolysNFacesBinary
|
||||||
(
|
(
|
||||||
faces[cf[faceI]].size(),
|
polys,
|
||||||
|
cellFaces,
|
||||||
ensightGeometryFile
|
ensightGeometryFile
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
forAll(polys, i)
|
|
||||||
{
|
{
|
||||||
const labelList& cf = cellFaces[polys[i]];
|
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
|
||||||
|
toMaster<< meshCellSets_.polys << cellFaces;
|
||||||
|
}
|
||||||
|
|
||||||
forAll(cf, faceI)
|
// Number of points for each face of the above list
|
||||||
|
if (Pstream::master())
|
||||||
|
{
|
||||||
|
// Master
|
||||||
|
writePolysNPointsPerFaceBinary
|
||||||
|
(
|
||||||
|
meshCellSets_.polys,
|
||||||
|
cellFaces,
|
||||||
|
faces,
|
||||||
|
ensightGeometryFile
|
||||||
|
);
|
||||||
|
// Slaves
|
||||||
|
for (int slave=1; slave<Pstream::nProcs(); slave++)
|
||||||
{
|
{
|
||||||
const face& f = faces[cf[faceI]];
|
IPstream fromSlave(Pstream::scheduled, slave);
|
||||||
|
labelList polys(fromSlave);
|
||||||
|
cellList cellFaces(fromSlave);
|
||||||
|
faceList faces(fromSlave);
|
||||||
|
|
||||||
forAll(f, pointI)
|
writePolysNPointsPerFaceBinary
|
||||||
{
|
(
|
||||||
writeEnsDataBinary(f[pointI] + po,ensightGeometryFile);
|
polys,
|
||||||
}
|
cellFaces,
|
||||||
|
faces,
|
||||||
|
ensightGeometryFile
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
|
||||||
|
toMaster<< meshCellSets_.polys << cellFaces << faces;
|
||||||
|
}
|
||||||
|
|
||||||
|
// List of points id for each face of the above list
|
||||||
|
if (Pstream::master())
|
||||||
|
{
|
||||||
|
// Master
|
||||||
|
writePolysPointsBinary
|
||||||
|
(
|
||||||
|
meshCellSets_.polys,
|
||||||
|
cellFaces,
|
||||||
|
faces,
|
||||||
|
0,
|
||||||
|
ensightGeometryFile
|
||||||
|
);
|
||||||
|
// Slaves
|
||||||
|
for (int slave=1; slave<Pstream::nProcs(); slave++)
|
||||||
|
{
|
||||||
|
IPstream fromSlave(Pstream::scheduled, slave);
|
||||||
|
labelList polys(fromSlave);
|
||||||
|
cellList cellFaces(fromSlave);
|
||||||
|
faceList faces(fromSlave);
|
||||||
|
|
||||||
|
writePolysPointsBinary
|
||||||
|
(
|
||||||
|
polys,
|
||||||
|
cellFaces,
|
||||||
|
faces,
|
||||||
|
pointOffsets[slave-1],
|
||||||
|
ensightGeometryFile
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
|
||||||
|
toMaster<< meshCellSets_.polys << cellFaces << faces;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -619,7 +886,6 @@ void Foam::ensightMesh::writeAllPrimsBinary
|
|||||||
|
|
||||||
void Foam::ensightMesh::writeFacePrims
|
void Foam::ensightMesh::writeFacePrims
|
||||||
(
|
(
|
||||||
const char* key,
|
|
||||||
const faceList& patchFaces,
|
const faceList& patchFaces,
|
||||||
const label pointOffset,
|
const label pointOffset,
|
||||||
OFstream& ensightGeometryFile
|
OFstream& ensightGeometryFile
|
||||||
@ -627,18 +893,6 @@ void Foam::ensightMesh::writeFacePrims
|
|||||||
{
|
{
|
||||||
if (patchFaces.size())
|
if (patchFaces.size())
|
||||||
{
|
{
|
||||||
if (word(key) == "nsided")
|
|
||||||
{
|
|
||||||
ensightGeometryFile
|
|
||||||
<< key << nl << setw(10) << patchFaces.size() << nl;
|
|
||||||
|
|
||||||
forAll(patchFaces, i)
|
|
||||||
{
|
|
||||||
ensightGeometryFile
|
|
||||||
<< setw(10) << patchFaces[i].size() << nl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
label po = pointOffset + 1;
|
label po = pointOffset + 1;
|
||||||
|
|
||||||
forAll(patchFaces, i)
|
forAll(patchFaces, i)
|
||||||
@ -657,7 +911,6 @@ void Foam::ensightMesh::writeFacePrims
|
|||||||
|
|
||||||
void Foam::ensightMesh::writeFacePrimsBinary
|
void Foam::ensightMesh::writeFacePrimsBinary
|
||||||
(
|
(
|
||||||
const char* key,
|
|
||||||
const faceList& patchFaces,
|
const faceList& patchFaces,
|
||||||
const label pointOffset,
|
const label pointOffset,
|
||||||
std::ofstream& ensightGeometryFile
|
std::ofstream& ensightGeometryFile
|
||||||
@ -665,22 +918,6 @@ void Foam::ensightMesh::writeFacePrimsBinary
|
|||||||
{
|
{
|
||||||
if (patchFaces.size())
|
if (patchFaces.size())
|
||||||
{
|
{
|
||||||
//TODO No buffer at the moment. To be done for speed purposes!
|
|
||||||
if (word(key) == "nsided")
|
|
||||||
{
|
|
||||||
writeEnsDataBinary(key,ensightGeometryFile);
|
|
||||||
writeEnsDataBinary(patchFaces.size(),ensightGeometryFile);
|
|
||||||
|
|
||||||
forAll(patchFaces, i)
|
|
||||||
{
|
|
||||||
writeEnsDataBinary
|
|
||||||
(
|
|
||||||
patchFaces[i].size(),
|
|
||||||
ensightGeometryFile
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
label po = pointOffset + 1;
|
label po = pointOffset + 1;
|
||||||
|
|
||||||
forAll(patchFaces, i)
|
forAll(patchFaces, i)
|
||||||
@ -732,16 +969,12 @@ void Foam::ensightMesh::writeAllFacePrims
|
|||||||
{
|
{
|
||||||
if (Pstream::master())
|
if (Pstream::master())
|
||||||
{
|
{
|
||||||
if (word(key) != "nsided")
|
ensightGeometryFile << key << nl << setw(10) << nPrims << nl;
|
||||||
{
|
|
||||||
ensightGeometryFile << key << nl << setw(10) << nPrims << nl;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (&prims != NULL)
|
if (&prims != NULL)
|
||||||
{
|
{
|
||||||
writeFacePrims
|
writeFacePrims
|
||||||
(
|
(
|
||||||
key,
|
|
||||||
map(patchFaces, prims),
|
map(patchFaces, prims),
|
||||||
0,
|
0,
|
||||||
ensightGeometryFile
|
ensightGeometryFile
|
||||||
@ -758,7 +991,251 @@ void Foam::ensightMesh::writeAllFacePrims
|
|||||||
|
|
||||||
writeFacePrims
|
writeFacePrims
|
||||||
(
|
(
|
||||||
key,
|
patchFaces,
|
||||||
|
pointOffsets[i],
|
||||||
|
ensightGeometryFile
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (&prims != NULL)
|
||||||
|
{
|
||||||
|
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
|
||||||
|
toMaster<< map(patchFaces, prims);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::ensightMesh::writeNSidedNPointsPerFace
|
||||||
|
(
|
||||||
|
const faceList& patchFaces,
|
||||||
|
OFstream& ensightGeometryFile
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
forAll(patchFaces, i)
|
||||||
|
{
|
||||||
|
ensightGeometryFile
|
||||||
|
<< setw(10) << patchFaces[i].size() << nl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::ensightMesh::writeNSidedPoints
|
||||||
|
(
|
||||||
|
const faceList& patchFaces,
|
||||||
|
const label pointOffset,
|
||||||
|
OFstream& ensightGeometryFile
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
writeFacePrims
|
||||||
|
(
|
||||||
|
patchFaces,
|
||||||
|
pointOffset,
|
||||||
|
ensightGeometryFile
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::ensightMesh::writeAllNSided
|
||||||
|
(
|
||||||
|
const labelList& prims,
|
||||||
|
const label nPrims,
|
||||||
|
const faceList& patchFaces,
|
||||||
|
const labelList& pointOffsets,
|
||||||
|
const labelList& patchProcessors,
|
||||||
|
OFstream& ensightGeometryFile
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
if (nPrims)
|
||||||
|
{
|
||||||
|
if (Pstream::master())
|
||||||
|
{
|
||||||
|
ensightGeometryFile
|
||||||
|
<< "nsided" << nl << setw(10) << nPrims << nl;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Number of points for each face
|
||||||
|
if (Pstream::master())
|
||||||
|
{
|
||||||
|
if (&prims != NULL)
|
||||||
|
{
|
||||||
|
writeNSidedNPointsPerFace
|
||||||
|
(
|
||||||
|
map(patchFaces, prims),
|
||||||
|
ensightGeometryFile
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
forAll (patchProcessors, i)
|
||||||
|
{
|
||||||
|
if (patchProcessors[i] != 0)
|
||||||
|
{
|
||||||
|
label slave = patchProcessors[i];
|
||||||
|
IPstream fromSlave(Pstream::scheduled, slave);
|
||||||
|
faceList patchFaces(fromSlave);
|
||||||
|
|
||||||
|
writeNSidedNPointsPerFace
|
||||||
|
(
|
||||||
|
patchFaces,
|
||||||
|
ensightGeometryFile
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (&prims != NULL)
|
||||||
|
{
|
||||||
|
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
|
||||||
|
toMaster<< map(patchFaces, prims);
|
||||||
|
}
|
||||||
|
|
||||||
|
// List of points id for each face
|
||||||
|
if (Pstream::master())
|
||||||
|
{
|
||||||
|
if (&prims != NULL)
|
||||||
|
{
|
||||||
|
writeNSidedPoints
|
||||||
|
(
|
||||||
|
map(patchFaces, prims),
|
||||||
|
0,
|
||||||
|
ensightGeometryFile
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
forAll (patchProcessors, i)
|
||||||
|
{
|
||||||
|
if (patchProcessors[i] != 0)
|
||||||
|
{
|
||||||
|
label slave = patchProcessors[i];
|
||||||
|
IPstream fromSlave(Pstream::scheduled, slave);
|
||||||
|
faceList patchFaces(fromSlave);
|
||||||
|
|
||||||
|
writeNSidedPoints
|
||||||
|
(
|
||||||
|
patchFaces,
|
||||||
|
pointOffsets[i],
|
||||||
|
ensightGeometryFile
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (&prims != NULL)
|
||||||
|
{
|
||||||
|
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
|
||||||
|
toMaster<< map(patchFaces, prims);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::ensightMesh::writeNSidedPointsBinary
|
||||||
|
(
|
||||||
|
const faceList& patchFaces,
|
||||||
|
const label pointOffset,
|
||||||
|
std::ofstream& ensightGeometryFile
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
writeFacePrimsBinary
|
||||||
|
(
|
||||||
|
patchFaces,
|
||||||
|
pointOffset,
|
||||||
|
ensightGeometryFile
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::ensightMesh::writeNSidedNPointsPerFaceBinary
|
||||||
|
(
|
||||||
|
const faceList& patchFaces,
|
||||||
|
std::ofstream& ensightGeometryFile
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
forAll(patchFaces, i)
|
||||||
|
{
|
||||||
|
writeEnsDataBinary
|
||||||
|
(
|
||||||
|
patchFaces[i].size(),
|
||||||
|
ensightGeometryFile
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::ensightMesh::writeAllNSidedBinary
|
||||||
|
(
|
||||||
|
const labelList& prims,
|
||||||
|
const label nPrims,
|
||||||
|
const faceList& patchFaces,
|
||||||
|
const labelList& pointOffsets,
|
||||||
|
const labelList& patchProcessors,
|
||||||
|
std::ofstream& ensightGeometryFile
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
if (nPrims)
|
||||||
|
{
|
||||||
|
if (Pstream::master())
|
||||||
|
{
|
||||||
|
writeEnsDataBinary("nsided",ensightGeometryFile);
|
||||||
|
writeEnsDataBinary(nPrims,ensightGeometryFile);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Number of points for each face
|
||||||
|
if (Pstream::master())
|
||||||
|
{
|
||||||
|
if (&prims != NULL)
|
||||||
|
{
|
||||||
|
writeNSidedNPointsPerFaceBinary
|
||||||
|
(
|
||||||
|
map(patchFaces, prims),
|
||||||
|
ensightGeometryFile
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
forAll (patchProcessors, i)
|
||||||
|
{
|
||||||
|
if (patchProcessors[i] != 0)
|
||||||
|
{
|
||||||
|
label slave = patchProcessors[i];
|
||||||
|
IPstream fromSlave(Pstream::scheduled, slave);
|
||||||
|
faceList patchFaces(fromSlave);
|
||||||
|
|
||||||
|
writeNSidedNPointsPerFaceBinary
|
||||||
|
(
|
||||||
|
patchFaces,
|
||||||
|
ensightGeometryFile
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (&prims != NULL)
|
||||||
|
{
|
||||||
|
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
|
||||||
|
toMaster<< map(patchFaces, prims);
|
||||||
|
}
|
||||||
|
|
||||||
|
// List of points id for each face
|
||||||
|
if (Pstream::master())
|
||||||
|
{
|
||||||
|
if (&prims != NULL)
|
||||||
|
{
|
||||||
|
writeNSidedPointsBinary
|
||||||
|
(
|
||||||
|
map(patchFaces, prims),
|
||||||
|
0,
|
||||||
|
ensightGeometryFile
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
forAll (patchProcessors, i)
|
||||||
|
{
|
||||||
|
if (patchProcessors[i] != 0)
|
||||||
|
{
|
||||||
|
label slave = patchProcessors[i];
|
||||||
|
IPstream fromSlave(Pstream::scheduled, slave);
|
||||||
|
faceList patchFaces(fromSlave);
|
||||||
|
|
||||||
|
writeNSidedPointsBinary
|
||||||
|
(
|
||||||
patchFaces,
|
patchFaces,
|
||||||
pointOffsets[i],
|
pointOffsets[i],
|
||||||
ensightGeometryFile
|
ensightGeometryFile
|
||||||
@ -790,17 +1267,13 @@ void Foam::ensightMesh::writeAllFacePrimsBinary
|
|||||||
{
|
{
|
||||||
if (Pstream::master())
|
if (Pstream::master())
|
||||||
{
|
{
|
||||||
if (word(key) != "nsided")
|
writeEnsDataBinary(key,ensightGeometryFile);
|
||||||
{
|
writeEnsDataBinary(nPrims,ensightGeometryFile);
|
||||||
writeEnsDataBinary(key,ensightGeometryFile);
|
|
||||||
writeEnsDataBinary(nPrims,ensightGeometryFile);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (&prims != NULL)
|
if (&prims != NULL)
|
||||||
{
|
{
|
||||||
writeFacePrimsBinary
|
writeFacePrimsBinary
|
||||||
(
|
(
|
||||||
key,
|
|
||||||
map(patchFaces, prims),
|
map(patchFaces, prims),
|
||||||
0,
|
0,
|
||||||
ensightGeometryFile
|
ensightGeometryFile
|
||||||
@ -817,7 +1290,6 @@ void Foam::ensightMesh::writeAllFacePrimsBinary
|
|||||||
|
|
||||||
writeFacePrimsBinary
|
writeFacePrimsBinary
|
||||||
(
|
(
|
||||||
key,
|
|
||||||
patchFaces,
|
patchFaces,
|
||||||
pointOffsets[i],
|
pointOffsets[i],
|
||||||
ensightGeometryFile
|
ensightGeometryFile
|
||||||
@ -863,8 +1335,6 @@ void Foam::ensightMesh::writeAscii
|
|||||||
{
|
{
|
||||||
const Time& runTime = mesh_.time();
|
const Time& runTime = mesh_.time();
|
||||||
const pointField& points = mesh_.points();
|
const pointField& points = mesh_.points();
|
||||||
const cellList& cellFaces = mesh_.cells();
|
|
||||||
const faceList& faces = mesh_.faces();
|
|
||||||
const cellShapeList& cellShapes = mesh_.cellShapes();
|
const cellShapeList& cellShapes = mesh_.cellShapes();
|
||||||
|
|
||||||
word timeFile = prepend;
|
word timeFile = prepend;
|
||||||
@ -990,48 +1460,11 @@ void Foam::ensightMesh::writeAscii
|
|||||||
ensightGeometryFile
|
ensightGeometryFile
|
||||||
);
|
);
|
||||||
|
|
||||||
|
writeAllPolys
|
||||||
if (meshCellSets_.nPolys)
|
(
|
||||||
{
|
pointOffsets,
|
||||||
if (Pstream::master())
|
ensightGeometryFile
|
||||||
{
|
);
|
||||||
/*
|
|
||||||
ensightGeometryFile
|
|
||||||
<< "nfaced" << nl
|
|
||||||
<< setw(10) << meshCellSets_.nPolys << nl;
|
|
||||||
*/
|
|
||||||
writePolys
|
|
||||||
(
|
|
||||||
meshCellSets_.polys,
|
|
||||||
cellFaces,
|
|
||||||
faces,
|
|
||||||
0,
|
|
||||||
ensightGeometryFile
|
|
||||||
);
|
|
||||||
|
|
||||||
for (int slave=1; slave<Pstream::nProcs(); slave++)
|
|
||||||
{
|
|
||||||
IPstream fromSlave(Pstream::scheduled, slave);
|
|
||||||
labelList polys(fromSlave);
|
|
||||||
cellList cellFaces(fromSlave);
|
|
||||||
faceList faces(fromSlave);
|
|
||||||
|
|
||||||
writePolys
|
|
||||||
(
|
|
||||||
polys,
|
|
||||||
cellFaces,
|
|
||||||
faces,
|
|
||||||
pointOffsets[slave-1],
|
|
||||||
ensightGeometryFile
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
|
|
||||||
toMaster<< meshCellSets_.polys << cellFaces << faces;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1166,9 +1599,8 @@ void Foam::ensightMesh::writeAscii
|
|||||||
ensightGeometryFile
|
ensightGeometryFile
|
||||||
);
|
);
|
||||||
|
|
||||||
writeAllFacePrims
|
writeAllNSided
|
||||||
(
|
(
|
||||||
"nsided",
|
|
||||||
polys,
|
polys,
|
||||||
nfp.nPolys,
|
nfp.nPolys,
|
||||||
patchFaces,
|
patchFaces,
|
||||||
@ -1197,8 +1629,6 @@ void Foam::ensightMesh::writeBinary
|
|||||||
{
|
{
|
||||||
//const Time& runTime = mesh.time();
|
//const Time& runTime = mesh.time();
|
||||||
const pointField& points = mesh_.points();
|
const pointField& points = mesh_.points();
|
||||||
const cellList& cellFaces = mesh_.cells();
|
|
||||||
const faceList& faces = mesh_.faces();
|
|
||||||
const cellShapeList& cellShapes = mesh_.cellShapes();
|
const cellShapeList& cellShapes = mesh_.cellShapes();
|
||||||
|
|
||||||
word timeFile = prepend;
|
word timeFile = prepend;
|
||||||
@ -1316,47 +1746,11 @@ void Foam::ensightMesh::writeBinary
|
|||||||
ensightGeometryFile
|
ensightGeometryFile
|
||||||
);
|
);
|
||||||
|
|
||||||
if (meshCellSets_.nPolys)
|
writeAllPolysBinary
|
||||||
{
|
(
|
||||||
if (Pstream::master())
|
pointOffsets,
|
||||||
{
|
ensightGeometryFile
|
||||||
/*
|
);
|
||||||
ensightGeometryFile
|
|
||||||
<< "nfaced" << nl
|
|
||||||
<< setw(10) << meshCellSets_.nPolys << nl;
|
|
||||||
*/
|
|
||||||
writePolysBinary
|
|
||||||
(
|
|
||||||
meshCellSets_.polys,
|
|
||||||
cellFaces,
|
|
||||||
faces,
|
|
||||||
0,
|
|
||||||
ensightGeometryFile
|
|
||||||
);
|
|
||||||
|
|
||||||
for (int slave=1; slave<Pstream::nProcs(); slave++)
|
|
||||||
{
|
|
||||||
IPstream fromSlave(Pstream::scheduled, slave);
|
|
||||||
labelList polys(fromSlave);
|
|
||||||
cellList cellFaces(fromSlave);
|
|
||||||
faceList faces(fromSlave);
|
|
||||||
|
|
||||||
writePolysBinary
|
|
||||||
(
|
|
||||||
polys,
|
|
||||||
cellFaces,
|
|
||||||
faces,
|
|
||||||
pointOffsets[slave-1],
|
|
||||||
ensightGeometryFile
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
|
|
||||||
toMaster<< meshCellSets_.polys << cellFaces << faces;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1495,9 +1889,8 @@ void Foam::ensightMesh::writeBinary
|
|||||||
ensightGeometryFile
|
ensightGeometryFile
|
||||||
);
|
);
|
||||||
|
|
||||||
writeAllFacePrimsBinary
|
writeAllNSidedBinary
|
||||||
(
|
(
|
||||||
"nsided",
|
|
||||||
polys,
|
polys,
|
||||||
nfp.nPolys,
|
nfp.nPolys,
|
||||||
patchFaces,
|
patchFaces,
|
||||||
@ -1516,4 +1909,5 @@ void Foam::ensightMesh::writeBinary
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -134,7 +134,22 @@ class ensightMesh
|
|||||||
OFstream& ensightGeometryFile
|
OFstream& ensightGeometryFile
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
void writePolys
|
void writePolysNFaces
|
||||||
|
(
|
||||||
|
const labelList& polys,
|
||||||
|
const cellList& cellFaces,
|
||||||
|
OFstream& ensightGeometryFile
|
||||||
|
) const;
|
||||||
|
|
||||||
|
void writePolysNPointsPerFace
|
||||||
|
(
|
||||||
|
const labelList& polys,
|
||||||
|
const cellList& cellFaces,
|
||||||
|
const faceList& faces,
|
||||||
|
OFstream& ensightGeometryFile
|
||||||
|
) const;
|
||||||
|
|
||||||
|
void writePolysPoints
|
||||||
(
|
(
|
||||||
const labelList& polys,
|
const labelList& polys,
|
||||||
const cellList& cellFaces,
|
const cellList& cellFaces,
|
||||||
@ -143,6 +158,12 @@ class ensightMesh
|
|||||||
OFstream& ensightGeometryFile
|
OFstream& ensightGeometryFile
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
void writeAllPolys
|
||||||
|
(
|
||||||
|
const labelList& pointOffsets,
|
||||||
|
OFstream& ensightGeometryFile
|
||||||
|
) const;
|
||||||
|
|
||||||
void writeAllPrims
|
void writeAllPrims
|
||||||
(
|
(
|
||||||
const char* key,
|
const char* key,
|
||||||
@ -154,7 +175,6 @@ class ensightMesh
|
|||||||
|
|
||||||
void writeFacePrims
|
void writeFacePrims
|
||||||
(
|
(
|
||||||
const char* key,
|
|
||||||
const faceList& patchFaces,
|
const faceList& patchFaces,
|
||||||
const label pointOffset,
|
const label pointOffset,
|
||||||
OFstream& ensightGeometryFile
|
OFstream& ensightGeometryFile
|
||||||
@ -177,6 +197,29 @@ class ensightMesh
|
|||||||
OFstream& ensightGeometryFile
|
OFstream& ensightGeometryFile
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
void writeNSidedNPointsPerFace
|
||||||
|
(
|
||||||
|
const faceList& patchFaces,
|
||||||
|
OFstream& ensightGeometryFile
|
||||||
|
) const;
|
||||||
|
|
||||||
|
void writeNSidedPoints
|
||||||
|
(
|
||||||
|
const faceList& patchFaces,
|
||||||
|
const label pointOffset,
|
||||||
|
OFstream& ensightGeometryFile
|
||||||
|
) const;
|
||||||
|
|
||||||
|
void writeAllNSided
|
||||||
|
(
|
||||||
|
const labelList& prims,
|
||||||
|
const label nPrims,
|
||||||
|
const faceList& patchFaces,
|
||||||
|
const labelList& pointOffsets,
|
||||||
|
const labelList& patchProcessors,
|
||||||
|
OFstream& ensightGeometryFile
|
||||||
|
) const;
|
||||||
|
|
||||||
void writeAscii
|
void writeAscii
|
||||||
(
|
(
|
||||||
const fileName& postProcPath,
|
const fileName& postProcPath,
|
||||||
@ -209,7 +252,22 @@ class ensightMesh
|
|||||||
std::ofstream& ensightGeometryFile
|
std::ofstream& ensightGeometryFile
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
void writePolysBinary
|
void writePolysNFacesBinary
|
||||||
|
(
|
||||||
|
const labelList& polys,
|
||||||
|
const cellList& cellFaces,
|
||||||
|
std::ofstream& ensightGeometryFile
|
||||||
|
) const;
|
||||||
|
|
||||||
|
void writePolysNPointsPerFaceBinary
|
||||||
|
(
|
||||||
|
const labelList& polys,
|
||||||
|
const cellList& cellFaces,
|
||||||
|
const faceList& faces,
|
||||||
|
std::ofstream& ensightGeometryFile
|
||||||
|
) const;
|
||||||
|
|
||||||
|
void writePolysPointsBinary
|
||||||
(
|
(
|
||||||
const labelList& polys,
|
const labelList& polys,
|
||||||
const cellList& cellFaces,
|
const cellList& cellFaces,
|
||||||
@ -218,6 +276,12 @@ class ensightMesh
|
|||||||
std::ofstream& ensightGeometryFile
|
std::ofstream& ensightGeometryFile
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
void writeAllPolysBinary
|
||||||
|
(
|
||||||
|
const labelList& pointOffsets,
|
||||||
|
std::ofstream& ensightGeometryFile
|
||||||
|
) const;
|
||||||
|
|
||||||
void writeAllFacePrimsBinary
|
void writeAllFacePrimsBinary
|
||||||
(
|
(
|
||||||
const char* key,
|
const char* key,
|
||||||
@ -231,12 +295,33 @@ class ensightMesh
|
|||||||
|
|
||||||
void writeFacePrimsBinary
|
void writeFacePrimsBinary
|
||||||
(
|
(
|
||||||
const char* key,
|
|
||||||
const faceList& patchFaces,
|
const faceList& patchFaces,
|
||||||
const label pointOffset,
|
const label pointOffset,
|
||||||
std::ofstream& ensightGeometryFile
|
std::ofstream& ensightGeometryFile
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
void writeNSidedPointsBinary
|
||||||
|
(
|
||||||
|
const faceList& patchFaces,
|
||||||
|
const label pointOffset,
|
||||||
|
std::ofstream& ensightGeometryFile
|
||||||
|
) const;
|
||||||
|
|
||||||
|
void writeNSidedNPointsPerFaceBinary
|
||||||
|
(
|
||||||
|
const faceList& patchFaces,
|
||||||
|
std::ofstream& ensightGeometryFile
|
||||||
|
) const;
|
||||||
|
|
||||||
|
void writeAllNSidedBinary
|
||||||
|
(
|
||||||
|
const labelList& prims,
|
||||||
|
const label nPrims,
|
||||||
|
const faceList& patchFaces,
|
||||||
|
const labelList& pointOffsets,
|
||||||
|
const labelList& patchProcessors,
|
||||||
|
std::ofstream& ensightGeometryFile
|
||||||
|
) const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user