blockMesh: change block from 'has-a' to 'is-a' blockDescription

This commit is contained in:
Mark Olesen
2009-09-16 22:50:07 +02:00
parent dd093e0a37
commit c2ad2d1bd6
8 changed files with 48 additions and 49 deletions

View File

@ -37,9 +37,9 @@ Foam::block::block
Istream& is Istream& is
) )
: :
blockDef_(blockMeshPoints, edges, is), blockDescriptor(blockMeshPoints, edges, is),
vertices_(blockDef_.nPoints()), vertices_(nPoints()),
cells_(blockDef_.nCells()), cells_(nCells()),
boundaryPatches_(6) boundaryPatches_(6)
{ {
createPrimitives(); createPrimitives();
@ -48,9 +48,9 @@ Foam::block::block
Foam::block::block(const blockDescriptor& definition) Foam::block::block(const blockDescriptor& definition)
: :
blockDef_(definition), blockDescriptor(definition),
vertices_(blockDef_.nPoints()), vertices_(nPoints()),
cells_(blockDef_.nCells()), cells_(nCells()),
boundaryPatches_(6) boundaryPatches_(6)
{ {
createPrimitives(); createPrimitives();

View File

@ -56,12 +56,11 @@ class Ostream;
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
class block class block
:
public blockDescriptor
{ {
// Private data // Private data
//- Block definition
blockDescriptor blockDef_;
//- List of vertices //- List of vertices
pointField vertices_; pointField vertices_;
@ -125,7 +124,7 @@ public:
//- Return the block definition //- Return the block definition
inline const blockDescriptor& blockDef() const inline const blockDescriptor& blockDef() const
{ {
return blockDef_; return *this;
} }
const pointField& points() const; const pointField& points() const;

View File

@ -35,8 +35,8 @@ Foam::label Foam::block::vtxLabel(label i, label j, label k) const
return return
( (
i i
+ j*(blockDef_.meshDensity().x() + 1) + j * (meshDensity().x() + 1)
+ k*(blockDef_.meshDensity().x() + 1) * (blockDef_.meshDensity().y() + 1) + k * (meshDensity().x() + 1) * (meshDensity().y() + 1)
); );
} }
@ -44,24 +44,24 @@ Foam::label Foam::block::vtxLabel(label i, label j, label k) const
void Foam::block::createPoints() void Foam::block::createPoints()
{ {
// set local variables for mesh specification // set local variables for mesh specification
const label ni = blockDef_.meshDensity().x(); const label ni = meshDensity().x();
const label nj = blockDef_.meshDensity().y(); const label nj = meshDensity().y();
const label nk = blockDef_.meshDensity().z(); const label nk = meshDensity().z();
const point& p000 = blockDef_.blockPoint(0); const point& p000 = blockPoint(0);
const point& p100 = blockDef_.blockPoint(1); const point& p100 = blockPoint(1);
const point& p110 = blockDef_.blockPoint(2); const point& p110 = blockPoint(2);
const point& p010 = blockDef_.blockPoint(3); const point& p010 = blockPoint(3);
const point& p001 = blockDef_.blockPoint(4); const point& p001 = blockPoint(4);
const point& p101 = blockDef_.blockPoint(5); const point& p101 = blockPoint(5);
const point& p111 = blockDef_.blockPoint(6); const point& p111 = blockPoint(6);
const point& p011 = blockDef_.blockPoint(7); const point& p011 = blockPoint(7);
// list of edge point and weighting factors // list of edge point and weighting factors
const List<List<point> >& p = blockDef_.blockEdgePoints(); const List< List<point> >& p = blockEdgePoints();
const scalarListList& w = blockDef_.blockEdgeWeights(); const scalarListList& w = blockEdgeWeights();
// generate vertices // generate vertices
@ -243,9 +243,9 @@ void Foam::block::createPoints()
void Foam::block::createCells() void Foam::block::createCells()
{ {
const label ni = blockDef_.meshDensity().x(); const label ni = meshDensity().x();
const label nj = blockDef_.meshDensity().y(); const label nj = meshDensity().y();
const label nk = blockDef_.meshDensity().z(); const label nk = meshDensity().z();
label cellNo = 0; label cellNo = 0;
@ -274,9 +274,9 @@ void Foam::block::createCells()
void Foam::block::createBoundary() void Foam::block::createBoundary()
{ {
const label ni = blockDef_.meshDensity().x(); const label ni = meshDensity().x();
const label nj = blockDef_.meshDensity().y(); const label nj = meshDensity().y();
const label nk = blockDef_.meshDensity().z(); const label nk = meshDensity().z();
// x-direction // x-direction

View File

@ -111,7 +111,7 @@ Foam::label Foam::blockMesh::numZonedBlocks() const
forAll(*this, blockI) forAll(*this, blockI)
{ {
if (operator[](blockI).blockDef().zoneName().size()) if (operator[](blockI).zoneName().size())
{ {
num++; num++;
} }

View File

@ -327,6 +327,8 @@ Foam::labelList Foam::blockMesh::createMergeList()
} }
} }
// FIXME? - there seems to be some logic missing here
foundFace = false; foundFace = false;
label blockNfaceLabel; label blockNfaceLabel;
for for
@ -347,6 +349,9 @@ Foam::labelList Foam::blockMesh::createMergeList()
} }
} }
// FIXME? - there seems to be some logic missing here
const labelListList& blockPfaceFaces = const labelListList& blockPfaceFaces =
blocks[blockPlabel].boundaryPatches()[blockPfaceLabel]; blocks[blockPlabel].boundaryPatches()[blockPfaceLabel];

View File

@ -41,12 +41,9 @@ Foam::faceList Foam::blockMesh::createPatchFaces
forAll(patchTopologyFaces, patchTopologyFaceLabel) forAll(patchTopologyFaces, patchTopologyFaceLabel)
{ {
label blockLabel = blockLabels[patchTopologyFaceLabel]; const label blockI = blockLabels[patchTopologyFaceLabel];
faceList blockFaces faceList blockFaces = blocks[blockI].blockShape().faces();
(
blocks[blockLabel].blockDef().blockShape().faces()
);
forAll(blockFaces, blockFaceLabel) forAll(blockFaces, blockFaceLabel)
{ {
@ -57,7 +54,7 @@ Foam::faceList Foam::blockMesh::createPatchFaces
) )
{ {
nFaces += nFaces +=
blocks[blockLabel].boundaryPatches()[blockFaceLabel].size(); blocks[blockI].boundaryPatches()[blockFaceLabel].size();
} }
} }
} }
@ -69,12 +66,9 @@ Foam::faceList Foam::blockMesh::createPatchFaces
forAll(patchTopologyFaces, patchTopologyFaceLabel) forAll(patchTopologyFaces, patchTopologyFaceLabel)
{ {
label blockLabel = blockLabels[patchTopologyFaceLabel]; const label blockI = blockLabels[patchTopologyFaceLabel];
faceList blockFaces faceList blockFaces = blocks[blockI].blockShape().faces();
(
blocks[blockLabel].blockDef().blockShape().faces()
);
forAll(blockFaces, blockFaceLabel) forAll(blockFaces, blockFaceLabel)
{ {
@ -85,7 +79,7 @@ Foam::faceList Foam::blockMesh::createPatchFaces
) )
{ {
const labelListList& blockPatchFaces = const labelListList& blockPatchFaces =
blocks[blockLabel].boundaryPatches()[blockFaceLabel]; blocks[blockI].boundaryPatches()[blockFaceLabel];
forAll(blockPatchFaces, blockFaceLabel) forAll(blockPatchFaces, blockFaceLabel)
{ {
@ -96,7 +90,7 @@ Foam::faceList Foam::blockMesh::createPatchFaces
mergeList_ mergeList_
[ [
blockPatchFaces[blockFaceLabel][0] blockPatchFaces[blockFaceLabel][0]
+ blockOffsets_[blockLabel] + blockOffsets_[blockI]
]; ];
label nUnique = 1; label nUnique = 1;
@ -112,7 +106,7 @@ Foam::faceList Foam::blockMesh::createPatchFaces
mergeList_ mergeList_
[ [
blockPatchFaces[blockFaceLabel][facePointLabel] blockPatchFaces[blockFaceLabel][facePointLabel]
+ blockOffsets_[blockLabel] + blockOffsets_[blockI]
]; ];
if (quadFace[nUnique] != quadFace[nUnique-1]) if (quadFace[nUnique] != quadFace[nUnique-1])

View File

@ -173,7 +173,7 @@ Foam::polyMesh* Foam::blockMesh::createTopology(IOdictionary& meshDescription)
( (
nBlocks, nBlocks,
tmpBlockPoints, tmpBlockPoints,
blocks[nBlocks].blockDef().blockShape() blocks[nBlocks].blockShape()
); );
nBlocks++; nBlocks++;
@ -292,7 +292,7 @@ Foam::polyMesh* Foam::blockMesh::createTopology(IOdictionary& meshDescription)
tmpBlockShapes.set tmpBlockShapes.set
( (
blockI, blockI,
new cellShape(blocks[blockI].blockDef().blockShape()) new cellShape(blocks[blockI].blockShape())
); );
if (tmpBlockShapes[blockI].mag(tmpBlockPoints) < 0.0) if (tmpBlockShapes[blockI].mag(tmpBlockPoints) < 0.0)

View File

@ -22,10 +22,11 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation, along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
InClass Typedef
Foam::curvedEdgeList Foam::curvedEdgeList
Description Description
A PtrList of curvedEdges
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/