Commit 2339d607 authored by Henry Weller's avatar Henry Weller
Browse files

blockMesh: Added support for run-time selectable methods to set the block vertex locations

parent 00920318
blockVertices/blockVertex/blockVertex.C
blockVertices/pointVertex/pointVertex.C
blockEdges/blockEdge/blockEdge.C
blockEdges/lineDivide/lineDivide.C
blockEdges/lineEdge/lineEdge.C
......
......@@ -33,12 +33,12 @@ Description
(block, centre): faces 0 (f0) and 1 are left and right, respectively; faces
2 and 3 are front the back; and faces 4 and 5 are bottom and top:
\verbatim
4 ---- 5
7 ---- 6
f5 |\ |\ f3
| | 7 ---- 6 \
| 0 |--- 1 | \
| | 4 ---- 5 \
| 3 |--- 2 | \
| \| \| f2
f4 3 ---- 2
f4 0 ---- 1
f0 ----- f1
\endverbatim
......
......@@ -96,7 +96,7 @@ Foam::label Foam::blockDescriptor::edgePointsWeights
// Not curved-edge: divide the edge as a straight line
lineDivide divEdge
(
lineEdge(blockPoints, start, end),
blockEdges::lineEdge(blockPoints, start, end),
nDiv,
expand_[edgei]
);
......
......@@ -30,6 +30,8 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace blockEdges
{
defineTypeNameAndDebug(BSplineEdge, 0);
......@@ -40,11 +42,12 @@ namespace Foam
Istream
);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::BSplineEdge::BSplineEdge
Foam::blockEdges::BSplineEdge::BSplineEdge
(
const pointField& points,
const label start,
......@@ -57,7 +60,7 @@ Foam::BSplineEdge::BSplineEdge
{}
Foam::BSplineEdge::BSplineEdge
Foam::blockEdges::BSplineEdge::BSplineEdge
(
const searchableSurfaces& geometry,
const pointField& points,
......@@ -81,19 +84,19 @@ Foam::BSplineEdge::BSplineEdge
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::BSplineEdge::~BSplineEdge()
Foam::blockEdges::BSplineEdge::~BSplineEdge()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::point Foam::BSplineEdge::position(const scalar mu) const
Foam::point Foam::blockEdges::BSplineEdge::position(const scalar mu) const
{
return BSpline::position(mu);
}
Foam::scalar Foam::BSplineEdge::length() const
Foam::scalar Foam::blockEdges::BSplineEdge::length() const
{
return BSpline::length();
}
......
......@@ -22,7 +22,7 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::BSplineEdge
Foam::blockEdges::BSplineEdge
Description
A blockEdge interface for B-splines.
......@@ -42,6 +42,8 @@ SourceFiles
namespace Foam
{
namespace blockEdges
{
/*---------------------------------------------------------------------------*\
Class BSplineEdge Declaration
......@@ -104,6 +106,7 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End of namespace blockEdges
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......
......@@ -30,15 +30,18 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace blockEdges
{
defineTypeNameAndDebug(arcEdge, 0);
addToRunTimeSelectionTable(blockEdge, arcEdge, Istream);
}
}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
Foam::cylindricalCS Foam::arcEdge::calcAngle()
Foam::cylindricalCS Foam::blockEdges::arcEdge::calcAngle()
{
vector a = p2_ - p1_;
vector b = p3_ - p1_;
......@@ -102,7 +105,7 @@ Foam::cylindricalCS Foam::arcEdge::calcAngle()
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::arcEdge::arcEdge
Foam::blockEdges::arcEdge::arcEdge
(
const pointField& points,
const label start,
......@@ -118,7 +121,7 @@ Foam::arcEdge::arcEdge
{}
Foam::arcEdge::arcEdge
Foam::blockEdges::arcEdge::arcEdge
(
const searchableSurfaces& geometry,
const pointField& points,
......@@ -135,7 +138,7 @@ Foam::arcEdge::arcEdge
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::point Foam::arcEdge::position(const scalar lambda) const
Foam::point Foam::blockEdges::arcEdge::position(const scalar lambda) const
{
if (lambda < -SMALL || lambda > 1 + SMALL)
{
......@@ -159,7 +162,7 @@ Foam::point Foam::arcEdge::position(const scalar lambda) const
}
Foam::scalar Foam::arcEdge::length() const
Foam::scalar Foam::blockEdges::arcEdge::length() const
{
return degToRad(angle_*radius_);
}
......
......@@ -22,7 +22,7 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::arcEdge
Foam::blockEdges::arcEdge
Description
Defines the arcEdge of a circle in terms of 3 points on its circumference
......@@ -32,8 +32,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef arcEdge_H
#define arcEdge_H
#ifndef blockEdges_arcEdge_H
#define blockEdges_arcEdge_H
#include "blockEdge.H"
#include "cylindricalCS.H"
......@@ -42,6 +42,8 @@ SourceFiles
namespace Foam
{
namespace blockEdges
{
/*---------------------------------------------------------------------------*\
Class arcEdge Declaration
......@@ -113,6 +115,7 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End of namespace blockEdges
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......
......@@ -33,8 +33,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef blockEdges_H
#define blockEdges_H
#ifndef blockEdge_H
#define blockEdge_H
#include "searchableSurfaces.H"
......
......@@ -29,15 +29,18 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace blockEdges
{
defineTypeNameAndDebug(lineEdge, 0);
addToRunTimeSelectionTable(blockEdge, lineEdge, Istream);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::lineEdge::lineEdge
Foam::blockEdges::lineEdge::lineEdge
(
const pointField& points,
const label start,
......@@ -48,7 +51,7 @@ Foam::lineEdge::lineEdge
{}
Foam::lineEdge::lineEdge
Foam::blockEdges::lineEdge::lineEdge
(
const searchableSurfaces& geometry,
const pointField& points,
......@@ -61,13 +64,13 @@ Foam::lineEdge::lineEdge
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * * //
Foam::lineEdge::~lineEdge()
Foam::blockEdges::lineEdge::~lineEdge()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::point Foam::lineEdge::position(const scalar lambda) const
Foam::point Foam::blockEdges::lineEdge::position(const scalar lambda) const
{
if (lambda < -SMALL || lambda > 1+SMALL)
{
......@@ -80,7 +83,7 @@ Foam::point Foam::lineEdge::position(const scalar lambda) const
}
Foam::scalar Foam::lineEdge::length() const
Foam::scalar Foam::blockEdges::lineEdge::length() const
{
return mag(points_[end_] - points_[start_]);
}
......
......@@ -22,7 +22,7 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::lineEdge
Foam::blockEdges::lineEdge
Description
A straight edge between the start point and the end point.
......@@ -32,8 +32,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef lineEdge_H
#define lineEdge_H
#ifndef blockEdges_lineEdge_H
#define blockEdges_lineEdge_H
#include "blockEdge.H"
......@@ -41,6 +41,8 @@ SourceFiles
namespace Foam
{
namespace blockEdges
{
/*---------------------------------------------------------------------------*\
Class lineEdge Declaration
......@@ -89,6 +91,7 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End of namespace blockEdges
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......
......@@ -29,15 +29,18 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace blockEdges
{
defineTypeNameAndDebug(polyLineEdge, 0);
addToRunTimeSelectionTable(blockEdge, polyLineEdge, Istream);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::polyLineEdge::polyLineEdge
Foam::blockEdges::polyLineEdge::polyLineEdge
(
const pointField& ps,
const label start,
......@@ -50,7 +53,7 @@ Foam::polyLineEdge::polyLineEdge
{}
Foam::polyLineEdge::polyLineEdge
Foam::blockEdges::polyLineEdge::polyLineEdge
(
const searchableSurfaces& geometry,
const pointField& ps,
......@@ -64,19 +67,19 @@ Foam::polyLineEdge::polyLineEdge
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::polyLineEdge::~polyLineEdge()
Foam::blockEdges::polyLineEdge::~polyLineEdge()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::point Foam::polyLineEdge::position(const scalar lambda) const
Foam::point Foam::blockEdges::polyLineEdge::position(const scalar lambda) const
{
return polyLine::position(lambda);
}
Foam::scalar Foam::polyLineEdge::length() const
Foam::scalar Foam::blockEdges::polyLineEdge::length() const
{
return polyLine::lineLength_;
}
......
......@@ -22,7 +22,7 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::polyLineEdge
Foam::blockEdges::polyLineEdge
Description
A blockEdge defined in terms of a series of straight line segments.
......@@ -32,8 +32,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef polyLineEdge_H
#define polyLineEdge_H
#ifndef blockEdges_polyLineEdge_H
#define blockEdges_polyLineEdge_H
#include "blockEdge.H"
#include "polyLine.H"
......@@ -42,6 +42,8 @@ SourceFiles
namespace Foam
{
namespace blockEdges
{
/*---------------------------------------------------------------------------*\
Class polyLineEdge Declaration
......@@ -104,6 +106,7 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End of namespace blockEdges
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......
......@@ -30,6 +30,8 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace blockEdges
{
defineTypeNameAndDebug(splineEdge, 0);
......@@ -40,11 +42,12 @@ namespace Foam
Istream
);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::splineEdge::splineEdge
Foam::blockEdges::splineEdge::splineEdge
(
const pointField& points,
const label start,
......@@ -57,7 +60,7 @@ Foam::splineEdge::splineEdge
{}
Foam::splineEdge::splineEdge
Foam::blockEdges::splineEdge::splineEdge
(
const searchableSurfaces& geometry,
const pointField& points,
......@@ -81,19 +84,19 @@ Foam::splineEdge::splineEdge
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::splineEdge::~splineEdge()
Foam::blockEdges::splineEdge::~splineEdge()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::point Foam::splineEdge::position(const scalar mu) const
Foam::point Foam::blockEdges::splineEdge::position(const scalar mu) const
{
return CatmullRomSpline::position(mu);
}
Foam::scalar Foam::splineEdge::length() const
Foam::scalar Foam::blockEdges::splineEdge::length() const
{
return CatmullRomSpline::length();
}
......
......@@ -22,7 +22,7 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::splineEdge
Foam::blockEdges::splineEdge
Description
A blockEdge interface for Catmull-Rom splines.
......@@ -32,8 +32,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef splineEdge_H
#define splineEdge_H
#ifndef blockEdges_splineEdge_H
#define blockEdges_splineEdge_H
#include "blockEdge.H"
#include "CatmullRomSpline.H"
......@@ -42,6 +42,8 @@ SourceFiles
namespace Foam
{
namespace blockEdges
{
/*---------------------------------------------------------------------------*\
Class splineEdge Declaration
......@@ -104,6 +106,7 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End of namespace blockEdges
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......
......@@ -32,8 +32,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef blockFaces_H
#define blockFaces_H
#ifndef blockFace_H
#define blockFace_H
#include "searchableSurfaces.H"
......
......@@ -30,15 +30,18 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace blockFaces
{
defineTypeNameAndDebug(projectFace, 0);
addToRunTimeSelectionTable(blockFace, projectFace, Istream);
}
}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
const Foam::searchableSurface& Foam::projectFace::lookupSurface
const Foam::searchableSurface& Foam::blockFaces::projectFace::lookupSurface
(
const searchableSurfaces& geometry,
Istream& is
......@@ -64,7 +67,7 @@ const Foam::searchableSurface& Foam::projectFace::lookupSurface
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::projectFace::projectFace
Foam::blockFaces::projectFace::projectFace
(
const searchableSurfaces& geometry,
Istream& is
......@@ -77,7 +80,7 @@ Foam::projectFace::projectFace
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::projectFace::project(pointField& points) const
void Foam::blockFaces::projectFace::project(pointField& points) const
{
List<pointIndexHit> hits;
scalarField nearestDistSqr
......
......@@ -22,7 +22,7 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::projectFace
Foam::blockFaces::projectFace
Description
Projects the given set of face points onto the selected surface of the
......@@ -33,8 +33,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef projectFace_H
#define projectFace_H
#ifndef blockFaces_projectFace_H
#define blockFaces_projectFace_H
#include "blockFace.H"
......@@ -42,6 +42,8 @@ SourceFiles
namespace Foam
{
namespace blockFaces
{
/*---------------------------------------------------------------------------*\
Class projectFace Declaration
......@@ -102,6 +104,7 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace blockFaces
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......
......@@ -25,7 +25,6 @@ License
#include "blockMesh.H"
#include "Time.H"
#include "Switch.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
......@@ -57,7 +56,12 @@ Foam::blockMesh::blockMesh(const IOdictionary& dict, const word& regionName)
true
),
scaleFactor_(1.0),
vertices_(dict.lookup("vertices")),
blockVertices_
(
dict.lookup("vertices"),
blockVertex::iNew(geometry_)
),
vertices_(Foam::vertices(blockVertices_)),
topologyPtr_(createTopology(dict, regionName))
{
Switch fastMerge(dict.lookupOrDefault<Switch>("fastMerge", false));
......
......@@ -46,6 +46,7 @@ SourceFiles
#include "searchableSurfaces.H"
#include "polyMesh.H"
#include "IOdictionary.H"
#include "blockVertexList.H"
#include "blockEdgeList.H"
#include "blockFaceList.H"
......@@ -73,7 +74,10 @@ class blockMesh
//- The scaling factor to convert to metres
scalar scaleFactor_;
//- Vertices defining the block mesh (corners)
//- The list of block vertices
blockVertexList blockVertices_;
//- The list of block vertex positions
pointField vertices_;
//- The list of curved edges
......
......@@ -342,7 +342,6 @@ Foam::polyMesh* Foam::blockMesh::createTopology
meshDescription.readIfPresent("scale", scaleFactor_);
}
// Read the block edges
if (meshDescription.found("edges"))
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment