From fba3c2a732a47020864467d9d6d193aaa82a8a27 Mon Sep 17 00:00:00 2001 From: graham <graham.macpherson@strath.ac.uk> Date: Mon, 6 Apr 2009 15:11:54 +0100 Subject: [PATCH] Added pointFile initialPointsMethod. Lots of tweaks and setting up. --- .../mesh/generation/cvMesh/cvMeshDict | 184 ------------------ src/conformalVoronoiMesh/Make/files | 3 + .../conformalVoronoiMesh.C | 33 +++- .../conformalVoronoiMesh.H | 12 +- .../conformalVoronoiMeshI.H | 30 +-- .../cvControls/cvControls.C | 2 +- .../cvSearchableSurfaces.C | 89 ++++----- .../cvSearchableSurfaces.H | 64 ++---- .../cvSearchableSurfacesI.H | 59 ++++++ .../initialPointsMethod/initialPointsMethod.C | 9 +- .../initialPointsMethod/initialPointsMethod.H | 4 + .../initialPointsMethod/pointFile/pointFile.C | 97 +++++++++ .../initialPointsMethod/pointFile/pointFile.H | 101 ++++++++++ .../uniformGrid/uniformGrid.C | 2 +- 14 files changed, 388 insertions(+), 301 deletions(-) delete mode 100644 applications/utilities/mesh/generation/cvMesh/cvMeshDict create mode 100644 src/conformalVoronoiMesh/cvSearchableSurfaces/cvSearchableSurfacesI.H create mode 100644 src/conformalVoronoiMesh/initialPointsMethod/pointFile/pointFile.C create mode 100644 src/conformalVoronoiMesh/initialPointsMethod/pointFile/pointFile.H diff --git a/applications/utilities/mesh/generation/cvMesh/cvMeshDict b/applications/utilities/mesh/generation/cvMesh/cvMeshDict deleted file mode 100644 index bbf32682ba9..00000000000 --- a/applications/utilities/mesh/generation/cvMesh/cvMeshDict +++ /dev/null @@ -1,184 +0,0 @@ -/*---------------------------------------------------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: 1.5 | -| \\ / A nd | Web: http://www.openfoam.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ - -FoamFile -{ - version 2.0; - format ascii; - - root ""; - case ""; - instance ""; - local ""; - - class dictionary; - object cvMeshDict; -} - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - - -geometry -{ - channelWalls - { - type searchableBox; - min (-1 -1 -1); - max ( 2 2 2); - } - - dm_baffle.obj - { - type triSurfaceMesh; - } - - dangermouse.obj - { - type triSurfaceMesh; - } -} - - -motionControl -{ - defaultCellSize 0.06; - - // Assign a priority to all requests for cell sizes, the highest overrules. - defaultPriority 0; - - cellSizeControlGeometry - { - - } - - relaxationModel linear; - - linearCoeffs - { - relaxationStart 0.8; - relaxationEnd 0.0; - } - - alignmentSearchSpokes 36; - - alignmentAcceptanceAngle 48; - - targetCellSizeCoeff 1.0; - - pointInsertionCriteria - { - cellCentreDistCoeff 1.75; - faceAreaRatioCoeff 0.0025; - alignmentAcceptanceAngle 21.5; - } - - pointRemovalCriteria - { - cellCentreDistCoeff 0.65; - } - - faceAreaWeightModel piecewiseLinearRamp; - - piecewiseLinearRampCoeffs - { - lowerWeight 0; - lowerAreaFraction 0.707; - upperWeight 1; - upperAreaFraction 1.0; - } -} - - -surfaceConformation -{ - locationInMesh (0.1 0.1 0.2); - - // A faction of the local target cell size - pointPairDistanceCoeff 0.05; - - maxQuadAngle 125; - - geometryToConformTo - { - // Independently specify the featureMethod of individual parts of the - // geometry. Allows some parts to calculate their own features - // (including analytical surfaces), others to be read from file. - // Optional, if ommited, assume no features. - - channelWalls - { - featureMethod extractFeatures; - - extractFeaturesDetails - { - // Included angle used to identify the surface's own feature - // edges. 0 = no features, 180 = all features - featureAngle 145; - } - } - - dm_baffle.obj - { - // Allows surfaces to be use to generate baffles, default to no. - baffleSurface yes; - - featureMethod featureEdgeMesh; - - featureEdgeMeshDetails - { - featureEdgeMesh "LOCATION OF FEATUREEDGEMESH" - } - } - - dangermouse.obj - { - // Setting treatAsClosed true ignores whether or not the surface is - // closed when asked to determine the volumeType of a point (whether - // it is inside or outside). Intended to allow imperfect surface - // files to be meshed. Only valid for triSurfaceMesh types, default - // to false. - treatAsClosed true; - - featureMethod triSurfaceFeatureSet; - - trisurfacefeatureSetDetails - { - featureSet #include "$FOAM_CASE/constant/triSurface/dangermouse.fSet" - } - } - } - - initialPoints - { - minimumSurfaceDistance 0.0075; - - initialPointsMethod uniformGrid; - //initialPointsMethod pointsFile; - - uniformGridDetails - { - initialCellSize 0.005; - randomiseInitialGrid yes; - randomPerturbationCoeff 0.1; - } - - pointsFileDetails - { - pointsFile "$FOAM_CASE/40/internalDelaunayVertices" - } - } -} - - -polyMeshFiltering -{ - // A fraction of the local target cell size - minimumEdgeLengthCoeff 0.2; -} - -// ************************************************************************* // diff --git a/src/conformalVoronoiMesh/Make/files b/src/conformalVoronoiMesh/Make/files index 7fc57217f04..87c7993414d 100644 --- a/src/conformalVoronoiMesh/Make/files +++ b/src/conformalVoronoiMesh/Make/files @@ -4,7 +4,10 @@ conformalVoronoiMesh/conformalVoronoiMesh.C cvControls/cvControls.C +cvSearchableSurfaces/cvSearchableSurfaces.C + initialPointsMethod/initialPointsMethod/initialPointsMethod.C initialPointsMethod/uniformGrid/uniformGrid.C +initialPointsMethod/pointFile/pointFile.C LIB = $(FOAM_LIBBIN)/libconformalVoronoiMesh diff --git a/src/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.C b/src/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.C index b5ec1a06ecf..2d87019cb9f 100644 --- a/src/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.C +++ b/src/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.C @@ -39,6 +39,7 @@ Foam::conformalVoronoiMesh::conformalVoronoiMesh : HTriangulation(), runTime_(runTime), + cvSurfaces_(*this, cvMeshDict.subDict("geometry")), cvMeshControls_(*this, cvMeshDict), startOfInternalPoints_(0), startOfSurfacePointPairs_(0), @@ -51,7 +52,15 @@ Foam::conformalVoronoiMesh::conformalVoronoiMesh ) ) { + timeCheck(); + + insertFeaturePoints(); + + timeCheck(); + insertInitialPoints(); + + timeCheck(); } @@ -63,14 +72,34 @@ Foam::conformalVoronoiMesh::~conformalVoronoiMesh() // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // +void Foam::conformalVoronoiMesh::timeCheck() const +{ + Info<< nl << "--- [ " << runTime_.elapsedCpuTime() << "s ] --- " << endl; +} + + +void Foam::conformalVoronoiMesh::insertFeaturePoints() +{ + Info<< nl << "Inserting feature points" << endl; + + Info<< " Conforming to " << "XXX" << " feature locations" << nl + << " Inserting " << "YYY" << " points" << endl; +} + + +void Foam::conformalVoronoiMesh::reinsertFeaturePoints() +{ + +} + + void Foam::conformalVoronoiMesh::insertInitialPoints() { startOfInternalPoints_ = number_of_vertices(); label nVert = startOfInternalPoints_; - Info<< nl << "Inserting initial points" << nl - << " " << nVert << " existing points" << endl; + Info<< nl << "Inserting initial points" << endl; std::vector<Point> initialPoints = initialPointsMethod_->initialPoints(); diff --git a/src/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.H b/src/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.H index a5a61ebccf4..43d89b67b60 100644 --- a/src/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.H +++ b/src/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.H @@ -42,10 +42,9 @@ SourceFiles #include "CGALTriangulation3Ddefs.H" +#include "cvSearchableSurfaces.H" #include "cvControls.H" -#include "pointIOField.H" #include "DynamicList.H" -#include "Switch.H" #include "Time.H" #include "polyMesh.H" #include "triSurfaceTools.H" @@ -74,6 +73,9 @@ class conformalVoronoiMesh //- The time registry of the application const Time& runTime_; + //- The surfaces to conform to and to use for refinement + cvSearchableSurfaces cvSurfaces_; + //- Controls for the conformal Voronoi meshing process cvControls cvMeshControls_; @@ -98,6 +100,9 @@ class conformalVoronoiMesh //- Disallow default bitwise assignment void operator=(const conformalVoronoiMesh&); + //- Write the elapsedCpuTime + void timeCheck() const; + //- Insert point and return it's index inline label insertPoint ( @@ -162,6 +167,9 @@ public: // Access + //- Return the Time object + inline const Time& time() const; + //- Return the cvMeshControls object inline const cvControls& cvMeshControls() const; diff --git a/src/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshI.H b/src/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshI.H index 42bc9293111..3966417b4e3 100644 --- a/src/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshI.H +++ b/src/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshI.H @@ -26,31 +26,19 @@ License // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - - -// * * * * * * * * * * * * * * * * Destructors * * * * * * * * * * * * * * * // - - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // - - -// * * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * // - - -// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // - - -// * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * * // +inline const Foam::Time& Foam::conformalVoronoiMesh::time() const +{ + return runTime_; +} -// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * // +inline const Foam::cvControls& Foam::conformalVoronoiMesh::cvMeshControls() + const +{ + return cvMeshControls_; +} // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/conformalVoronoiMesh/cvControls/cvControls.C b/src/conformalVoronoiMesh/cvControls/cvControls.C index faca31bdeae..5041924a35a 100644 --- a/src/conformalVoronoiMesh/cvControls/cvControls.C +++ b/src/conformalVoronoiMesh/cvControls/cvControls.C @@ -38,7 +38,7 @@ Foam::cvControls::cvControls cvMesh_(cvMesh), cvMeshDict_(cvMeshDict) { - Info<< nl << "Reading cvMeshDict" << endl; + Info<< nl << "Reading " << cvMeshDict_.name() << endl; } diff --git a/src/conformalVoronoiMesh/cvSearchableSurfaces/cvSearchableSurfaces.C b/src/conformalVoronoiMesh/cvSearchableSurfaces/cvSearchableSurfaces.C index fcd212d47bf..f01781726fa 100644 --- a/src/conformalVoronoiMesh/cvSearchableSurfaces/cvSearchableSurfaces.C +++ b/src/conformalVoronoiMesh/cvSearchableSurfaces/cvSearchableSurfaces.C @@ -25,46 +25,33 @@ License \*---------------------------------------------------------------------------*/ #include "cvSearchableSurfaces.H" - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -const dataType Foam::cvSearchableSurfaces::staticData(); - - -// * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * * // - +#include "conformalVoronoiMesh.H" // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::cvSearchableSurfaces::cvSearchableSurfaces() +Foam::cvSearchableSurfaces::cvSearchableSurfaces +( + const conformalVoronoiMesh& cvMesh, + const dictionary& geometryDict +) : - baseClassName(), - data_() + searchableSurfaces + ( + IOobject + ( + "cvSearchableSurfacesDirectory", + cvMesh.time().constant(), + "triSurface", + cvMesh.time(), + IOobject::MUST_READ, + IOobject::NO_WRITE + ), + geometryDict + ), + cvMesh_(cvMesh) {} -Foam::cvSearchableSurfaces::cvSearchableSurfaces(const dataType& data) -: - baseClassName(), - data_(data) -{} - - -Foam::cvSearchableSurfaces::cvSearchableSurfaces(const cvSearchableSurfaces&) -: - baseClassName(), - data_() -{} - - -// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * // - -Foam::autoPtr<Foam::cvSearchableSurfaces> Foam::cvSearchableSurfaces::New() -{ - return autoPtr<cvSearchableSurfaces>(new cvSearchableSurfaces); -} - - // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // Foam::cvSearchableSurfaces::~cvSearchableSurfaces() @@ -74,29 +61,39 @@ Foam::cvSearchableSurfaces::~cvSearchableSurfaces() // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // -// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // - // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // +bool Foam::cvSearchableSurfaces::inside(const point& pt) const +{ + +} -// * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * * // -void Foam::cvSearchableSurfaces::operator=(const cvSearchableSurfaces& rhs) +bool Foam::cvSearchableSurfaces::outside(const point& pt) const { - // Check for assignment to self - if (this == &rhs) - { - FatalErrorIn("Foam::cvSearchableSurfaces::operator=(const Foam::cvSearchableSurfaces&)") - << "Attempted assignment to self" - << abort(FatalError); - } + } -// * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * * // + +bool Foam::cvSearchableSurfaces::wellInside +( + const point& pt, + const scalar dist2 +) const +{ + +} -// * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * * // +bool Foam::cvSearchableSurfaces::wellOutside +( + const point& pt, + const scalar dist2 +) const +{ + +} // ************************************************************************* // diff --git a/src/conformalVoronoiMesh/cvSearchableSurfaces/cvSearchableSurfaces.H b/src/conformalVoronoiMesh/cvSearchableSurfaces/cvSearchableSurfaces.H index 19794727e95..9188e377216 100644 --- a/src/conformalVoronoiMesh/cvSearchableSurfaces/cvSearchableSurfaces.H +++ b/src/conformalVoronoiMesh/cvSearchableSurfaces/cvSearchableSurfaces.H @@ -27,7 +27,7 @@ Class Description The surface geometry to be meshed with a conformalVoronoiMesh, adding - inside/outside queries and surfaceFeatures + inside/outside queries and features of the surface SourceFiles cvSearchableSurfaces.C @@ -45,19 +45,21 @@ SourceFiles namespace Foam { +// Forward declaration of classes +class conformalVoronoiMesh; + /*---------------------------------------------------------------------------*\ Class cvSearchableSurfaces Declaration \*---------------------------------------------------------------------------*/ class cvSearchableSurfaces : - public baseClassName + public searchableSurfaces { // Private data - //- Description of data_ - dataType data_; - + //- Reference to the conformalVoronoiMesh holding this cvControls object + const conformalVoronoiMesh& cvMesh_; // Private Member Functions @@ -70,32 +72,14 @@ class cvSearchableSurfaces public: - // Static data members - - //- Static data staticData - static const dataType staticData; - - // Constructors - //- Construct null - cvSearchableSurfaces(); - //- Construct from components - cvSearchableSurfaces(const dataType& data); - - //- Construct from Istream - cvSearchableSurfaces(Istream&); - - //- Construct as copy - cvSearchableSurfaces(const cvSearchableSurfaces&); - - - // Selectors - - //- Select null constructed - static autoPtr<cvSearchableSurfaces> New(); - + cvSearchableSurfaces + ( + const conformalVoronoiMesh& cvMesh, + const dictionary& geometryDict + ); //- Destructor ~cvSearchableSurfaces(); @@ -105,26 +89,20 @@ public: // Access - // Check - - // Edit - - // Write - - - // Member Operators - - void operator=(const cvSearchableSurfaces&); + // Query + //- Check if point is inside surfacesToConformTo + bool inside(const point& pt) const; - // Friend Functions + //- Check if point is outside surfacesToConformTo + bool outside(const point& pt) const; - // Friend Operators + //- Check if point is inside surfacesToConformTo by at least dist2 + bool wellInside(const point& pt, const scalar dist2) const; - // IOstream Operators + //- Check if point is outside surfacesToConformTo by at least dist2 + bool wellOutside(const point& pt, const scalar dist2) const; - friend Istream& operator>>(Istream&, cvSearchableSurfaces&); - friend Ostream& operator<<(Ostream&, const cvSearchableSurfaces&); }; diff --git a/src/conformalVoronoiMesh/cvSearchableSurfaces/cvSearchableSurfacesI.H b/src/conformalVoronoiMesh/cvSearchableSurfaces/cvSearchableSurfacesI.H new file mode 100644 index 00000000000..42bc9293111 --- /dev/null +++ b/src/conformalVoronoiMesh/cvSearchableSurfaces/cvSearchableSurfacesI.H @@ -0,0 +1,59 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + + +// * * * * * * * * * * * * * * * * Destructors * * * * * * * * * * * * * * * // + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + + +// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // + + +// * * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * // + + +// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // + + +// * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * * // + + +// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * // + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + + +// ************************************************************************* // diff --git a/src/conformalVoronoiMesh/initialPointsMethod/initialPointsMethod/initialPointsMethod.C b/src/conformalVoronoiMesh/initialPointsMethod/initialPointsMethod/initialPointsMethod.C index d244f8b4a1a..738d3ab0746 100644 --- a/src/conformalVoronoiMesh/initialPointsMethod/initialPointsMethod/initialPointsMethod.C +++ b/src/conformalVoronoiMesh/initialPointsMethod/initialPointsMethod/initialPointsMethod.C @@ -49,7 +49,14 @@ initialPointsMethod::initialPointsMethod : dictionary(initialPointsDict), cvMesh_(cvMesh), - detailsDict_(subDict(type + "Details")) + detailsDict_(subDict(type + "Details")), + minimumSurfaceDistance_ + ( + readScalar + ( + initialPointsDict.lookup("minimumSurfaceDistance") + ) + ) {} diff --git a/src/conformalVoronoiMesh/initialPointsMethod/initialPointsMethod/initialPointsMethod.H b/src/conformalVoronoiMesh/initialPointsMethod/initialPointsMethod/initialPointsMethod.H index b52eed201df..c60ef2ff566 100644 --- a/src/conformalVoronoiMesh/initialPointsMethod/initialPointsMethod/initialPointsMethod.H +++ b/src/conformalVoronoiMesh/initialPointsMethod/initialPointsMethod/initialPointsMethod.H @@ -66,6 +66,10 @@ protected: //- Method details dictionary dictionary detailsDict_; + //- Only allow the placement of initial points that are within the + // surfaces to be meshed by minimumSurfaceDistance + scalar minimumSurfaceDistance_; + private: // Private Member Functions diff --git a/src/conformalVoronoiMesh/initialPointsMethod/pointFile/pointFile.C b/src/conformalVoronoiMesh/initialPointsMethod/pointFile/pointFile.C new file mode 100644 index 00000000000..97ebb3d6884 --- /dev/null +++ b/src/conformalVoronoiMesh/initialPointsMethod/pointFile/pointFile.C @@ -0,0 +1,97 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "pointFile.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +defineTypeNameAndDebug(pointFile, 0); +addToRunTimeSelectionTable(initialPointsMethod, pointFile, dictionary); + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +pointFile::pointFile +( + const dictionary& initialPointsDict, + const conformalVoronoiMesh& cvMesh +) +: + initialPointsMethod(typeName, initialPointsDict, cvMesh), + pointFileName_(detailsDict().lookup("pointFile")) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +std::vector<Vb::Point> pointFile::initialPoints() const +{ + pointIOField points + ( + IOobject + ( + pointFileName_.name(), + pointFileName_.path(), + cvMesh_.time(), + IOobject::MUST_READ, + IOobject::NO_WRITE + ) + ); + + std::vector<Vb::Point> initialPoints; + + forAll(points, i) + { + const point& p = points[i]; + + // TODO Check if inside the surface + + initialPoints.push_back(Vb::Point(p.x(), p.y(), p.z())); + } + + label nPointsRejected = points.size() - initialPoints.size(); + + if (nPointsRejected) + { + Info<< " " << nPointsRejected << " points rejected from " + << pointFileName_.name() << endl; + } + + + return initialPoints; +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/conformalVoronoiMesh/initialPointsMethod/pointFile/pointFile.H b/src/conformalVoronoiMesh/initialPointsMethod/pointFile/pointFile.H new file mode 100644 index 00000000000..286c24b78eb --- /dev/null +++ b/src/conformalVoronoiMesh/initialPointsMethod/pointFile/pointFile.H @@ -0,0 +1,101 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + Foam::pointFile + +Description + Inserts points at locations specified in a pointFile into the surfaces to + be conformed to of the conformalVoronoiMesh + +SourceFiles + pointFile.C + +\*---------------------------------------------------------------------------*/ + +#ifndef pointFile_H +#define pointFile_H + +#include "fileName.H" +#include "pointIOField.H" +#include "initialPointsMethod.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class pointFile Declaration +\*---------------------------------------------------------------------------*/ + +class pointFile +: + public initialPointsMethod +{ + +private: + + // Private data + + //- The initial cell spacing + fileName pointFileName_; + + +public: + + //- Runtime type information + TypeName("pointFile"); + + // Constructors + + //- Construct from components + pointFile + ( + const dictionary& initialPointsDict, + const conformalVoronoiMesh& cvMesh + ); + + + //- Destructor + virtual ~pointFile() + {} + + + // Member Functions + + //- Return the initial points for the conformalVoronoiMesh + virtual std::vector<Vb::Point> initialPoints() const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/conformalVoronoiMesh/initialPointsMethod/uniformGrid/uniformGrid.C b/src/conformalVoronoiMesh/initialPointsMethod/uniformGrid/uniformGrid.C index de21564c5a8..40dcf9c2379 100644 --- a/src/conformalVoronoiMesh/initialPointsMethod/uniformGrid/uniformGrid.C +++ b/src/conformalVoronoiMesh/initialPointsMethod/uniformGrid/uniformGrid.C @@ -72,7 +72,7 @@ std::vector<Vb::Point> uniformGrid::initialPoints() const // scalar zR = qSurf_.bb().max().z() - z0; // int nk = int(zR/controls_.minCellSize) + 1; - Info<< "Is this actually uniform? or is it fitting the span with an " + Info<< " Is this actually uniform? or is it fitting the span with an " << "integer number?" << endl; scalar x0 = 0.0; -- GitLab