ENH: only use point/face/mesh references where needed in ensightPart*
- add points/faces constructor to ensightPartFaces with optional contiguousPoints flag. - Remove the now redundantensightPartNonMeshFaces class.
This commit is contained in:
parent
51df389de6
commit
0498967cc6
@ -4,7 +4,6 @@ ensight/part/ensightPart.C
|
||||
ensight/part/ensightPartIO.C
|
||||
ensight/part/ensightPartCells.C
|
||||
ensight/part/ensightPartFaces.C
|
||||
ensight/part/ensightPartNonMeshFaces.C
|
||||
ensight/part/ensightParts.C
|
||||
|
||||
meshTables/boundaryRegion.C
|
||||
|
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
|
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
|
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
|
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
|
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -24,21 +24,22 @@ License
|
||||
\*----------------------------------------------------------------------------*/
|
||||
|
||||
#include "ensightPart.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "dictionary.H"
|
||||
#include "ListOps.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(ensightPart, 0);
|
||||
defineTemplateTypeNameAndDebug(IOPtrList<ensightPart>, 0);
|
||||
defineRunTimeSelectionTable(ensightPart, istream);
|
||||
defineTypeNameAndDebug(ensightPart, 0);
|
||||
defineTemplateTypeNameAndDebug(IOPtrList<ensightPart>, 0);
|
||||
defineRunTimeSelectionTable(ensightPart, istream);
|
||||
}
|
||||
|
||||
Foam::List<Foam::word> Foam::ensightPart::elemTypes_(0);
|
||||
const Foam::List<Foam::word> Foam::ensightPart::elemTypes_(0);
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
bool Foam::ensightPart::isFieldDefined(const List<scalar>& field) const
|
||||
{
|
||||
@ -72,7 +73,7 @@ Foam::ensightPart::ensightPart
|
||||
size_(0),
|
||||
isCellData_(true),
|
||||
matId_(0),
|
||||
meshPtr_(0)
|
||||
points_(pointField::null())
|
||||
{}
|
||||
|
||||
|
||||
@ -89,7 +90,7 @@ Foam::ensightPart::ensightPart
|
||||
size_(0),
|
||||
isCellData_(true),
|
||||
matId_(0),
|
||||
meshPtr_(0)
|
||||
points_(pointField::null())
|
||||
{}
|
||||
|
||||
|
||||
@ -97,7 +98,7 @@ Foam::ensightPart::ensightPart
|
||||
(
|
||||
label partNumber,
|
||||
const string& partDescription,
|
||||
const polyMesh& pMesh
|
||||
const pointField& points
|
||||
)
|
||||
:
|
||||
number_(partNumber),
|
||||
@ -107,7 +108,7 @@ Foam::ensightPart::ensightPart
|
||||
size_(0),
|
||||
isCellData_(true),
|
||||
matId_(0),
|
||||
meshPtr_(&pMesh)
|
||||
points_(points)
|
||||
{}
|
||||
|
||||
|
||||
@ -120,7 +121,7 @@ Foam::ensightPart::ensightPart(const ensightPart& part)
|
||||
size_(part.size_),
|
||||
isCellData_(part.isCellData_),
|
||||
matId_(part.matId_),
|
||||
meshPtr_(part.meshPtr_)
|
||||
points_(part.points_)
|
||||
{}
|
||||
|
||||
|
||||
@ -158,31 +159,7 @@ Foam::ensightPart::~ensightPart()
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::ensightPart::reconstruct(Istream& is)
|
||||
{
|
||||
dictionary dict(is);
|
||||
dict.lookup("id") >> number_;
|
||||
dict.lookup("name") >> name_;
|
||||
dict.readIfPresent("offset", offset_);
|
||||
|
||||
// populate elemLists_
|
||||
elemLists_.setSize(elementTypes().size());
|
||||
|
||||
forAll(elementTypes(), elemI)
|
||||
{
|
||||
word key(elementTypes()[elemI]);
|
||||
|
||||
elemLists_[elemI].clear();
|
||||
dict.readIfPresent(key, elemLists_[elemI]);
|
||||
|
||||
size_ += elemLists_[elemI].size();
|
||||
}
|
||||
|
||||
is.check("ensightPart::reconstruct(Istream&)");
|
||||
}
|
||||
|
||||
|
||||
void Foam::ensightPart::renumber(labelList const& origId)
|
||||
void Foam::ensightPart::renumber(const labelList& origId)
|
||||
{
|
||||
// transform to global values first
|
||||
if (offset_)
|
||||
|
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -30,7 +30,7 @@ Description
|
||||
SourceFiles
|
||||
ensightPart.C
|
||||
ensightPartIO.C
|
||||
ensightPartI.H
|
||||
ensightPartTemplates.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -52,7 +52,7 @@ namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class ensightPart Declaration
|
||||
Class ensightPart Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class ensightPart
|
||||
@ -60,7 +60,7 @@ class ensightPart
|
||||
// Private data
|
||||
|
||||
// Static data members
|
||||
static List<word> elemTypes_;
|
||||
static const List<word> elemTypes_;
|
||||
|
||||
|
||||
protected:
|
||||
@ -88,8 +88,8 @@ protected:
|
||||
//- material id (numeric)
|
||||
label matId_;
|
||||
|
||||
//- mesh reference used
|
||||
const polyMesh* meshPtr_;
|
||||
//- pointField referenced
|
||||
const pointField& points_;
|
||||
|
||||
|
||||
// Protected Classes
|
||||
@ -104,25 +104,27 @@ protected:
|
||||
//- map global to local indices
|
||||
labelList list;
|
||||
|
||||
// null constructor
|
||||
//- null constructor
|
||||
localPoints()
|
||||
:
|
||||
nPoints(0),
|
||||
list(0)
|
||||
{}
|
||||
|
||||
// construct for mesh points
|
||||
localPoints(const polyMesh& pMesh)
|
||||
//- construct for mesh points
|
||||
localPoints(const pointField& pts)
|
||||
:
|
||||
nPoints(0),
|
||||
list(pMesh.points().size(), -1)
|
||||
list(pts.size(), -1)
|
||||
{}
|
||||
};
|
||||
|
||||
|
||||
// Protected Member Functions
|
||||
|
||||
//- reconstruct contents from Istream
|
||||
//- Reconstruct part characteristics (eg, element types) from Istream
|
||||
// A part reconstructed in this manner can be used when writing fields,
|
||||
// but cannot be used to write a new geometry
|
||||
void reconstruct(Istream&);
|
||||
|
||||
//- check for fully defined fields
|
||||
@ -170,12 +172,12 @@ public:
|
||||
//- Construct empty part with number and description
|
||||
ensightPart(label partNumber, const string& partDescription);
|
||||
|
||||
//- Construct empty part with number and description
|
||||
//- Construct part with number, description and points reference
|
||||
ensightPart
|
||||
(
|
||||
label partNumber,
|
||||
const string& partDescription,
|
||||
const polyMesh& pMesh
|
||||
const pointField& points
|
||||
);
|
||||
|
||||
//- Construct as copy
|
||||
@ -202,8 +204,9 @@ public:
|
||||
return autoPtr<ensightPart>(new ensightPart(*this));
|
||||
};
|
||||
|
||||
//- Construct on freestore from Istream
|
||||
static autoPtr<ensightPart> New(Istream& is);
|
||||
//- Reconstruct part characteristics on freestore from Istream
|
||||
// @sa reconstruct
|
||||
static autoPtr<ensightPart> New(Istream&);
|
||||
|
||||
|
||||
//- Destructor
|
||||
@ -212,7 +215,7 @@ public:
|
||||
|
||||
// Static members
|
||||
|
||||
virtual List<word> const& elementTypes() const
|
||||
virtual const List<word>& elementTypes() const
|
||||
{
|
||||
return elemTypes_;
|
||||
}
|
||||
@ -256,12 +259,13 @@ public:
|
||||
return matId_;
|
||||
}
|
||||
|
||||
//- non-const access
|
||||
//- non-const access to part name or description
|
||||
void name(const string& value)
|
||||
{
|
||||
name_ = value;
|
||||
}
|
||||
|
||||
//- non-const access to material id
|
||||
void materialId(const label value)
|
||||
{
|
||||
matId_ = value;
|
||||
@ -283,7 +287,7 @@ public:
|
||||
// Edit
|
||||
|
||||
//- renumber elements
|
||||
void renumber(labelList const&);
|
||||
void renumber(const labelList&);
|
||||
|
||||
//- write summary information about the object
|
||||
bool writeSummary(Ostream&) const;
|
||||
@ -296,7 +300,7 @@ public:
|
||||
{}
|
||||
|
||||
//- Helper: write geometry given the pointField
|
||||
void writeGeometry(ensightGeoFile&, const pointField& points) const;
|
||||
void writeGeometry(ensightGeoFile&, const pointField&) const;
|
||||
|
||||
//- write scalar field
|
||||
void writeScalarField
|
||||
@ -316,7 +320,7 @@ public:
|
||||
|
||||
|
||||
//- write generalized field components
|
||||
template <class Type>
|
||||
template<class Type>
|
||||
void writeField
|
||||
(
|
||||
ensightFile&,
|
||||
@ -339,11 +343,8 @@ public:
|
||||
friend Ostream& operator<<(Ostream&, const ensightPart&);
|
||||
|
||||
//- write geometry
|
||||
friend ensightGeoFile& operator<<
|
||||
(
|
||||
ensightGeoFile&,
|
||||
const ensightPart&
|
||||
);
|
||||
friend ensightGeoFile& operator<<(ensightGeoFile&, const ensightPart&);
|
||||
|
||||
};
|
||||
|
||||
|
||||
@ -354,7 +355,7 @@ public:
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "ensightPartI.H"
|
||||
# include "ensightPartTemplates.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -24,22 +24,21 @@ License
|
||||
\*----------------------------------------------------------------------------*/
|
||||
|
||||
#include "ensightPartCells.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "IOstream.H"
|
||||
#include "IStringStream.H"
|
||||
#include "dictionary.H"
|
||||
#include "cellModeller.H"
|
||||
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(ensightPartCells, 0);
|
||||
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream);
|
||||
defineTypeNameAndDebug(ensightPartCells, 0);
|
||||
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream);
|
||||
}
|
||||
|
||||
Foam::List<Foam::word> Foam::ensightPartCells::elemTypes_
|
||||
const Foam::List<Foam::word> Foam::ensightPartCells::elemTypes_
|
||||
(
|
||||
IStringStream
|
||||
(
|
||||
@ -50,7 +49,11 @@ Foam::List<Foam::word> Foam::ensightPartCells::elemTypes_
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::ensightPartCells::classify(const labelList& idList)
|
||||
void Foam::ensightPartCells::classify
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const labelList& idList
|
||||
)
|
||||
{
|
||||
// References to cell shape models
|
||||
const cellModel& tet = *(cellModeller::lookup("tet"));
|
||||
@ -58,7 +61,6 @@ void Foam::ensightPartCells::classify(const labelList& idList)
|
||||
const cellModel& prism = *(cellModeller::lookup("prism"));
|
||||
const cellModel& hex = *(cellModeller::lookup("hex"));
|
||||
|
||||
const polyMesh& mesh = *meshPtr_;
|
||||
const cellShapeList& cellShapes = mesh.cellShapes();
|
||||
|
||||
offset_ = 0;
|
||||
@ -78,13 +80,6 @@ void Foam::ensightPartCells::classify(const labelList& idList)
|
||||
label nHex = 0;
|
||||
label nPoly = 0;
|
||||
|
||||
|
||||
// TODO: allow tet-decomposition of polyhedral cells
|
||||
#if 0
|
||||
label nTetDecomp = 0;
|
||||
label nPyrDecomp = 0;
|
||||
#endif
|
||||
|
||||
for (label listI = 0; listI < size_; ++listI)
|
||||
{
|
||||
label cellId = listI;
|
||||
@ -115,26 +110,6 @@ void Foam::ensightPartCells::classify(const labelList& idList)
|
||||
else
|
||||
{
|
||||
nPoly++;
|
||||
|
||||
// TODO: allow tet-decomposition of polyhedral cells
|
||||
#if 0
|
||||
const cell& cFaces = mesh.cells()[cellI];
|
||||
|
||||
forAll(cFaces, cFaceI)
|
||||
{
|
||||
const face& f = mesh.faces()[cFaces[cFaceI]];
|
||||
|
||||
label nQuads = 0;
|
||||
label nTris = 0;
|
||||
f.nTrianglesQuads(mesh.points(), nTris, nQuads);
|
||||
|
||||
nTetDecomp += nTris;
|
||||
nPyrDecomp += nQuads;
|
||||
}
|
||||
|
||||
nAddCells--;
|
||||
nAddPoints++;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@ -183,29 +158,6 @@ void Foam::ensightPartCells::classify(const labelList& idList)
|
||||
else
|
||||
{
|
||||
polyCells[nPoly++] = cellId;
|
||||
|
||||
// TODO: allow tet-decomposition of polyhedral cells
|
||||
#if 0
|
||||
// Mapping from additional point to cell
|
||||
addPointCellLabels_[api] = cellId;
|
||||
|
||||
const cell& cFaces = mesh.cells()[cellId];
|
||||
|
||||
forAll(cFaces, cFaceI)
|
||||
{
|
||||
const face& f = mesh.faces()[cFaces[cFaceI]];
|
||||
|
||||
label nQuads = 0;
|
||||
label nTris = 0;
|
||||
f.nTrianglesQuads(mesh.points(), nTris, nQuads);
|
||||
|
||||
nTetDecomp += nTris;
|
||||
nPyrDecomp += nQuads;
|
||||
}
|
||||
|
||||
nAddCells--;
|
||||
nAddPoints++;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@ -213,11 +165,11 @@ void Foam::ensightPartCells::classify(const labelList& idList)
|
||||
// MUST match with elementTypes
|
||||
elemLists_.setSize(elementTypes().size());
|
||||
|
||||
elemLists_[tetra4Elements].transfer( tetCells );
|
||||
elemLists_[pyramid5Elements].transfer( pyramidCells );
|
||||
elemLists_[penta6Elements].transfer( prismCells );
|
||||
elemLists_[hexa8Elements].transfer( hexCells );
|
||||
elemLists_[nfacedElements].transfer( polyCells );
|
||||
elemLists_[tetra4Elements].transfer(tetCells);
|
||||
elemLists_[pyramid5Elements].transfer(pyramidCells);
|
||||
elemLists_[penta6Elements].transfer(prismCells);
|
||||
elemLists_[hexa8Elements].transfer(hexCells);
|
||||
elemLists_[nfacedElements].transfer(polyCells);
|
||||
}
|
||||
|
||||
|
||||
@ -229,57 +181,63 @@ Foam::ensightPartCells::ensightPartCells
|
||||
const string& partDescription
|
||||
)
|
||||
:
|
||||
ensightPart(partNumber, partDescription)
|
||||
ensightPart(partNumber, partDescription),
|
||||
mesh_(*reinterpret_cast<polyMesh*>(0))
|
||||
{}
|
||||
|
||||
|
||||
Foam::ensightPartCells::ensightPartCells
|
||||
(
|
||||
label partNumber,
|
||||
const polyMesh& pMesh
|
||||
const polyMesh& mesh
|
||||
)
|
||||
:
|
||||
ensightPart(partNumber, "cells", pMesh)
|
||||
ensightPart(partNumber, "cells", mesh.points()),
|
||||
mesh_(mesh)
|
||||
{
|
||||
classify();
|
||||
classify(mesh);
|
||||
}
|
||||
|
||||
|
||||
Foam::ensightPartCells::ensightPartCells
|
||||
(
|
||||
label partNumber,
|
||||
const polyMesh& pMesh,
|
||||
const polyMesh& mesh,
|
||||
const labelList& idList
|
||||
)
|
||||
:
|
||||
ensightPart(partNumber, "cells", pMesh)
|
||||
ensightPart(partNumber, "cells", mesh.points()),
|
||||
mesh_(mesh)
|
||||
{
|
||||
classify(idList);
|
||||
classify(mesh, idList);
|
||||
}
|
||||
|
||||
|
||||
Foam::ensightPartCells::ensightPartCells
|
||||
(
|
||||
label partNumber,
|
||||
const polyMesh& pMesh,
|
||||
const polyMesh& mesh,
|
||||
const cellZone& cZone
|
||||
)
|
||||
:
|
||||
ensightPart(partNumber, cZone.name(), pMesh)
|
||||
ensightPart(partNumber, cZone.name(), mesh.points()),
|
||||
mesh_(mesh)
|
||||
{
|
||||
classify(cZone);
|
||||
classify(mesh, cZone);
|
||||
}
|
||||
|
||||
|
||||
Foam::ensightPartCells::ensightPartCells(const ensightPartCells& part)
|
||||
:
|
||||
ensightPart(part)
|
||||
ensightPart(part),
|
||||
mesh_(part.mesh_)
|
||||
{}
|
||||
|
||||
|
||||
Foam::ensightPartCells::ensightPartCells(Istream& is)
|
||||
:
|
||||
ensightPart()
|
||||
ensightPart(),
|
||||
mesh_(*reinterpret_cast<polyMesh*>(0))
|
||||
{
|
||||
reconstruct(is);
|
||||
}
|
||||
@ -295,9 +253,7 @@ Foam::ensightPartCells::~ensightPartCells()
|
||||
|
||||
Foam::ensightPart::localPoints Foam::ensightPartCells::calcLocalPoints() const
|
||||
{
|
||||
const polyMesh& mesh = *meshPtr_;
|
||||
|
||||
localPoints ptList(mesh);
|
||||
localPoints ptList(points_);
|
||||
labelList& usedPoints = ptList.list;
|
||||
label nPoints = 0;
|
||||
|
||||
@ -309,11 +265,11 @@ Foam::ensightPart::localPoints Foam::ensightPartCells::calcLocalPoints() const
|
||||
forAll(idList, i)
|
||||
{
|
||||
label id = idList[i] + offset_;
|
||||
const labelList& cFaces = mesh.cells()[id];
|
||||
const labelList& cFaces = mesh_.cells()[id];
|
||||
|
||||
forAll(cFaces, cFaceI)
|
||||
{
|
||||
const face& f = mesh.faces()[cFaces[cFaceI]];
|
||||
const face& f = mesh_.faces()[cFaces[cFaceI]];
|
||||
|
||||
forAll(f, fp)
|
||||
{
|
||||
@ -353,20 +309,18 @@ void Foam::ensightPartCells::writeConnectivity
|
||||
os.write(idList.size());
|
||||
os.newline();
|
||||
|
||||
const polyMesh& mesh = *meshPtr_;
|
||||
|
||||
// write polyhedral
|
||||
if (key == "nfaced")
|
||||
{
|
||||
const faceList& meshFaces = mesh.faces();
|
||||
const faceList& meshFaces = mesh_.faces();
|
||||
|
||||
// write the number of faces per element
|
||||
forAll(idList, i)
|
||||
{
|
||||
label id = idList[i] + offset_;
|
||||
const labelList& cFace = mesh.cells()[id];
|
||||
const labelList& cFace = mesh_.cells()[id];
|
||||
|
||||
os.write( cFace.size() );
|
||||
os.write(cFace.size());
|
||||
os.newline();
|
||||
}
|
||||
|
||||
@ -374,13 +328,13 @@ void Foam::ensightPartCells::writeConnectivity
|
||||
forAll(idList, i)
|
||||
{
|
||||
label id = idList[i] + offset_;
|
||||
const labelList& cFace = mesh.cells()[id];
|
||||
const labelList& cFace = mesh_.cells()[id];
|
||||
|
||||
forAll(cFace, faceI)
|
||||
{
|
||||
const face& cf = meshFaces[cFace[faceI]];
|
||||
|
||||
os.write( cf.size() );
|
||||
os.write(cf.size());
|
||||
os.newline();
|
||||
}
|
||||
}
|
||||
@ -389,7 +343,7 @@ void Foam::ensightPartCells::writeConnectivity
|
||||
forAll(idList, i)
|
||||
{
|
||||
label id = idList[i] + offset_;
|
||||
const labelList& cFace = mesh.cells()[id];
|
||||
const labelList& cFace = mesh_.cells()[id];
|
||||
|
||||
forAll(cFace, faceI)
|
||||
{
|
||||
@ -399,7 +353,7 @@ void Foam::ensightPartCells::writeConnectivity
|
||||
{
|
||||
// convert global -> local index
|
||||
// (note: Ensight indices start with 1)
|
||||
os.write( pointMap[cf[ptI]] + 1);
|
||||
os.write(pointMap[cf[ptI]] + 1);
|
||||
}
|
||||
os.newline();
|
||||
}
|
||||
@ -408,7 +362,7 @@ void Foam::ensightPartCells::writeConnectivity
|
||||
else
|
||||
{
|
||||
// write primitive
|
||||
const cellShapeList& cellShapes = mesh.cellShapes();
|
||||
const cellShapeList& cellShapes = mesh_.cellShapes();
|
||||
|
||||
forAll(idList, i)
|
||||
{
|
||||
@ -419,7 +373,7 @@ void Foam::ensightPartCells::writeConnectivity
|
||||
// (note: Ensight indices start with 1)
|
||||
forAll(cellPoints, ptI)
|
||||
{
|
||||
os.write( pointMap[cellPoints[ptI]] + 1 );
|
||||
os.write(pointMap[cellPoints[ptI]] + 1);
|
||||
}
|
||||
os.newline();
|
||||
}
|
||||
@ -429,8 +383,7 @@ void Foam::ensightPartCells::writeConnectivity
|
||||
|
||||
void Foam::ensightPartCells::writeGeometry(ensightGeoFile& os) const
|
||||
{
|
||||
const polyMesh& mesh = *meshPtr_;
|
||||
ensightPart::writeGeometry(os, mesh.points());
|
||||
ensightPart::writeGeometry(os, points_);
|
||||
}
|
||||
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -56,8 +56,12 @@ class ensightPartCells
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const ensightPartCells&);
|
||||
|
||||
//- classify the cell types
|
||||
void classify(const labelList& idLabels = labelList::null());
|
||||
//- Classify the cell types, set elemLists.
|
||||
void classify
|
||||
(
|
||||
const polyMesh&,
|
||||
const labelList& idLabels = labelList::null()
|
||||
);
|
||||
|
||||
//- track points used
|
||||
virtual localPoints calcLocalPoints() const;
|
||||
@ -74,24 +78,29 @@ class ensightPartCells
|
||||
const labelList& pointMap
|
||||
) const;
|
||||
|
||||
//- write geometry
|
||||
virtual void writeGeometry(ensightGeoFile& os) const;
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
//- addressable Ensight element types
|
||||
enum elemType
|
||||
{
|
||||
tetra4Elements,
|
||||
pyramid5Elements,
|
||||
penta6Elements,
|
||||
hexa8Elements,
|
||||
nfacedElements
|
||||
};
|
||||
//- addressable ensight element types
|
||||
enum elemType
|
||||
{
|
||||
tetra4Elements,
|
||||
pyramid5Elements,
|
||||
penta6Elements,
|
||||
hexa8Elements,
|
||||
nfacedElements
|
||||
};
|
||||
|
||||
|
||||
// Static data members
|
||||
static List<word> elemTypes_;
|
||||
|
||||
static const List<word> elemTypes_;
|
||||
|
||||
|
||||
// Protected data
|
||||
|
||||
//- mesh referenced
|
||||
const polyMesh& mesh_;
|
||||
|
||||
|
||||
public:
|
||||
@ -126,10 +135,13 @@ public:
|
||||
//- Construct as copy
|
||||
ensightPartCells(const ensightPartCells&);
|
||||
|
||||
//- Construct from Istream
|
||||
//- Reconstruct part characteristics (eg, element types) from Istream
|
||||
// A part reconstructed in this manner can be used when writing fields,
|
||||
// but cannot be used to write a new geometry
|
||||
// @sa Foam::ensightPart::reconstruct
|
||||
ensightPartCells(Istream&);
|
||||
|
||||
//- Construct on freestore from Istream
|
||||
//- Reconstruct part characteristics on freestore from Istream
|
||||
static autoPtr<ensightPartCells> New(Istream& is)
|
||||
{
|
||||
return autoPtr<ensightPartCells>(new ensightPartCells(is));
|
||||
@ -142,8 +154,11 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- write geometry
|
||||
virtual void writeGeometry(ensightGeoFile&) const;
|
||||
|
||||
//- static listing of the element types
|
||||
virtual List<word> const& elementTypes() const
|
||||
virtual const List<word>& elementTypes() const
|
||||
{
|
||||
return elemTypes_;
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -24,21 +24,21 @@ License
|
||||
\*----------------------------------------------------------------------------*/
|
||||
|
||||
#include "ensightPartFaces.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "IOstreams.H"
|
||||
#include "IStringStream.H"
|
||||
#include "dictionary.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(ensightPartFaces, 0);
|
||||
addToRunTimeSelectionTable(ensightPart, ensightPartFaces, istream);
|
||||
defineTypeNameAndDebug(ensightPartFaces, 0);
|
||||
addToRunTimeSelectionTable(ensightPart, ensightPartFaces, istream);
|
||||
}
|
||||
|
||||
|
||||
Foam::List<Foam::word> Foam::ensightPartFaces::elemTypes_
|
||||
const Foam::List<Foam::word> Foam::ensightPartFaces::elemTypes_
|
||||
(
|
||||
IStringStream
|
||||
(
|
||||
@ -49,7 +49,7 @@ Foam::List<Foam::word> Foam::ensightPartFaces::elemTypes_
|
||||
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::ensightPartFaces::binShapes(const faceList& faces)
|
||||
void Foam::ensightPartFaces::classify(const faceList& faces)
|
||||
{
|
||||
// count the shapes
|
||||
label nTri = 0;
|
||||
@ -107,9 +107,9 @@ void Foam::ensightPartFaces::binShapes(const faceList& faces)
|
||||
// MUST match with elementTypes
|
||||
elemLists_.setSize(elementTypes().size());
|
||||
|
||||
elemLists_[tria3Elements].transfer( triCells );
|
||||
elemLists_[quad4Elements].transfer( quadCells );
|
||||
elemLists_[nsidedElements].transfer( polygonCells );
|
||||
elemLists_[tria3Elements].transfer(triCells);
|
||||
elemLists_[quad4Elements].transfer(quadCells);
|
||||
elemLists_[nsidedElements].transfer(polygonCells);
|
||||
|
||||
size_ = faces.size();
|
||||
}
|
||||
@ -123,7 +123,9 @@ Foam::ensightPartFaces::ensightPartFaces
|
||||
const string& partDescription
|
||||
)
|
||||
:
|
||||
ensightPart(partNumber, partDescription)
|
||||
ensightPart(partNumber, partDescription),
|
||||
faces_(faceList::null()),
|
||||
contiguousPoints_(false)
|
||||
{
|
||||
isCellData_ = false;
|
||||
offset_ = 0;
|
||||
@ -134,29 +136,57 @@ Foam::ensightPartFaces::ensightPartFaces
|
||||
Foam::ensightPartFaces::ensightPartFaces
|
||||
(
|
||||
label partNumber,
|
||||
const polyMesh& pMesh,
|
||||
const polyPatch& pPatch
|
||||
const string& partDescription,
|
||||
const pointField& points,
|
||||
const faceList& faces,
|
||||
const bool contiguousPoints
|
||||
)
|
||||
:
|
||||
ensightPart(partNumber, pPatch.name(), pMesh)
|
||||
ensightPart(partNumber, partDescription, points),
|
||||
faces_(faces),
|
||||
contiguousPoints_(contiguousPoints)
|
||||
{
|
||||
isCellData_ = false;
|
||||
offset_ = pPatch.start();
|
||||
offset_ = 0;
|
||||
size_ = 0;
|
||||
|
||||
// count the shapes
|
||||
binShapes(pPatch);
|
||||
// classify the face shapes
|
||||
classify(faces);
|
||||
}
|
||||
|
||||
|
||||
Foam::ensightPartFaces::ensightPartFaces
|
||||
(
|
||||
label partNumber,
|
||||
const polyMesh& mesh,
|
||||
const polyPatch& patch
|
||||
)
|
||||
:
|
||||
ensightPart(partNumber, patch.name(), mesh.points()),
|
||||
faces_(mesh.faces()),
|
||||
contiguousPoints_(false)
|
||||
{
|
||||
isCellData_ = false;
|
||||
offset_ = patch.start();
|
||||
|
||||
// classify the face shapes
|
||||
classify(patch);
|
||||
}
|
||||
|
||||
|
||||
Foam::ensightPartFaces::ensightPartFaces(const ensightPartFaces& part)
|
||||
:
|
||||
ensightPart(part)
|
||||
ensightPart(part),
|
||||
faces_(part.faces_),
|
||||
contiguousPoints_(part.contiguousPoints_)
|
||||
{}
|
||||
|
||||
|
||||
Foam::ensightPartFaces::ensightPartFaces(Istream& is)
|
||||
:
|
||||
ensightPart()
|
||||
ensightPart(),
|
||||
faces_(faceList::null()),
|
||||
contiguousPoints_(false)
|
||||
{
|
||||
isCellData_ = false;
|
||||
reconstruct(is);
|
||||
@ -173,9 +203,15 @@ Foam::ensightPartFaces::~ensightPartFaces()
|
||||
|
||||
Foam::ensightPart::localPoints Foam::ensightPartFaces::calcLocalPoints() const
|
||||
{
|
||||
const polyMesh& mesh = *meshPtr_;
|
||||
if (contiguousPoints_)
|
||||
{
|
||||
localPoints ptList;
|
||||
ptList.list = identity(points_.size());
|
||||
ptList.nPoints = points_.size();
|
||||
return ptList;
|
||||
}
|
||||
|
||||
localPoints ptList(mesh);
|
||||
localPoints ptList(points_);
|
||||
labelList& usedPoints = ptList.list;
|
||||
label nPoints = 0;
|
||||
|
||||
@ -187,7 +223,7 @@ Foam::ensightPart::localPoints Foam::ensightPartFaces::calcLocalPoints() const
|
||||
forAll(idList, i)
|
||||
{
|
||||
label id = idList[i] + offset_;
|
||||
const face& f = mesh.faces()[id];
|
||||
const face& f = faces_[id];
|
||||
|
||||
forAll(f, fp)
|
||||
{
|
||||
@ -236,7 +272,7 @@ void Foam::ensightPartFaces::writeConnectivity
|
||||
label id = idList[i] + offset_;
|
||||
const face& f = faces[id];
|
||||
|
||||
os.write( f.size() );
|
||||
os.write(f.size());
|
||||
os.newline();
|
||||
}
|
||||
}
|
||||
@ -251,7 +287,7 @@ void Foam::ensightPartFaces::writeConnectivity
|
||||
// (note: Ensight indices start with 1)
|
||||
forAll(f, fp)
|
||||
{
|
||||
os.write( pointMap[f[fp]] + 1 );
|
||||
os.write(pointMap[f[fp]] + 1);
|
||||
}
|
||||
os.newline();
|
||||
}
|
||||
@ -270,7 +306,7 @@ void Foam::ensightPartFaces::writeConnectivity
|
||||
(
|
||||
os,
|
||||
key,
|
||||
meshPtr_->faces(),
|
||||
faces_,
|
||||
idList,
|
||||
pointMap
|
||||
);
|
||||
@ -279,9 +315,7 @@ void Foam::ensightPartFaces::writeConnectivity
|
||||
|
||||
void Foam::ensightPartFaces::writeGeometry(ensightGeoFile& os) const
|
||||
{
|
||||
const polyMesh& mesh = *meshPtr_;
|
||||
const pointField& points = mesh.points();
|
||||
ensightPart::writeGeometry(os, points);
|
||||
ensightPart::writeGeometry(os, points_);
|
||||
}
|
||||
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -61,41 +61,52 @@ class ensightPartFaces
|
||||
//- element connectivity
|
||||
virtual void writeConnectivity
|
||||
(
|
||||
ensightGeoFile& os,
|
||||
ensightGeoFile&,
|
||||
const word& key,
|
||||
const labelList& idList,
|
||||
const labelList& pointMap
|
||||
) const;
|
||||
|
||||
//- write geometry
|
||||
virtual void writeGeometry(ensightGeoFile& os) const;
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
//- addressable ensight element types
|
||||
enum elemType
|
||||
{
|
||||
tria3Elements,
|
||||
quad4Elements,
|
||||
nsidedElements
|
||||
};
|
||||
//- addressable ensight element types
|
||||
enum elemType
|
||||
{
|
||||
tria3Elements,
|
||||
quad4Elements,
|
||||
nsidedElements
|
||||
};
|
||||
|
||||
|
||||
// Static data members
|
||||
static List<word> elemTypes_;
|
||||
|
||||
//- Divide the shapes, set elemLists.
|
||||
void binShapes(const faceList& faces);
|
||||
static const List<word> elemTypes_;
|
||||
|
||||
//- Helper: write connectivity
|
||||
void writeConnectivity
|
||||
(
|
||||
ensightGeoFile& os,
|
||||
const word& key,
|
||||
const faceList& faces,
|
||||
const labelList& idList,
|
||||
const labelList& pointMap
|
||||
) const;
|
||||
|
||||
// Protected data
|
||||
|
||||
//- faces referenced
|
||||
const faceList& faces_;
|
||||
|
||||
//- Can skip local point renumbering when points are contiguous
|
||||
const bool contiguousPoints_;
|
||||
|
||||
|
||||
// Protected Member Functions
|
||||
|
||||
//- Classify the face shapes, set elemLists.
|
||||
void classify(const faceList&);
|
||||
|
||||
//- Helper: write connectivity
|
||||
void writeConnectivity
|
||||
(
|
||||
ensightGeoFile&,
|
||||
const word& key,
|
||||
const faceList&,
|
||||
const labelList& idList,
|
||||
const labelList& pointMap
|
||||
) const;
|
||||
|
||||
|
||||
public:
|
||||
@ -108,6 +119,17 @@ public:
|
||||
//- Construct empty part with number and description
|
||||
ensightPartFaces(label partNumber, const string& partDescription);
|
||||
|
||||
//- Construct part with number, description, points and faces
|
||||
// Can skip local point renumbering when points are contiguous
|
||||
ensightPartFaces
|
||||
(
|
||||
label partNumber,
|
||||
const string& partDescription,
|
||||
const pointField&,
|
||||
const faceList&,
|
||||
const bool contiguousPoints = false
|
||||
);
|
||||
|
||||
//- Construct from polyMesh and polyPatch
|
||||
ensightPartFaces
|
||||
(
|
||||
@ -119,10 +141,13 @@ public:
|
||||
//- Construct as copy
|
||||
ensightPartFaces(const ensightPartFaces&);
|
||||
|
||||
//- Construct from Istream
|
||||
//- Reconstruct part characteristics (eg, element types) from Istream
|
||||
// A part reconstructed in this manner can be used when writing fields,
|
||||
// but cannot be used to write a new geometry
|
||||
// @sa Foam::ensightPart::reconstruct
|
||||
ensightPartFaces(Istream&);
|
||||
|
||||
//- Construct on freestore from Istream
|
||||
//- Reconstruct part characteristics on freestore from Istream
|
||||
static autoPtr<ensightPartFaces> New(Istream& is)
|
||||
{
|
||||
return autoPtr<ensightPartFaces>(new ensightPartFaces(is));
|
||||
@ -135,8 +160,11 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- write geometry
|
||||
virtual void writeGeometry(ensightGeoFile&) const;
|
||||
|
||||
//- static listing of the element types
|
||||
virtual List<word> const& elementTypes() const
|
||||
virtual const List<word>& elementTypes() const
|
||||
{
|
||||
return elemTypes_;
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -77,6 +77,32 @@ void Foam::ensightPart::writeFieldList
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::ensightPart::reconstruct(Istream& is)
|
||||
{
|
||||
dictionary dict(is);
|
||||
dict.lookup("id") >> number_;
|
||||
dict.lookup("name") >> name_;
|
||||
|
||||
offset_ = 0;
|
||||
dict.readIfPresent("offset", offset_);
|
||||
|
||||
// populate elemLists_
|
||||
elemLists_.setSize(elementTypes().size());
|
||||
|
||||
forAll(elementTypes(), elemI)
|
||||
{
|
||||
word key(elementTypes()[elemI]);
|
||||
|
||||
elemLists_[elemI].clear();
|
||||
dict.readIfPresent(key, elemLists_[elemI]);
|
||||
|
||||
size_ += elemLists_[elemI].size();
|
||||
}
|
||||
|
||||
is.check("ensightPart::reconstruct(Istream&)");
|
||||
}
|
||||
|
||||
|
||||
bool Foam::ensightPart::writeSummary(Ostream& os) const
|
||||
{
|
||||
os << indent << type() << nl
|
||||
@ -88,7 +114,7 @@ bool Foam::ensightPart::writeSummary(Ostream& os) const
|
||||
os.writeKeyword("offset") << offset() << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("size") << size() << token::END_STATEMENT << nl;
|
||||
|
||||
os << decrIndent << indent << token::END_BLOCK << nl << endl;
|
||||
os << decrIndent << indent << token::END_BLOCK << nl << endl;
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -112,7 +138,7 @@ bool Foam::ensightPart::writeData(Ostream& os) const
|
||||
}
|
||||
}
|
||||
|
||||
os << decrIndent << indent << token::END_BLOCK << nl << endl;
|
||||
os << decrIndent << indent << token::END_BLOCK << nl << endl;
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -136,13 +162,13 @@ void Foam::ensightPart::writeGeometry
|
||||
os.write(ptList.nPoints);
|
||||
os.newline();
|
||||
|
||||
for (direction cmpt=0; cmpt < vector::nComponents; cmpt++)
|
||||
for (direction cmpt=0; cmpt < point::nComponents; ++cmpt)
|
||||
{
|
||||
forAll(pointMap, ptI)
|
||||
{
|
||||
if (pointMap[ptI] > -1)
|
||||
{
|
||||
os.write( points[ptI].component(cmpt) );
|
||||
os.write(points[ptI].component(cmpt));
|
||||
os.newline();
|
||||
}
|
||||
}
|
||||
@ -182,7 +208,7 @@ void Foam::ensightPart::writeScalarField
|
||||
|
||||
if (idList.size())
|
||||
{
|
||||
os.writeKeyword( elementTypes()[elemI] );
|
||||
os.writeKeyword(elementTypes()[elemI]);
|
||||
writeFieldList(os, field, idList);
|
||||
}
|
||||
}
|
||||
@ -208,7 +234,7 @@ void Foam::ensightPart::writeVectorField
|
||||
|
||||
if (idList.size())
|
||||
{
|
||||
os.writeKeyword( elementTypes()[elemI] );
|
||||
os.writeKeyword(elementTypes()[elemI]);
|
||||
writeFieldList(os, field0, idList);
|
||||
writeFieldList(os, field1, idList);
|
||||
writeFieldList(os, field2, idList);
|
||||
|
@ -1,122 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-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_);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
@ -1,131 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-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
|
||||
|
||||
// ************************************************************************* //
|
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -30,14 +30,14 @@ Description
|
||||
|
||||
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
|
||||
|
||||
template <class Type>
|
||||
template<class Type>
|
||||
void Foam::ensightPart::writeField
|
||||
(
|
||||
ensightFile& os,
|
||||
const Field<Type>& field
|
||||
) const
|
||||
{
|
||||
if (size() && field.size())
|
||||
if (this->size() && field.size())
|
||||
{
|
||||
writeHeader(os);
|
||||
|
||||
@ -47,13 +47,13 @@ void Foam::ensightPart::writeField
|
||||
|
||||
if (idList.size())
|
||||
{
|
||||
os.writeKeyword( elementTypes()[elemI] );
|
||||
os.writeKeyword(elementTypes()[elemI]);
|
||||
|
||||
for
|
||||
(
|
||||
direction cmpt=0;
|
||||
cmpt < pTraits<Type>::nComponents;
|
||||
cmpt++
|
||||
++cmpt
|
||||
)
|
||||
{
|
||||
writeFieldList(os, field.component(cmpt), idList);
|
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -27,11 +27,11 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::ensightParts::ensightParts(const polyMesh& pMesh)
|
||||
Foam::ensightParts::ensightParts(const polyMesh& mesh)
|
||||
:
|
||||
partsList_()
|
||||
{
|
||||
recalculate(pMesh);
|
||||
recalculate(mesh);
|
||||
}
|
||||
|
||||
|
||||
@ -52,15 +52,15 @@ Foam::ensightParts::~ensightParts()
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::ensightParts::recalculate(const polyMesh& pMesh)
|
||||
void Foam::ensightParts::recalculate(const polyMesh& mesh)
|
||||
{
|
||||
partsList_.clear();
|
||||
|
||||
// extra space for unzoned cells
|
||||
label nPart =
|
||||
(
|
||||
pMesh.cellZones().size()
|
||||
+ pMesh.boundaryMesh().size()
|
||||
mesh.cellZones().size()
|
||||
+ mesh.boundaryMesh().size()
|
||||
+ 1
|
||||
);
|
||||
|
||||
@ -70,9 +70,9 @@ void Foam::ensightParts::recalculate(const polyMesh& pMesh)
|
||||
label nZoneCells = 0;
|
||||
|
||||
// do cell zones
|
||||
forAll(pMesh.cellZones(), zoneI)
|
||||
forAll(mesh.cellZones(), zoneI)
|
||||
{
|
||||
const cellZone& cZone = pMesh.cellZones()[zoneI];
|
||||
const cellZone& cZone = mesh.cellZones()[zoneI];
|
||||
nZoneCells += cZone.size();
|
||||
|
||||
if (cZone.size())
|
||||
@ -80,12 +80,7 @@ void Foam::ensightParts::recalculate(const polyMesh& pMesh)
|
||||
partsList_.set
|
||||
(
|
||||
nPart,
|
||||
new ensightPartCells
|
||||
(
|
||||
nPart,
|
||||
pMesh,
|
||||
cZone
|
||||
)
|
||||
new ensightPartCells(nPart, mesh, cZone)
|
||||
);
|
||||
|
||||
nPart++;
|
||||
@ -100,23 +95,19 @@ void Foam::ensightParts::recalculate(const polyMesh& pMesh)
|
||||
partsList_.set
|
||||
(
|
||||
nPart,
|
||||
new ensightPartCells
|
||||
(
|
||||
nPart,
|
||||
pMesh
|
||||
)
|
||||
new ensightPartCells(nPart, mesh)
|
||||
);
|
||||
|
||||
nPart++;
|
||||
}
|
||||
else if (pMesh.nCells() > nZoneCells)
|
||||
else if (mesh.nCells() > nZoneCells)
|
||||
{
|
||||
// determine which cells are not in a cellZone
|
||||
labelList unzoned(pMesh.nCells(), -1);
|
||||
labelList unzoned(mesh.nCells(), -1);
|
||||
|
||||
forAll(pMesh.cellZones(), zoneI)
|
||||
forAll(mesh.cellZones(), zoneI)
|
||||
{
|
||||
const labelList& idList = pMesh.cellZones()[zoneI];
|
||||
const labelList& idList = mesh.cellZones()[zoneI];
|
||||
|
||||
forAll(idList, i)
|
||||
{
|
||||
@ -140,12 +131,7 @@ void Foam::ensightParts::recalculate(const polyMesh& pMesh)
|
||||
partsList_.set
|
||||
(
|
||||
nPart,
|
||||
new ensightPartCells
|
||||
(
|
||||
nPart,
|
||||
pMesh,
|
||||
unzoned
|
||||
)
|
||||
new ensightPartCells(nPart, mesh, unzoned)
|
||||
);
|
||||
|
||||
nPart++;
|
||||
@ -154,20 +140,15 @@ void Foam::ensightParts::recalculate(const polyMesh& pMesh)
|
||||
|
||||
|
||||
// do boundaries, skipping empty and processor patches
|
||||
forAll(pMesh.boundaryMesh(), patchI)
|
||||
forAll(mesh.boundaryMesh(), patchI)
|
||||
{
|
||||
const polyPatch& pPatch = pMesh.boundaryMesh()[patchI];
|
||||
if (pPatch.size() && !isA<processorPolyPatch>(pPatch))
|
||||
const polyPatch& patch = mesh.boundaryMesh()[patchI];
|
||||
if (patch.size() && !isA<processorPolyPatch>(patch))
|
||||
{
|
||||
partsList_.set
|
||||
(
|
||||
nPart,
|
||||
new ensightPartFaces
|
||||
(
|
||||
nPart,
|
||||
pMesh,
|
||||
pPatch
|
||||
)
|
||||
new ensightPartFaces(nPart, mesh, patch)
|
||||
);
|
||||
|
||||
nPart++;
|
||||
@ -199,7 +180,7 @@ void Foam::ensightParts::renumber
|
||||
}
|
||||
|
||||
|
||||
void Foam::ensightParts::writeGeometry( ensightGeoFile& os) const
|
||||
void Foam::ensightParts::writeGeometry(ensightGeoFile& os) const
|
||||
{
|
||||
// with some feedback
|
||||
Info<< "write geometry part:" << nl << flush;
|
||||
@ -225,23 +206,21 @@ bool Foam::ensightParts::writeSummary(Ostream& os) const
|
||||
|
||||
void Foam::ensightParts::writeData(Ostream& os) const
|
||||
{
|
||||
// Write size of list
|
||||
os << nl << partsList_.size();
|
||||
|
||||
// Write beginning of contents
|
||||
os << nl << token::BEGIN_LIST;
|
||||
// Begin write list
|
||||
os << nl << partsList_.size()
|
||||
<< nl << token::BEGIN_LIST;
|
||||
|
||||
// Write list contents
|
||||
forAll(partsList_, i)
|
||||
{
|
||||
os << nl << partsList_[i];
|
||||
os << nl << partsList_[i];
|
||||
}
|
||||
|
||||
// Write end of contents
|
||||
os << nl << token::END_LIST << nl;
|
||||
// End write list
|
||||
os << nl << token::END_LIST << nl;
|
||||
|
||||
// Check state of IOstream
|
||||
os.check("Ostream& operator<<(Ostream&, const PtrList&)");
|
||||
os.check("ensightParts::writeData(Ostream&)");
|
||||
}
|
||||
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -29,7 +29,7 @@ Description
|
||||
|
||||
SourceFiles
|
||||
ensightParts.C
|
||||
ensightPartsI.H
|
||||
ensightPartsTemplates.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -128,7 +128,7 @@ public:
|
||||
|
||||
|
||||
//- write generalized field components
|
||||
template <class Type>
|
||||
template<class Type>
|
||||
void writeField
|
||||
(
|
||||
ensightFile&,
|
||||
@ -138,11 +138,8 @@ public:
|
||||
|
||||
// Friend Operators
|
||||
|
||||
friend ensightGeoFile& operator<<
|
||||
(
|
||||
ensightGeoFile&,
|
||||
const ensightParts&
|
||||
);
|
||||
//- write geometry
|
||||
friend ensightGeoFile& operator<<(ensightGeoFile&, const ensightParts&);
|
||||
};
|
||||
|
||||
|
||||
@ -153,7 +150,7 @@ public:
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "ensightPartsI.H"
|
||||
# include "ensightPartsTemplates.C"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -30,7 +30,7 @@ Description
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
template <class Type>
|
||||
template<class Type>
|
||||
void Foam::ensightParts::writeField
|
||||
(
|
||||
ensightFile& os,
|
@ -28,8 +28,7 @@ License
|
||||
#include "OFstream.H"
|
||||
#include "OSspecific.H"
|
||||
#include "IOmanip.H"
|
||||
#include "ensightGeoFile.H"
|
||||
#include "ensightPartNonMeshFaces.H"
|
||||
#include "ensightPartFaces.H"
|
||||
|
||||
#include "makeSurfaceWriterMethods.H"
|
||||
|
||||
@ -153,7 +152,7 @@ void Foam::ensightSurfaceWriter::writeTemplate
|
||||
<< timeValue << nl
|
||||
<< nl;
|
||||
|
||||
ensightPartNonMeshFaces ensPart(0, geomStr.name().name(), faces, points);
|
||||
ensightPartFaces ensPart(0, geomStr.name().name(), points, faces, true);
|
||||
geomStr << ensPart;
|
||||
|
||||
// Write field
|
||||
@ -252,7 +251,7 @@ void Foam::ensightSurfaceWriter::write
|
||||
<< timeValue << nl
|
||||
<< nl;
|
||||
|
||||
ensightPartNonMeshFaces ensPart(0, geomStr.name().name(), faces, points);
|
||||
ensightPartFaces ensPart(0, geomStr.name().name(), points, faces, true);
|
||||
geomStr << ensPart;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user