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
)
:
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();

View File

@ -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;

View File

@ -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<List<point> >& p = blockDef_.blockEdgePoints();
const scalarListList& w = blockDef_.blockEdgeWeights();
const List< List<point> >& 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

View File

@ -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++;
}

View File

@ -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];

View File

@ -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])

View File

@ -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)

View File

@ -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
\*---------------------------------------------------------------------------*/