diff --git a/src/mesh/blockMesh/Make/files b/src/mesh/blockMesh/Make/files index 98e1c9cf6e41c06286cb4be0ee6ebfd361067b25..d17f08e044b3feb625ac2024994fefdcb1e7a498 100644 --- a/src/mesh/blockMesh/Make/files +++ b/src/mesh/blockMesh/Make/files @@ -1,3 +1,6 @@ +blockVertices/blockVertex/blockVertex.C +blockVertices/pointVertex/pointVertex.C + blockEdges/blockEdge/blockEdge.C blockEdges/lineDivide/lineDivide.C blockEdges/lineEdge/lineEdge.C diff --git a/src/mesh/blockMesh/blockDescriptor/blockDescriptor.H b/src/mesh/blockMesh/blockDescriptor/blockDescriptor.H index fd7ac5d1eb1248c512ed5fca4e61c4b18d1edb29..b0f7b1412cfef83aa8dca994b71f5df70864ceee 100644 --- a/src/mesh/blockMesh/blockDescriptor/blockDescriptor.H +++ b/src/mesh/blockMesh/blockDescriptor/blockDescriptor.H @@ -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 diff --git a/src/mesh/blockMesh/blockDescriptor/blockDescriptorEdges.C b/src/mesh/blockMesh/blockDescriptor/blockDescriptorEdges.C index 77ca51abdd1873aa2bf383d6da65b88969bc0cf6..ad8baf22d935d1cfeb035828848d887dc6c749fc 100644 --- a/src/mesh/blockMesh/blockDescriptor/blockDescriptorEdges.C +++ b/src/mesh/blockMesh/blockDescriptor/blockDescriptorEdges.C @@ -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] ); diff --git a/src/mesh/blockMesh/blockEdges/BSplineEdge/BSplineEdge.C b/src/mesh/blockMesh/blockEdges/BSplineEdge/BSplineEdge.C index 206d5db9574f11b532e7ecc9830c91bc2aec9ac9..4e16c18264c06d3925c628910180db9efefa51f1 100644 --- a/src/mesh/blockMesh/blockEdges/BSplineEdge/BSplineEdge.C +++ b/src/mesh/blockMesh/blockEdges/BSplineEdge/BSplineEdge.C @@ -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(); } diff --git a/src/mesh/blockMesh/blockEdges/BSplineEdge/BSplineEdge.H b/src/mesh/blockMesh/blockEdges/BSplineEdge/BSplineEdge.H index 8d11e15446494dc07f62c54c0941d7b84d7d877a..fcc799a425521047a5670a62b21718aa723ffa22 100644 --- a/src/mesh/blockMesh/blockEdges/BSplineEdge/BSplineEdge.H +++ b/src/mesh/blockMesh/blockEdges/BSplineEdge/BSplineEdge.H @@ -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 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/mesh/blockMesh/blockEdges/arcEdge/arcEdge.C b/src/mesh/blockMesh/blockEdges/arcEdge/arcEdge.C index 55597f2deac7d577b7d936285c168b04c3f44752..5d012e0531c35ebe7adae77608e9e55afc5e0443 100644 --- a/src/mesh/blockMesh/blockEdges/arcEdge/arcEdge.C +++ b/src/mesh/blockMesh/blockEdges/arcEdge/arcEdge.C @@ -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_); } diff --git a/src/mesh/blockMesh/blockEdges/arcEdge/arcEdge.H b/src/mesh/blockMesh/blockEdges/arcEdge/arcEdge.H index c41ae669b87e97719803ba68ca63391205e53f6e..b7a71ff6d102fb56a66e9f3239832c3d0bc66be2 100644 --- a/src/mesh/blockMesh/blockEdges/arcEdge/arcEdge.H +++ b/src/mesh/blockMesh/blockEdges/arcEdge/arcEdge.H @@ -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 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/mesh/blockMesh/blockEdges/blockEdge/blockEdge.H b/src/mesh/blockMesh/blockEdges/blockEdge/blockEdge.H index 24a64509ab4fb681c908fdc5683ebb1dfec4173d..86561f6abdef6e4774e6a65532192a4bfea509c6 100644 --- a/src/mesh/blockMesh/blockEdges/blockEdge/blockEdge.H +++ b/src/mesh/blockMesh/blockEdges/blockEdge/blockEdge.H @@ -33,8 +33,8 @@ SourceFiles \*---------------------------------------------------------------------------*/ -#ifndef blockEdges_H -#define blockEdges_H +#ifndef blockEdge_H +#define blockEdge_H #include "searchableSurfaces.H" diff --git a/src/mesh/blockMesh/blockEdges/lineEdge/lineEdge.C b/src/mesh/blockMesh/blockEdges/lineEdge/lineEdge.C index 5ceaafc5c5e382b66e29a76ac53d084b811d0965..45b4434850a1f3cb5964e86836c08aa143e2e25a 100644 --- a/src/mesh/blockMesh/blockEdges/lineEdge/lineEdge.C +++ b/src/mesh/blockMesh/blockEdges/lineEdge/lineEdge.C @@ -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_]); } diff --git a/src/mesh/blockMesh/blockEdges/lineEdge/lineEdge.H b/src/mesh/blockMesh/blockEdges/lineEdge/lineEdge.H index 7eb5de7ec6a9b91c86a13bf679276272604f07da..e70ffd10bf79477159eaa3e3ed15729963361200 100644 --- a/src/mesh/blockMesh/blockEdges/lineEdge/lineEdge.H +++ b/src/mesh/blockMesh/blockEdges/lineEdge/lineEdge.H @@ -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 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/mesh/blockMesh/blockEdges/polyLineEdge/polyLineEdge.C b/src/mesh/blockMesh/blockEdges/polyLineEdge/polyLineEdge.C index c79097ce20e6338cad13a180f62960d0b8b37c8c..1396636a66f62ebe1ed0be3d969e712e52a169d3 100644 --- a/src/mesh/blockMesh/blockEdges/polyLineEdge/polyLineEdge.C +++ b/src/mesh/blockMesh/blockEdges/polyLineEdge/polyLineEdge.C @@ -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_; } diff --git a/src/mesh/blockMesh/blockEdges/polyLineEdge/polyLineEdge.H b/src/mesh/blockMesh/blockEdges/polyLineEdge/polyLineEdge.H index 7458b393e893fc6680bd076e64ad9b257fc84e6b..adcd7fd1b47c641467ad89d1c2513da007bbef9d 100644 --- a/src/mesh/blockMesh/blockEdges/polyLineEdge/polyLineEdge.H +++ b/src/mesh/blockMesh/blockEdges/polyLineEdge/polyLineEdge.H @@ -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 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/mesh/blockMesh/blockEdges/splineEdge/splineEdge.C b/src/mesh/blockMesh/blockEdges/splineEdge/splineEdge.C index 511220bffc9b03307bff4b5d914b0a96fd8e23c7..5a6be74f4e8dd94b6b87d1fd777825f72eb069de 100644 --- a/src/mesh/blockMesh/blockEdges/splineEdge/splineEdge.C +++ b/src/mesh/blockMesh/blockEdges/splineEdge/splineEdge.C @@ -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(); } diff --git a/src/mesh/blockMesh/blockEdges/splineEdge/splineEdge.H b/src/mesh/blockMesh/blockEdges/splineEdge/splineEdge.H index cb9afb90322fc6c1aa4d184458d9ef3bf97db67f..4080b606c82a7b72698632567851e96c5ecc5da5 100644 --- a/src/mesh/blockMesh/blockEdges/splineEdge/splineEdge.H +++ b/src/mesh/blockMesh/blockEdges/splineEdge/splineEdge.H @@ -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 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/mesh/blockMesh/blockFaces/blockFace/blockFace.H b/src/mesh/blockMesh/blockFaces/blockFace/blockFace.H index bbee0cb818a46df6f315942f3f44772a0bf7ebbc..b060031d5a44c578740df1fc44b35efebab84aeb 100644 --- a/src/mesh/blockMesh/blockFaces/blockFace/blockFace.H +++ b/src/mesh/blockMesh/blockFaces/blockFace/blockFace.H @@ -32,8 +32,8 @@ SourceFiles \*---------------------------------------------------------------------------*/ -#ifndef blockFaces_H -#define blockFaces_H +#ifndef blockFace_H +#define blockFace_H #include "searchableSurfaces.H" diff --git a/src/mesh/blockMesh/blockFaces/projectFace/projectFace.C b/src/mesh/blockMesh/blockFaces/projectFace/projectFace.C index 4876230c077e1b6efbeaa0af388247c605a6be1c..fbc40094de60634bf5f8b9e3b949090736d3d271 100644 --- a/src/mesh/blockMesh/blockFaces/projectFace/projectFace.C +++ b/src/mesh/blockMesh/blockFaces/projectFace/projectFace.C @@ -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 diff --git a/src/mesh/blockMesh/blockFaces/projectFace/projectFace.H b/src/mesh/blockMesh/blockFaces/projectFace/projectFace.H index 787f5fe152855fd7b12dc7cef16879b4146fc160..44a2a25c54071954549c35cd94555158ddfe7e4f 100644 --- a/src/mesh/blockMesh/blockFaces/projectFace/projectFace.H +++ b/src/mesh/blockMesh/blockFaces/projectFace/projectFace.H @@ -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 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/mesh/blockMesh/blockMesh/blockMesh.C b/src/mesh/blockMesh/blockMesh/blockMesh.C index 458b7ee2b6de99ee204dbefb78e0958537f10a74..366288e5ae72ef566d50681c0262a60650a2844f 100644 --- a/src/mesh/blockMesh/blockMesh/blockMesh.C +++ b/src/mesh/blockMesh/blockMesh/blockMesh.C @@ -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)); diff --git a/src/mesh/blockMesh/blockMesh/blockMesh.H b/src/mesh/blockMesh/blockMesh/blockMesh.H index 2b07036d3b9b711ce4bb157067957a138f32ff90..fcd3698c34027ee3f08cf42be98ce2751a5d25af 100644 --- a/src/mesh/blockMesh/blockMesh/blockMesh.H +++ b/src/mesh/blockMesh/blockMesh/blockMesh.H @@ -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 diff --git a/src/mesh/blockMesh/blockMesh/blockMeshTopology.C b/src/mesh/blockMesh/blockMesh/blockMeshTopology.C index aaa76ac22d39cabcd8b95fcff14557964e03d538..ab998442051ad93e6b1bf0bc884573f33f857f43 100644 --- a/src/mesh/blockMesh/blockMesh/blockMeshTopology.C +++ b/src/mesh/blockMesh/blockMesh/blockMeshTopology.C @@ -342,7 +342,6 @@ Foam::polyMesh* Foam::blockMesh::createTopology meshDescription.readIfPresent("scale", scaleFactor_); } - // Read the block edges if (meshDescription.found("edges")) { diff --git a/src/mesh/blockMesh/blockVertices/blockVertex/blockVertex.C b/src/mesh/blockMesh/blockVertices/blockVertex/blockVertex.C new file mode 100644 index 0000000000000000000000000000000000000000..fe8ab41dc590827f32ef1f0a22e6b9586c83871c --- /dev/null +++ b/src/mesh/blockMesh/blockVertices/blockVertex/blockVertex.C @@ -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); + } +} + + +// ************************************************************************* // diff --git a/src/mesh/blockMesh/blockVertices/blockVertex/blockVertex.H b/src/mesh/blockMesh/blockVertices/blockVertex/blockVertex.H new file mode 100644 index 0000000000000000000000000000000000000000..7d5bb9fbd635c16ca9a6da3774578f8b7640fdab --- /dev/null +++ b/src/mesh/blockMesh/blockVertices/blockVertex/blockVertex.H @@ -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 + +// ************************************************************************* // diff --git a/src/mesh/blockMesh/blockVertices/blockVertex/blockVertexList.H b/src/mesh/blockMesh/blockVertices/blockVertex/blockVertexList.H new file mode 100644 index 0000000000000000000000000000000000000000..bfab04c9b27a35b0a91f81cc80f6dccf9e842db6 --- /dev/null +++ b/src/mesh/blockMesh/blockVertices/blockVertex/blockVertexList.H @@ -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 + +// ************************************************************************* // diff --git a/src/mesh/blockMesh/blockVertices/pointVertex/pointVertex.C b/src/mesh/blockMesh/blockVertices/pointVertex/pointVertex.C new file mode 100644 index 0000000000000000000000000000000000000000..4b3120d98b2a3bea482f4366650d0ec5293ad573 --- /dev/null +++ b/src/mesh/blockMesh/blockVertices/pointVertex/pointVertex.C @@ -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_; +} + + +// ************************************************************************* // diff --git a/src/mesh/blockMesh/blockVertices/pointVertex/pointVertex.H b/src/mesh/blockMesh/blockVertices/pointVertex/pointVertex.H new file mode 100644 index 0000000000000000000000000000000000000000..9df74a713103175169371fb1184f0fb6cea224cc --- /dev/null +++ b/src/mesh/blockMesh/blockVertices/pointVertex/pointVertex.H @@ -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 + +// ************************************************************************* // diff --git a/src/mesh/blockMesh/blockVertices/projectVertex/projectVertex.C b/src/mesh/blockMesh/blockVertices/projectVertex/projectVertex.C new file mode 100644 index 0000000000000000000000000000000000000000..a3d6c28d7e5a91c36df4492b951953f236ece2b3 --- /dev/null +++ b/src/mesh/blockMesh/blockVertices/projectVertex/projectVertex.C @@ -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(); + } + } +} + + +// ************************************************************************* // diff --git a/src/mesh/blockMesh/blockVertices/projectVertex/projectVertex.H b/src/mesh/blockMesh/blockVertices/projectVertex/projectVertex.H new file mode 100644 index 0000000000000000000000000000000000000000..23e4fd10bfa4827db2d71348bd16a0256aeb3253 --- /dev/null +++ b/src/mesh/blockMesh/blockVertices/projectVertex/projectVertex.H @@ -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 + +// ************************************************************************* //