This repository has been archived on 2023-11-20. You can view files and clone it, but cannot push or open issues or pull requests.
foam-extend4.1-coherent-io/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightMesh.C

1910 lines
50 KiB
C++
Raw Normal View History

/*---------------------------------------------------------------------------*\
========= |
2013-12-11 16:09:41 +00:00
\\ / F ield | foam-extend: Open Source CFD
2016-06-20 15:00:40 +00:00
\\ / O peration | Version: 4.0
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
2013-12-11 16:09:41 +00:00
This file is part of foam-extend.
2013-12-11 16:09:41 +00:00
foam-extend is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
2013-12-11 16:09:41 +00:00
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
2013-12-11 16:09:41 +00:00
foam-extend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
2013-12-11 16:09:41 +00:00
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "argList.H"
2013-11-03 20:28:05 +00:00
#include "objectRegistry.H"
#include "foamTime.H"
#include "ensightMesh.H"
#include "fvMesh.H"
2010-08-26 14:22:03 +00:00
#include "globalMeshData.H"
#include "PstreamCombineReduceOps.H"
#include "processorPolyPatch.H"
#include "cellModeller.H"
#include "IOmanip.H"
#include "itoa.H"
#include "ensightWriteBinary.H"
#include <fstream>
// * * * * * * * * * * * * * Private Functions * * * * * * * * * * * * * * //
namespace Foam
{
2010-08-26 14:22:03 +00:00
//- Proxy-class to hold the patch processor list combination operator
class concatPatchProcs
{
2010-08-26 14:22:03 +00:00
public:
2010-08-26 14:22:03 +00:00
void operator()
(
List<labelList>& x,
const List<labelList>& y
) const
{
2010-08-26 14:22:03 +00:00
forAll(y, i)
{
2010-08-26 14:22:03 +00:00
const labelList& yPatches = y[i];
2010-08-26 14:22:03 +00:00
if (yPatches.size())
{
2010-08-26 14:22:03 +00:00
labelList& xPatches = x[i];
label offset = xPatches.size();
xPatches.setSize(offset + yPatches.size());
forAll(yPatches, i)
{
xPatches[i + offset] = yPatches[i];
}
}
}
}
2010-08-26 14:22:03 +00:00
};
} // End namespace Foam
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::ensightMesh::ensightMesh
(
const fvMesh& mesh,
const argList& args,
const bool binary
)
:
mesh_(mesh),
2010-08-26 14:22:03 +00:00
binary_(binary),
patchPartOffset_(2),
meshCellSets_(mesh_.nCells()),
boundaryFaceSets_(mesh_.boundary().size()),
allPatchNames_(0),
2010-08-26 14:22:03 +00:00
allPatchProcs_(0),
patchNames_(0),
nPatchPrims_(0)
{
2010-08-26 14:22:03 +00:00
const cellShapeList& cellShapes = mesh.cellShapes();
const cellModel& tet = *(cellModeller::lookup("tet"));
const cellModel& pyr = *(cellModeller::lookup("pyr"));
const cellModel& prism = *(cellModeller::lookup("prism"));
const cellModel& wedge = *(cellModeller::lookup("wedge"));
const cellModel& hex = *(cellModeller::lookup("hex"));
if (!args.optionFound("noPatches"))
{
2010-08-26 14:22:03 +00:00
allPatchNames_ = wordList::subList
(
2010-08-26 14:22:03 +00:00
mesh_.boundaryMesh().names(), mesh_.boundary().size()
- mesh_.globalData().processorPatches().size()
);
allPatchProcs_.setSize(allPatchNames_.size());
forAll (allPatchProcs_, patchi)
{
2010-08-26 14:22:03 +00:00
if (mesh_.boundary()[patchi].size())
{
2010-08-26 14:22:03 +00:00
allPatchProcs_[patchi].setSize(1);
allPatchProcs_[patchi][0] = Pstream::myProcNo();
}
}
2010-08-26 14:22:03 +00:00
combineReduce(allPatchProcs_, concatPatchProcs());
2010-08-26 14:22:03 +00:00
if (args.optionFound("patches"))
{
2010-08-26 14:22:03 +00:00
wordList patchNameList(args.optionLookup("patches")());
2010-08-26 14:22:03 +00:00
if (patchNameList.empty())
{
patchNameList = allPatchNames_;
}
forAll (patchNameList, i)
{
patchNames_.insert(patchNameList[i]);
}
}
}
2010-08-26 14:22:03 +00:00
if (patchNames_.size())
{
2010-08-26 14:22:03 +00:00
// no internalMesh
patchPartOffset_ = 1;
}
else
{
// Count the shapes
labelList& tets = meshCellSets_.tets;
labelList& pyrs = meshCellSets_.pyrs;
labelList& prisms = meshCellSets_.prisms;
labelList& wedges = meshCellSets_.wedges;
labelList& hexes = meshCellSets_.hexes;
labelList& polys = meshCellSets_.polys;
label nTets = 0;
label nPyrs = 0;
label nPrisms = 0;
label nWedges = 0;
label nHexes = 0;
label nPolys = 0;
forAll(cellShapes, cellI)
{
2010-08-26 14:22:03 +00:00
const cellShape& cellShape = cellShapes[cellI];
const cellModel& cellModel = cellShape.model();
if (cellModel == tet)
{
2010-08-26 14:22:03 +00:00
tets[nTets++] = cellI;
}
else if (cellModel == pyr)
{
2010-08-26 14:22:03 +00:00
pyrs[nPyrs++] = cellI;
}
else if (cellModel == prism)
{
2010-08-26 14:22:03 +00:00
prisms[nPrisms++] = cellI;
}
else if (cellModel == wedge)
{
2010-08-26 14:22:03 +00:00
wedges[nWedges++] = cellI;
}
else if (cellModel == hex)
{
2010-08-26 14:22:03 +00:00
hexes[nHexes++] = cellI;
}
else
{
2010-08-26 14:22:03 +00:00
polys[nPolys++] = cellI;
}
}
tets.setSize(nTets);
pyrs.setSize(nPyrs);
prisms.setSize(nPrisms);
wedges.setSize(nWedges);
hexes.setSize(nHexes);
polys.setSize(nPolys);
meshCellSets_.nTets = nTets;
reduce(meshCellSets_.nTets, sumOp<label>());
meshCellSets_.nPyrs = nPyrs;
reduce(meshCellSets_.nPyrs, sumOp<label>());
meshCellSets_.nPrisms = nPrisms;
reduce(meshCellSets_.nPrisms, sumOp<label>());
meshCellSets_.nHexesWedges = nHexes + nWedges;
reduce(meshCellSets_.nHexesWedges, sumOp<label>());
meshCellSets_.nPolys = nPolys;
reduce(meshCellSets_.nPolys, sumOp<label>());
}
2010-08-26 14:22:03 +00:00
if (!args.optionFound("noPatches"))
{
2010-08-26 14:22:03 +00:00
forAll (mesh.boundary(), patchi)
{
2010-08-26 14:22:03 +00:00
if (mesh.boundary()[patchi].size())
{
const polyPatch& p = mesh.boundaryMesh()[patchi];
2010-08-26 14:22:03 +00:00
labelList& tris = boundaryFaceSets_[patchi].tris;
labelList& quads = boundaryFaceSets_[patchi].quads;
labelList& polys = boundaryFaceSets_[patchi].polys;
2010-08-26 14:22:03 +00:00
tris.setSize(p.size());
quads.setSize(p.size());
polys.setSize(p.size());
2010-08-26 14:22:03 +00:00
label nTris = 0;
label nQuads = 0;
label nPolys = 0;
2010-08-26 14:22:03 +00:00
forAll(p, faceI)
{
2010-08-26 14:22:03 +00:00
const face& f = p[faceI];
if (f.size() == 3)
{
tris[nTris++] = faceI;
}
else if (f.size() == 4)
{
quads[nQuads++] = faceI;
}
else
{
polys[nPolys++] = faceI;
}
}
2010-08-26 14:22:03 +00:00
tris.setSize(nTris);
quads.setSize(nQuads);
polys.setSize(nPolys);
}
}
}
2010-08-26 14:22:03 +00:00
forAll(allPatchNames_, patchi)
{
2010-08-26 14:22:03 +00:00
const word& patchName = allPatchNames_[patchi];
nFacePrimitives nfp;
2010-08-26 14:22:03 +00:00
if (patchNames_.empty() || patchNames_.found(patchName))
{
2010-08-26 14:22:03 +00:00
if (mesh.boundary()[patchi].size())
{
nfp.nPoints = mesh.boundaryMesh()[patchi].localPoints().size();
2010-08-26 14:22:03 +00:00
nfp.nTris = boundaryFaceSets_[patchi].tris.size();
nfp.nQuads = boundaryFaceSets_[patchi].quads.size();
nfp.nPolys = boundaryFaceSets_[patchi].polys.size();
}
}
reduce(nfp.nPoints, sumOp<label>());
reduce(nfp.nTris, sumOp<label>());
reduce(nfp.nQuads, sumOp<label>());
reduce(nfp.nPolys, sumOp<label>());
nPatchPrims_.insert(patchName, nfp);
}
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::ensightMesh::~ensightMesh()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::ensightMesh::writePoints
(
const scalarField& pointsComponent,
OFstream& ensightGeometryFile
) const
{
2010-08-26 14:22:03 +00:00
forAll(pointsComponent, pointI)
{
2010-08-26 14:22:03 +00:00
ensightGeometryFile<< setw(12) << float(pointsComponent[pointI]) << nl;
}
}
2015-07-08 01:33:52 +00:00
Foam::cellShapeList Foam::ensightMesh::ensMap
(
const cellShapeList& cellShapes,
const labelList& prims
) const
{
cellShapeList mcsl(prims.size());
forAll(prims, i)
{
mcsl[i] = cellShapes[prims[i]];
}
return mcsl;
}
2015-07-08 01:33:52 +00:00
Foam::cellShapeList Foam::ensightMesh::ensMap
(
const cellShapeList& cellShapes,
const labelList& hexes,
const labelList& wedges
) const
{
cellShapeList mcsl(hexes.size() + wedges.size());
forAll(hexes, i)
{
mcsl[i] = cellShapes[hexes[i]];
}
label offset = hexes.size();
const cellModel& hex = *(cellModeller::lookup("hex"));
labelList hexLabels(8);
forAll(wedges, i)
{
const cellShape& cellPoints = cellShapes[wedges[i]];
hexLabels[0] = cellPoints[0];
hexLabels[1] = cellPoints[1];
hexLabels[2] = cellPoints[0];
hexLabels[3] = cellPoints[2];
hexLabels[4] = cellPoints[3];
hexLabels[5] = cellPoints[4];
hexLabels[6] = cellPoints[6];
hexLabels[7] = cellPoints[5];
mcsl[i + offset] = cellShape(hex, hexLabels);
}
return mcsl;
}
void Foam::ensightMesh::writePrims
(
const cellShapeList& cellShapes,
const label pointOffset,
OFstream& ensightGeometryFile
) const
{
label po = pointOffset + 1;
forAll(cellShapes, i)
{
const cellShape& cellPoints = cellShapes[i];
2010-08-26 14:22:03 +00:00
forAll(cellPoints, pointI)
{
2010-08-26 14:22:03 +00:00
ensightGeometryFile<< setw(10) << cellPoints[pointI] + po;
}
ensightGeometryFile << nl;
}
}
void Foam::ensightMesh::writePrimsBinary
(
const cellShapeList& cellShapes,
const label pointOffset,
std::ofstream& ensightGeometryFile
) const
{
label po = pointOffset + 1;
2010-08-26 14:22:03 +00:00
if (cellShapes.size())
{
// All the cellShapes have the same number of elements!
int numIntElem = cellShapes.size()*cellShapes[0].size();
List<int> temp(numIntElem);
int n = 0;
forAll(cellShapes, i)
{
const cellShape& cellPoints = cellShapes[i];
2010-08-26 14:22:03 +00:00
forAll(cellPoints, pointI)
{
2010-08-26 14:22:03 +00:00
temp[n] = cellPoints[pointI] + po;
n++;
}
}
ensightGeometryFile.write
(
reinterpret_cast<char*>(temp.begin()),
numIntElem*sizeof(int)
);
}
}
2010-08-26 14:22:03 +00:00
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
{
2010-08-26 14:22:03 +00:00
forAll(polys, i)
{
2010-08-26 14:22:03 +00:00
const labelList& cf = cellFaces[polys[i]];
2010-08-26 14:22:03 +00:00
forAll(cf, faceI)
{
ensightGeometryFile
2010-08-26 14:22:03 +00:00
<< setw(10) << faces[cf[faceI]].size() << nl;
}
2010-08-26 14:22:03 +00:00
}
}
2010-08-26 14:22:03 +00:00
void Foam::ensightMesh::writePolysPoints
(
const labelList& polys,
const cellList& cellFaces,
const faceList& faces,
const label pointOffset,
OFstream& ensightGeometryFile
) const
{
label po = pointOffset + 1;
forAll(polys, i)
{
const labelList& cf = cellFaces[polys[i]];
forAll(cf, faceI)
{
2010-08-26 14:22:03 +00:00
const face& f = faces[cf[faceI]];
2010-08-26 14:22:03 +00:00
forAll(f, pointI)
{
2010-08-26 14:22:03 +00:00
ensightGeometryFile << setw(10) << f[pointI] + po;
}
ensightGeometryFile << nl;
}
}
}
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
2010-08-26 14:22:03 +00:00
);
// Slaves
for (int slave=1; slave<Pstream::nProcs(); slave++)
{
IPstream fromSlave(Pstream::scheduled, slave);
labelList polys(fromSlave);
cellList cellFaces(fromSlave);
writePolysNFaces
(
polys,
cellFaces,
ensightGeometryFile
);
}
}
2010-08-26 14:22:03 +00:00
else
{
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
toMaster<< meshCellSets_.polys << cellFaces;
}
2010-08-26 14:22:03 +00:00
// Number of points for each face of the above list
if (Pstream::master())
{
2010-08-26 14:22:03 +00:00
// 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);
2010-08-26 14:22:03 +00:00
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++)
{
2010-08-26 14:22:03 +00:00
IPstream fromSlave(Pstream::scheduled, slave);
labelList polys(fromSlave);
cellList cellFaces(fromSlave);
faceList faces(fromSlave);
2010-08-26 14:22:03 +00:00
writePolysPoints
(
polys,
cellFaces,
faces,
pointOffsets[slave-1],
ensightGeometryFile
);
}
}
2010-08-26 14:22:03 +00:00
else
{
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
toMaster<< meshCellSets_.polys << cellFaces << faces;
}
}
}
2010-08-26 14:22:03 +00:00
void Foam::ensightMesh::writePolysNFacesBinary
(
const labelList& polys,
const cellList& cellFaces,
std::ofstream& ensightGeometryFile
) const
{
2010-08-26 14:22:03 +00:00
forAll(polys, i)
{
2010-08-26 14:22:03 +00:00
writeEnsDataBinary
(
cellFaces[polys[i]].size(),
ensightGeometryFile
);
}
}
2010-08-26 14:22:03 +00:00
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
(
2010-08-26 14:22:03 +00:00
faces[cf[faceI]].size(),
ensightGeometryFile
);
}
2010-08-26 14:22:03 +00:00
}
}
2010-08-26 14:22:03 +00:00
void Foam::ensightMesh::writePolysPointsBinary
(
const labelList& polys,
const cellList& cellFaces,
const faceList& faces,
const label pointOffset,
std::ofstream& ensightGeometryFile
) const
{
label po = pointOffset + 1;
forAll(polys, i)
{
const labelList& cf = cellFaces[polys[i]];
forAll(cf, faceI)
{
2010-08-26 14:22:03 +00:00
const face& f = faces[cf[faceI]];
2010-08-26 14:22:03 +00:00
forAll(f, pointI)
{
2010-08-26 14:22:03 +00:00
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);
}
// Number of faces for each poly cell
if (Pstream::master())
{
// Master
writePolysNFacesBinary
(
meshCellSets_.polys,
cellFaces,
ensightGeometryFile
);
// Slaves
for (int slave=1; slave<Pstream::nProcs(); slave++)
{
IPstream fromSlave(Pstream::scheduled, slave);
labelList polys(fromSlave);
cellList cellFaces(fromSlave);
writePolysNFacesBinary
(
2010-08-26 14:22:03 +00:00
polys,
cellFaces,
ensightGeometryFile
);
}
}
2010-08-26 14:22:03 +00:00
else
{
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
toMaster<< meshCellSets_.polys << cellFaces;
}
2010-08-26 14:22:03 +00:00
// Number of points for each face of the above list
if (Pstream::master())
{
2010-08-26 14:22:03 +00:00
// Master
writePolysNPointsPerFaceBinary
(
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);
2010-08-26 14:22:03 +00:00
writePolysNPointsPerFaceBinary
(
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++)
{
2010-08-26 14:22:03 +00:00
IPstream fromSlave(Pstream::scheduled, slave);
labelList polys(fromSlave);
cellList cellFaces(fromSlave);
faceList faces(fromSlave);
2010-08-26 14:22:03 +00:00
writePolysPointsBinary
(
polys,
cellFaces,
faces,
pointOffsets[slave-1],
ensightGeometryFile
);
}
}
2010-08-26 14:22:03 +00:00
else
{
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
toMaster<< meshCellSets_.polys << cellFaces << faces;
}
}
}
void Foam::ensightMesh::writeAllPrims
(
const char* key,
const label nPrims,
const cellShapeList& cellShapes,
const labelList& pointOffsets,
OFstream& ensightGeometryFile
) const
{
if (nPrims)
{
if (Pstream::master())
{
ensightGeometryFile << key << nl << setw(10) << nPrims << nl;
writePrims(cellShapes, 0, ensightGeometryFile);
for (int slave=1; slave<Pstream::nProcs(); slave++)
{
IPstream fromSlave(Pstream::scheduled, slave);
cellShapeList cellShapes(fromSlave);
writePrims
(
cellShapes,
pointOffsets[slave-1],
ensightGeometryFile
);
}
}
else
{
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
toMaster<< cellShapes;
}
}
}
void Foam::ensightMesh::writeAllPrimsBinary
(
const char* key,
const label nPrims,
const cellShapeList& cellShapes,
const labelList& pointOffsets,
std::ofstream& ensightGeometryFile
) const
{
if (nPrims)
{
if (Pstream::master())
{
writeEnsDataBinary(key,ensightGeometryFile);
writeEnsDataBinary(nPrims,ensightGeometryFile);
writePrimsBinary(cellShapes, 0, ensightGeometryFile);
for (int slave=1; slave<Pstream::nProcs(); slave++)
{
IPstream fromSlave(Pstream::scheduled, slave);
cellShapeList cellShapes(fromSlave);
writePrimsBinary
(
2010-08-26 14:22:03 +00:00
cellShapes,
pointOffsets[slave-1],
ensightGeometryFile
);
}
}
else
{
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
toMaster<< cellShapes;
}
}
}
void Foam::ensightMesh::writeFacePrims
(
const faceList& patchFaces,
const label pointOffset,
OFstream& ensightGeometryFile
) const
{
if (patchFaces.size())
{
label po = pointOffset + 1;
forAll(patchFaces, i)
{
const face& patchFace = patchFaces[i];
forAll(patchFace, pointI)
{
ensightGeometryFile << setw(10) << patchFace[pointI] + po;
}
ensightGeometryFile << nl;
}
}
}
void Foam::ensightMesh::writeFacePrimsBinary
(
const faceList& patchFaces,
const label pointOffset,
std::ofstream& ensightGeometryFile
) const
{
if (patchFaces.size())
{
label po = pointOffset + 1;
forAll(patchFaces, i)
{
const face& patchFace = patchFaces[i];
forAll(patchFace, pointI)
{
writeEnsDataBinary
(
patchFace[pointI] + po,
ensightGeometryFile
);
}
}
}
}
2015-07-08 01:33:52 +00:00
Foam::faceList Foam::ensightMesh::ensMap
2010-08-26 14:22:03 +00:00
(
const faceList& patchFaces,
const labelList& prims
) const
{
faceList ppf(prims.size());
forAll (prims, i)
{
ppf[i] = patchFaces[prims[i]];
}
return ppf;
}
void Foam::ensightMesh::writeAllFacePrims
(
const char* key,
const labelList& prims,
const label nPrims,
const faceList& patchFaces,
const labelList& pointOffsets,
const labelList& patchProcessors,
OFstream& ensightGeometryFile
) const
{
if (nPrims)
{
if (Pstream::master())
{
ensightGeometryFile << key << nl << setw(10) << nPrims << nl;
if (&prims != NULL)
{
writeFacePrims
(
2015-07-08 01:33:52 +00:00
ensMap(patchFaces, prims),
2010-08-26 14:22:03 +00:00
0,
ensightGeometryFile
);
}
2010-08-26 14:22:03 +00:00
forAll (patchProcessors, i)
{
if (patchProcessors[i] != 0)
{
label slave = patchProcessors[i];
IPstream fromSlave(Pstream::scheduled, slave);
faceList patchFaces(fromSlave);
writeFacePrims
(
patchFaces,
pointOffsets[i],
ensightGeometryFile
);
}
}
}
2010-08-26 14:22:03 +00:00
else if (&prims != NULL)
{
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
2015-07-08 01:33:52 +00:00
toMaster<< ensMap(patchFaces, prims);
}
}
}
2010-08-26 14:22:03 +00:00
void Foam::ensightMesh::writeNSidedNPointsPerFace
(
const faceList& patchFaces,
OFstream& ensightGeometryFile
) const
{
2010-08-26 14:22:03 +00:00
forAll(patchFaces, i)
{
2010-08-26 14:22:03 +00:00
ensightGeometryFile
<< setw(10) << patchFaces[i].size() << nl;
}
}
2010-08-26 14:22:03 +00:00
void Foam::ensightMesh::writeNSidedPoints
(
const faceList& patchFaces,
const label pointOffset,
2010-08-26 14:22:03 +00:00
OFstream& ensightGeometryFile
) const
{
2010-08-26 14:22:03 +00:00
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)
{
2010-08-26 14:22:03 +00:00
if (Pstream::master())
{
2010-08-26 14:22:03 +00:00
ensightGeometryFile
<< "nsided" << nl << setw(10) << nPrims << nl;
}
2010-08-26 14:22:03 +00:00
// Number of points for each face
if (Pstream::master())
{
if (&prims != NULL)
{
2010-08-26 14:22:03 +00:00
writeNSidedNPointsPerFace
(
2015-07-08 01:33:52 +00:00
ensMap(patchFaces, prims),
ensightGeometryFile
);
}
2010-08-26 14:22:03 +00:00
forAll (patchProcessors, i)
{
if (patchProcessors[i] != 0)
{
label slave = patchProcessors[i];
IPstream fromSlave(Pstream::scheduled, slave);
faceList patchFaces(fromSlave);
2010-08-26 14:22:03 +00:00
writeNSidedNPointsPerFace
(
patchFaces,
ensightGeometryFile
);
}
}
}
else if (&prims != NULL)
{
2010-08-26 14:22:03 +00:00
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
2015-07-08 01:33:52 +00:00
toMaster<< ensMap(patchFaces, prims);
2010-08-26 14:22:03 +00:00
}
2010-08-26 14:22:03 +00:00
// List of points id for each face
if (Pstream::master())
{
if (&prims != NULL)
{
2010-08-26 14:22:03 +00:00
writeNSidedPoints
(
2015-07-08 01:33:52 +00:00
ensMap(patchFaces, prims),
2010-08-26 14:22:03 +00:00
0,
ensightGeometryFile
);
}
2010-08-26 14:22:03 +00:00
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());
2015-07-08 01:33:52 +00:00
toMaster<< ensMap(patchFaces, prims);
}
}
}
2010-08-26 14:22:03 +00:00
void Foam::ensightMesh::writeNSidedPointsBinary
(
const faceList& patchFaces,
2010-08-26 14:22:03 +00:00
const label pointOffset,
std::ofstream& ensightGeometryFile
) const
{
2010-08-26 14:22:03 +00:00
writeFacePrimsBinary
(
patchFaces,
pointOffset,
ensightGeometryFile
);
}
2010-08-26 14:22:03 +00:00
void Foam::ensightMesh::writeNSidedNPointsPerFaceBinary
(
const faceList& patchFaces,
std::ofstream& ensightGeometryFile
) const
{
forAll(patchFaces, i)
{
2010-08-26 14:22:03 +00:00
writeEnsDataBinary
(
patchFaces[i].size(),
ensightGeometryFile
);
}
}
2010-08-26 14:22:03 +00:00
void Foam::ensightMesh::writeAllNSidedBinary
(
const labelList& prims,
const label nPrims,
const faceList& patchFaces,
const labelList& pointOffsets,
const labelList& patchProcessors,
2010-08-26 14:22:03 +00:00
std::ofstream& ensightGeometryFile
) const
{
if (nPrims)
{
if (Pstream::master())
{
2010-08-26 14:22:03 +00:00
writeEnsDataBinary("nsided",ensightGeometryFile);
writeEnsDataBinary(nPrims,ensightGeometryFile);
}
// Number of points for each face
if (Pstream::master())
{
if (&prims != NULL)
{
writeNSidedNPointsPerFaceBinary
(
2015-07-08 01:33:52 +00:00
ensMap(patchFaces, prims),
2010-08-26 14:22:03 +00:00
ensightGeometryFile
);
}
forAll (patchProcessors, i)
{
2010-08-26 14:22:03 +00:00
if (patchProcessors[i] != 0)
{
label slave = patchProcessors[i];
IPstream fromSlave(Pstream::scheduled, slave);
faceList patchFaces(fromSlave);
writeNSidedNPointsPerFaceBinary
(
patchFaces,
ensightGeometryFile
);
}
}
2010-08-26 14:22:03 +00:00
}
else if (&prims != NULL)
{
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
2015-07-08 01:33:52 +00:00
toMaster<< ensMap(patchFaces, prims);
2010-08-26 14:22:03 +00:00
}
2010-08-26 14:22:03 +00:00
// List of points id for each face
if (Pstream::master())
{
if (&prims != NULL)
{
2010-08-26 14:22:03 +00:00
writeNSidedPointsBinary
(
2015-07-08 01:33:52 +00:00
ensMap(patchFaces, prims),
0,
ensightGeometryFile
);
}
forAll (patchProcessors, i)
{
if (patchProcessors[i] != 0)
{
label slave = patchProcessors[i];
IPstream fromSlave(Pstream::scheduled, slave);
faceList patchFaces(fromSlave);
2010-08-26 14:22:03 +00:00
writeNSidedPointsBinary
(
patchFaces,
pointOffsets[i],
ensightGeometryFile
);
}
}
}
else if (&prims != NULL)
{
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
2015-07-08 01:33:52 +00:00
toMaster<< ensMap(patchFaces, prims);
}
}
}
void Foam::ensightMesh::writeAllFacePrimsBinary
(
const char* key,
const labelList& prims,
const label nPrims,
const faceList& patchFaces,
const labelList& pointOffsets,
const labelList& patchProcessors,
std::ofstream& ensightGeometryFile
) const
{
if (nPrims)
{
if (Pstream::master())
{
2010-08-26 14:22:03 +00:00
writeEnsDataBinary(key,ensightGeometryFile);
writeEnsDataBinary(nPrims,ensightGeometryFile);
if (&prims != NULL)
{
writeFacePrimsBinary
(
2015-07-08 01:33:52 +00:00
ensMap(patchFaces, prims),
0,
ensightGeometryFile
);
}
forAll (patchProcessors, i)
{
if (patchProcessors[i] != 0)
{
label slave = patchProcessors[i];
IPstream fromSlave(Pstream::scheduled, slave);
faceList patchFaces(fromSlave);
writeFacePrimsBinary
(
patchFaces,
pointOffsets[i],
ensightGeometryFile
);
}
}
}
else if (&prims != NULL)
{
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
2015-07-08 01:33:52 +00:00
toMaster<< ensMap(patchFaces, prims);
}
}
}
void Foam::ensightMesh::write
(
const fileName& postProcPath,
const word& prepend,
const label timeIndex,
Ostream& ensightCaseFile
) const
{
if (binary_)
{
writeBinary(postProcPath, prepend, timeIndex, ensightCaseFile);
}
else
{
writeAscii(postProcPath, prepend, timeIndex, ensightCaseFile);
}
}
void Foam::ensightMesh::writeAscii
(
const fileName& postProcPath,
const word& prepend,
const label timeIndex,
Ostream& ensightCaseFile
) const
{
const Time& runTime = mesh_.time();
const pointField& points = mesh_.points();
const cellShapeList& cellShapes = mesh_.cellShapes();
word timeFile = prepend;
if (timeIndex == 0)
{
timeFile += "000.";
}
else if (mesh_.moving())
{
timeFile += itoa(timeIndex) + '.';
}
// set the filename of the ensight file
fileName ensightGeometryFileName = timeFile + "mesh";
OFstream *ensightGeometryFilePtr = NULL;
if (Pstream::master())
{
ensightGeometryFilePtr = new OFstream
(
postProcPath/ensightGeometryFileName,
2010-09-22 18:13:13 +00:00
ios_base::out|ios_base::trunc,
runTime.writeFormat(),
runTime.writeVersion(),
2010-08-26 14:22:03 +00:00
IOstream::UNCOMPRESSED
);
}
OFstream& ensightGeometryFile = *ensightGeometryFilePtr;
if (Pstream::master())
{
// Set Format
ensightGeometryFile.setf
(
ios_base::scientific,
ios_base::floatfield
);
ensightGeometryFile.precision(5);
ensightGeometryFile
2010-08-26 14:22:03 +00:00
<< "EnSight Geometry File" << nl
2013-12-11 16:09:41 +00:00
<< "written from FOAM-" << Foam::FOAMversion << nl
<< "node id assign" << nl
<< "element id assign" << nl;
}
labelList pointOffsets(Pstream::nProcs(), 0);
2010-08-26 14:22:03 +00:00
if (patchNames_.empty())
{
label nPoints = points.size();
Pstream::gather(nPoints, sumOp<label>());
if (Pstream::master())
{
ensightGeometryFile
<< "part" << nl
<< setw(10) << 1 << nl
2010-08-26 14:22:03 +00:00
<< "internalMesh" << nl
<< "coordinates" << nl
<< setw(10) << nPoints
<< endl;
for (direction d=0; d<vector::nComponents; d++)
{
writePoints(points.component(d), ensightGeometryFile);
pointOffsets[0] = points.size();
for (int slave=1; slave<Pstream::nProcs(); slave++)
{
IPstream fromSlave(Pstream::scheduled, slave);
scalarField pointsComponent(fromSlave);
writePoints(pointsComponent, ensightGeometryFile);
pointOffsets[slave] =
pointOffsets[slave-1]
+ pointsComponent.size();
}
}
}
else
{
for (direction d=0; d<vector::nComponents; d++)
{
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
toMaster<< points.component(d);
}
}
writeAllPrims
(
"hexa8",
meshCellSets_.nHexesWedges,
2015-07-08 01:33:52 +00:00
ensMap(cellShapes, meshCellSets_.hexes, meshCellSets_.wedges),
pointOffsets,
ensightGeometryFile
);
writeAllPrims
(
"penta6",
meshCellSets_.nPrisms,
2015-07-08 01:33:52 +00:00
ensMap(cellShapes, meshCellSets_.prisms),
pointOffsets,
ensightGeometryFile
);
writeAllPrims
(
"pyramid5",
meshCellSets_.nPyrs,
2015-07-08 01:33:52 +00:00
ensMap(cellShapes, meshCellSets_.pyrs),
pointOffsets,
ensightGeometryFile
);
writeAllPrims
(
"tetra4",
meshCellSets_.nTets,
2015-07-08 01:33:52 +00:00
ensMap(cellShapes, meshCellSets_.tets),
pointOffsets,
ensightGeometryFile
);
2010-08-26 14:22:03 +00:00
writeAllPolys
(
pointOffsets,
ensightGeometryFile
);
}
2010-08-26 14:22:03 +00:00
label ensightPatchI = patchPartOffset_;
2010-08-26 14:22:03 +00:00
forAll(allPatchNames_, patchi)
{
2010-08-26 14:22:03 +00:00
const word& patchName = allPatchNames_[patchi];
const labelList& patchProcessors = allPatchProcs_[patchi];
2010-08-26 14:22:03 +00:00
if (patchNames_.empty() || patchNames_.found(patchName))
{
const nFacePrimitives& nfp = nPatchPrims_.find(patchName)();
2010-08-26 14:22:03 +00:00
const labelList *trisPtr = NULL;
const labelList *quadsPtr = NULL;
const labelList *polysPtr = NULL;
const pointField *patchPointsPtr = NULL;
const faceList *patchFacesPtr = NULL;
2010-08-26 14:22:03 +00:00
if (mesh_.boundary()[patchi].size())
{
const polyPatch& p = mesh_.boundaryMesh()[patchi];
2010-08-26 14:22:03 +00:00
trisPtr = &boundaryFaceSets_[patchi].tris;
quadsPtr = &boundaryFaceSets_[patchi].quads;
polysPtr = &boundaryFaceSets_[patchi].polys;
patchPointsPtr = &(p.localPoints());
2010-08-26 14:22:03 +00:00
patchFacesPtr = &(p.localFaces());
}
const labelList& tris = *trisPtr;
const labelList& quads = *quadsPtr;
const labelList& polys = *polysPtr;
const pointField& patchPoints = *patchPointsPtr;
const faceList& patchFaces = *patchFacesPtr;
if (nfp.nTris || nfp.nQuads || nfp.nPolys)
{
labelList patchPointOffsets(Pstream::nProcs(), 0);
if (Pstream::master())
{
ensightGeometryFile
<< "part" << nl
2010-08-26 14:22:03 +00:00
<< setw(10) << ensightPatchI++ << nl
<< patchName << nl
<< "coordinates" << nl
<< setw(10) << nfp.nPoints
<< endl;
for (direction d=0; d<vector::nComponents; d++)
{
if (patchPointsPtr)
{
writePoints
(
patchPoints.component(d),
ensightGeometryFile
);
}
patchPointOffsets = 0;
forAll (patchProcessors, i)
{
if (patchProcessors[i] != 0)
{
label slave = patchProcessors[i];
IPstream fromSlave(Pstream::scheduled, slave);
scalarField patchPointsComponent(fromSlave);
writePoints
(
patchPointsComponent,
ensightGeometryFile
);
if (i < Pstream::nProcs()-1)
{
patchPointOffsets[i+1] =
patchPointOffsets[i]
+ patchPointsComponent.size();
}
}
else
{
if (i < Pstream::nProcs()-1)
{
patchPointOffsets[i+1] =
patchPointOffsets[i]
+ patchPoints.size();
}
}
}
}
}
else if (patchPointsPtr)
{
for (direction d=0; d<vector::nComponents; d++)
{
OPstream toMaster
(
Pstream::scheduled,
Pstream::masterNo()
);
toMaster<< patchPoints.component(d);
}
}
writeAllFacePrims
(
"tria3",
tris,
nfp.nTris,
patchFaces,
patchPointOffsets,
patchProcessors,
ensightGeometryFile
);
writeAllFacePrims
(
"quad4",
quads,
nfp.nQuads,
patchFaces,
patchPointOffsets,
patchProcessors,
ensightGeometryFile
);
2010-08-26 14:22:03 +00:00
writeAllNSided
(
polys,
nfp.nPolys,
patchFaces,
patchPointOffsets,
patchProcessors,
ensightGeometryFile
);
}
}
}
if (Pstream::master())
{
delete ensightGeometryFilePtr;
}
}
void Foam::ensightMesh::writeBinary
(
const fileName& postProcPath,
const word& prepend,
const label timeIndex,
Ostream& ensightCaseFile
) const
{
//const Time& runTime = mesh.time();
const pointField& points = mesh_.points();
const cellShapeList& cellShapes = mesh_.cellShapes();
word timeFile = prepend;
if (timeIndex == 0)
{
timeFile += "000.";
}
else if (mesh_.moving())
{
timeFile += itoa(timeIndex) + '.';
}
// set the filename of the ensight file
fileName ensightGeometryFileName = timeFile + "mesh";
std::ofstream *ensightGeometryFilePtr = NULL;
if (Pstream::master())
{
ensightGeometryFilePtr = new std::ofstream
(
(postProcPath/ensightGeometryFileName).c_str(),
ios_base::out | ios_base::binary | ios_base::trunc
);
// Check on file opened?
}
std::ofstream& ensightGeometryFile = *ensightGeometryFilePtr;
if (Pstream::master())
{
2010-08-26 14:22:03 +00:00
writeEnsDataBinary("C binary", ensightGeometryFile);
writeEnsDataBinary("EnSight Geometry File", ensightGeometryFile);
2013-12-11 16:09:41 +00:00
writeEnsDataBinary("written from FOAM", ensightGeometryFile);
2010-08-26 14:22:03 +00:00
writeEnsDataBinary("node id assign", ensightGeometryFile);
writeEnsDataBinary("element id assign", ensightGeometryFile);
}
labelList pointOffsets(Pstream::nProcs(), 0);
2010-08-26 14:22:03 +00:00
if (patchNames_.empty())
{
label nPoints = points.size();
Pstream::gather(nPoints, sumOp<label>());
if (Pstream::master())
{
writeEnsDataBinary("part",ensightGeometryFile);
writeEnsDataBinary(1,ensightGeometryFile);
2010-08-26 14:22:03 +00:00
writeEnsDataBinary("internalMesh",ensightGeometryFile);
writeEnsDataBinary("coordinates",ensightGeometryFile);
writeEnsDataBinary(nPoints,ensightGeometryFile);
for (direction d=0; d<vector::nComponents; d++)
{
//writePointsBinary(points.component(d), ensightGeometryFile);
writeEnsDataBinary(points.component(d), ensightGeometryFile);
pointOffsets[0] = points.size();
for (int slave=1; slave<Pstream::nProcs(); slave++)
{
IPstream fromSlave(Pstream::scheduled, slave);
scalarField pointsComponent(fromSlave);
//writePointsBinary(pointsComponent, ensightGeometryFile);
writeEnsDataBinary(pointsComponent, ensightGeometryFile);
pointOffsets[slave] =
pointOffsets[slave-1]
+ pointsComponent.size();
}
}
}
else
{
for (direction d=0; d<vector::nComponents; d++)
{
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
toMaster<< points.component(d);
}
}
writeAllPrimsBinary
(
"hexa8",
meshCellSets_.nHexesWedges,
2015-07-08 01:33:52 +00:00
ensMap(cellShapes, meshCellSets_.hexes, meshCellSets_.wedges),
pointOffsets,
ensightGeometryFile
);
writeAllPrimsBinary
(
"penta6",
meshCellSets_.nPrisms,
2015-07-08 01:33:52 +00:00
ensMap(cellShapes, meshCellSets_.prisms),
pointOffsets,
ensightGeometryFile
);
writeAllPrimsBinary
(
"pyramid5",
meshCellSets_.nPyrs,
2015-07-08 01:33:52 +00:00
ensMap(cellShapes, meshCellSets_.pyrs),
pointOffsets,
ensightGeometryFile
);
writeAllPrimsBinary
(
"tetra4",
meshCellSets_.nTets,
2015-07-08 01:33:52 +00:00
ensMap(cellShapes, meshCellSets_.tets),
pointOffsets,
ensightGeometryFile
);
2010-08-26 14:22:03 +00:00
writeAllPolysBinary
(
pointOffsets,
ensightGeometryFile
);
}
2010-08-26 14:22:03 +00:00
label ensightPatchI = patchPartOffset_;
label iCount = 0;
2010-08-26 14:22:03 +00:00
forAll(allPatchNames_, patchi)
{
iCount ++;
2010-08-26 14:22:03 +00:00
const word& patchName = allPatchNames_[patchi];
const labelList& patchProcessors = allPatchProcs_[patchi];
2010-08-26 14:22:03 +00:00
if (patchNames_.empty() || patchNames_.found(patchName))
{
const nFacePrimitives& nfp = nPatchPrims_.find(patchName)();
const labelList *trisPtr = NULL;
const labelList *quadsPtr = NULL;
const labelList *polysPtr = NULL;
const pointField *patchPointsPtr = NULL;
const faceList *patchFacesPtr = NULL;
2010-08-26 14:22:03 +00:00
if (mesh_.boundary()[patchi].size())
{
const polyPatch& p = mesh_.boundaryMesh()[patchi];
trisPtr = &boundaryFaceSets_[patchi].tris;
quadsPtr = &boundaryFaceSets_[patchi].quads;
polysPtr = &boundaryFaceSets_[patchi].polys;
patchPointsPtr = &(p.localPoints());
patchFacesPtr = &(p.localFaces());
}
const labelList& tris = *trisPtr;
const labelList& quads = *quadsPtr;
const labelList& polys = *polysPtr;
const pointField& patchPoints = *patchPointsPtr;
const faceList& patchFaces = *patchFacesPtr;
if (nfp.nTris || nfp.nQuads || nfp.nPolys)
{
labelList patchPointOffsets(Pstream::nProcs(), 0);
if (Pstream::master())
{
writeEnsDataBinary("part",ensightGeometryFile);
2010-08-26 14:22:03 +00:00
writeEnsDataBinary(ensightPatchI++,ensightGeometryFile);
//writeEnsDataBinary(patchName.c_str(),ensightGeometryFile);
2010-08-26 14:22:03 +00:00
writeEnsDataBinary(patchName.c_str(),ensightGeometryFile);
writeEnsDataBinary("coordinates",ensightGeometryFile);
writeEnsDataBinary(nfp.nPoints,ensightGeometryFile);
for (direction d=0; d<vector::nComponents; d++)
{
if (patchPointsPtr)
{
//writePointsBinary
writeEnsDataBinary
(
patchPoints.component(d),
ensightGeometryFile
);
}
patchPointOffsets = 0;
forAll (patchProcessors, i)
{
if (patchProcessors[i] != 0)
{
label slave = patchProcessors[i];
IPstream fromSlave(Pstream::scheduled, slave);
scalarField patchPointsComponent(fromSlave);
//writePointsBinary
writeEnsDataBinary
(
patchPointsComponent,
ensightGeometryFile
);
if (i < Pstream::nProcs()-1)
{
patchPointOffsets[i+1] =
patchPointOffsets[i]
+ patchPointsComponent.size();
}
}
else
{
if (i < Pstream::nProcs()-1)
{
patchPointOffsets[i+1] =
patchPointOffsets[i]
+ patchPoints.size();
}
}
}
}
}
else if (patchPointsPtr)
{
for (direction d=0; d<vector::nComponents; d++)
{
OPstream toMaster
(
Pstream::scheduled,
Pstream::masterNo()
);
toMaster<< patchPoints.component(d);
}
}
writeAllFacePrimsBinary
(
"tria3",
tris,
nfp.nTris,
patchFaces,
patchPointOffsets,
patchProcessors,
ensightGeometryFile
);
writeAllFacePrimsBinary
(
"quad4",
quads,
nfp.nQuads,
patchFaces,
patchPointOffsets,
patchProcessors,
ensightGeometryFile
);
2010-08-26 14:22:03 +00:00
writeAllNSidedBinary
(
polys,
nfp.nPolys,
patchFaces,
patchPointOffsets,
patchProcessors,
ensightGeometryFile
);
}
}
}
if (Pstream::master())
{
delete ensightGeometryFilePtr;
}
}
2010-08-26 14:22:03 +00:00
// ************************************************************************* //