Commit dd093e0a authored by Mark Olesen's avatar Mark Olesen
Browse files

blockMesh: rationalize file names/contents

parent 6fc500d6
......@@ -146,8 +146,8 @@ int main(int argc, char *argv[])
<< exit(FatalError);
}
Info<< nl << "Creating block mesh from\n "
<< meshDictIoPtr->objectPath() << nl << endl;
Info<< "Creating block mesh from\n "
<< meshDictIoPtr->objectPath() << endl;
IOdictionary meshDict(meshDictIoPtr());
blockMesh blocks(meshDict);
......@@ -195,8 +195,7 @@ int main(int argc, char *argv[])
}
Info<< nl << "Creating mesh from block mesh" << endl;
Info<< nl << "Creating polyMesh from blockMesh" << endl;
wordList patchNames = blocks.patchNames();
wordList patchTypes = blocks.patchTypes();
......
curvedEdges/curvedEdge.C
curvedEdges/lineEdge.C
curvedEdges/polyLine.C
curvedEdges/polyLineEdge.C
curvedEdges/arcEdge.C
curvedEdges/spline.C
curvedEdges/BSpline.C
curvedEdges/simpleSplineEdge.C
curvedEdges/polySplineEdge.C
curvedEdges/lineDivide.C
blockDescriptor/blockDescriptor.C
blockDescriptor/blockDescriptorEdges.C
block/block.C
block/blockCreate.C
blockMesh/blockMesh.C
blockMesh/blockMeshCells.C
blockMesh/blockMeshPatches.C
blockMesh/blockMeshPoints.C
blockMesh/blockMeshTopology.C
blockMesh/blockMeshCheck.C
blockMesh/blockMeshOffsets.C
blockMesh/blockMeshMergeList.C
LIB = $(FOAM_LIBBIN)/libblockMesh
......@@ -22,73 +22,56 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
\*---------------------------------------------------------------------------*/
#include "error.H"
#include "block.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
label block::vtxLabel(label a, label b, label c)
Foam::block::block
(
const pointField& blockMeshPoints,
const curvedEdgeList& edges,
Istream& is
)
:
blockDef_(blockMeshPoints, edges, is),
vertices_(blockDef_.nPoints()),
cells_(blockDef_.nCells()),
boundaryPatches_(6)
{
return (a + b*(blockDef_.n().x() + 1)
+ c*(blockDef_.n().x() + 1)*(blockDef_.n().y() + 1));
createPrimitives();
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from description
block::block(const blockDescriptor& definition)
Foam::block::block(const blockDescriptor& definition)
:
blockDef_(definition),
vertices_
(
((blockDef_.n().x() + 1)*(blockDef_.n().y() + 1)*(blockDef_.n().z() + 1))
),
cells_
(
(blockDef_.n().x()*blockDef_.n().y()*blockDef_.n().z())
),
vertices_(blockDef_.nPoints()),
cells_(blockDef_.nCells()),
boundaryPatches_(6)
{
// create points
blockPoints();
// generate internal cells
blockCells();
// generate boundary patches
blockBoundary();
createPrimitives();
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
const blockDescriptor& block::blockDef() const
{
return blockDef_;
}
const pointField& block::points() const
const Foam::pointField& Foam::block::points() const
{
return vertices_;
}
const labelListList& block::cells() const
const Foam::labelListList& Foam::block::cells() const
{
return cells_;
}
const labelListListList& block::boundaryPatches() const
const Foam::labelListListList& Foam::block::boundaryPatches() const
{
return boundaryPatches_;
}
......@@ -96,19 +79,14 @@ const labelListListList& block::boundaryPatches() const
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
Ostream& operator<<(Ostream& os, const block& b)
Foam::Ostream& Foam::operator<<(Ostream& os, const block& b)
{
os << b.vertices_ << nl
<< b.cells_ << nl
<< b.boundaryPatches_ << endl;
os << b.points() << nl
<< b.cells() << nl
<< b.boundaryPatches() << endl;
return os;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //
......@@ -26,11 +26,12 @@ Class
Foam::block
Description
creates a single block of cells from point coordinates,
numbers of cells in each direction and expansion ratio
Creates a single block of cells from point coordinates, numbers of
cells in each direction and an expansion ratio.
SourceFiles
block.C
blockCreate.C
\*---------------------------------------------------------------------------*/
......@@ -58,35 +59,55 @@ class block
{
// Private data
//- block definition
//- Block definition
blockDescriptor blockDef_;
//- list of vertices
//- List of vertices
pointField vertices_;
//- list of cells
//- List of cells
labelListList cells_;
//- boundary patches
//- Boundary patches
labelListListList boundaryPatches_;
// private member functions
// Private Member Functions
label vtxLabel(label i, label j, label k);
//- Vertex label offset for a particular i,j,k position
label vtxLabel(label i, label j, label k) const;
void blockPoints();
//- Creates vertices for cells filling the block.
void createPoints();
void blockCells();
//- Creates cells for the block.
void createCells();
void blockBoundary();
//- Creates boundary patches for the block
void createBoundary();
//- Creates vertices, cells, boundary patches for the block
void createPrimitives();
//- Disallow default bitwise copy construct
block(const block&);
//- Disallow default bitwise assignment
void operator=(const block&);
public:
// Constructors
//- Construct from the block definition
//- Construct from components with Istream
block
(
const pointField& blockMeshPoints,
const curvedEdgeList&,
Istream&
);
//- Construct from a block definition
block(const blockDescriptor&);
//- Clone
......@@ -101,9 +122,16 @@ public:
// Access
const blockDescriptor& blockDef() const;
//- Return the block definition
inline const blockDescriptor& blockDef() const
{
return blockDef_;
}
const pointField& points() const;
const labelListList& cells() const;
const labelListListList& boundaryPatches() const;
......@@ -112,14 +140,6 @@ public:
friend Ostream& operator<<(Ostream&, const block&);
};
inline Istream& operator>>(Istream& is, block*)
{
notImplemented("Istream& operator>>(Istream& is, block*)");
return is;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
......
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
private member of block. Creates boundary patches for the block
\*---------------------------------------------------------------------------*/
#include "error.H"
#include "block.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::block::blockBoundary()
{
label ni = blockDef_.n().x();
label nj = blockDef_.n().y();
label nk = blockDef_.n().z();
// x-direction
label wallLabel = 0;
label wallCellLabel = 0;
// x-min
boundaryPatches_[wallLabel].setSize(nj*nk);
for (label k = 0; k <= nk - 1; k++)
{
for (label j = 0; j <= nj - 1; j++)
{
boundaryPatches_[wallLabel][wallCellLabel].setSize(4);
// set the points
boundaryPatches_[wallLabel][wallCellLabel][0] =
vtxLabel(0, j, k);
boundaryPatches_[wallLabel][wallCellLabel][1] =
vtxLabel(0, j, k + 1);
boundaryPatches_[wallLabel][wallCellLabel][2] =
vtxLabel(0, j + 1, k + 1);
boundaryPatches_[wallLabel][wallCellLabel][3] =
vtxLabel(0, j + 1, k);
// update the counter
wallCellLabel++;
}
}
// x-max
wallLabel++;
wallCellLabel = 0;
boundaryPatches_[wallLabel].setSize(nj*nk);
for (label k = 0; k <= nk - 1; k++)
{
for (label j = 0; j <= nj - 1; j++)
{
boundaryPatches_[wallLabel][wallCellLabel].setSize(4);
// set the points
boundaryPatches_[wallLabel][wallCellLabel][0] =
vtxLabel(ni, j, k);
boundaryPatches_[wallLabel][wallCellLabel][1] =
vtxLabel(ni, j+1, k);
boundaryPatches_[wallLabel][wallCellLabel][2] =
vtxLabel(ni, j+1, k+1);
boundaryPatches_[wallLabel][wallCellLabel][3] =
vtxLabel(ni, j, k+1);
// update the counter
wallCellLabel++;
}
}
// y-direction
// y-min
wallLabel++;
wallCellLabel = 0;
boundaryPatches_[wallLabel].setSize(ni*nk);
for (label i = 0; i <= ni - 1; i++)
{
for (label k = 0; k <= nk - 1; k++)
{
boundaryPatches_[wallLabel][wallCellLabel].setSize(4);
// set the points
boundaryPatches_[wallLabel][wallCellLabel][0] =
vtxLabel(i, 0, k);
boundaryPatches_[wallLabel][wallCellLabel][1] =
vtxLabel(i + 1, 0, k);
boundaryPatches_[wallLabel][wallCellLabel][2] =
vtxLabel(i + 1, 0, k + 1);
boundaryPatches_[wallLabel][wallCellLabel][3] =
vtxLabel(i, 0, k + 1);
// update the counter
wallCellLabel++;
}
}
// y-max
wallLabel++;
wallCellLabel = 0;
boundaryPatches_[wallLabel].setSize(ni*nk);
for (label i = 0; i <= ni - 1; i++)
{
for (label k = 0; k <= nk - 1; k++)
{
boundaryPatches_[wallLabel][wallCellLabel].setSize(4);
// set the points
boundaryPatches_[wallLabel][wallCellLabel][0] =
vtxLabel(i, nj, k);
boundaryPatches_[wallLabel][wallCellLabel][1] =
vtxLabel(i, nj, k + 1);
boundaryPatches_[wallLabel][wallCellLabel][2] =
vtxLabel(i + 1, nj, k + 1);
boundaryPatches_[wallLabel][wallCellLabel][3] =
vtxLabel(i + 1, nj, k);
// update the counter
wallCellLabel++;
}
}
// z-direction
// z-min
wallLabel++;
wallCellLabel = 0;
boundaryPatches_[wallLabel].setSize(ni*nj);
for (label i = 0; i <= ni - 1; i++)
{
for (label j = 0; j <= nj - 1; j++)
{
boundaryPatches_[wallLabel][wallCellLabel].setSize(4);
// set the points
boundaryPatches_[wallLabel][wallCellLabel][0] =
vtxLabel(i, j, 0);
boundaryPatches_[wallLabel][wallCellLabel][1] =
vtxLabel(i, j + 1, 0);
boundaryPatches_[wallLabel][wallCellLabel][2] =
vtxLabel(i + 1, j + 1, 0);
boundaryPatches_[wallLabel][wallCellLabel][3] =
vtxLabel(i + 1, j, 0);
// update the counter
wallCellLabel++;
}
}
// z-max
wallLabel++;
wallCellLabel = 0;
boundaryPatches_[wallLabel].setSize(ni*nj);
for (label i = 0; i <= ni - 1; i++)
{
for (label j = 0; j <= nj - 1; j++)
{
boundaryPatches_[wallLabel][wallCellLabel].setSize(4);
// set the points
boundaryPatches_[wallLabel][wallCellLabel][0] =
vtxLabel(i, j, nk);
boundaryPatches_[wallLabel][wallCellLabel][1] =
vtxLabel(i + 1, j, nk);
boundaryPatches_[wallLabel][wallCellLabel][2] =
vtxLabel(i + 1, j + 1, nk);
boundaryPatches_[wallLabel][wallCellLabel][3] =
vtxLabel(i, j + 1, nk);
// update the counter
wallCellLabel++;
}
}
}
// ************************************************************************* //
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
private member of block. Creates cells for the block.
\*---------------------------------------------------------------------------*/
#include "error.H"
#include "block.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::block::blockCells()
{
label ni = blockDef_.n().x();
label nj = blockDef_.n().y();
label nk = blockDef_.n().z();
label cellNo = 0;
for (label k = 0; k <= nk - 1; k++)
{
for (label j = 0; j <= nj - 1; j++)
{
for (label i = 0; i <= ni - 1; i++)
{
cells_[cellNo].setSize(8);
cells_[cellNo][0] = vtxLabel(i, j, k);
cells_[cellNo][1] = vtxLabel(i+1, j, k);
cells_[cellNo][2] = vtxLabel(i+1, j+1, k);
cells_[cellNo][3] = vtxLabel(i, j+1, k);
cells_[cellNo][4] = vtxLabel(i, j, k+1);
cells_[cellNo][5] = vtxLabel(i+1, j, k+1);
cells_[cellNo][6] = vtxLabel(i+1, j+1, k+1);
cells_[cellNo][7] = vtxLabel(i, j+1, k+1);
cellNo++;
}
}
}
}
// ************************************************************************* //
......@@ -22,32 +22,42 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
private member of block. Creates vertices for cells filling the block.
\*---------------------------------------------------------------------------*/
#include "error.H"
#include "block.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::block::blockPoints()
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)
);
}
void Foam::block::createPoints()
{
// set local variables for mesh specification
const label ni = blockDef_.n().x();
const label nj = blockDef_.n().y();
const label nk = blockDef_.n().z();
const label ni = blockDef_.meshDensity().x();
const label nj = blockDef_.meshDensity().y();
const label nk = blockDef_.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 = blockDef_.points()[blockDef_.blockShape()[0]];
const point p100 = blockDef_.points()[blockDef_.blockShape()[1]];
const point p110 = blockDef_.points()[blockDef_.blockShape()[2]];
const point p010 = blockDef_.points()[blockDef_.blockShape()[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 = blockDef_.points()[blockDef_.blockShape()[4]];
const point p101 = blockDef_.points()[blockDef_