From c2ad2d1bd61c1f8a90ba0c92c466af389d4cf5ad Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Wed, 16 Sep 2009 22:50:07 +0200 Subject: [PATCH] blockMesh: change block from 'has-a' to 'is-a' blockDescription --- src/meshing/blockMesh/block/block.C | 12 +++--- src/meshing/blockMesh/block/block.H | 7 ++-- src/meshing/blockMesh/block/blockCreate.C | 42 +++++++++---------- src/meshing/blockMesh/blockMesh/blockMesh.C | 2 +- .../blockMesh/blockMesh/blockMeshMergeList.C | 5 +++ .../blockMesh/blockMesh/blockMeshPatches.C | 22 ++++------ .../blockMesh/blockMesh/blockMeshTopology.C | 4 +- .../blockMesh/curvedEdges/curvedEdgeList.H | 3 +- 8 files changed, 48 insertions(+), 49 deletions(-) diff --git a/src/meshing/blockMesh/block/block.C b/src/meshing/blockMesh/block/block.C index d8093d3389..0fe19e2ba7 100644 --- a/src/meshing/blockMesh/block/block.C +++ b/src/meshing/blockMesh/block/block.C @@ -37,9 +37,9 @@ Foam::block::block Istream& is ) : - blockDef_(blockMeshPoints, edges, is), - vertices_(blockDef_.nPoints()), - cells_(blockDef_.nCells()), + blockDescriptor(blockMeshPoints, edges, is), + vertices_(nPoints()), + cells_(nCells()), boundaryPatches_(6) { createPrimitives(); @@ -48,9 +48,9 @@ Foam::block::block Foam::block::block(const blockDescriptor& definition) : - blockDef_(definition), - vertices_(blockDef_.nPoints()), - cells_(blockDef_.nCells()), + blockDescriptor(definition), + vertices_(nPoints()), + cells_(nCells()), boundaryPatches_(6) { createPrimitives(); diff --git a/src/meshing/blockMesh/block/block.H b/src/meshing/blockMesh/block/block.H index 557e6a05f4..a53a067c60 100644 --- a/src/meshing/blockMesh/block/block.H +++ b/src/meshing/blockMesh/block/block.H @@ -56,12 +56,11 @@ class Ostream; \*---------------------------------------------------------------------------*/ class block +: + public blockDescriptor { // Private data - //- Block definition - blockDescriptor blockDef_; - //- List of vertices pointField vertices_; @@ -125,7 +124,7 @@ public: //- Return the block definition inline const blockDescriptor& blockDef() const { - return blockDef_; + return *this; } const pointField& points() const; diff --git a/src/meshing/blockMesh/block/blockCreate.C b/src/meshing/blockMesh/block/blockCreate.C index 15e2d28386..d3d09edc97 100644 --- a/src/meshing/blockMesh/block/blockCreate.C +++ b/src/meshing/blockMesh/block/blockCreate.C @@ -35,8 +35,8 @@ Foam::label Foam::block::vtxLabel(label i, label j, label k) const return ( i - + j*(blockDef_.meshDensity().x() + 1) - + k*(blockDef_.meshDensity().x() + 1) * (blockDef_.meshDensity().y() + 1) + + j * (meshDensity().x() + 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() { // set local variables for mesh specification - const label ni = blockDef_.meshDensity().x(); - const label nj = blockDef_.meshDensity().y(); - const label nk = blockDef_.meshDensity().z(); + const label ni = meshDensity().x(); + const label nj = meshDensity().y(); + const label nk = meshDensity().z(); - const point& p000 = blockDef_.blockPoint(0); - const point& p100 = blockDef_.blockPoint(1); - const point& p110 = blockDef_.blockPoint(2); - const point& p010 = blockDef_.blockPoint(3); + const point& p000 = blockPoint(0); + const point& p100 = blockPoint(1); + const point& p110 = blockPoint(2); + const point& p010 = blockPoint(3); - const point& p001 = blockDef_.blockPoint(4); - const point& p101 = blockDef_.blockPoint(5); - const point& p111 = blockDef_.blockPoint(6); - const point& p011 = blockDef_.blockPoint(7); + const point& p001 = blockPoint(4); + const point& p101 = blockPoint(5); + const point& p111 = blockPoint(6); + const point& p011 = blockPoint(7); // list of edge point and weighting factors - const List >& p = blockDef_.blockEdgePoints(); - const scalarListList& w = blockDef_.blockEdgeWeights(); + const List< List >& p = blockEdgePoints(); + const scalarListList& w = blockEdgeWeights(); // generate vertices @@ -243,9 +243,9 @@ void Foam::block::createPoints() void Foam::block::createCells() { - const label ni = blockDef_.meshDensity().x(); - const label nj = blockDef_.meshDensity().y(); - const label nk = blockDef_.meshDensity().z(); + const label ni = meshDensity().x(); + const label nj = meshDensity().y(); + const label nk = meshDensity().z(); label cellNo = 0; @@ -274,9 +274,9 @@ void Foam::block::createCells() void Foam::block::createBoundary() { - const label ni = blockDef_.meshDensity().x(); - const label nj = blockDef_.meshDensity().y(); - const label nk = blockDef_.meshDensity().z(); + const label ni = meshDensity().x(); + const label nj = meshDensity().y(); + const label nk = meshDensity().z(); // x-direction diff --git a/src/meshing/blockMesh/blockMesh/blockMesh.C b/src/meshing/blockMesh/blockMesh/blockMesh.C index babb05e448..a46eace62d 100644 --- a/src/meshing/blockMesh/blockMesh/blockMesh.C +++ b/src/meshing/blockMesh/blockMesh/blockMesh.C @@ -111,7 +111,7 @@ Foam::label Foam::blockMesh::numZonedBlocks() const forAll(*this, blockI) { - if (operator[](blockI).blockDef().zoneName().size()) + if (operator[](blockI).zoneName().size()) { num++; } diff --git a/src/meshing/blockMesh/blockMesh/blockMeshMergeList.C b/src/meshing/blockMesh/blockMesh/blockMeshMergeList.C index 4c7c7b5e52..1e17bc3002 100644 --- a/src/meshing/blockMesh/blockMesh/blockMeshMergeList.C +++ b/src/meshing/blockMesh/blockMesh/blockMeshMergeList.C @@ -327,6 +327,8 @@ Foam::labelList Foam::blockMesh::createMergeList() } } +// FIXME? - there seems to be some logic missing here + foundFace = false; label blockNfaceLabel; for @@ -347,6 +349,9 @@ Foam::labelList Foam::blockMesh::createMergeList() } } +// FIXME? - there seems to be some logic missing here + + const labelListList& blockPfaceFaces = blocks[blockPlabel].boundaryPatches()[blockPfaceLabel]; diff --git a/src/meshing/blockMesh/blockMesh/blockMeshPatches.C b/src/meshing/blockMesh/blockMesh/blockMeshPatches.C index 62f1cc679f..3e0f608792 100644 --- a/src/meshing/blockMesh/blockMesh/blockMeshPatches.C +++ b/src/meshing/blockMesh/blockMesh/blockMeshPatches.C @@ -41,12 +41,9 @@ Foam::faceList Foam::blockMesh::createPatchFaces forAll(patchTopologyFaces, patchTopologyFaceLabel) { - label blockLabel = blockLabels[patchTopologyFaceLabel]; + const label blockI = blockLabels[patchTopologyFaceLabel]; - faceList blockFaces - ( - blocks[blockLabel].blockDef().blockShape().faces() - ); + faceList blockFaces = blocks[blockI].blockShape().faces(); forAll(blockFaces, blockFaceLabel) { @@ -57,7 +54,7 @@ Foam::faceList Foam::blockMesh::createPatchFaces ) { nFaces += - blocks[blockLabel].boundaryPatches()[blockFaceLabel].size(); + blocks[blockI].boundaryPatches()[blockFaceLabel].size(); } } } @@ -69,12 +66,9 @@ Foam::faceList Foam::blockMesh::createPatchFaces forAll(patchTopologyFaces, patchTopologyFaceLabel) { - label blockLabel = blockLabels[patchTopologyFaceLabel]; + const label blockI = blockLabels[patchTopologyFaceLabel]; - faceList blockFaces - ( - blocks[blockLabel].blockDef().blockShape().faces() - ); + faceList blockFaces = blocks[blockI].blockShape().faces(); forAll(blockFaces, blockFaceLabel) { @@ -85,7 +79,7 @@ Foam::faceList Foam::blockMesh::createPatchFaces ) { const labelListList& blockPatchFaces = - blocks[blockLabel].boundaryPatches()[blockFaceLabel]; + blocks[blockI].boundaryPatches()[blockFaceLabel]; forAll(blockPatchFaces, blockFaceLabel) { @@ -96,7 +90,7 @@ Foam::faceList Foam::blockMesh::createPatchFaces mergeList_ [ blockPatchFaces[blockFaceLabel][0] - + blockOffsets_[blockLabel] + + blockOffsets_[blockI] ]; label nUnique = 1; @@ -112,7 +106,7 @@ Foam::faceList Foam::blockMesh::createPatchFaces mergeList_ [ blockPatchFaces[blockFaceLabel][facePointLabel] - + blockOffsets_[blockLabel] + + blockOffsets_[blockI] ]; if (quadFace[nUnique] != quadFace[nUnique-1]) diff --git a/src/meshing/blockMesh/blockMesh/blockMeshTopology.C b/src/meshing/blockMesh/blockMesh/blockMeshTopology.C index 882f8297c0..3bca1b4052 100644 --- a/src/meshing/blockMesh/blockMesh/blockMeshTopology.C +++ b/src/meshing/blockMesh/blockMesh/blockMeshTopology.C @@ -173,7 +173,7 @@ Foam::polyMesh* Foam::blockMesh::createTopology(IOdictionary& meshDescription) ( nBlocks, tmpBlockPoints, - blocks[nBlocks].blockDef().blockShape() + blocks[nBlocks].blockShape() ); nBlocks++; @@ -292,7 +292,7 @@ Foam::polyMesh* Foam::blockMesh::createTopology(IOdictionary& meshDescription) tmpBlockShapes.set ( blockI, - new cellShape(blocks[blockI].blockDef().blockShape()) + new cellShape(blocks[blockI].blockShape()) ); if (tmpBlockShapes[blockI].mag(tmpBlockPoints) < 0.0) diff --git a/src/meshing/blockMesh/curvedEdges/curvedEdgeList.H b/src/meshing/blockMesh/curvedEdges/curvedEdgeList.H index 3918dded60..6111d53565 100644 --- a/src/meshing/blockMesh/curvedEdges/curvedEdgeList.H +++ b/src/meshing/blockMesh/curvedEdges/curvedEdgeList.H @@ -22,10 +22,11 @@ License along with OpenFOAM; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -InClass +Typedef Foam::curvedEdgeList Description + A PtrList of curvedEdges \*---------------------------------------------------------------------------*/