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