mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
blockMesh: rationalize file names/contents
This commit is contained in:
@ -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();
|
||||
|
||||
27
src/meshing/blockMesh/Make/files
Normal file
27
src/meshing/blockMesh/Make/files
Normal file
@ -0,0 +1,27 @@
|
||||
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 * * * * * * * * * * * //
|
||||
|
||||
|
||||
label block::vtxLabel(label a, label b, label c)
|
||||
{
|
||||
return (a + b*(blockDef_.n().x() + 1)
|
||||
+ c*(blockDef_.n().x() + 1)*(blockDef_.n().y() + 1));
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
// Construct from description
|
||||
block::block(const blockDescriptor& definition)
|
||||
Foam::block::block
|
||||
(
|
||||
const pointField& blockMeshPoints,
|
||||
const curvedEdgeList& edges,
|
||||
Istream& is
|
||||
)
|
||||
:
|
||||
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())
|
||||
),
|
||||
blockDef_(blockMeshPoints, edges, is),
|
||||
vertices_(blockDef_.nPoints()),
|
||||
cells_(blockDef_.nCells()),
|
||||
boundaryPatches_(6)
|
||||
{
|
||||
// create points
|
||||
blockPoints();
|
||||
createPrimitives();
|
||||
}
|
||||
|
||||
// generate internal cells
|
||||
blockCells();
|
||||
|
||||
// generate boundary patches
|
||||
blockBoundary();
|
||||
Foam::block::block(const blockDescriptor& definition)
|
||||
:
|
||||
blockDef_(definition),
|
||||
vertices_(blockDef_.nPoints()),
|
||||
cells_(blockDef_.nCells()),
|
||||
boundaryPatches_(6)
|
||||
{
|
||||
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
|
||||
|
||||
@ -1,209 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,65 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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_.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& p000 = blockDef_.blockPoint(0);
|
||||
const point& p100 = blockDef_.blockPoint(1);
|
||||
const point& p110 = blockDef_.blockPoint(2);
|
||||
const point& p010 = blockDef_.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 = blockDef_.points()[blockDef_.blockShape()[4]];
|
||||
const point p101 = blockDef_.points()[blockDef_.blockShape()[5]];
|
||||
const point p111 = blockDef_.points()[blockDef_.blockShape()[6]];
|
||||
const point p011 = blockDef_.points()[blockDef_.blockShape()[7]];
|
||||
|
||||
// list of edge point and weighting factors
|
||||
const List<List<point> >& p = blockDef_.blockEdgePoints();
|
||||
@ -80,7 +90,8 @@ void Foam::block::blockPoints()
|
||||
vector edgez4 = p010 + (p011 - p010)*w[11][k];
|
||||
|
||||
// calculate the importance factors for all edges
|
||||
// x - direction
|
||||
|
||||
// x-direction
|
||||
scalar impx1 =
|
||||
(
|
||||
(1.0 - w[0][i])*(1.0 - w[4][j])*(1.0 - w[8][k])
|
||||
@ -113,7 +124,7 @@ void Foam::block::blockPoints()
|
||||
impx4 /= magImpx;
|
||||
|
||||
|
||||
// y - direction
|
||||
// y-direction
|
||||
scalar impy1 =
|
||||
(
|
||||
(1.0 - w[4][j])*(1.0 - w[0][i])*(1.0 - w[8][k])
|
||||
@ -145,7 +156,7 @@ void Foam::block::blockPoints()
|
||||
impy4 /= magImpy;
|
||||
|
||||
|
||||
// z - direction
|
||||
// z-direction
|
||||
scalar impz1 =
|
||||
(
|
||||
(1.0 - w[8][k])*(1.0 - w[0][i])*(1.0 - w[4][j])
|
||||
@ -195,19 +206,19 @@ void Foam::block::blockPoints()
|
||||
|
||||
// multiply by the importance factor
|
||||
|
||||
// x - direction
|
||||
// x-direction
|
||||
edgex1 *= impx1;
|
||||
edgex2 *= impx2;
|
||||
edgex3 *= impx3;
|
||||
edgex4 *= impx4;
|
||||
|
||||
// y - direction
|
||||
// y-direction
|
||||
edgey1 *= impy1;
|
||||
edgey2 *= impy2;
|
||||
edgey3 *= impy3;
|
||||
edgey4 *= impy4;
|
||||
|
||||
// z - direction
|
||||
// z-direction
|
||||
edgez1 *= impz1;
|
||||
edgez2 *= impz2;
|
||||
edgez3 *= impz3;
|
||||
@ -229,4 +240,223 @@ void Foam::block::blockPoints()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::block::createCells()
|
||||
{
|
||||
const label ni = blockDef_.meshDensity().x();
|
||||
const label nj = blockDef_.meshDensity().y();
|
||||
const label nk = blockDef_.meshDensity().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++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::block::createBoundary()
|
||||
{
|
||||
const label ni = blockDef_.meshDensity().x();
|
||||
const label nj = blockDef_.meshDensity().y();
|
||||
const label nk = blockDef_.meshDensity().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++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::block::createPrimitives()
|
||||
{
|
||||
// create points
|
||||
createPoints();
|
||||
|
||||
// generate internal cells
|
||||
createCells();
|
||||
|
||||
// generate boundary patches
|
||||
createBoundary();
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -22,13 +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::blockList
|
||||
|
||||
Description
|
||||
|
||||
SourceFiles
|
||||
blockList.C
|
||||
A PtrList of blocks
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
@ -22,63 +22,29 @@ 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 "blockDescriptor.H"
|
||||
#include "scalarList.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
void blockDescriptor::makeBlockEdges()
|
||||
{
|
||||
// for all edges check the list of curved edges. If the edge is curved,
|
||||
// add it to the list. If the edge is not found, create is as a line
|
||||
|
||||
setEdge(0, 0, 1, n_.x());
|
||||
setEdge(1, 3, 2, n_.x());
|
||||
setEdge(2, 7, 6, n_.x());
|
||||
setEdge(3, 4, 5, n_.x());
|
||||
|
||||
setEdge(4, 0, 3, n_.y());
|
||||
setEdge(5, 1, 2, n_.y());
|
||||
setEdge(6, 5, 6, n_.y());
|
||||
setEdge(7, 4, 7, n_.y());
|
||||
|
||||
setEdge(8, 0, 4, n_.z());
|
||||
setEdge(9, 1, 5, n_.z());
|
||||
setEdge(10, 2, 6, n_.z());
|
||||
setEdge(11, 3, 7, n_.z());
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
// from components
|
||||
blockDescriptor::blockDescriptor
|
||||
Foam::blockDescriptor::blockDescriptor
|
||||
(
|
||||
const cellShape& bshape,
|
||||
const pointField& blockMeshPoints,
|
||||
const curvedEdgeList& edges,
|
||||
const Vector<label>& n,
|
||||
const scalarList& expand,
|
||||
const Vector<label>& meshDensity,
|
||||
const UList<scalar>& expand,
|
||||
const word& zoneName
|
||||
)
|
||||
:
|
||||
blockMeshPoints_(blockMeshPoints),
|
||||
blockShape_(bshape),
|
||||
curvedEdges_(edges),
|
||||
blockShape_(bshape),
|
||||
meshDensity_(meshDensity),
|
||||
edgePoints_(12),
|
||||
edgeWeights_(12),
|
||||
n_(n),
|
||||
expand_(expand),
|
||||
zoneName_(zoneName)
|
||||
{
|
||||
@ -87,19 +53,19 @@ blockDescriptor::blockDescriptor
|
||||
FatalErrorIn
|
||||
(
|
||||
"blockDescriptor::blockDescriptor"
|
||||
"(const cellShape& bshape, const pointField& blockMeshPoints, "
|
||||
"const curvedEdgeList& edges, label xnum, label ynum, label znum, "
|
||||
"(const cellShape&, const pointField& blockMeshPoints, "
|
||||
"const curvedEdgeList&, const Vector<label>& meshDensity, "
|
||||
"const scalarList& expand, const word& zoneName)"
|
||||
) << "Unknown definition of expansion ratios"
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
// create a list of edges
|
||||
makeBlockEdges();
|
||||
}
|
||||
|
||||
|
||||
// from Istream
|
||||
blockDescriptor::blockDescriptor
|
||||
Foam::blockDescriptor::blockDescriptor
|
||||
(
|
||||
const pointField& blockMeshPoints,
|
||||
const curvedEdgeList& edges,
|
||||
@ -107,43 +73,40 @@ blockDescriptor::blockDescriptor
|
||||
)
|
||||
:
|
||||
blockMeshPoints_(blockMeshPoints),
|
||||
blockShape_(is),
|
||||
curvedEdges_(edges),
|
||||
blockShape_(is),
|
||||
meshDensity_(),
|
||||
edgePoints_(12),
|
||||
edgeWeights_(12),
|
||||
n_(),
|
||||
expand_(12),
|
||||
zoneName_()
|
||||
{
|
||||
// Look at first token
|
||||
// Examine next token
|
||||
token t(is);
|
||||
is.putBack(t);
|
||||
|
||||
// Optional zone name
|
||||
if (t.isWord())
|
||||
{
|
||||
zoneName_ = t.wordToken();
|
||||
|
||||
// Consume zoneName token
|
||||
// Get the next token
|
||||
is >> t;
|
||||
|
||||
// New look-ahead
|
||||
is >> t;
|
||||
is.putBack(t);
|
||||
}
|
||||
is.putBack(t);
|
||||
|
||||
if (t.isPunctuation())
|
||||
{
|
||||
// new-style: read a list of 3 values
|
||||
if (t.pToken() == token::BEGIN_LIST)
|
||||
{
|
||||
is >> n_;
|
||||
is >> meshDensity_;
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalIOErrorIn
|
||||
(
|
||||
"blockDescriptor::blockDescriptor"
|
||||
"(const pointField&, const curvedEdgeList&, Istream& is)",
|
||||
"(const pointField&, const curvedEdgeList&, Istream&)",
|
||||
is
|
||||
) << "incorrect token while reading n, expected '(', found "
|
||||
<< t.info()
|
||||
@ -152,7 +115,10 @@ blockDescriptor::blockDescriptor
|
||||
}
|
||||
else
|
||||
{
|
||||
is >> n_.x() >> n_.y() >> n_.z();
|
||||
// old-style: read three labels
|
||||
is >> meshDensity_.x()
|
||||
>> meshDensity_.y()
|
||||
>> meshDensity_.z();
|
||||
}
|
||||
|
||||
is >> t;
|
||||
@ -165,18 +131,21 @@ blockDescriptor::blockDescriptor
|
||||
|
||||
if (expRatios.size() == 3)
|
||||
{
|
||||
expand_[0] = expRatios[0];
|
||||
expand_[1] = expRatios[0];
|
||||
expand_[2] = expRatios[0];
|
||||
expand_[3] = expRatios[0];
|
||||
// x-direction
|
||||
expand_[0] = expRatios[0];
|
||||
expand_[1] = expRatios[0];
|
||||
expand_[2] = expRatios[0];
|
||||
expand_[3] = expRatios[0];
|
||||
|
||||
expand_[4] = expRatios[1];
|
||||
expand_[5] = expRatios[1];
|
||||
expand_[6] = expRatios[1];
|
||||
expand_[7] = expRatios[1];
|
||||
// y-direction
|
||||
expand_[4] = expRatios[1];
|
||||
expand_[5] = expRatios[1];
|
||||
expand_[6] = expRatios[1];
|
||||
expand_[7] = expRatios[1];
|
||||
|
||||
expand_[8] = expRatios[2];
|
||||
expand_[9] = expRatios[2];
|
||||
// z-direction
|
||||
expand_[8] = expRatios[2];
|
||||
expand_[9] = expRatios[2];
|
||||
expand_[10] = expRatios[2];
|
||||
expand_[11] = expRatios[2];
|
||||
}
|
||||
@ -189,8 +158,7 @@ blockDescriptor::blockDescriptor
|
||||
FatalErrorIn
|
||||
(
|
||||
"blockDescriptor::blockDescriptor"
|
||||
"(const pointField& blockMeshPoints, const curvedEdgeList& edges,"
|
||||
"Istream& is)"
|
||||
"(const pointField&, const curvedEdgeList&, Istream&)"
|
||||
) << "Unknown definition of expansion ratios"
|
||||
<< exit(FatalError);
|
||||
}
|
||||
@ -202,47 +170,144 @@ blockDescriptor::blockDescriptor
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
const pointField& blockDescriptor::points() const
|
||||
const Foam::pointField& Foam::blockDescriptor::blockPointField() const
|
||||
{
|
||||
return blockMeshPoints_;
|
||||
}
|
||||
|
||||
const cellShape& blockDescriptor::blockShape() const
|
||||
|
||||
const Foam::cellShape& Foam::blockDescriptor::blockShape() const
|
||||
{
|
||||
return blockShape_;
|
||||
}
|
||||
|
||||
const List<List<point> >& blockDescriptor::blockEdgePoints() const
|
||||
|
||||
const Foam::List< Foam::List< Foam::point > >&
|
||||
Foam::blockDescriptor::blockEdgePoints() const
|
||||
{
|
||||
return edgePoints_;
|
||||
}
|
||||
|
||||
const scalarListList& blockDescriptor::blockEdgeWeights() const
|
||||
|
||||
const Foam::scalarListList& Foam::blockDescriptor::blockEdgeWeights() const
|
||||
{
|
||||
return edgeWeights_;
|
||||
}
|
||||
|
||||
const Vector<label>& blockDescriptor::n() const
|
||||
|
||||
const Foam::Vector<Foam::label>& Foam::blockDescriptor::meshDensity() const
|
||||
{
|
||||
return n_;
|
||||
return meshDensity_;
|
||||
}
|
||||
|
||||
const word& blockDescriptor::zoneName() const
|
||||
|
||||
const Foam::word& Foam::blockDescriptor::zoneName() const
|
||||
{
|
||||
return zoneName_;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||
|
||||
void blockDescriptor::operator=(const blockDescriptor&)
|
||||
Foam::label Foam::blockDescriptor::nPoints() const
|
||||
{
|
||||
notImplemented("void blockDescriptor::operator=(const blockDescriptor&)");
|
||||
return
|
||||
(
|
||||
(meshDensity_.x() + 1)
|
||||
* (meshDensity_.y() + 1)
|
||||
* (meshDensity_.z() + 1)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
Foam::label Foam::blockDescriptor::nCells() const
|
||||
{
|
||||
return
|
||||
(
|
||||
meshDensity_.x()
|
||||
* meshDensity_.y()
|
||||
* meshDensity_.z()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
const Foam::point& Foam::blockDescriptor::blockPoint(const label i) const
|
||||
{
|
||||
return blockMeshPoints_[blockShape_[i]];
|
||||
}
|
||||
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::Ostream& Foam::operator<<(Ostream& os, const blockDescriptor& bd)
|
||||
{
|
||||
const cellShape& bshape = bd.blockShape();
|
||||
const labelList& blockLabels = bshape;
|
||||
|
||||
os << bshape.model().name() << " (";
|
||||
|
||||
forAll(blockLabels, labelI)
|
||||
{
|
||||
if (labelI)
|
||||
{
|
||||
os << ' ';
|
||||
}
|
||||
os << blockLabels[labelI];
|
||||
}
|
||||
os << ')';
|
||||
|
||||
if (bd.zoneName().size())
|
||||
{
|
||||
os << ' ' << bd.zoneName();
|
||||
}
|
||||
|
||||
os << ' ' << bd.meshDensity()
|
||||
<< " simpleGrading (";
|
||||
|
||||
|
||||
const scalarList& expand = bd.expand_;
|
||||
|
||||
// can we use a compact notation?
|
||||
if
|
||||
(
|
||||
// x-direction
|
||||
(
|
||||
expand[0] == expand[1]
|
||||
&& expand[0] == expand[2]
|
||||
&& expand[0] == expand[3]
|
||||
)
|
||||
&& // y-direction
|
||||
(
|
||||
expand[4] == expand[5]
|
||||
&& expand[4] == expand[6]
|
||||
&& expand[4] == expand[7]
|
||||
)
|
||||
&& // z-direction
|
||||
(
|
||||
expand[8] == expand[9]
|
||||
&& expand[8] == expand[10]
|
||||
&& expand[8] == expand[11]
|
||||
)
|
||||
)
|
||||
{
|
||||
os << expand[0] << ' ' << expand[4] << ' ' << expand[8];
|
||||
}
|
||||
else
|
||||
{
|
||||
forAll(expand, edgeI)
|
||||
{
|
||||
if (edgeI)
|
||||
{
|
||||
os << ' ';
|
||||
}
|
||||
os << expand[edgeI];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
os << ")";
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -26,20 +26,18 @@ Class
|
||||
Foam::blockDescriptor
|
||||
|
||||
Description
|
||||
block descriptor. Takes the description of the block and the list
|
||||
of curved edges and creates a list of points on edges together
|
||||
with the weighting factors
|
||||
Takes the description of the block and the list of curved edges and
|
||||
creates a list of points on edges together with the weighting factors
|
||||
|
||||
SourceFiles
|
||||
blockDescriptor.C
|
||||
blockDescriptorEdges.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef blockDescriptor_H
|
||||
#define blockDescriptor_H
|
||||
|
||||
#include "scalar.H"
|
||||
#include "label.H"
|
||||
#include "point.H"
|
||||
#include "cellShape.H"
|
||||
#include "scalarList.H"
|
||||
@ -54,42 +52,50 @@ class Istream;
|
||||
class Ostream;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class blockDescriptor Declaration
|
||||
Class blockDescriptor Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class blockDescriptor
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Block mesh points
|
||||
//- Reference to point field defining the block mesh
|
||||
const pointField& blockMeshPoints_;
|
||||
|
||||
//- block shape
|
||||
cellShape blockShape_;
|
||||
|
||||
// reference to a list of curved edges
|
||||
//- Reference to a list of curved edges
|
||||
const curvedEdgeList& curvedEdges_;
|
||||
|
||||
// block edge points
|
||||
List<List<point> > edgePoints_;
|
||||
//- Block shape
|
||||
cellShape blockShape_;
|
||||
|
||||
//- block edge weighting factors
|
||||
//- The number of cells in the i,j,k directions
|
||||
Vector<label> meshDensity_;
|
||||
|
||||
//- Block edge points
|
||||
List< List<point> > edgePoints_;
|
||||
|
||||
//- Block edge weighting factors
|
||||
scalarListList edgeWeights_;
|
||||
|
||||
//- number of point in each direction
|
||||
Vector<label> n_;
|
||||
|
||||
//- expansion ratios in all directions
|
||||
//- Expansion ratios in all directions
|
||||
scalarList expand_;
|
||||
|
||||
//- name of the zone (empty string if none)
|
||||
//- Name of the zone (empty string if none)
|
||||
word zoneName_;
|
||||
|
||||
// Private member functions
|
||||
// Private Member Functions
|
||||
|
||||
//- Set the points/weights for all edges
|
||||
void makeBlockEdges();
|
||||
|
||||
void setEdge(label edge, label start, label end, label dim);
|
||||
//- Set the edge points/weights
|
||||
void setEdge(label edgeI, label start, label end, label dim);
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const blockDescriptor&);
|
||||
|
||||
|
||||
public:
|
||||
@ -101,9 +107,9 @@ public:
|
||||
(
|
||||
const cellShape&,
|
||||
const pointField& blockMeshPoints,
|
||||
const curvedEdgeList& edges,
|
||||
const Vector<label>& n,
|
||||
const scalarList& expand,
|
||||
const curvedEdgeList&,
|
||||
const Vector<label>& meshDensity,
|
||||
const UList<scalar>& expand,
|
||||
const word& zoneName = ""
|
||||
);
|
||||
|
||||
@ -111,8 +117,8 @@ public:
|
||||
blockDescriptor
|
||||
(
|
||||
const pointField& blockMeshPoints,
|
||||
const curvedEdgeList& edges,
|
||||
Istream& is
|
||||
const curvedEdgeList&,
|
||||
Istream&
|
||||
);
|
||||
|
||||
//- Clone
|
||||
@ -127,21 +133,33 @@ public:
|
||||
|
||||
// Access
|
||||
|
||||
const pointField& points() const;
|
||||
//- Reference to point field defining the block mesh
|
||||
const pointField& blockPointField() const;
|
||||
|
||||
//- Return the block shape
|
||||
const cellShape& blockShape() const;
|
||||
|
||||
const List<List<point> >& blockEdgePoints() const;
|
||||
//- Return the block points along each edge
|
||||
const List< List<point> >& blockEdgePoints() const;
|
||||
|
||||
//- Return the weightings along each edge
|
||||
const scalarListList& blockEdgeWeights() const;
|
||||
|
||||
const Vector<label>& n() const;
|
||||
//- Return the mesh density (number of cells) in the i,j,k directions
|
||||
const Vector<label>& meshDensity() const;
|
||||
|
||||
//- Return the (optional) zone name
|
||||
const word& zoneName() const;
|
||||
|
||||
// Member Operators
|
||||
|
||||
void operator=(const blockDescriptor&);
|
||||
//- Return the number of points
|
||||
label nPoints() const;
|
||||
|
||||
//- Return the number of cells
|
||||
label nCells() const;
|
||||
|
||||
//- Return block point at local label i
|
||||
const point& blockPoint(const label i) const;
|
||||
|
||||
|
||||
// IOstream Operators
|
||||
@ -150,13 +168,6 @@ public:
|
||||
};
|
||||
|
||||
|
||||
inline Istream& operator>>(Istream& is, blockDescriptor*)
|
||||
{
|
||||
notImplemented("Istream& operator>>(Istream& is, blockDescriptor*)");
|
||||
return is;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
@ -22,15 +22,9 @@ License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Description
|
||||
from the list of curved edges creates a list
|
||||
of edges that are not curved. It is assumed
|
||||
that all other edges are straight lines
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "error.H"
|
||||
|
||||
#include "blockDescriptor.H"
|
||||
#include "lineEdge.H"
|
||||
#include "lineDivide.H"
|
||||
@ -39,68 +33,91 @@ Description
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
scalar calcGexp(const scalar expRatio, const label dim)
|
||||
{
|
||||
if (dim == 1)
|
||||
//! @cond fileScope
|
||||
// Calculate the geometric expension factor from the expansion ratio
|
||||
inline scalar calcGexp(const scalar expRatio, const label dim)
|
||||
{
|
||||
return 0.0;
|
||||
return dim > 1 ? pow(expRatio, 1.0/(dim - 1)) : 0.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return pow(expRatio, 1.0/(dim - 1));
|
||||
}
|
||||
}
|
||||
//! @endcond fileScope
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
void blockDescriptor::setEdge(label edgeI, label start, label end, label dim)
|
||||
void Foam::blockDescriptor::makeBlockEdges()
|
||||
{
|
||||
// for all edges check the list of curved edges. If the edge is curved,
|
||||
// add it to the list. If the edge is not found, create is as a line
|
||||
const label ni = meshDensity_.x();
|
||||
const label nj = meshDensity_.y();
|
||||
const label nk = meshDensity_.z();
|
||||
|
||||
bool found = false;
|
||||
// these edges correspond to the "hex" cellModel
|
||||
|
||||
// x-direction
|
||||
setEdge(0, 0, 1, ni);
|
||||
setEdge(1, 3, 2, ni);
|
||||
setEdge(2, 7, 6, ni);
|
||||
setEdge(3, 4, 5, ni);
|
||||
|
||||
// y-direction
|
||||
setEdge(4, 0, 3, nj);
|
||||
setEdge(5, 1, 2, nj);
|
||||
setEdge(6, 5, 6, nj);
|
||||
setEdge(7, 4, 7, nj);
|
||||
|
||||
// z-direction
|
||||
setEdge(8, 0, 4, nk);
|
||||
setEdge(9, 1, 5, nk);
|
||||
setEdge(10, 2, 6, nk);
|
||||
setEdge(11, 3, 7, nk);
|
||||
}
|
||||
|
||||
|
||||
void Foam::blockDescriptor::setEdge
|
||||
(
|
||||
label edgeI,
|
||||
label start,
|
||||
label end,
|
||||
label dim
|
||||
)
|
||||
{
|
||||
// set reference to the list of labels defining the block
|
||||
const labelList& blockLabels = blockShape_;
|
||||
|
||||
// set reference to global list of points
|
||||
const pointField blockPoints = blockShape_.points(blockMeshPoints_);
|
||||
|
||||
// x1
|
||||
found = false;
|
||||
// Set the edge points/weights
|
||||
// The edge is a straight-line if it is not in the list of curvedEdges
|
||||
|
||||
forAll (curvedEdges_, nCEI)
|
||||
// calc geometric expension factor from the expansion ratio
|
||||
const scalar gExp = calcGexp(expand_[edgeI], dim);
|
||||
|
||||
forAll(curvedEdges_, cedgeI)
|
||||
{
|
||||
if (curvedEdges_[nCEI].compare(blockLabels[start], blockLabels[end]))
|
||||
{
|
||||
found = true;
|
||||
const curvedEdge& cedge = curvedEdges_[cedgeI];
|
||||
|
||||
// check the orientation:
|
||||
// if the starting point of the curve is the same as the starting
|
||||
// point of the edge, do the parametrisation and pick up the points
|
||||
if (blockLabels[start] == curvedEdges_[nCEI].start())
|
||||
int cmp = cedge.compare(blockLabels[start], blockLabels[end]);
|
||||
|
||||
if (cmp)
|
||||
{
|
||||
if (cmp > 0)
|
||||
{
|
||||
// calculate the geometric expension factor out of the
|
||||
// expansion ratio
|
||||
scalar gExp = calcGexp(expand_[edgeI], dim);
|
||||
// curve has the same orientation
|
||||
|
||||
// divide the line
|
||||
lineDivide divEdge(curvedEdges_[nCEI], dim, gExp);
|
||||
lineDivide divEdge(cedge, dim, gExp);
|
||||
|
||||
edgePoints_[edgeI] = divEdge.points();
|
||||
edgePoints_[edgeI] = divEdge.points();
|
||||
edgeWeights_[edgeI] = divEdge.lambdaDivisions();
|
||||
}
|
||||
else
|
||||
{
|
||||
// the curve has got the opposite orientation
|
||||
scalar gExp = calcGexp(expand_[edgeI], dim);
|
||||
// curve has the opposite orientation
|
||||
|
||||
// divide the line
|
||||
lineDivide divEdge(curvedEdges_[nCEI], dim, 1.0/(gExp+SMALL));
|
||||
lineDivide divEdge(cedge, dim, 1.0/(gExp+SMALL));
|
||||
|
||||
pointField p = divEdge.points();
|
||||
scalarList d = divEdge.lambdaDivisions();
|
||||
@ -109,38 +126,32 @@ void blockDescriptor::setEdge(label edgeI, label start, label end, label dim)
|
||||
edgeWeights_[edgeI].setSize(d.size());
|
||||
|
||||
label pMax = p.size() - 1;
|
||||
forAll (p, pI)
|
||||
forAll(p, pI)
|
||||
{
|
||||
edgePoints_[edgeI][pI] = p[pMax - pI];
|
||||
edgePoints_[edgeI][pI] = p[pMax - pI];
|
||||
edgeWeights_[edgeI][pI] = 1.0 - d[pMax - pI];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
// found curved-edge: done
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found)
|
||||
{
|
||||
// edge is a straight line
|
||||
scalar gExp = calcGexp(expand_[edgeI], dim);
|
||||
|
||||
// divide the line
|
||||
lineDivide divEdge
|
||||
(
|
||||
lineEdge(blockPoints, start, end),
|
||||
dim,
|
||||
gExp
|
||||
);
|
||||
// not found: divide the edge as a straight line
|
||||
|
||||
edgePoints_[edgeI] = divEdge.points();
|
||||
edgeWeights_[edgeI] = divEdge.lambdaDivisions();
|
||||
}
|
||||
lineDivide divEdge
|
||||
(
|
||||
lineEdge(blockPoints, start, end),
|
||||
dim,
|
||||
gExp
|
||||
);
|
||||
|
||||
edgePoints_[edgeI] = divEdge.points();
|
||||
edgeWeights_[edgeI] = divEdge.lambdaDivisions();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -22,12 +22,6 @@ License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Application
|
||||
blockMesh
|
||||
|
||||
Description
|
||||
Mesh generator
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "blockMesh.H"
|
||||
@ -35,7 +29,6 @@ Description
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
// Construct from IOdictionary
|
||||
Foam::blockMesh::blockMesh(IOdictionary& meshDescription)
|
||||
:
|
||||
topologyPtr_(createTopology(meshDescription)),
|
||||
@ -75,7 +68,7 @@ Foam::wordList Foam::blockMesh::patchNames() const
|
||||
const polyPatchList& patchTopologies = topology().boundaryMesh();
|
||||
wordList names(patchTopologies.size());
|
||||
|
||||
forAll (names, patchI)
|
||||
forAll(names, patchI)
|
||||
{
|
||||
names[patchI] = patchTopologies[patchI].name();
|
||||
}
|
||||
@ -89,7 +82,7 @@ Foam::wordList Foam::blockMesh::patchTypes() const
|
||||
const polyPatchList& patchTopologies = topology().boundaryMesh();
|
||||
wordList types(patchTopologies.size());
|
||||
|
||||
forAll (types, patchI)
|
||||
forAll(types, patchI)
|
||||
{
|
||||
types[patchI] = patchTopologies[patchI].type();
|
||||
}
|
||||
@ -103,7 +96,7 @@ Foam::wordList Foam::blockMesh::patchPhysicalTypes() const
|
||||
const polyPatchList& patchTopologies = topology().boundaryMesh();
|
||||
wordList physicalTypes(patchTopologies.size());
|
||||
|
||||
forAll (physicalTypes, patchI)
|
||||
forAll(physicalTypes, patchI)
|
||||
{
|
||||
physicalTypes[patchI] = patchTopologies[patchI].physicalType();
|
||||
}
|
||||
|
||||
@ -29,6 +29,13 @@ Description
|
||||
|
||||
SourceFiles
|
||||
blockMesh.C
|
||||
blockMeshCells.C
|
||||
blockMeshCheck.C
|
||||
blockMeshMergeList.C
|
||||
blockMeshOffsets.C
|
||||
blockMeshPatches.C
|
||||
blockMeshPoints.C
|
||||
blockMeshTopology.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -77,26 +84,26 @@ class blockMesh
|
||||
const label blockLabel,
|
||||
const pointField& points,
|
||||
const cellShape& blockShape
|
||||
);
|
||||
) const;
|
||||
|
||||
bool patchLabelsOK
|
||||
(
|
||||
const label patchLabel,
|
||||
const pointField& points,
|
||||
const faceList& patchShapes
|
||||
);
|
||||
) const;
|
||||
|
||||
polyMesh* createTopology(IOdictionary&);
|
||||
void checkBlockMesh(const polyMesh&);
|
||||
void checkBlockMesh(const polyMesh&) const;
|
||||
|
||||
labelList createBlockOffsets();
|
||||
labelList createMergeList();
|
||||
|
||||
pointField createPoints(const dictionary&);
|
||||
cellShapeList createCells();
|
||||
pointField createPoints(const dictionary&) const;
|
||||
cellShapeList createCells() const;
|
||||
|
||||
faceList createPatchFaces(const polyPatch& patchTopologyFaces);
|
||||
faceListList createPatches();
|
||||
faceList createPatchFaces(const polyPatch& patchTopologyFaces) const;
|
||||
faceListList createPatches() const;
|
||||
|
||||
//- as copy (not implemented)
|
||||
blockMesh(const blockMesh&);
|
||||
|
||||
@ -25,43 +25,42 @@ License
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "error.H"
|
||||
|
||||
#include "blockMesh.H"
|
||||
#include "cellModeller.H"
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
Foam::cellShapeList Foam::blockMesh::createCells()
|
||||
Foam::cellShapeList Foam::blockMesh::createCells() const
|
||||
{
|
||||
Info<< nl << "Creating cells" << endl;
|
||||
Info<< "Creating cells" << endl;
|
||||
|
||||
PtrList<cellShape> cells(nCells_);
|
||||
|
||||
blockMesh& blocks = *this;
|
||||
const blockMesh& blocks = *this;
|
||||
|
||||
const cellModel& hex = *(cellModeller::lookup("hex"));
|
||||
|
||||
label cellLabel = 0;
|
||||
|
||||
forAll(blocks, blockLabel)
|
||||
forAll(blocks, blockI)
|
||||
{
|
||||
const labelListList& blockCells = blocks[blockLabel].cells();
|
||||
const labelListList& blockCells = blocks[blockI].cells();
|
||||
|
||||
forAll(blockCells, blockCellLabel)
|
||||
forAll(blockCells, blockCellI)
|
||||
{
|
||||
labelList cellPoints(blockCells[blockCellLabel].size());
|
||||
labelList cellPoints(blockCells[blockCellI].size());
|
||||
|
||||
forAll(cellPoints, cellPointLabel)
|
||||
forAll(cellPoints, cellPointI)
|
||||
{
|
||||
cellPoints[cellPointLabel] =
|
||||
cellPoints[cellPointI] =
|
||||
mergeList_
|
||||
[
|
||||
blockCells[blockCellLabel][cellPointLabel]
|
||||
+ blockOffsets_[blockLabel]
|
||||
blockCells[blockCellI][cellPointI]
|
||||
+ blockOffsets_[blockI]
|
||||
];
|
||||
}
|
||||
|
||||
// Construct collapsed cell and all to list
|
||||
// Construct collapsed cell and add to list
|
||||
cells.set(cellLabel, new cellShape(hex, cellPoints, true));
|
||||
|
||||
cellLabel++;
|
||||
@ -22,8 +22,6 @@ 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 "blockMesh.H"
|
||||
@ -31,18 +29,18 @@ Description
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
// Check the blockMesh topology
|
||||
void Foam::blockMesh::checkBlockMesh(const polyMesh& bm)
|
||||
void Foam::blockMesh::checkBlockMesh(const polyMesh& bm) const
|
||||
{
|
||||
Info<< nl << "Check block mesh topology" << endl;
|
||||
Info<< nl << "Check blockMesh topology" << endl;
|
||||
|
||||
bool blockMeshOK = true;
|
||||
bool ok = true;
|
||||
|
||||
const pointField& points = bm.points();
|
||||
const faceList& faces = bm.faces();
|
||||
const cellList& cells = bm.cells();
|
||||
const polyPatchList& patches = bm.boundaryMesh();
|
||||
|
||||
label nBoundaryFaces=0;
|
||||
label nBoundaryFaces = 0;
|
||||
forAll(cells, celli)
|
||||
{
|
||||
nBoundaryFaces += cells[celli].nFaces();
|
||||
@ -50,7 +48,7 @@ void Foam::blockMesh::checkBlockMesh(const polyMesh& bm)
|
||||
|
||||
nBoundaryFaces -= 2*bm.nInternalFaces();
|
||||
|
||||
label nDefinedBoundaryFaces=0;
|
||||
label nDefinedBoundaryFaces = 0;
|
||||
forAll(patches, patchi)
|
||||
{
|
||||
nDefinedBoundaryFaces += patches[patchi].size();
|
||||
@ -115,7 +113,7 @@ void Foam::blockMesh::checkBlockMesh(const polyMesh& bm)
|
||||
<< " points inwards"
|
||||
<< endl;
|
||||
|
||||
blockMeshOK = false;
|
||||
ok = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -129,12 +127,14 @@ void Foam::blockMesh::checkBlockMesh(const polyMesh& bm)
|
||||
<< " (" << patches[patchi].name() << ")"
|
||||
<< " does not match any block faces" << endl;
|
||||
|
||||
blockMeshOK = false;
|
||||
ok = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!blockMeshOK)
|
||||
Info<< endl;
|
||||
|
||||
if (!ok)
|
||||
{
|
||||
FatalErrorIn("blockMesh::checkBlockMesh(const polyMesh& bm)")
|
||||
<< "Block mesh topology incorrect, stopping mesh generation!"
|
||||
@ -142,4 +142,91 @@ void Foam::blockMesh::checkBlockMesh(const polyMesh& bm)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool Foam::blockMesh::blockLabelsOK
|
||||
(
|
||||
const label blockLabel,
|
||||
const pointField& points,
|
||||
const cellShape& blockShape
|
||||
) const
|
||||
{
|
||||
bool ok = true;
|
||||
|
||||
forAll(blockShape, blockI)
|
||||
{
|
||||
if (blockShape[blockI] < 0)
|
||||
{
|
||||
ok = false;
|
||||
|
||||
WarningIn
|
||||
(
|
||||
"bool Foam::blockMesh::blockLabelsOK(...)"
|
||||
) << "out-of-range point label " << blockShape[blockI]
|
||||
<< " (min = 0"
|
||||
<< ") in block " << blockLabel << endl;
|
||||
}
|
||||
else if (blockShape[blockI] >= points.size())
|
||||
{
|
||||
ok = false;
|
||||
|
||||
WarningIn
|
||||
(
|
||||
"bool Foam::blockMesh::blockLabelsOK(...)"
|
||||
) << "out-of-range point label " << blockShape[blockI]
|
||||
<< " (max = " << points.size() - 1
|
||||
<< ") in block " << blockLabel << endl;
|
||||
}
|
||||
}
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::blockMesh::patchLabelsOK
|
||||
(
|
||||
const label patchLabel,
|
||||
const pointField& points,
|
||||
const faceList& patchFaces
|
||||
) const
|
||||
{
|
||||
bool ok = true;
|
||||
|
||||
forAll(patchFaces, faceI)
|
||||
{
|
||||
const labelList& f = patchFaces[faceI];
|
||||
|
||||
forAll(f, fp)
|
||||
{
|
||||
if (f[fp] < 0)
|
||||
{
|
||||
ok = false;
|
||||
|
||||
WarningIn
|
||||
(
|
||||
"bool Foam::blockMesh::patchLabelsOK(...)"
|
||||
) << "out-of-range point label " << f[fp]
|
||||
<< " (min = 0"
|
||||
<< ") on patch " << patchLabel
|
||||
<< ", face " << faceI << endl;
|
||||
}
|
||||
else if (f[fp] >= points.size())
|
||||
{
|
||||
ok = false;
|
||||
|
||||
WarningIn
|
||||
(
|
||||
"bool Foam::blockMesh::patchLabelsOK(...)"
|
||||
) << "out-of-range point label " << f[fp]
|
||||
<< " (max = " << points.size() - 1
|
||||
<< ") on patch " << patchLabel
|
||||
<< ", face " << faceI << endl;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -30,11 +30,11 @@ License
|
||||
|
||||
Foam::labelList Foam::blockMesh::createMergeList()
|
||||
{
|
||||
Info<< nl << "Creating merge list " << flush;
|
||||
Info<< "Creating merge list " << flush;
|
||||
|
||||
labelList MergeList(nPoints_, -1);
|
||||
|
||||
blockMesh& blocks = *this;
|
||||
const blockMesh& blocks = *this;
|
||||
|
||||
const pointField& blockPoints = topology().points();
|
||||
const cellList& blockCells = topology().cells();
|
||||
@ -386,7 +386,7 @@ Foam::labelList Foam::blockMesh::createMergeList()
|
||||
}
|
||||
}
|
||||
}
|
||||
Info << "." << flush;
|
||||
Info<< "." << flush;
|
||||
|
||||
if (nPasses > 100)
|
||||
{
|
||||
@ -396,7 +396,7 @@ Foam::labelList Foam::blockMesh::createMergeList()
|
||||
}
|
||||
}
|
||||
while (changedPointMerge);
|
||||
Info << endl;
|
||||
Info<< endl;
|
||||
|
||||
forAll(blockInternalFaces, blockFaceLabel)
|
||||
{
|
||||
@ -22,8 +22,6 @@ 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"
|
||||
@ -33,25 +31,24 @@ Description
|
||||
|
||||
Foam::labelList Foam::blockMesh::createBlockOffsets()
|
||||
{
|
||||
Info<< nl << "Creating block offsets" << endl;
|
||||
Info<< "Creating block offsets" << endl;
|
||||
|
||||
blockMesh& blocks = *this;
|
||||
|
||||
nPoints_ = blocks[0].points().size();
|
||||
nCells_ = blocks[0].cells().size();
|
||||
const blockMesh& blocks = *this;
|
||||
|
||||
labelList BlockOffsets(blocks.size());
|
||||
|
||||
BlockOffsets[0] = 0;
|
||||
nPoints_ = blocks[0].points().size();
|
||||
nCells_ = blocks[0].cells().size();
|
||||
|
||||
label blockLabel;
|
||||
for (blockLabel=1; blockLabel<blocks.size(); blockLabel++)
|
||||
for (label blockI=1; blockI < blocks.size(); blockI++)
|
||||
{
|
||||
nPoints_ += blocks[blockLabel].points().size();
|
||||
nCells_ += blocks[blockLabel].cells().size();
|
||||
BlockOffsets[blockI]
|
||||
= BlockOffsets[blockI-1]
|
||||
+ blocks[blockI-1].points().size();
|
||||
|
||||
BlockOffsets[blockLabel]
|
||||
= BlockOffsets[blockLabel-1]
|
||||
+ blocks[blockLabel-1].points().size();
|
||||
nPoints_ += blocks[blockI].points().size();
|
||||
nCells_ += blocks[blockI].cells().size();
|
||||
}
|
||||
|
||||
return BlockOffsets;
|
||||
@ -22,9 +22,6 @@ 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 "blockMesh.H"
|
||||
@ -34,9 +31,9 @@ Description
|
||||
Foam::faceList Foam::blockMesh::createPatchFaces
|
||||
(
|
||||
const polyPatch& patchTopologyFaces
|
||||
)
|
||||
) const
|
||||
{
|
||||
blockMesh& blocks = *this;
|
||||
const blockMesh& blocks = *this;
|
||||
|
||||
labelList blockLabels = patchTopologyFaces.polyPatch::faceCells();
|
||||
|
||||
@ -152,9 +149,9 @@ Foam::faceList Foam::blockMesh::createPatchFaces
|
||||
}
|
||||
|
||||
|
||||
Foam::faceListList Foam::blockMesh::createPatches()
|
||||
Foam::faceListList Foam::blockMesh::createPatches() const
|
||||
{
|
||||
Info<< "\nCreating patches\n";
|
||||
Info<< "Creating patches" << endl;
|
||||
|
||||
const polyPatchList& patchTopologies = topology().boundaryMesh();
|
||||
faceListList patches(patchTopologies.size());
|
||||
@ -22,9 +22,6 @@ 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"
|
||||
@ -32,9 +29,9 @@ Description
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
Foam::pointField Foam::blockMesh::createPoints(const dictionary& dict)
|
||||
Foam::pointField Foam::blockMesh::createPoints(const dictionary& dict) const
|
||||
{
|
||||
blockMesh& blocks = *this;
|
||||
const blockMesh& blocks = *this;
|
||||
|
||||
scalar scaleFactor = 1.0;
|
||||
|
||||
@ -44,13 +41,13 @@ Foam::pointField Foam::blockMesh::createPoints(const dictionary& dict)
|
||||
dict.readIfPresent("scale", scaleFactor);
|
||||
}
|
||||
|
||||
Info<< nl << "Creating points with scale " << scaleFactor << endl;
|
||||
Info<< "Creating points with scale " << scaleFactor << endl;
|
||||
|
||||
pointField points(nPoints_);
|
||||
|
||||
forAll(blocks, blockLabel)
|
||||
forAll(blocks, blockI)
|
||||
{
|
||||
const pointField& blockPoints = blocks[blockLabel].points();
|
||||
const pointField& blockPoints = blocks[blockI].points();
|
||||
|
||||
forAll(blockPoints, blockPointLabel)
|
||||
{
|
||||
@ -59,7 +56,7 @@ Foam::pointField Foam::blockMesh::createPoints(const dictionary& dict)
|
||||
mergeList_
|
||||
[
|
||||
blockPointLabel
|
||||
+ blockOffsets_[blockLabel]
|
||||
+ blockOffsets_[blockI]
|
||||
]
|
||||
] = scaleFactor * blockPoints[blockPointLabel];
|
||||
}
|
||||
@ -29,98 +29,6 @@ License
|
||||
#include "preservePatchTypes.H"
|
||||
#include "emptyPolyPatch.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::blockMesh::blockLabelsOK
|
||||
(
|
||||
const label blockLabel,
|
||||
const pointField& points,
|
||||
const cellShape& blockShape
|
||||
)
|
||||
{
|
||||
bool ok = true;
|
||||
|
||||
forAll(blockShape, blockI)
|
||||
{
|
||||
if (blockShape[blockI] < 0)
|
||||
{
|
||||
ok = false;
|
||||
|
||||
WarningIn
|
||||
(
|
||||
"bool Foam::blockMesh::blockLabelsOK"
|
||||
"(const label blockLabel, const pointField& points, "
|
||||
"const cellShape& blockShape)"
|
||||
) << "block " << blockLabel
|
||||
<< " point label " << blockShape[blockI]
|
||||
<< " less than zero" << endl;
|
||||
}
|
||||
else if (blockShape[blockI] >= points.size())
|
||||
{
|
||||
ok = false;
|
||||
|
||||
WarningIn
|
||||
(
|
||||
"bool Foam::blockMesh::blockLabelsOK"
|
||||
"(const label blockLabel, const pointField& points, "
|
||||
"const cellShape& blockShape)"
|
||||
) << "block " << blockLabel
|
||||
<< " point label " << blockShape[blockI]
|
||||
<< " larger than " << points.size() - 1
|
||||
<< " the largest defined point label" << endl;
|
||||
}
|
||||
}
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::blockMesh::patchLabelsOK
|
||||
(
|
||||
const label patchLabel,
|
||||
const pointField& points,
|
||||
const faceList& patchFaces
|
||||
)
|
||||
{
|
||||
bool ok = true;
|
||||
|
||||
forAll(patchFaces, faceI)
|
||||
{
|
||||
const labelList& f = patchFaces[faceI];
|
||||
|
||||
forAll(f, fp)
|
||||
{
|
||||
if (f[fp] < 0)
|
||||
{
|
||||
ok = false;
|
||||
|
||||
WarningIn
|
||||
(
|
||||
"bool Foam::blockMesh::patchLabelsOK(...)"
|
||||
) << "patch " << patchLabel
|
||||
<< " face " << faceI
|
||||
<< " point label " << f[fp]
|
||||
<< " less than zero" << endl;
|
||||
}
|
||||
else if (f[fp] >= points.size())
|
||||
{
|
||||
ok = false;
|
||||
|
||||
WarningIn
|
||||
(
|
||||
"bool Foam::blockMesh::patchLabelsOK(...)"
|
||||
) << "patch " << patchLabel
|
||||
<< " face " << faceI
|
||||
<< " point label " << f[fp]
|
||||
<< " larger than " << points.size() - 1
|
||||
<< " the largest defined point label" << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
@ -142,7 +50,7 @@ Foam::polyMesh* Foam::blockMesh::createTopology(IOdictionary& meshDescription)
|
||||
dictPtr->readIfPresent("type", defaultPatchType);
|
||||
}
|
||||
|
||||
Info<< nl << "Creating blockCorners" << endl;
|
||||
Info<< "Creating block corners" << endl;
|
||||
|
||||
// create blockCorners
|
||||
pointField tmpBlockPoints(meshDescription.lookup("vertices"));
|
||||
@ -150,13 +58,13 @@ Foam::polyMesh* Foam::blockMesh::createTopology(IOdictionary& meshDescription)
|
||||
if (meshDescription.found("edges"))
|
||||
{
|
||||
// read number of non-linear edges in mesh
|
||||
Info<< nl << "Creating curved edges" << endl;
|
||||
Info<< "Creating curved edges" << endl;
|
||||
|
||||
ITstream& edgesStream(meshDescription.lookup("edges"));
|
||||
ITstream& is(meshDescription.lookup("edges"));
|
||||
|
||||
label nEdges = 0;
|
||||
|
||||
token firstToken(edgesStream);
|
||||
token firstToken(is);
|
||||
|
||||
if (firstToken.isLabel())
|
||||
{
|
||||
@ -165,15 +73,15 @@ Foam::polyMesh* Foam::blockMesh::createTopology(IOdictionary& meshDescription)
|
||||
}
|
||||
else
|
||||
{
|
||||
edgesStream.putBack(firstToken);
|
||||
is.putBack(firstToken);
|
||||
}
|
||||
|
||||
// Read beginning of edges
|
||||
edgesStream.readBegin("edges");
|
||||
is.readBegin("edges");
|
||||
|
||||
nEdges = 0;
|
||||
|
||||
token lastToken(edgesStream);
|
||||
token lastToken(is);
|
||||
while
|
||||
(
|
||||
!(
|
||||
@ -187,37 +95,37 @@ Foam::polyMesh* Foam::blockMesh::createTopology(IOdictionary& meshDescription)
|
||||
edges_.setSize(nEdges + 1);
|
||||
}
|
||||
|
||||
edgesStream.putBack(lastToken);
|
||||
is.putBack(lastToken);
|
||||
|
||||
edges_.set
|
||||
(
|
||||
nEdges,
|
||||
curvedEdge::New(tmpBlockPoints, edgesStream)
|
||||
curvedEdge::New(tmpBlockPoints, is)
|
||||
);
|
||||
|
||||
nEdges++;
|
||||
|
||||
edgesStream >> lastToken;
|
||||
is >> lastToken;
|
||||
}
|
||||
edgesStream.putBack(lastToken);
|
||||
is.putBack(lastToken);
|
||||
|
||||
// Read end of edges
|
||||
edgesStream.readEnd("edges");
|
||||
is.readEnd("edges");
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< nl << "There are no non-linear edges" << endl;
|
||||
Info<< "No non-linear edges" << endl;
|
||||
}
|
||||
|
||||
|
||||
Info<< nl << "Creating blocks" << endl;
|
||||
Info<< "Creating blocks" << endl;
|
||||
{
|
||||
ITstream& blockDescriptorStream(meshDescription.lookup("blocks"));
|
||||
ITstream& is(meshDescription.lookup("blocks"));
|
||||
|
||||
// read number of blocks in mesh
|
||||
label nBlocks = 0;
|
||||
|
||||
token firstToken(blockDescriptorStream);
|
||||
token firstToken(is);
|
||||
|
||||
if (firstToken.isLabel())
|
||||
{
|
||||
@ -226,15 +134,15 @@ Foam::polyMesh* Foam::blockMesh::createTopology(IOdictionary& meshDescription)
|
||||
}
|
||||
else
|
||||
{
|
||||
blockDescriptorStream.putBack(firstToken);
|
||||
is.putBack(firstToken);
|
||||
}
|
||||
|
||||
// Read beginning of blocks
|
||||
blockDescriptorStream.readBegin("blocks");
|
||||
is.readBegin("blocks");
|
||||
|
||||
nBlocks = 0;
|
||||
|
||||
token lastToken(blockDescriptorStream);
|
||||
token lastToken(is);
|
||||
while
|
||||
(
|
||||
!(
|
||||
@ -248,19 +156,16 @@ Foam::polyMesh* Foam::blockMesh::createTopology(IOdictionary& meshDescription)
|
||||
blocks.setSize(nBlocks + 1);
|
||||
}
|
||||
|
||||
blockDescriptorStream.putBack(lastToken);
|
||||
is.putBack(lastToken);
|
||||
|
||||
blocks.set
|
||||
(
|
||||
nBlocks,
|
||||
new block
|
||||
(
|
||||
blockDescriptor
|
||||
(
|
||||
tmpBlockPoints,
|
||||
edges_,
|
||||
blockDescriptorStream
|
||||
)
|
||||
tmpBlockPoints,
|
||||
edges_,
|
||||
is
|
||||
)
|
||||
);
|
||||
|
||||
@ -273,28 +178,28 @@ Foam::polyMesh* Foam::blockMesh::createTopology(IOdictionary& meshDescription)
|
||||
|
||||
nBlocks++;
|
||||
|
||||
blockDescriptorStream >> lastToken;
|
||||
is >> lastToken;
|
||||
}
|
||||
blockDescriptorStream.putBack(lastToken);
|
||||
is.putBack(lastToken);
|
||||
|
||||
// Read end of blocks
|
||||
blockDescriptorStream.readEnd("blocks");
|
||||
is.readEnd("blocks");
|
||||
}
|
||||
|
||||
|
||||
Info<< nl << "Creating patches" << endl;
|
||||
Info<< "Creating patches" << endl;
|
||||
|
||||
faceListList tmpBlocksPatches;
|
||||
wordList patchNames;
|
||||
wordList patchTypes;
|
||||
|
||||
{
|
||||
ITstream& patchStream(meshDescription.lookup("patches"));
|
||||
ITstream& is(meshDescription.lookup("patches"));
|
||||
|
||||
// read number of patches in mesh
|
||||
label nPatches = 0;
|
||||
|
||||
token firstToken(patchStream);
|
||||
token firstToken(is);
|
||||
|
||||
if (firstToken.isLabel())
|
||||
{
|
||||
@ -306,15 +211,15 @@ Foam::polyMesh* Foam::blockMesh::createTopology(IOdictionary& meshDescription)
|
||||
}
|
||||
else
|
||||
{
|
||||
patchStream.putBack(firstToken);
|
||||
is.putBack(firstToken);
|
||||
}
|
||||
|
||||
// Read beginning of blocks
|
||||
patchStream.readBegin("patches");
|
||||
is.readBegin("patches");
|
||||
|
||||
nPatches = 0;
|
||||
|
||||
token lastToken(patchStream);
|
||||
token lastToken(is);
|
||||
while
|
||||
(
|
||||
!(
|
||||
@ -330,9 +235,9 @@ Foam::polyMesh* Foam::blockMesh::createTopology(IOdictionary& meshDescription)
|
||||
patchTypes.setSize(nPatches + 1);
|
||||
}
|
||||
|
||||
patchStream.putBack(lastToken);
|
||||
is.putBack(lastToken);
|
||||
|
||||
patchStream
|
||||
is
|
||||
>> patchTypes[nPatches]
|
||||
>> patchNames[nPatches]
|
||||
>> tmpBlocksPatches[nPatches];
|
||||
@ -347,7 +252,7 @@ Foam::polyMesh* Foam::blockMesh::createTopology(IOdictionary& meshDescription)
|
||||
(
|
||||
"blockMesh::createTopology(IOdictionary&)"
|
||||
) << "Duplicate patch " << patchNames[nPatches]
|
||||
<< " at line " << patchStream.lineNumber()
|
||||
<< " at line " << is.lineNumber()
|
||||
<< ". Exiting !" << nl
|
||||
<< exit(FatalError);
|
||||
}
|
||||
@ -362,12 +267,12 @@ Foam::polyMesh* Foam::blockMesh::createTopology(IOdictionary& meshDescription)
|
||||
|
||||
nPatches++;
|
||||
|
||||
patchStream >> lastToken;
|
||||
is >> lastToken;
|
||||
}
|
||||
patchStream.putBack(lastToken);
|
||||
is.putBack(lastToken);
|
||||
|
||||
// Read end of blocks
|
||||
patchStream.readEnd("patches");
|
||||
is.readEnd("patches");
|
||||
}
|
||||
|
||||
|
||||
@ -379,23 +284,23 @@ Foam::polyMesh* Foam::blockMesh::createTopology(IOdictionary& meshDescription)
|
||||
}
|
||||
|
||||
|
||||
Info<< nl << "Creating block mesh topology" << endl;
|
||||
Info<< "Creating topology" << endl;
|
||||
|
||||
PtrList<cellShape> tmpBlockCells(blocks.size());
|
||||
forAll(blocks, blockLabel)
|
||||
PtrList<cellShape> tmpBlockShapes(blocks.size());
|
||||
forAll(blocks, blockI)
|
||||
{
|
||||
tmpBlockCells.set
|
||||
tmpBlockShapes.set
|
||||
(
|
||||
blockLabel,
|
||||
new cellShape(blocks[blockLabel].blockDef().blockShape())
|
||||
blockI,
|
||||
new cellShape(blocks[blockI].blockDef().blockShape())
|
||||
);
|
||||
|
||||
if (tmpBlockCells[blockLabel].mag(tmpBlockPoints) < 0.0)
|
||||
if (tmpBlockShapes[blockI].mag(tmpBlockPoints) < 0.0)
|
||||
{
|
||||
WarningIn
|
||||
(
|
||||
"blockMesh::createTopology(IOdictionary&)"
|
||||
) << "negative volume block : " << blockLabel
|
||||
) << "negative volume block : " << blockI
|
||||
<< ", probably defined inside-out" << endl;
|
||||
}
|
||||
}
|
||||
@ -426,7 +331,7 @@ Foam::polyMesh* Foam::blockMesh::createTopology(IOdictionary& meshDescription)
|
||||
false
|
||||
),
|
||||
xferMove(tmpBlockPoints),
|
||||
tmpBlockCells,
|
||||
tmpBlockShapes,
|
||||
tmpBlocksPatches,
|
||||
patchNames,
|
||||
patchTypes,
|
||||
@ -22,9 +22,6 @@ License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Description
|
||||
BSpline : cubic spline going through all the knots
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "error.H"
|
||||
@ -34,10 +31,7 @@ Description
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
pointField BSpline::findKnots
|
||||
Foam::pointField Foam::BSpline::findKnots
|
||||
(
|
||||
const pointField& allknots,
|
||||
const vector& fstend,
|
||||
@ -106,15 +100,13 @@ pointField BSpline::findKnots
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
// Construct from components
|
||||
BSpline::BSpline(const pointField& Knots)
|
||||
Foam::BSpline::BSpline(const pointField& Knots)
|
||||
:
|
||||
spline(findKnots(Knots))
|
||||
{}
|
||||
|
||||
|
||||
// Construct from components
|
||||
BSpline::BSpline
|
||||
Foam::BSpline::BSpline
|
||||
(
|
||||
const pointField& Knots,
|
||||
const vector& fstend,
|
||||
@ -127,32 +119,23 @@ BSpline::BSpline
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
//- Return the real position of a point on the curve given by
|
||||
// the parameter 0 <= lambda <= 1
|
||||
vector BSpline::realPosition(scalar mu)
|
||||
Foam::vector Foam::BSpline::realPosition(scalar mu)
|
||||
{
|
||||
return spline::position(mu);
|
||||
}
|
||||
|
||||
|
||||
//- Return the position of a point on the curve given by
|
||||
// the parameter 0 <= lambda <= 1
|
||||
vector BSpline::position(const scalar mu) const
|
||||
Foam::vector Foam::BSpline::position(const scalar mu) const
|
||||
{
|
||||
return spline::position((1.0/(nKnots() - 1))*(1.0 + mu*(nKnots() - 3)));
|
||||
}
|
||||
|
||||
|
||||
//- Return the length of the curve
|
||||
scalar BSpline::length() const
|
||||
Foam::scalar Foam::BSpline::length() const
|
||||
{
|
||||
notImplemented("BSpline::length() const");
|
||||
return 1.0;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -26,7 +26,7 @@ Class
|
||||
Foam::BSpline
|
||||
|
||||
Description
|
||||
BSpline : cubic spline going through all the knots
|
||||
A cubic spline going through all the knots
|
||||
|
||||
SourceFiles
|
||||
BSpline.C
|
||||
|
||||
@ -22,10 +22,6 @@ License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Description
|
||||
arcEdge class : defines the arcEdge of a circle in terms of 3 points on its
|
||||
circumference
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "arcEdge.H"
|
||||
@ -37,8 +33,6 @@ Description
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(arcEdge, 0);
|
||||
|
||||
// Add the curvedEdge constructor functions to the hash tables
|
||||
addToRunTimeSelectionTable(curvedEdge, arcEdge, Istream);
|
||||
}
|
||||
|
||||
@ -81,15 +75,21 @@ Foam::cylindricalCS Foam::arcEdge::calcAngle()
|
||||
angle_ = acos(tmp)*180.0/mathematicalConstant::pi;
|
||||
|
||||
// check if the vectors define an exterior or an interior arcEdge
|
||||
if (((r1 ^ r2)&(r1 ^ r3)) < 0.0) angle_ = 360 - angle_;
|
||||
if (((r1 ^ r2)&(r1 ^ r3)) < 0.0)
|
||||
{
|
||||
angle_ = 360 - angle_;
|
||||
}
|
||||
|
||||
vector tempAxis(0.0,0.0,0.0);
|
||||
vector tempAxis;
|
||||
|
||||
if (angle_ <= 180.0)
|
||||
{
|
||||
tempAxis = r1 ^ r3;
|
||||
|
||||
if (mag(tempAxis)/(mag(r1)*mag(r3)) < 0.001) tempAxis = r1 ^ r2;
|
||||
if (mag(tempAxis)/(mag(r1)*mag(r3)) < 0.001)
|
||||
{
|
||||
tempAxis = r1 ^ r2;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -105,7 +105,6 @@ Foam::cylindricalCS Foam::arcEdge::calcAngle()
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
// Construct from components
|
||||
Foam::arcEdge::arcEdge
|
||||
(
|
||||
const pointField& points,
|
||||
@ -122,7 +121,6 @@ Foam::arcEdge::arcEdge
|
||||
{}
|
||||
|
||||
|
||||
// Construct from Istream
|
||||
Foam::arcEdge::arcEdge(const pointField& points, Istream& is)
|
||||
:
|
||||
curvedEdge(points, is),
|
||||
@ -159,13 +157,10 @@ Foam::vector Foam::arcEdge::position(const scalar lambda) const
|
||||
}
|
||||
|
||||
|
||||
//- Return the length of the curve
|
||||
Foam::scalar Foam::arcEdge::length() const
|
||||
{
|
||||
return angle_*radius_*mathematicalConstant::pi/180.0;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -26,8 +26,7 @@ Class
|
||||
Foam::arcEdge
|
||||
|
||||
Description
|
||||
arcEdge class : defines the arcEdge of a circle in terms of 3 points on its
|
||||
circumference
|
||||
Defines the arcEdge of a circle in terms of 3 points on its circumference
|
||||
|
||||
SourceFiles
|
||||
arcEdge.C
|
||||
|
||||
@ -22,32 +22,24 @@ License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Description
|
||||
library functions that will define a curvedEdge in space
|
||||
parameterised for 0<lambda<1 from the beginning
|
||||
point to the end point.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "error.H"
|
||||
|
||||
#include "curvedEdge.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(curvedEdge, 0);
|
||||
defineRunTimeSelectionTable(curvedEdge, Istream);
|
||||
defineTypeNameAndDebug(curvedEdge, 0);
|
||||
defineRunTimeSelectionTable(curvedEdge, Istream);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
// Construct from components
|
||||
curvedEdge::curvedEdge
|
||||
Foam::curvedEdge::curvedEdge
|
||||
(
|
||||
const pointField& points,
|
||||
const label start,
|
||||
@ -60,8 +52,7 @@ curvedEdge::curvedEdge
|
||||
{}
|
||||
|
||||
|
||||
// Construct from Istream
|
||||
curvedEdge::curvedEdge(const pointField& points, Istream& is)
|
||||
Foam::curvedEdge::curvedEdge(const pointField& points, Istream& is)
|
||||
:
|
||||
points_(points),
|
||||
start_(readLabel(is)),
|
||||
@ -69,8 +60,7 @@ curvedEdge::curvedEdge(const pointField& points, Istream& is)
|
||||
{}
|
||||
|
||||
|
||||
// Copy construct
|
||||
curvedEdge::curvedEdge(const curvedEdge& c)
|
||||
Foam::curvedEdge::curvedEdge(const curvedEdge& c)
|
||||
:
|
||||
points_(c.points_),
|
||||
start_(c.start_),
|
||||
@ -78,16 +68,18 @@ curvedEdge::curvedEdge(const curvedEdge& c)
|
||||
{}
|
||||
|
||||
|
||||
//- Clone function
|
||||
autoPtr<curvedEdge> curvedEdge::clone() const
|
||||
Foam::autoPtr<Foam::curvedEdge> Foam::curvedEdge::clone() const
|
||||
{
|
||||
notImplemented("curvedEdge::clone() const");
|
||||
return autoPtr<curvedEdge>(NULL);
|
||||
}
|
||||
|
||||
|
||||
//- New function which constructs and returns pointer to a curvedEdge
|
||||
autoPtr<curvedEdge> curvedEdge::New(const pointField& points, Istream& is)
|
||||
Foam::autoPtr<Foam::curvedEdge> Foam::curvedEdge::New
|
||||
(
|
||||
const pointField& points,
|
||||
Istream& is
|
||||
)
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
@ -96,16 +88,15 @@ autoPtr<curvedEdge> curvedEdge::New(const pointField& points, Istream& is)
|
||||
<< endl;
|
||||
}
|
||||
|
||||
word curvedEdgeType(is);
|
||||
word edgeType(is);
|
||||
|
||||
IstreamConstructorTable::iterator cstrIter =
|
||||
IstreamConstructorTablePtr_
|
||||
->find(curvedEdgeType);
|
||||
IstreamConstructorTablePtr_->find(edgeType);
|
||||
|
||||
if (cstrIter == IstreamConstructorTablePtr_->end())
|
||||
{
|
||||
FatalErrorIn("curvedEdge::New(const pointField&, Istream&)")
|
||||
<< "Unknown curvedEdge type " << curvedEdgeType << endl << endl
|
||||
<< "Unknown curvedEdge type " << edgeType << endl << endl
|
||||
<< "Valid curvedEdge types are" << endl
|
||||
<< IstreamConstructorTablePtr_->sortedToc()
|
||||
<< abort(FatalError);
|
||||
@ -117,9 +108,7 @@ autoPtr<curvedEdge> curvedEdge::New(const pointField& points, Istream& is)
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
//- Return the complete knotList by adding the start and end points to the
|
||||
// given list
|
||||
pointField knotlist
|
||||
Foam::pointField Foam::knotlist
|
||||
(
|
||||
const pointField& points,
|
||||
const label start,
|
||||
@ -145,13 +134,13 @@ pointField knotlist
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||
|
||||
void curvedEdge::operator=(const curvedEdge&)
|
||||
void Foam::curvedEdge::operator=(const curvedEdge&)
|
||||
{
|
||||
notImplemented("void curvedEdge::operator=(const curvedEdge&)");
|
||||
}
|
||||
|
||||
|
||||
Ostream& operator<<(Ostream& os, const curvedEdge& p)
|
||||
Foam::Ostream& Foam::operator<<(Ostream& os, const curvedEdge& p)
|
||||
{
|
||||
os << p.start_ << tab << p.end_ << endl;
|
||||
|
||||
@ -159,8 +148,4 @@ Ostream& operator<<(Ostream& os, const curvedEdge& p)
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -26,9 +26,8 @@ Class
|
||||
Foam::curvedEdge
|
||||
|
||||
Description
|
||||
curvedEdges : library functions that will define a curvedEdge in space
|
||||
parameterised for 0<lambda<1 from the beginning point to the end point.
|
||||
This file contains the abstract base class curvedEdge.
|
||||
Define a curved edge in space that is parameterised for
|
||||
0<lambda<1 from the beginning to the end point.
|
||||
|
||||
SourceFiles
|
||||
curvedEdge.C
|
||||
@ -49,7 +48,7 @@ namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class curvedEdge Declaration
|
||||
Class curvedEdge Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class curvedEdge
|
||||
@ -59,7 +58,8 @@ protected:
|
||||
// Protected data
|
||||
|
||||
const pointField& points_;
|
||||
const label start_, end_;
|
||||
const label start_;
|
||||
const label end_;
|
||||
|
||||
public:
|
||||
|
||||
@ -124,14 +124,24 @@ public:
|
||||
return end_;
|
||||
}
|
||||
|
||||
//- Compare the given start and end points with those of this curve
|
||||
bool compare(const label start, const label end) const
|
||||
//- Compare the given start and end points with this curve
|
||||
// - 0: different
|
||||
// - +1: identical
|
||||
// - -1: same edge, but different orientation
|
||||
int compare(const label start, const label end) const
|
||||
{
|
||||
return
|
||||
(
|
||||
(start_ == start && end_ == end)
|
||||
|| (start_ == end && end_ == start)
|
||||
);
|
||||
if (start_ == start && end_ == end)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else if (start_ == end && end_ == start)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
//- Return the position of a point on the curve given by
|
||||
|
||||
@ -22,9 +22,6 @@ License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Description
|
||||
lineDivide class : divides a line into segments
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "error.H"
|
||||
@ -32,15 +29,15 @@ Description
|
||||
#include "lineDivide.H"
|
||||
#include "curvedEdge.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
// Construct from components
|
||||
lineDivide::lineDivide(const curvedEdge& bc, const label n, const scalar xratio)
|
||||
Foam::lineDivide::lineDivide
|
||||
(
|
||||
const curvedEdge& bc,
|
||||
const label n,
|
||||
const scalar xratio
|
||||
)
|
||||
:
|
||||
points_(n + 1),
|
||||
divisions_(n + 1),
|
||||
@ -78,20 +75,16 @@ lineDivide::lineDivide(const curvedEdge& bc, const label n, const scalar xratio)
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
const pointField& lineDivide::points() const
|
||||
const Foam::pointField& Foam::lineDivide::points() const
|
||||
{
|
||||
return points_;
|
||||
}
|
||||
|
||||
|
||||
const scalarList& lineDivide::lambdaDivisions() const
|
||||
const Foam::scalarList& Foam::lineDivide::lambdaDivisions() const
|
||||
{
|
||||
return divisions_;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -26,7 +26,7 @@ Class
|
||||
Foam::lineDivide
|
||||
|
||||
Description
|
||||
lineDivide class : divides a line into segments
|
||||
Divides a line into segments
|
||||
|
||||
SourceFiles
|
||||
lineDivide.C
|
||||
@ -47,7 +47,7 @@ namespace Foam
|
||||
class curvedEdge;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class lineDivide Declaration
|
||||
Class lineDivide Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class lineDivide
|
||||
|
||||
@ -22,34 +22,24 @@ License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Description
|
||||
line class : defines a straight line between the start point and the
|
||||
end point
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "error.H"
|
||||
|
||||
#include "lineEdge.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(lineEdge, 0);
|
||||
|
||||
// Add the curvedEdge constructor functions to the hash tables
|
||||
curvedEdge::addIstreamConstructorToTable<lineEdge>
|
||||
addLineEdgeIstreamConstructorToTable_;
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(lineEdge, 0);
|
||||
addToRunTimeSelectionTable(curvedEdge, lineEdge, Istream);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
// Construct from components
|
||||
lineEdge::lineEdge
|
||||
Foam::lineEdge::lineEdge
|
||||
(
|
||||
const pointField& points,
|
||||
const label start,
|
||||
@ -62,8 +52,7 @@ lineEdge::lineEdge
|
||||
{}
|
||||
|
||||
|
||||
// Construct from Istream
|
||||
lineEdge::lineEdge(const pointField& points, Istream& is)
|
||||
Foam::lineEdge::lineEdge(const pointField& points, Istream& is)
|
||||
:
|
||||
curvedEdge(points, is),
|
||||
startPoint_(points_[start_]),
|
||||
@ -73,7 +62,7 @@ lineEdge::lineEdge(const pointField& points, Istream& is)
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
vector lineEdge::position(const scalar lambda) const
|
||||
Foam::vector Foam::lineEdge::position(const scalar lambda) const
|
||||
{
|
||||
if (lambda < 0 || lambda > 1)
|
||||
{
|
||||
@ -86,15 +75,10 @@ vector lineEdge::position(const scalar lambda) const
|
||||
}
|
||||
|
||||
|
||||
//- Return the length of the curve
|
||||
scalar lineEdge::length() const
|
||||
Foam::scalar Foam::lineEdge::length() const
|
||||
{
|
||||
return mag(direction_);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -26,8 +26,7 @@ Class
|
||||
Foam::lineEdge
|
||||
|
||||
Description
|
||||
lineEdge class : defines a straight line between the start point and the
|
||||
end point
|
||||
Defines a straight line between the start point and the end point.
|
||||
|
||||
SourceFiles
|
||||
lineEdge.C
|
||||
@ -45,7 +44,7 @@ namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class lineEdge Declaration
|
||||
Class lineEdge Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
|
||||
@ -22,27 +22,17 @@ License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Description
|
||||
polyLineEdge class : defines a curvedEdge in terms of a series of
|
||||
straight line segments
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "error.H"
|
||||
|
||||
#include "polyLine.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
// calcDistances generates the distances_ lookup table (cumulative
|
||||
// distance along the line) from the individual vectors to the points
|
||||
|
||||
void polyLine::calcDistances()
|
||||
void Foam::polyLine::calcDistances()
|
||||
{
|
||||
distances_[0] = 0.0;
|
||||
|
||||
@ -64,7 +54,7 @@ void polyLine::calcDistances()
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
polyLine::polyLine(const pointField& ps)
|
||||
Foam::polyLine::polyLine(const pointField& ps)
|
||||
:
|
||||
controlPoints_(ps),
|
||||
distances_(ps.size())
|
||||
@ -78,7 +68,7 @@ polyLine::polyLine(const pointField& ps)
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
vector polyLine::position(const scalar lambda) const
|
||||
Foam::vector Foam::polyLine::position(const scalar lambda) const
|
||||
{
|
||||
// check range of lambda
|
||||
|
||||
@ -124,14 +114,10 @@ vector polyLine::position(const scalar lambda) const
|
||||
}
|
||||
|
||||
|
||||
scalar polyLine::length() const
|
||||
Foam::scalar Foam::polyLine::length() const
|
||||
{
|
||||
return lineLength_;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -26,9 +26,10 @@ Class
|
||||
Foam::polyLine
|
||||
|
||||
Description
|
||||
polyLine class : defines a curvedEdge in terms of a series of straight
|
||||
line segments. This is the basic polyLine class which implements
|
||||
just the line (no topology : its not derived from curvedEdge)
|
||||
Defines a curvedEdge in terms of a series of straight line segments.
|
||||
|
||||
This is the basic polyLine class which implements just the line
|
||||
(no topology - it is not derived from curvedEdge)
|
||||
|
||||
SourceFiles
|
||||
polyLine.C
|
||||
@ -47,7 +48,7 @@ namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class polyLine Declaration
|
||||
Class polyLine Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
|
||||
@ -22,32 +22,24 @@ 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 "polyLineEdge.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(polyLineEdge, 0);
|
||||
|
||||
// Add the curvedEdge constructor functions to the hash tables
|
||||
curvedEdge::addIstreamConstructorToTable<polyLineEdge>
|
||||
addPolyLineEdgeIstreamConstructorToTable_;
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(polyLineEdge, 0);
|
||||
addToRunTimeSelectionTable(curvedEdge, polyLineEdge, Istream);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
// Construct from components
|
||||
polyLineEdge::polyLineEdge
|
||||
Foam::polyLineEdge::polyLineEdge
|
||||
(
|
||||
const pointField& ps,
|
||||
const label start,
|
||||
@ -60,8 +52,7 @@ polyLineEdge::polyLineEdge
|
||||
{}
|
||||
|
||||
|
||||
// Construct from Istream
|
||||
polyLineEdge::polyLineEdge(const pointField& ps, Istream& is)
|
||||
Foam::polyLineEdge::polyLineEdge(const pointField& ps, Istream& is)
|
||||
:
|
||||
curvedEdge(ps, is),
|
||||
polyLine(knotlist(ps, start_, end_, pointField(is)))
|
||||
@ -70,23 +61,16 @@ polyLineEdge::polyLineEdge(const pointField& ps, Istream& is)
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
//- Return the position of a point on the curve given by
|
||||
// the parameter 0 <= lambda <= 1
|
||||
vector polyLineEdge::position(const scalar lambda) const
|
||||
Foam::vector Foam::polyLineEdge::position(const scalar lambda) const
|
||||
{
|
||||
return polyLine::position(lambda);
|
||||
}
|
||||
|
||||
|
||||
//- Return the length of the curve
|
||||
scalar polyLineEdge::length() const
|
||||
Foam::scalar Foam::polyLineEdge::length() const
|
||||
{
|
||||
return polyLine::lineLength_;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -26,8 +26,8 @@ Class
|
||||
Foam::polyLineEdge
|
||||
|
||||
Description
|
||||
polyLineEdge class : defines a curvedEdge in terms of a series of straight
|
||||
line segments. This is the public face of polyLine
|
||||
Defines a curvedEdge in terms of a series of straight line segments.
|
||||
This is the public face of polyLine
|
||||
|
||||
SourceFiles
|
||||
polyLineEdge.C
|
||||
@ -46,7 +46,7 @@ namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class polyLineEdge Declaration
|
||||
Class polyLineEdge Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class polyLineEdge
|
||||
|
||||
@ -33,8 +33,6 @@ License
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(polySplineEdge, 0);
|
||||
|
||||
// Add the curvedEdge constructor functions to the hash tables
|
||||
addToRunTimeSelectionTable(curvedEdge, polySplineEdge, Istream);
|
||||
}
|
||||
|
||||
|
||||
@ -26,7 +26,7 @@ Class
|
||||
Foam::polySplineEdge
|
||||
|
||||
Description
|
||||
polySplineEdge class : representation of a spline via a polyLine
|
||||
A spline representation via a polyLine
|
||||
|
||||
SourceFiles
|
||||
polySplineEdge.C
|
||||
@ -45,7 +45,7 @@ namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class polySplineEdge Declaration
|
||||
Class polySplineEdge Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class polySplineEdge
|
||||
@ -63,7 +63,7 @@ class polySplineEdge
|
||||
pointField intervening
|
||||
(
|
||||
const pointField& otherknots,
|
||||
const label nbetweenKnots,
|
||||
const label nbetweenKnots,
|
||||
const vector&, const vector&
|
||||
);
|
||||
|
||||
@ -84,7 +84,7 @@ public:
|
||||
//- Construct from components
|
||||
polySplineEdge
|
||||
(
|
||||
const pointField& ps,
|
||||
const pointField& points,
|
||||
const label start,
|
||||
const label end,
|
||||
const pointField& otherknots,
|
||||
|
||||
@ -22,29 +22,24 @@ License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Description
|
||||
simpleSplineEdge : the actual access class for Bspline
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "simpleSplineEdge.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(simpleSplineEdge, 0);
|
||||
addToRunTimeSelectionTable(curvedEdge, simpleSplineEdge, Istream);
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(simpleSplineEdge, 0);
|
||||
addToRunTimeSelectionTable(curvedEdge, simpleSplineEdge, Istream);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
// Construct from components
|
||||
simpleSplineEdge::simpleSplineEdge
|
||||
Foam::simpleSplineEdge::simpleSplineEdge
|
||||
(
|
||||
const pointField& points,
|
||||
const label start,
|
||||
@ -57,8 +52,7 @@ simpleSplineEdge::simpleSplineEdge
|
||||
{}
|
||||
|
||||
|
||||
// Construct from components
|
||||
simpleSplineEdge::simpleSplineEdge
|
||||
Foam::simpleSplineEdge::simpleSplineEdge
|
||||
(
|
||||
const pointField& points,
|
||||
const label start,
|
||||
@ -73,8 +67,7 @@ simpleSplineEdge::simpleSplineEdge
|
||||
{}
|
||||
|
||||
|
||||
// Construct from Istream
|
||||
simpleSplineEdge::simpleSplineEdge(const pointField& points, Istream& is)
|
||||
Foam::simpleSplineEdge::simpleSplineEdge(const pointField& points, Istream& is)
|
||||
:
|
||||
curvedEdge(points, is),
|
||||
BSpline(knotlist(points, start_, end_, pointField(is)))
|
||||
@ -83,24 +76,17 @@ simpleSplineEdge::simpleSplineEdge(const pointField& points, Istream& is)
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
//- Return the position of a point on the simple spline curve given by
|
||||
// the parameter 0 <= lambda <= 1
|
||||
vector simpleSplineEdge::position(const scalar mu) const
|
||||
Foam::vector Foam::simpleSplineEdge::position(const scalar mu) const
|
||||
{
|
||||
return BSpline::position(mu);
|
||||
}
|
||||
|
||||
|
||||
//- Return the length of the simple spline curve
|
||||
scalar simpleSplineEdge::length() const
|
||||
Foam::scalar Foam::simpleSplineEdge::length() const
|
||||
{
|
||||
notImplemented("simpleSplineEdge::length() const");
|
||||
return 1.0;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -26,7 +26,7 @@ Class
|
||||
Foam::simpleSplineEdge
|
||||
|
||||
Description
|
||||
simpleSplineEdge : the actual access class for Bspline
|
||||
The actual access class for Bspline
|
||||
|
||||
SourceFiles
|
||||
simpleSplineEdge.C
|
||||
@ -45,7 +45,7 @@ namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class simpleSplineEdge Declaration
|
||||
Class simpleSplineEdge Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class simpleSplineEdge
|
||||
@ -65,7 +65,7 @@ public:
|
||||
//- Construct from components
|
||||
simpleSplineEdge
|
||||
(
|
||||
const pointField& ps,
|
||||
const pointField& points,
|
||||
const label start,
|
||||
const label end,
|
||||
const pointField& otherknots
|
||||
@ -88,7 +88,8 @@ public:
|
||||
|
||||
// Destructor
|
||||
|
||||
virtual ~simpleSplineEdge(){}
|
||||
virtual ~simpleSplineEdge()
|
||||
{}
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
@ -22,96 +22,72 @@ License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Description
|
||||
spline class : define a basic spline on nKnots knots - this
|
||||
does not go anywhere near these knots (will act as a base type for
|
||||
various splines that will have real uses)
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "spline.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
// Construct from components
|
||||
spline::spline(const pointField& a)
|
||||
Foam::spline::spline(const pointField& knotPoints)
|
||||
:
|
||||
knots_(a)
|
||||
knots_(knotPoints)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
// function B : this is the blending function for constructing the
|
||||
// spline
|
||||
|
||||
scalar spline::B(const scalar& tau) const
|
||||
Foam::scalar Foam::spline::B(const scalar& tau) const
|
||||
{
|
||||
scalar value = 0.0;
|
||||
|
||||
if (tau>=2.0 || tau<=-2.0)
|
||||
if (tau <= -2.0 || tau >= 2.0)
|
||||
{
|
||||
value = 0.0;
|
||||
return 0.0;
|
||||
}
|
||||
else if (tau<=-1.0)
|
||||
else if (tau <= -1.0)
|
||||
{
|
||||
value = pow((2.0 + tau),3.0)/6.0;
|
||||
return pow((2.0 + tau),3.0)/6.0;
|
||||
}
|
||||
else if (tau<=0.0)
|
||||
else if (tau <= 0.0)
|
||||
{
|
||||
value = (4.0 - 6.0*tau*tau - 3.0*tau*tau*tau)/6.0;
|
||||
return (4.0 - 6.0*tau*tau - 3.0*tau*tau*tau)/6.0;
|
||||
}
|
||||
else if (tau<=1.0)
|
||||
else if (tau <= 1.0)
|
||||
{
|
||||
value = (4.0 - 6.0*tau*tau + 3.0*tau*tau*tau)/6.0;
|
||||
return (4.0 - 6.0*tau*tau + 3.0*tau*tau*tau)/6.0;
|
||||
}
|
||||
else if (tau<=2.0)
|
||||
else if (tau <= 2.0)
|
||||
{
|
||||
value = pow((2.0 - tau),3.0)/6.0;
|
||||
return pow((2.0 - tau),3.0)/6.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorIn("spline::B(const scalar&)")
|
||||
<< "How the hell did we get here???, "
|
||||
<< "Programming error???, "
|
||||
<< "tau = " << tau
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
return value;
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
|
||||
// position : returns the position along the spline corresponding to the
|
||||
// variable mu1
|
||||
|
||||
vector spline::position(const scalar mu1) const
|
||||
Foam::vector Foam::spline::position(const scalar mu1) const
|
||||
{
|
||||
vector tmp(vector::zero);
|
||||
vector loc(vector::zero);
|
||||
|
||||
for (register label i=0; i<knots_.size(); i++)
|
||||
{
|
||||
tmp += B((knots_.size() - 1)*mu1 - i)*knots_[i];
|
||||
loc += B((knots_.size() - 1)*mu1 - i)*knots_[i];
|
||||
}
|
||||
|
||||
return tmp;
|
||||
return loc;
|
||||
}
|
||||
|
||||
|
||||
//- Return the length of the spline curve
|
||||
scalar spline::length() const
|
||||
Foam::scalar Foam::spline::length() const
|
||||
{
|
||||
notImplemented("spline::length() const");
|
||||
return 1.0;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -26,9 +26,9 @@ Class
|
||||
Foam::spline
|
||||
|
||||
Description
|
||||
spline class : define a basic spline on nKnots knots - this
|
||||
does not go anywhere near these knots (will act as a base type for
|
||||
various splines that will have real uses)
|
||||
Define a basic spline on nKnots knots.
|
||||
The spline does not go anywhere near these knots
|
||||
(will act as a base type for various splines that will have real uses)
|
||||
|
||||
SourceFiles
|
||||
spline.C
|
||||
@ -46,7 +46,7 @@ namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class spline Declaration
|
||||
Class spline Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class spline
|
||||
|
||||
Reference in New Issue
Block a user