mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: ensightSurfaceWriter : rewrite to use conversion library.
This commit is contained in:
@ -38,6 +38,8 @@ wmake libso genericPatchFields
|
|||||||
# Build the proper scotchDecomp, metisDecomp etc.
|
# Build the proper scotchDecomp, metisDecomp etc.
|
||||||
parallel/Allwmake
|
parallel/Allwmake
|
||||||
|
|
||||||
|
wmake libso conversion
|
||||||
|
|
||||||
wmake libso sampling
|
wmake libso sampling
|
||||||
|
|
||||||
wmake libso dynamicMesh
|
wmake libso dynamicMesh
|
||||||
@ -53,7 +55,6 @@ turbulenceModels/Allwmake
|
|||||||
wmake libso surfaceFilmModels
|
wmake libso surfaceFilmModels
|
||||||
lagrangian/Allwmake
|
lagrangian/Allwmake
|
||||||
postProcessing/Allwmake
|
postProcessing/Allwmake
|
||||||
conversion/Allwmake
|
|
||||||
mesh/Allwmake
|
mesh/Allwmake
|
||||||
|
|
||||||
wmake libso errorEstimation
|
wmake libso errorEstimation
|
||||||
|
|||||||
@ -4,6 +4,7 @@ ensight/part/ensightPart.C
|
|||||||
ensight/part/ensightPartIO.C
|
ensight/part/ensightPartIO.C
|
||||||
ensight/part/ensightPartCells.C
|
ensight/part/ensightPartCells.C
|
||||||
ensight/part/ensightPartFaces.C
|
ensight/part/ensightPartFaces.C
|
||||||
|
ensight/part/ensightPartNonMeshFaces.C
|
||||||
ensight/part/ensightParts.C
|
ensight/part/ensightParts.C
|
||||||
|
|
||||||
meshTables/boundaryRegion.C
|
meshTables/boundaryRegion.C
|
||||||
|
|||||||
@ -267,6 +267,12 @@ public:
|
|||||||
matId_ = value;
|
matId_ = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//- simple labelList with a name
|
||||||
|
const labelListList& elemLists() const
|
||||||
|
{
|
||||||
|
return elemLists_;
|
||||||
|
}
|
||||||
|
|
||||||
//- offset for element ids
|
//- offset for element ids
|
||||||
label offset() const
|
label offset() const
|
||||||
{
|
{
|
||||||
@ -285,8 +291,12 @@ public:
|
|||||||
//- write reconstruction information for the object
|
//- write reconstruction information for the object
|
||||||
bool writeData(Ostream&) const;
|
bool writeData(Ostream&) const;
|
||||||
|
|
||||||
//- write geometry
|
//- Write geometry
|
||||||
void writeGeometry(ensightGeoFile&) const;
|
virtual void writeGeometry(ensightGeoFile&) const
|
||||||
|
{}
|
||||||
|
|
||||||
|
//- Helper: write geometry given the pointField
|
||||||
|
void writeGeometry(ensightGeoFile&, const pointField& points) const;
|
||||||
|
|
||||||
//- write scalar field
|
//- write scalar field
|
||||||
void writeScalarField
|
void writeScalarField
|
||||||
|
|||||||
@ -427,4 +427,11 @@ void Foam::ensightPartCells::writeConnectivity
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::ensightPartCells::writeGeometry(ensightGeoFile& os) const
|
||||||
|
{
|
||||||
|
const polyMesh& mesh = *meshPtr_;
|
||||||
|
ensightPart::writeGeometry(os, mesh.points());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -74,6 +74,9 @@ class ensightPartCells
|
|||||||
const labelList& pointMap
|
const labelList& pointMap
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
//- write geometry
|
||||||
|
virtual void writeGeometry(ensightGeoFile& os) const;
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
|||||||
@ -47,41 +47,18 @@ Foam::List<Foam::word> Foam::ensightPartFaces::elemTypes_
|
|||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::ensightPartFaces::ensightPartFaces
|
void Foam::ensightPartFaces::binShapes(const faceList& faces)
|
||||||
(
|
|
||||||
label partNumber,
|
|
||||||
const string& partDescription
|
|
||||||
)
|
|
||||||
:
|
|
||||||
ensightPart(partNumber, partDescription)
|
|
||||||
{
|
{
|
||||||
isCellData_ = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::ensightPartFaces::ensightPartFaces
|
|
||||||
(
|
|
||||||
label partNumber,
|
|
||||||
const polyMesh& pMesh,
|
|
||||||
const polyPatch& pPatch
|
|
||||||
)
|
|
||||||
:
|
|
||||||
ensightPart(partNumber, pPatch.name(), pMesh)
|
|
||||||
{
|
|
||||||
isCellData_ = false;
|
|
||||||
offset_ = pPatch.start();
|
|
||||||
size_ = pPatch.size();
|
|
||||||
|
|
||||||
// count the shapes
|
// count the shapes
|
||||||
label nTri = 0;
|
label nTri = 0;
|
||||||
label nQuad = 0;
|
label nQuad = 0;
|
||||||
label nPoly = 0;
|
label nPoly = 0;
|
||||||
|
|
||||||
forAll(pPatch, patchfaceI)
|
forAll(faces, faceI)
|
||||||
{
|
{
|
||||||
const face& f = pMesh.faces()[patchfaceI + offset_];
|
const face& f = faces[faceI];
|
||||||
|
|
||||||
if (f.size() == 3)
|
if (f.size() == 3)
|
||||||
{
|
{
|
||||||
@ -108,21 +85,21 @@ Foam::ensightPartFaces::ensightPartFaces
|
|||||||
nPoly = 0;
|
nPoly = 0;
|
||||||
|
|
||||||
// classify the shapes
|
// classify the shapes
|
||||||
forAll(pPatch, patchfaceI)
|
forAll(faces, faceI)
|
||||||
{
|
{
|
||||||
const face& f = pMesh.faces()[patchfaceI + offset_];
|
const face& f = faces[faceI];
|
||||||
|
|
||||||
if (f.size() == 3)
|
if (f.size() == 3)
|
||||||
{
|
{
|
||||||
triCells[nTri++] = patchfaceI;
|
triCells[nTri++] = faceI;
|
||||||
}
|
}
|
||||||
else if (f.size() == 4)
|
else if (f.size() == 4)
|
||||||
{
|
{
|
||||||
quadCells[nQuad++] = patchfaceI;
|
quadCells[nQuad++] = faceI;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
polygonCells[nPoly++] = patchfaceI;
|
polygonCells[nPoly++] = faceI;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -133,10 +110,45 @@ Foam::ensightPartFaces::ensightPartFaces
|
|||||||
elemLists_[tria3Elements].transfer( triCells );
|
elemLists_[tria3Elements].transfer( triCells );
|
||||||
elemLists_[quad4Elements].transfer( quadCells );
|
elemLists_[quad4Elements].transfer( quadCells );
|
||||||
elemLists_[nsidedElements].transfer( polygonCells );
|
elemLists_[nsidedElements].transfer( polygonCells );
|
||||||
|
|
||||||
|
size_ = faces.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::ensightPartFaces::ensightPartFaces(const ensightPartFaces &part)
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::ensightPartFaces::ensightPartFaces
|
||||||
|
(
|
||||||
|
label partNumber,
|
||||||
|
const string& partDescription
|
||||||
|
)
|
||||||
|
:
|
||||||
|
ensightPart(partNumber, partDescription)
|
||||||
|
{
|
||||||
|
isCellData_ = false;
|
||||||
|
offset_ = 0;
|
||||||
|
size_ = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::ensightPartFaces::ensightPartFaces
|
||||||
|
(
|
||||||
|
label partNumber,
|
||||||
|
const polyMesh& pMesh,
|
||||||
|
const polyPatch& pPatch
|
||||||
|
)
|
||||||
|
:
|
||||||
|
ensightPart(partNumber, pPatch.name(), pMesh)
|
||||||
|
{
|
||||||
|
isCellData_ = false;
|
||||||
|
offset_ = pPatch.start();
|
||||||
|
|
||||||
|
// count the shapes
|
||||||
|
binShapes(pPatch);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::ensightPartFaces::ensightPartFaces(const ensightPartFaces& part)
|
||||||
:
|
:
|
||||||
ensightPart(part)
|
ensightPart(part)
|
||||||
{}
|
{}
|
||||||
@ -206,6 +218,7 @@ void Foam::ensightPartFaces::writeConnectivity
|
|||||||
(
|
(
|
||||||
ensightGeoFile& os,
|
ensightGeoFile& os,
|
||||||
const word& key,
|
const word& key,
|
||||||
|
const faceList& faces,
|
||||||
const labelList& idList,
|
const labelList& idList,
|
||||||
const labelList& pointMap
|
const labelList& pointMap
|
||||||
) const
|
) const
|
||||||
@ -214,8 +227,6 @@ void Foam::ensightPartFaces::writeConnectivity
|
|||||||
os.write(idList.size());
|
os.write(idList.size());
|
||||||
os.newline();
|
os.newline();
|
||||||
|
|
||||||
const faceList& meshFaces = meshPtr_->faces();
|
|
||||||
|
|
||||||
// write (polygon) face sizes
|
// write (polygon) face sizes
|
||||||
if (key == "nsided")
|
if (key == "nsided")
|
||||||
{
|
{
|
||||||
@ -223,7 +234,7 @@ void Foam::ensightPartFaces::writeConnectivity
|
|||||||
forAll(idList, i)
|
forAll(idList, i)
|
||||||
{
|
{
|
||||||
label id = idList[i] + offset_;
|
label id = idList[i] + offset_;
|
||||||
const face& f = meshFaces[id];
|
const face& f = faces[id];
|
||||||
|
|
||||||
os.write( f.size() );
|
os.write( f.size() );
|
||||||
os.newline();
|
os.newline();
|
||||||
@ -234,7 +245,7 @@ void Foam::ensightPartFaces::writeConnectivity
|
|||||||
forAll(idList, i)
|
forAll(idList, i)
|
||||||
{
|
{
|
||||||
label id = idList[i] + offset_;
|
label id = idList[i] + offset_;
|
||||||
const face& f = meshFaces[id];
|
const face& f = faces[id];
|
||||||
|
|
||||||
// convert global -> local index
|
// convert global -> local index
|
||||||
// (note: Ensight indices start with 1)
|
// (note: Ensight indices start with 1)
|
||||||
@ -247,4 +258,31 @@ void Foam::ensightPartFaces::writeConnectivity
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::ensightPartFaces::writeConnectivity
|
||||||
|
(
|
||||||
|
ensightGeoFile& os,
|
||||||
|
const word& key,
|
||||||
|
const labelList& idList,
|
||||||
|
const labelList& pointMap
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
writeConnectivity
|
||||||
|
(
|
||||||
|
os,
|
||||||
|
key,
|
||||||
|
meshPtr_->faces(),
|
||||||
|
idList,
|
||||||
|
pointMap
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::ensightPartFaces::writeGeometry(ensightGeoFile& os) const
|
||||||
|
{
|
||||||
|
const polyMesh& mesh = *meshPtr_;
|
||||||
|
const pointField& points = mesh.points();
|
||||||
|
ensightPart::writeGeometry(os, points);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -67,6 +67,9 @@ class ensightPartFaces
|
|||||||
const labelList& pointMap
|
const labelList& pointMap
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
//- write geometry
|
||||||
|
virtual void writeGeometry(ensightGeoFile& os) const;
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
@ -81,6 +84,19 @@ protected:
|
|||||||
// Static data members
|
// Static data members
|
||||||
static List<word> elemTypes_;
|
static List<word> elemTypes_;
|
||||||
|
|
||||||
|
//- Divide the shapes, set elemLists.
|
||||||
|
void binShapes(const faceList& faces);
|
||||||
|
|
||||||
|
//- Helper: write connectivity
|
||||||
|
void writeConnectivity
|
||||||
|
(
|
||||||
|
ensightGeoFile& os,
|
||||||
|
const word& key,
|
||||||
|
const faceList& faces,
|
||||||
|
const labelList& idList,
|
||||||
|
const labelList& pointMap
|
||||||
|
) const;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|||||||
@ -118,15 +118,16 @@ bool Foam::ensightPart::writeData(Ostream& os) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::ensightPart::writeGeometry(ensightGeoFile& os) const
|
void Foam::ensightPart::writeGeometry
|
||||||
|
(
|
||||||
|
ensightGeoFile& os,
|
||||||
|
const pointField& points
|
||||||
|
) const
|
||||||
{
|
{
|
||||||
if (size() && meshPtr_)
|
if (size())
|
||||||
{
|
{
|
||||||
const polyMesh& mesh = *meshPtr_;
|
const localPoints ptList = calcLocalPoints();
|
||||||
const pointField& meshPoints = mesh.points();
|
const labelList& pointMap = ptList.list;
|
||||||
|
|
||||||
localPoints ptList = calcLocalPoints();
|
|
||||||
labelList& pointMap = ptList.list;
|
|
||||||
|
|
||||||
writeHeader(os, true);
|
writeHeader(os, true);
|
||||||
|
|
||||||
@ -141,7 +142,7 @@ void Foam::ensightPart::writeGeometry(ensightGeoFile& os) const
|
|||||||
{
|
{
|
||||||
if (pointMap[ptI] > -1)
|
if (pointMap[ptI] > -1)
|
||||||
{
|
{
|
||||||
os.write( meshPoints[ptI].component(cmpt) );
|
os.write( points[ptI].component(cmpt) );
|
||||||
os.newline();
|
os.newline();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
122
src/conversion/ensight/part/ensightPartNonMeshFaces.C
Normal file
122
src/conversion/ensight/part/ensightPartNonMeshFaces.C
Normal file
@ -0,0 +1,122 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM 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
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "ensightPartNonMeshFaces.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
defineTypeNameAndDebug(ensightPartNonMeshFaces, 0);
|
||||||
|
addToRunTimeSelectionTable(ensightPart, ensightPartNonMeshFaces, istream);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::ensightPart::localPoints
|
||||||
|
Foam::ensightPartNonMeshFaces::calcLocalPoints() const
|
||||||
|
{
|
||||||
|
localPoints ptList;
|
||||||
|
ptList.list = identity(points_.size());
|
||||||
|
ptList.nPoints = points_.size();
|
||||||
|
return ptList;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::ensightPartNonMeshFaces::ensightPartNonMeshFaces
|
||||||
|
(
|
||||||
|
label partNumber,
|
||||||
|
const string& partDescription,
|
||||||
|
const faceList& faces,
|
||||||
|
const pointField& points
|
||||||
|
)
|
||||||
|
:
|
||||||
|
ensightPartFaces(partNumber, partDescription),
|
||||||
|
faces_(faces),
|
||||||
|
points_(points)
|
||||||
|
{
|
||||||
|
binShapes(faces);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//- Construct as copy
|
||||||
|
Foam::ensightPartNonMeshFaces::ensightPartNonMeshFaces
|
||||||
|
(
|
||||||
|
const ensightPartNonMeshFaces& part
|
||||||
|
)
|
||||||
|
:
|
||||||
|
ensightPartFaces(part),
|
||||||
|
faces_(part.faces_),
|
||||||
|
points_(part.points_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
//- Construct from Istream
|
||||||
|
Foam::ensightPartNonMeshFaces::ensightPartNonMeshFaces(Istream& is)
|
||||||
|
:
|
||||||
|
ensightPartFaces(is),
|
||||||
|
faces_(is),
|
||||||
|
points_(is)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::ensightPartNonMeshFaces::~ensightPartNonMeshFaces()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::ensightPartNonMeshFaces::writeConnectivity
|
||||||
|
(
|
||||||
|
ensightGeoFile& os,
|
||||||
|
const word& key,
|
||||||
|
const labelList& idList,
|
||||||
|
const labelList& pointMap
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
ensightPartFaces::writeConnectivity
|
||||||
|
(
|
||||||
|
os,
|
||||||
|
key,
|
||||||
|
faces_,
|
||||||
|
idList,
|
||||||
|
pointMap
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::ensightPartNonMeshFaces::writeGeometry(ensightGeoFile& os) const
|
||||||
|
{
|
||||||
|
ensightPart::writeGeometry(os, points_);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
131
src/conversion/ensight/part/ensightPartNonMeshFaces.H
Normal file
131
src/conversion/ensight/part/ensightPartNonMeshFaces.H
Normal file
@ -0,0 +1,131 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM 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
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::ensightPartNonMeshFaces
|
||||||
|
|
||||||
|
Description
|
||||||
|
An implementation of ensightPart to work on self-contained faces and points
|
||||||
|
(without a mesh).
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
ensightPartNonMeshFaces.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef ensightPartNonMeshFaces_H
|
||||||
|
#define ensightPartNonMeshFaces_H
|
||||||
|
|
||||||
|
#include "ensightPartFaces.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class ensightPartNonMeshFaces Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class ensightPartNonMeshFaces
|
||||||
|
:
|
||||||
|
public ensightPartFaces
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- faces (reference)
|
||||||
|
const faceList& faces_;
|
||||||
|
|
||||||
|
//- points (reference)
|
||||||
|
const pointField& points_;
|
||||||
|
|
||||||
|
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Disallow default bitwise assignment
|
||||||
|
void operator=(const ensightPartNonMeshFaces&);
|
||||||
|
|
||||||
|
//- track points used
|
||||||
|
virtual localPoints calcLocalPoints() const;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("ensightNonMeshFaces");
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from faces and points
|
||||||
|
ensightPartNonMeshFaces
|
||||||
|
(
|
||||||
|
label partNumber,
|
||||||
|
const string& partDescription,
|
||||||
|
const faceList& faces,
|
||||||
|
const pointField& points
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct as copy
|
||||||
|
ensightPartNonMeshFaces(const ensightPartNonMeshFaces& part);
|
||||||
|
|
||||||
|
//- Construct from Istream
|
||||||
|
ensightPartNonMeshFaces(Istream& is);
|
||||||
|
|
||||||
|
//- Construct on freestore from Istream
|
||||||
|
static autoPtr<ensightPartNonMeshFaces> New(Istream& is)
|
||||||
|
{
|
||||||
|
return autoPtr<ensightPartNonMeshFaces>
|
||||||
|
(
|
||||||
|
new ensightPartNonMeshFaces(is)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~ensightPartNonMeshFaces();
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
//- element connectivity
|
||||||
|
virtual void writeConnectivity
|
||||||
|
(
|
||||||
|
ensightGeoFile& os,
|
||||||
|
const word& key,
|
||||||
|
const labelList& idList,
|
||||||
|
const labelList& pointMap
|
||||||
|
) const;
|
||||||
|
|
||||||
|
virtual void writeGeometry(ensightGeoFile& os) const;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -3,6 +3,7 @@ EXE_INC = \
|
|||||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||||
-I$(LIB_SRC)/surfMesh/lnInclude \
|
-I$(LIB_SRC)/surfMesh/lnInclude \
|
||||||
-I$(LIB_SRC)/triSurface/lnInclude \
|
-I$(LIB_SRC)/triSurface/lnInclude \
|
||||||
|
-I$(LIB_SRC)/conversion/lnInclude \
|
||||||
-I$(LIB_SRC)/lagrangian/basic/lnInclude
|
-I$(LIB_SRC)/lagrangian/basic/lnInclude
|
||||||
|
|
||||||
LIB_LIBS = \
|
LIB_LIBS = \
|
||||||
@ -10,4 +11,5 @@ LIB_LIBS = \
|
|||||||
-lmeshTools \
|
-lmeshTools \
|
||||||
-lsurfMesh \
|
-lsurfMesh \
|
||||||
-ltriSurface \
|
-ltriSurface \
|
||||||
|
-lconversion \
|
||||||
-llagrangian
|
-llagrangian
|
||||||
|
|||||||
@ -28,119 +28,11 @@ License
|
|||||||
#include "OFstream.H"
|
#include "OFstream.H"
|
||||||
#include "OSspecific.H"
|
#include "OSspecific.H"
|
||||||
#include "IOmanip.H"
|
#include "IOmanip.H"
|
||||||
|
#include "ensightGeoFile.H"
|
||||||
|
#include "ensightPartNonMeshFaces.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
void Foam::ensightSurfaceWriter<Type>::binShapes
|
|
||||||
(
|
|
||||||
const pointField& points,
|
|
||||||
const faceList& faces,
|
|
||||||
DynamicList<label>& tris,
|
|
||||||
DynamicList<label>& quads,
|
|
||||||
DynamicList<label>& polys
|
|
||||||
)
|
|
||||||
{
|
|
||||||
tris.setCapacity(faces.size());
|
|
||||||
quads.setCapacity(faces.size());
|
|
||||||
polys.setCapacity(faces.size());
|
|
||||||
|
|
||||||
forAll(faces, i)
|
|
||||||
{
|
|
||||||
const face& f = faces[i];
|
|
||||||
if (f.size() == 3)
|
|
||||||
{
|
|
||||||
tris.append(i);
|
|
||||||
}
|
|
||||||
else if (f.size() == 4)
|
|
||||||
{
|
|
||||||
quads.append(i);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
polys.append(i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
void Foam::ensightSurfaceWriter<Type>::writeGeometry
|
|
||||||
(
|
|
||||||
const fileName& surfaceName,
|
|
||||||
Ostream& os,
|
|
||||||
const pointField& points,
|
|
||||||
const faceList& faces,
|
|
||||||
const DynamicList<label>& tris,
|
|
||||||
const DynamicList<label>& quads,
|
|
||||||
const DynamicList<label>& polys
|
|
||||||
)
|
|
||||||
{
|
|
||||||
os << "EnSight Geometry File" << nl
|
|
||||||
<< (string("written by OpenFOAM-") + Foam::FOAMversion).c_str() << nl
|
|
||||||
<< "node id assign" << nl
|
|
||||||
<< "element id assign" << nl
|
|
||||||
<< "part" << nl
|
|
||||||
<< setw(10) << 1 << nl
|
|
||||||
<< surfaceName.c_str() << nl;
|
|
||||||
|
|
||||||
os << "coordinates" << nl
|
|
||||||
<< setw(10) << points.size() << nl;
|
|
||||||
for (direction cmpt = 0; cmpt < vector::nComponents; cmpt++)
|
|
||||||
{
|
|
||||||
scalarField v = points.component(cmpt);
|
|
||||||
forAll(v, i)
|
|
||||||
{
|
|
||||||
os << v[i] << nl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (tris.size())
|
|
||||||
{
|
|
||||||
os << "tria3" << nl
|
|
||||||
<< setw(10) << tris.size() << nl;
|
|
||||||
forAll(tris, i)
|
|
||||||
{
|
|
||||||
const face& f = faces[tris[i]];
|
|
||||||
forAll(f, fp)
|
|
||||||
{
|
|
||||||
os << setw(10) << f[fp]+1;
|
|
||||||
}
|
|
||||||
os << nl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (quads.size())
|
|
||||||
{
|
|
||||||
os << "quad4" << nl
|
|
||||||
<< setw(10) << quads.size() << nl;
|
|
||||||
forAll(quads, i)
|
|
||||||
{
|
|
||||||
const face& f = faces[quads[i]];
|
|
||||||
forAll(f, fp)
|
|
||||||
{
|
|
||||||
os << setw(10) << f[fp]+1;
|
|
||||||
}
|
|
||||||
os << nl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (polys.size())
|
|
||||||
{
|
|
||||||
os << "nsided" << nl
|
|
||||||
<< setw(10) << polys.size() << nl;
|
|
||||||
forAll(polys, i)
|
|
||||||
{
|
|
||||||
const face& f = faces[polys[i]];
|
|
||||||
forAll(f, fp)
|
|
||||||
{
|
|
||||||
os << setw(10) << f[fp]+1;
|
|
||||||
}
|
|
||||||
os << nl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -233,7 +125,11 @@ void Foam::ensightSurfaceWriter<Type>::write
|
|||||||
|
|
||||||
|
|
||||||
OFstream caseStr(outputDir/surfaceName + ".case");
|
OFstream caseStr(outputDir/surfaceName + ".case");
|
||||||
OFstream geomStr(outputDir/surfaceName + ".***.mesh");
|
ensightGeoFile geomStr
|
||||||
|
(
|
||||||
|
outputDir/surfaceName + ".000.mesh",
|
||||||
|
IOstream::ASCII
|
||||||
|
);
|
||||||
|
|
||||||
if (verbose)
|
if (verbose)
|
||||||
{
|
{
|
||||||
@ -256,12 +152,8 @@ void Foam::ensightSurfaceWriter<Type>::write
|
|||||||
<< timeValue << nl
|
<< timeValue << nl
|
||||||
<< nl;
|
<< nl;
|
||||||
|
|
||||||
DynamicList<label> tris;
|
ensightPartNonMeshFaces faceWriter(0, geomStr.name().name(), faces, points);
|
||||||
DynamicList<label> quads;
|
faceWriter.writeGeometry(geomStr);
|
||||||
DynamicList<label> polys;
|
|
||||||
binShapes(points, faces, tris, quads, polys);
|
|
||||||
|
|
||||||
writeGeometry(surfaceName, geomStr, points, faces, tris, quads, polys);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -288,8 +180,16 @@ void Foam::ensightSurfaceWriter<Type>::write
|
|||||||
|
|
||||||
|
|
||||||
OFstream caseStr(outputDir/fieldName/surfaceName + ".case");
|
OFstream caseStr(outputDir/fieldName/surfaceName + ".case");
|
||||||
OFstream geomStr(outputDir/fieldName/surfaceName + ".000.mesh");
|
ensightGeoFile geomStr
|
||||||
OFstream fieldStr(outputDir/fieldName/surfaceName + ".000." + fieldName);
|
(
|
||||||
|
outputDir/fieldName/surfaceName + ".000.mesh",
|
||||||
|
IOstream::ASCII
|
||||||
|
);
|
||||||
|
ensightFile fieldStr
|
||||||
|
(
|
||||||
|
outputDir/fieldName/surfaceName + ".000." + fieldName,
|
||||||
|
IOstream::ASCII
|
||||||
|
);
|
||||||
|
|
||||||
if (verbose)
|
if (verbose)
|
||||||
{
|
{
|
||||||
@ -308,15 +208,15 @@ void Foam::ensightSurfaceWriter<Type>::write
|
|||||||
{
|
{
|
||||||
caseStr
|
caseStr
|
||||||
<< pTraits<Type>::typeName << " per node:" << setw(10) << 1
|
<< pTraits<Type>::typeName << " per node:" << setw(10) << 1
|
||||||
<< " " << fieldName
|
<< " " << fieldName
|
||||||
<< " " << surfaceName.c_str() << ".***." << fieldName << nl;
|
<< " " << surfaceName.c_str() << ".***." << fieldName << nl;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
caseStr
|
caseStr
|
||||||
<< pTraits<Type>::typeName << " per element:" << setw(10) << 1
|
<< pTraits<Type>::typeName << " per element:" << setw(10) << 1
|
||||||
<< " " << fieldName
|
<< " " << fieldName
|
||||||
<< " " << surfaceName.c_str() << ".***." << fieldName << nl;
|
<< " " << surfaceName.c_str() << ".***." << fieldName << nl;
|
||||||
}
|
}
|
||||||
|
|
||||||
caseStr
|
caseStr
|
||||||
@ -330,12 +230,8 @@ void Foam::ensightSurfaceWriter<Type>::write
|
|||||||
<< timeValue << nl
|
<< timeValue << nl
|
||||||
<< nl;
|
<< nl;
|
||||||
|
|
||||||
DynamicList<label> tris;
|
ensightPartNonMeshFaces faceWriter(0, geomStr.name().name(), faces, points);
|
||||||
DynamicList<label> quads;
|
faceWriter.writeGeometry(geomStr);
|
||||||
DynamicList<label> polys;
|
|
||||||
binShapes(points, faces, tris, quads, polys);
|
|
||||||
|
|
||||||
writeGeometry(surfaceName, geomStr, points, faces, tris, quads, polys);
|
|
||||||
|
|
||||||
// Write field
|
// Write field
|
||||||
fieldStr
|
fieldStr
|
||||||
@ -350,20 +246,22 @@ void Foam::ensightSurfaceWriter<Type>::write
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (tris.size())
|
//faceWriter.writeField(fieldStr, values);
|
||||||
|
forAll(faceWriter.elementTypes(), elemI)
|
||||||
{
|
{
|
||||||
fieldStr << "tria3" << nl;
|
if (faceWriter.elemLists()[elemI].size())
|
||||||
writeData(fieldStr, Field<Type>(values, tris));
|
{
|
||||||
}
|
fieldStr.writeKeyword(faceWriter.elementTypes()[elemI]);
|
||||||
if (quads.size())
|
writeData
|
||||||
{
|
(
|
||||||
fieldStr << "quad4" << nl;
|
fieldStr,
|
||||||
writeData(fieldStr, Field<Type>(values, quads));
|
Field<Type>
|
||||||
}
|
(
|
||||||
if (polys.size())
|
values,
|
||||||
{
|
faceWriter.elemLists()[elemI]
|
||||||
fieldStr << "nsided" << nl;
|
)
|
||||||
writeData(fieldStr, Field<Type>(values, polys));
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -41,6 +41,8 @@ SourceFiles
|
|||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
|
||||||
|
class ensightGeoFile;
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class ensightSurfaceWriter Declaration
|
Class ensightSurfaceWriter Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
@ -50,28 +52,17 @@ class ensightSurfaceWriter
|
|||||||
:
|
:
|
||||||
public surfaceWriter<Type>
|
public surfaceWriter<Type>
|
||||||
{
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
fileName caseFileName_;
|
||||||
|
fileName surfaceName_;
|
||||||
|
fileName geomName_;
|
||||||
|
DynamicList<word> varNames_;
|
||||||
|
DynamicList<fileName> varFileNames_;
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
static void binShapes
|
|
||||||
(
|
|
||||||
const pointField& points,
|
|
||||||
const faceList& faces,
|
|
||||||
DynamicList<label>& tris,
|
|
||||||
DynamicList<label>& quads,
|
|
||||||
DynamicList<label>& polys
|
|
||||||
);
|
|
||||||
|
|
||||||
static void writeGeometry
|
|
||||||
(
|
|
||||||
const fileName&,
|
|
||||||
Ostream&,
|
|
||||||
const pointField&,
|
|
||||||
const faceList&,
|
|
||||||
const DynamicList<label>&,
|
|
||||||
const DynamicList<label>&,
|
|
||||||
const DynamicList<label>&
|
|
||||||
);
|
|
||||||
|
|
||||||
static void writeData(Ostream&, const Field<Type>& values);
|
static void writeData(Ostream&, const Field<Type>& values);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user