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

This commit is contained in:
Henry Weller
2016-10-15 14:24:36 +01:00
parent 009203188f
commit 2339d607ee
27 changed files with 769 additions and 57 deletions

View File

@ -1,3 +1,6 @@
blockVertices/blockVertex/blockVertex.C
blockVertices/pointVertex/pointVertex.C
blockEdges/blockEdge/blockEdge.C blockEdges/blockEdge/blockEdge.C
blockEdges/lineDivide/lineDivide.C blockEdges/lineDivide/lineDivide.C
blockEdges/lineEdge/lineEdge.C blockEdges/lineEdge/lineEdge.C

View File

@ -33,12 +33,12 @@ Description
(block, centre): faces 0 (f0) and 1 are left and right, respectively; faces (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: 2 and 3 are front the back; and faces 4 and 5 are bottom and top:
\verbatim \verbatim
4 ---- 5 7 ---- 6
f5 |\ |\ f3 f5 |\ |\ f3
| | 7 ---- 6 \ | | 4 ---- 5 \
| 0 |--- 1 | \ | 3 |--- 2 | \
| \| \| f2 | \| \| f2
f4 3 ---- 2 f4 0 ---- 1
f0 ----- f1 f0 ----- f1
\endverbatim \endverbatim

View File

@ -96,7 +96,7 @@ Foam::label Foam::blockDescriptor::edgePointsWeights
// Not curved-edge: divide the edge as a straight line // Not curved-edge: divide the edge as a straight line
lineDivide divEdge lineDivide divEdge
( (
lineEdge(blockPoints, start, end), blockEdges::lineEdge(blockPoints, start, end),
nDiv, nDiv,
expand_[edgei] expand_[edgei]
); );

View File

@ -30,6 +30,8 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam namespace Foam
{
namespace blockEdges
{ {
defineTypeNameAndDebug(BSplineEdge, 0); defineTypeNameAndDebug(BSplineEdge, 0);
@ -40,11 +42,12 @@ namespace Foam
Istream Istream
); );
} }
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::BSplineEdge::BSplineEdge Foam::blockEdges::BSplineEdge::BSplineEdge
( (
const pointField& points, const pointField& points,
const label start, const label start,
@ -57,7 +60,7 @@ Foam::BSplineEdge::BSplineEdge
{} {}
Foam::BSplineEdge::BSplineEdge Foam::blockEdges::BSplineEdge::BSplineEdge
( (
const searchableSurfaces& geometry, const searchableSurfaces& geometry,
const pointField& points, const pointField& points,
@ -81,19 +84,19 @@ Foam::BSplineEdge::BSplineEdge
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::BSplineEdge::~BSplineEdge() Foam::blockEdges::BSplineEdge::~BSplineEdge()
{} {}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * 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); return BSpline::position(mu);
} }
Foam::scalar Foam::BSplineEdge::length() const Foam::scalar Foam::blockEdges::BSplineEdge::length() const
{ {
return BSpline::length(); return BSpline::length();
} }

View File

@ -22,7 +22,7 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class Class
Foam::BSplineEdge Foam::blockEdges::BSplineEdge
Description Description
A blockEdge interface for B-splines. A blockEdge interface for B-splines.
@ -42,6 +42,8 @@ SourceFiles
namespace Foam namespace Foam
{ {
namespace blockEdges
{
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class BSplineEdge Declaration Class BSplineEdge Declaration
@ -104,6 +106,7 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End of namespace blockEdges
} // End namespace Foam } // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -30,15 +30,18 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam namespace Foam
{
namespace blockEdges
{ {
defineTypeNameAndDebug(arcEdge, 0); defineTypeNameAndDebug(arcEdge, 0);
addToRunTimeSelectionTable(blockEdge, arcEdge, Istream); addToRunTimeSelectionTable(blockEdge, arcEdge, Istream);
} }
}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
Foam::cylindricalCS Foam::arcEdge::calcAngle() Foam::cylindricalCS Foam::blockEdges::arcEdge::calcAngle()
{ {
vector a = p2_ - p1_; vector a = p2_ - p1_;
vector b = p3_ - p1_; vector b = p3_ - p1_;
@ -102,7 +105,7 @@ Foam::cylindricalCS Foam::arcEdge::calcAngle()
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::arcEdge::arcEdge Foam::blockEdges::arcEdge::arcEdge
( (
const pointField& points, const pointField& points,
const label start, const label start,
@ -118,7 +121,7 @@ Foam::arcEdge::arcEdge
{} {}
Foam::arcEdge::arcEdge Foam::blockEdges::arcEdge::arcEdge
( (
const searchableSurfaces& geometry, const searchableSurfaces& geometry,
const pointField& points, const pointField& points,
@ -135,7 +138,7 @@ Foam::arcEdge::arcEdge
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * 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) 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_); return degToRad(angle_*radius_);
} }

View File

@ -22,7 +22,7 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class Class
Foam::arcEdge Foam::blockEdges::arcEdge
Description Description
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
@ -32,8 +32,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef arcEdge_H #ifndef blockEdges_arcEdge_H
#define arcEdge_H #define blockEdges_arcEdge_H
#include "blockEdge.H" #include "blockEdge.H"
#include "cylindricalCS.H" #include "cylindricalCS.H"
@ -42,6 +42,8 @@ SourceFiles
namespace Foam namespace Foam
{ {
namespace blockEdges
{
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class arcEdge Declaration Class arcEdge Declaration
@ -113,6 +115,7 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End of namespace blockEdges
} // End namespace Foam } // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -33,8 +33,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef blockEdges_H #ifndef blockEdge_H
#define blockEdges_H #define blockEdge_H
#include "searchableSurfaces.H" #include "searchableSurfaces.H"

View File

@ -29,15 +29,18 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam namespace Foam
{
namespace blockEdges
{ {
defineTypeNameAndDebug(lineEdge, 0); defineTypeNameAndDebug(lineEdge, 0);
addToRunTimeSelectionTable(blockEdge, lineEdge, Istream); addToRunTimeSelectionTable(blockEdge, lineEdge, Istream);
} }
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::lineEdge::lineEdge Foam::blockEdges::lineEdge::lineEdge
( (
const pointField& points, const pointField& points,
const label start, const label start,
@ -48,7 +51,7 @@ Foam::lineEdge::lineEdge
{} {}
Foam::lineEdge::lineEdge Foam::blockEdges::lineEdge::lineEdge
( (
const searchableSurfaces& geometry, const searchableSurfaces& geometry,
const pointField& points, const pointField& points,
@ -61,13 +64,13 @@ Foam::lineEdge::lineEdge
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * * //
Foam::lineEdge::~lineEdge() Foam::blockEdges::lineEdge::~lineEdge()
{} {}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * 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) 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_]); return mag(points_[end_] - points_[start_]);
} }

View File

@ -22,7 +22,7 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class Class
Foam::lineEdge Foam::blockEdges::lineEdge
Description Description
A straight edge between the start point and the end point. A straight edge between the start point and the end point.
@ -32,8 +32,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef lineEdge_H #ifndef blockEdges_lineEdge_H
#define lineEdge_H #define blockEdges_lineEdge_H
#include "blockEdge.H" #include "blockEdge.H"
@ -41,6 +41,8 @@ SourceFiles
namespace Foam namespace Foam
{ {
namespace blockEdges
{
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class lineEdge Declaration Class lineEdge Declaration
@ -89,6 +91,7 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End of namespace blockEdges
} // End namespace Foam } // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -29,15 +29,18 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam namespace Foam
{
namespace blockEdges
{ {
defineTypeNameAndDebug(polyLineEdge, 0); defineTypeNameAndDebug(polyLineEdge, 0);
addToRunTimeSelectionTable(blockEdge, polyLineEdge, Istream); addToRunTimeSelectionTable(blockEdge, polyLineEdge, Istream);
} }
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::polyLineEdge::polyLineEdge Foam::blockEdges::polyLineEdge::polyLineEdge
( (
const pointField& ps, const pointField& ps,
const label start, const label start,
@ -50,7 +53,7 @@ Foam::polyLineEdge::polyLineEdge
{} {}
Foam::polyLineEdge::polyLineEdge Foam::blockEdges::polyLineEdge::polyLineEdge
( (
const searchableSurfaces& geometry, const searchableSurfaces& geometry,
const pointField& ps, const pointField& ps,
@ -64,19 +67,19 @@ Foam::polyLineEdge::polyLineEdge
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::polyLineEdge::~polyLineEdge() Foam::blockEdges::polyLineEdge::~polyLineEdge()
{} {}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * 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); return polyLine::position(lambda);
} }
Foam::scalar Foam::polyLineEdge::length() const Foam::scalar Foam::blockEdges::polyLineEdge::length() const
{ {
return polyLine::lineLength_; return polyLine::lineLength_;
} }

View File

@ -22,7 +22,7 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class Class
Foam::polyLineEdge Foam::blockEdges::polyLineEdge
Description Description
A blockEdge defined in terms of a series of straight line segments. A blockEdge defined in terms of a series of straight line segments.
@ -32,8 +32,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef polyLineEdge_H #ifndef blockEdges_polyLineEdge_H
#define polyLineEdge_H #define blockEdges_polyLineEdge_H
#include "blockEdge.H" #include "blockEdge.H"
#include "polyLine.H" #include "polyLine.H"
@ -42,6 +42,8 @@ SourceFiles
namespace Foam namespace Foam
{ {
namespace blockEdges
{
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class polyLineEdge Declaration Class polyLineEdge Declaration
@ -104,6 +106,7 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End of namespace blockEdges
} // End namespace Foam } // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -30,6 +30,8 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam namespace Foam
{
namespace blockEdges
{ {
defineTypeNameAndDebug(splineEdge, 0); defineTypeNameAndDebug(splineEdge, 0);
@ -40,11 +42,12 @@ namespace Foam
Istream Istream
); );
} }
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::splineEdge::splineEdge Foam::blockEdges::splineEdge::splineEdge
( (
const pointField& points, const pointField& points,
const label start, const label start,
@ -57,7 +60,7 @@ Foam::splineEdge::splineEdge
{} {}
Foam::splineEdge::splineEdge Foam::blockEdges::splineEdge::splineEdge
( (
const searchableSurfaces& geometry, const searchableSurfaces& geometry,
const pointField& points, const pointField& points,
@ -81,19 +84,19 @@ Foam::splineEdge::splineEdge
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::splineEdge::~splineEdge() Foam::blockEdges::splineEdge::~splineEdge()
{} {}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * 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); return CatmullRomSpline::position(mu);
} }
Foam::scalar Foam::splineEdge::length() const Foam::scalar Foam::blockEdges::splineEdge::length() const
{ {
return CatmullRomSpline::length(); return CatmullRomSpline::length();
} }

View File

@ -22,7 +22,7 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class Class
Foam::splineEdge Foam::blockEdges::splineEdge
Description Description
A blockEdge interface for Catmull-Rom splines. A blockEdge interface for Catmull-Rom splines.
@ -32,8 +32,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef splineEdge_H #ifndef blockEdges_splineEdge_H
#define splineEdge_H #define blockEdges_splineEdge_H
#include "blockEdge.H" #include "blockEdge.H"
#include "CatmullRomSpline.H" #include "CatmullRomSpline.H"
@ -42,6 +42,8 @@ SourceFiles
namespace Foam namespace Foam
{ {
namespace blockEdges
{
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class splineEdge Declaration Class splineEdge Declaration
@ -104,6 +106,7 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End of namespace blockEdges
} // End namespace Foam } // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -32,8 +32,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef blockFaces_H #ifndef blockFace_H
#define blockFaces_H #define blockFace_H
#include "searchableSurfaces.H" #include "searchableSurfaces.H"

View File

@ -30,15 +30,18 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam namespace Foam
{
namespace blockFaces
{ {
defineTypeNameAndDebug(projectFace, 0); defineTypeNameAndDebug(projectFace, 0);
addToRunTimeSelectionTable(blockFace, projectFace, Istream); addToRunTimeSelectionTable(blockFace, projectFace, Istream);
} }
}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
const Foam::searchableSurface& Foam::projectFace::lookupSurface const Foam::searchableSurface& Foam::blockFaces::projectFace::lookupSurface
( (
const searchableSurfaces& geometry, const searchableSurfaces& geometry,
Istream& is Istream& is
@ -64,7 +67,7 @@ const Foam::searchableSurface& Foam::projectFace::lookupSurface
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::projectFace::projectFace Foam::blockFaces::projectFace::projectFace
( (
const searchableSurfaces& geometry, const searchableSurfaces& geometry,
Istream& is Istream& is
@ -77,7 +80,7 @@ Foam::projectFace::projectFace
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::projectFace::project(pointField& points) const void Foam::blockFaces::projectFace::project(pointField& points) const
{ {
List<pointIndexHit> hits; List<pointIndexHit> hits;
scalarField nearestDistSqr scalarField nearestDistSqr

View File

@ -22,7 +22,7 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class Class
Foam::projectFace Foam::blockFaces::projectFace
Description Description
Projects the given set of face points onto the selected surface of the Projects the given set of face points onto the selected surface of the
@ -33,8 +33,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef projectFace_H #ifndef blockFaces_projectFace_H
#define projectFace_H #define blockFaces_projectFace_H
#include "blockFace.H" #include "blockFace.H"
@ -42,6 +42,8 @@ SourceFiles
namespace Foam namespace Foam
{ {
namespace blockFaces
{
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class projectFace Declaration Class projectFace Declaration
@ -102,6 +104,7 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace blockFaces
} // End namespace Foam } // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -25,7 +25,6 @@ License
#include "blockMesh.H" #include "blockMesh.H"
#include "Time.H" #include "Time.H"
#include "Switch.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -57,7 +56,12 @@ Foam::blockMesh::blockMesh(const IOdictionary& dict, const word& regionName)
true true
), ),
scaleFactor_(1.0), scaleFactor_(1.0),
vertices_(dict.lookup("vertices")), blockVertices_
(
dict.lookup("vertices"),
blockVertex::iNew(geometry_)
),
vertices_(Foam::vertices(blockVertices_)),
topologyPtr_(createTopology(dict, regionName)) topologyPtr_(createTopology(dict, regionName))
{ {
Switch fastMerge(dict.lookupOrDefault<Switch>("fastMerge", false)); Switch fastMerge(dict.lookupOrDefault<Switch>("fastMerge", false));

View File

@ -46,6 +46,7 @@ SourceFiles
#include "searchableSurfaces.H" #include "searchableSurfaces.H"
#include "polyMesh.H" #include "polyMesh.H"
#include "IOdictionary.H" #include "IOdictionary.H"
#include "blockVertexList.H"
#include "blockEdgeList.H" #include "blockEdgeList.H"
#include "blockFaceList.H" #include "blockFaceList.H"
@ -73,7 +74,10 @@ class blockMesh
//- The scaling factor to convert to metres //- The scaling factor to convert to metres
scalar scaleFactor_; scalar scaleFactor_;
//- Vertices defining the block mesh (corners) //- The list of block vertices
blockVertexList blockVertices_;
//- The list of block vertex positions
pointField vertices_; pointField vertices_;
//- The list of curved edges //- The list of curved edges

View File

@ -342,7 +342,6 @@ Foam::polyMesh* Foam::blockMesh::createTopology
meshDescription.readIfPresent("scale", scaleFactor_); meshDescription.readIfPresent("scale", scaleFactor_);
} }
// Read the block edges // Read the block edges
if (meshDescription.found("edges")) if (meshDescription.found("edges"))
{ {

View File

@ -0,0 +1,105 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenFOAM Foundation
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "blockVertex.H"
#include "pointVertex.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(blockVertex, 0);
defineRunTimeSelectionTable(blockVertex, Istream);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::blockVertex::blockVertex()
{}
Foam::autoPtr<Foam::blockVertex> Foam::blockVertex::clone() const
{
NotImplemented;
return autoPtr<blockVertex>(nullptr);
}
Foam::autoPtr<Foam::blockVertex> Foam::blockVertex::New
(
const searchableSurfaces& geometry,
Istream& is
)
{
if (debug)
{
InfoInFunction << "Constructing blockVertex" << endl;
}
token firstToken(is);
if (firstToken.pToken() == token::BEGIN_LIST)
{
// Putback the opening bracket
is.putBack(firstToken);
return autoPtr<blockVertex>
(
new blockVertices::pointVertex(geometry, is)
);
}
else if (firstToken.isWord())
{
const word faceType(firstToken.wordToken());
IstreamConstructorTable::iterator cstrIter =
IstreamConstructorTablePtr_->find(faceType);
if (cstrIter == IstreamConstructorTablePtr_->end())
{
FatalErrorInFunction
<< "Unknown blockVertex type "
<< faceType << nl << nl
<< "Valid blockVertex types are" << endl
<< IstreamConstructorTablePtr_->sortedToc()
<< abort(FatalError);
}
return autoPtr<blockVertex>(cstrIter()(geometry, is));
}
else
{
FatalIOErrorInFunction(is)
<< "incorrect first token, expected <word> or '(', found "
<< firstToken.info()
<< exit(FatalIOError);
return autoPtr<blockVertex>(nullptr);
}
}
// ************************************************************************* //

View File

@ -0,0 +1,127 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenFOAM Foundation
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
Class
Foam::blockVertex
Description
Define a block vertex.
SourceFiles
blockVertex.C
\*---------------------------------------------------------------------------*/
#ifndef blockVertex_H
#define blockVertex_H
#include "searchableSurfaces.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class blockVertex Declaration
\*---------------------------------------------------------------------------*/
class blockVertex
{
public:
//- Runtime type information
TypeName("blockVertex");
// Declare run-time constructor selection tables
declareRunTimeSelectionTable
(
autoPtr,
blockVertex,
Istream,
(
const searchableSurfaces& geometry,
Istream& is
),
(geometry, is)
);
// Constructors
//- Construct null
blockVertex();
//- Clone function
virtual autoPtr<blockVertex> clone() const;
//- New function which constructs and returns pointer to a blockVertex
static autoPtr<blockVertex> New
(
const searchableSurfaces& geometry,
Istream&
);
//- Class used for the read-construction of
// PtrLists of blockVertex
class iNew
{
const searchableSurfaces& geometry_;
public:
iNew(const searchableSurfaces& geometry)
:
geometry_(geometry)
{}
autoPtr<blockVertex> operator()(Istream& is) const
{
return blockVertex::New(geometry_, is);
}
};
//- Destructor
virtual ~blockVertex()
{}
// Member Functions
virtual operator point() const = 0;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,66 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenFOAM Foundation
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
Typedef
Foam::blockVertexList
Description
A PtrList of blockVertex
\*---------------------------------------------------------------------------*/
#ifndef blockVertexList_H
#define blockVertexList_H
#include "blockVertex.H"
#include "PtrList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
typedef PtrList<blockVertex> blockVertexList;
inline pointField vertices(const blockVertexList& bvl)
{
pointField vertices(bvl.size());
forAll(bvl, pi)
{
vertices[pi] = bvl[pi];
}
return vertices;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,61 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenFOAM Foundation
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "pointVertex.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace blockVertices
{
defineTypeNameAndDebug(pointVertex, 0);
addToRunTimeSelectionTable(blockVertex, pointVertex, Istream);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::blockVertices::pointVertex::pointVertex
(
const searchableSurfaces& geometry,
Istream& is
)
:
vertex_(is)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::blockVertices::pointVertex::operator point() const
{
return vertex_;
}
// ************************************************************************* //

View File

@ -0,0 +1,96 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenFOAM Foundation
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
Class
Foam::blockVertices::pointVertex
Description
SourceFiles
pointVertex.C
\*---------------------------------------------------------------------------*/
#ifndef blockVertices_pointVertex_H
#define blockVertices_pointVertex_H
#include "blockVertex.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace blockVertices
{
/*---------------------------------------------------------------------------*\
Class pointVertex Declaration
\*---------------------------------------------------------------------------*/
class pointVertex
:
public blockVertex
{
// Private member data
//- The vertex location
point vertex_;
public:
//- Runtime type information
TypeName("point");
// Constructors
//- Construct from Istream setting pointsList
pointVertex
(
const searchableSurfaces& geometry,
Istream&
);
//- Destructor
virtual ~pointVertex()
{}
// Member Functions
virtual operator point() const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace blockVertices
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,100 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenFOAM Foundation
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "projectFace.H"
#include "unitConversion.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(projectFace, 0);
addToRunTimeSelectionTable(blockVertex, projectFace, Istream);
}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
const Foam::searchableSurface& Foam::projectFace::lookupSurface
(
const searchableSurfaces& geometry,
Istream& is
) const
{
word name(is);
forAll(geometry, i)
{
if (geometry[i].name() == name)
{
return geometry[i];
}
}
FatalIOErrorInFunction(is)
<< "Cannot find surface " << name << " in geometry"
<< exit(FatalIOError);
return geometry[0];
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::projectFace::projectFace
(
const searchableSurfaces& geometry,
Istream& is
)
:
blockVertex(is),
surface_(lookupSurface(geometry, is))
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::projectFace::project(pointField& points) const
{
List<pointIndexHit> hits;
scalarField nearestDistSqr
(
points.size(),
magSqr(points[0] - points[points.size()-1])
);
surface_.findNearest(points, nearestDistSqr, hits);
forAll(hits, i)
{
if (hits[i].hit())
{
points[i] = hits[i].hitPoint();
}
}
}
// ************************************************************************* //

View File

@ -0,0 +1,111 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenFOAM Foundation
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
Class
Foam::projectFace
Description
Projects the given set of face points onto the selected surface of the
geometry provided as a searchableSurfaces object.
SourceFiles
projectFace.C
\*---------------------------------------------------------------------------*/
#ifndef projectFace_H
#define projectFace_H
#include "blockVertex.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class projectFace Declaration
\*---------------------------------------------------------------------------*/
class projectFace
:
public blockVertex
{
// Private data
//- The surface onto which the points are projected
const searchableSurface& surface_;
// Private Member Functions
const searchableSurface& lookupSurface
(
const searchableSurfaces& geometry,
Istream& is
) const;
//- Disallow default bitwise copy construct
projectFace(const projectFace&);
//- Disallow default bitwise assignment
void operator=(const projectFace&);
public:
//- Runtime type information
TypeName("project");
// Constructors
//- Construct from Istream setting pointsList
projectFace
(
const searchableSurfaces& geometry,
Istream&
);
//- Destructor
virtual ~projectFace()
{}
// Member Functions
//- Project the given points onto the surface
virtual void project(pointField& points) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //