mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Ability to fill any initial points properly into any surfaces. Using conformationSurfaces class to handle geometric queries to the surfaces to be conformed to.
This commit is contained in:
@ -13,6 +13,7 @@ EXE_INC = \
|
||||
-I$(LIB_SRC)/conformalVoronoiMesh/lnInclude \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/edgeMesh/lnInclude \
|
||||
-I$(LIB_SRC)/dynamicMesh/lnInclude \
|
||||
-I$(LIB_SRC)/triSurface/lnInclude
|
||||
|
||||
@ -21,6 +22,7 @@ EXE_LIBS = \
|
||||
-L$(WM_THIRD_PARTY_DIR)/mpfr-2.4.1/platforms/$(WM_ARCH)$(WM_COMPILER_ARCH)/lib \
|
||||
-lconformalVoronoiMesh \
|
||||
-lmeshTools \
|
||||
-ledgeMesh \
|
||||
-ltriSurface \
|
||||
-ldynamicMesh \
|
||||
-lboost_thread-gcc43-mt-1_38 \
|
||||
|
||||
@ -1,10 +1,11 @@
|
||||
#include CGAL_FILES
|
||||
|
||||
conformalVoronoiMesh/conformalVoronoiMesh.C
|
||||
conformalVoronoiMesh/conformalVoronoiMeshIO.C
|
||||
|
||||
cvControls/cvControls.C
|
||||
|
||||
cvSearchableSurfaces/cvSearchableSurfaces.C
|
||||
conformationSurfaces/conformationSurfaces.C
|
||||
|
||||
initialPointsMethod/initialPointsMethod/initialPointsMethod.C
|
||||
initialPointsMethod/uniformGrid/uniformGrid.C
|
||||
|
||||
@ -12,6 +12,7 @@ EXE_INC = \
|
||||
-I$(WM_THIRD_PARTY_DIR)/mpfr-2.4.1 \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/edgeMesh/lnInclude \
|
||||
-I$(LIB_SRC)/dynamicMesh/lnInclude \
|
||||
-I$(LIB_SRC)/triSurface/lnInclude
|
||||
|
||||
@ -19,6 +20,7 @@ EXE_LIBS = \
|
||||
-L$(BOOST_ROOT)/lib \
|
||||
-L$(WM_THIRD_PARTY_DIR)/mpfr-2.4.1/platforms/$(WM_ARCH)$(WM_COMPILER_ARCH)/lib \
|
||||
-lmeshTools \
|
||||
-ledgeMesh \
|
||||
-ltriSurface \
|
||||
-ldynamicMesh \
|
||||
-lboost_thread-gcc43-mt-1_38 \
|
||||
|
||||
@ -39,7 +39,25 @@ Foam::conformalVoronoiMesh::conformalVoronoiMesh
|
||||
:
|
||||
HTriangulation(),
|
||||
runTime_(runTime),
|
||||
cvSurfaces_(*this, cvMeshDict.subDict("geometry")),
|
||||
allGeometry_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"cvSearchableSurfacesDirectory",
|
||||
runTime_.constant(),
|
||||
"triSurface",
|
||||
runTime_,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
cvMeshDict.subDict("geometry")
|
||||
),
|
||||
geometryToConformTo_
|
||||
(
|
||||
*this,
|
||||
allGeometry_,
|
||||
cvMeshDict.subDict("surfaceConformation")
|
||||
),
|
||||
cvMeshControls_(*this, cvMeshDict),
|
||||
startOfInternalPoints_(0),
|
||||
startOfSurfacePointPairs_(0),
|
||||
@ -47,7 +65,7 @@ Foam::conformalVoronoiMesh::conformalVoronoiMesh
|
||||
(
|
||||
initialPointsMethod::New
|
||||
(
|
||||
cvMeshDict.subDict("surfaceConformation").subDict("initialPoints"),
|
||||
cvMeshDict.subDict("initialPoints"),
|
||||
*this
|
||||
)
|
||||
)
|
||||
@ -123,6 +141,8 @@ void Foam::conformalVoronoiMesh::insertInitialPoints()
|
||||
vit->index() = nVert++;
|
||||
}
|
||||
}
|
||||
|
||||
writePoints("initialPoints.obj", true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -42,11 +42,13 @@ SourceFiles
|
||||
|
||||
#include "CGALTriangulation3Ddefs.H"
|
||||
|
||||
#include "cvSearchableSurfaces.H"
|
||||
#include "searchableSurfaces.H"
|
||||
#include "conformationSurfaces.H"
|
||||
#include "cvControls.H"
|
||||
#include "DynamicList.H"
|
||||
#include "Time.H"
|
||||
#include "polyMesh.H"
|
||||
#include "meshTools.H"
|
||||
#include "triSurfaceTools.H"
|
||||
#include "mathematicalConstants.H"
|
||||
#include "transform.H"
|
||||
@ -73,8 +75,12 @@ class conformalVoronoiMesh
|
||||
//- The time registry of the application
|
||||
const Time& runTime_;
|
||||
|
||||
//- The surfaces to conform to and to use for refinement
|
||||
cvSearchableSurfaces cvSurfaces_;
|
||||
//- All geometry of the meshing process, including surfaces to be
|
||||
// conformed to and those to be used for refinement
|
||||
searchableSurfaces allGeometry_;
|
||||
|
||||
//- The surfaces to conform to
|
||||
conformationSurfaces geometryToConformTo_;
|
||||
|
||||
//- Controls for the conformal Voronoi meshing process
|
||||
cvControls cvMeshControls_;
|
||||
@ -170,6 +176,9 @@ public:
|
||||
//- Return the Time object
|
||||
inline const Time& time() const;
|
||||
|
||||
//- Return the conformationSurfaces object
|
||||
inline const conformationSurfaces& geometryToConformTo() const;
|
||||
|
||||
//- Return the cvMeshControls object
|
||||
inline const cvControls& cvMeshControls() const;
|
||||
|
||||
@ -179,6 +188,8 @@ public:
|
||||
|
||||
// Write
|
||||
|
||||
//- Write Delaunay points to .obj file
|
||||
void writePoints(const fileName& fName, bool internalOnly) const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -28,14 +28,69 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef CGAL_INEXACT
|
||||
|
||||
inline Foam::conformalVoronoiMesh::pointFromPoint
|
||||
Foam::conformalVoronoiMesh::topoint
|
||||
(
|
||||
const Point& P
|
||||
) const
|
||||
{
|
||||
return reinterpret_cast<pointFromPoint>(P);
|
||||
}
|
||||
|
||||
inline Foam::conformalVoronoiMesh::PointFrompoint
|
||||
Foam::conformalVoronoiMesh::toPoint
|
||||
(
|
||||
const point& p
|
||||
) const
|
||||
{
|
||||
return reinterpret_cast<PointFrompoint>(p);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
inline Foam::conformalVoronoiMesh::pointFromPoint
|
||||
Foam::conformalVoronoiMesh::topoint
|
||||
(
|
||||
const Point& P
|
||||
) const
|
||||
{
|
||||
return point
|
||||
(
|
||||
CGAL::to_double(P.x()),
|
||||
CGAL::to_double(P.y()),
|
||||
CGAL::to_double(P.z())
|
||||
);
|
||||
}
|
||||
|
||||
inline Foam::conformalVoronoiMesh::PointFrompoint
|
||||
Foam::conformalVoronoiMesh::toPoint
|
||||
(
|
||||
const point& p
|
||||
) const
|
||||
{
|
||||
return Point(p.x(), p.y(), p.z());
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
inline const Foam::Time& Foam::conformalVoronoiMesh::time() const
|
||||
{
|
||||
return runTime_;
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::cvControls& Foam::conformalVoronoiMesh::cvMeshControls()
|
||||
const
|
||||
inline const Foam::conformationSurfaces&
|
||||
Foam::conformalVoronoiMesh::geometryToConformTo() const
|
||||
{
|
||||
return geometryToConformTo_;
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::cvControls&
|
||||
Foam::conformalVoronoiMesh::cvMeshControls() const
|
||||
{
|
||||
return cvMeshControls_;
|
||||
}
|
||||
|
||||
@ -26,45 +26,32 @@ License
|
||||
|
||||
#include "conformalVoronoiMesh.H"
|
||||
#include "IOstreams.H"
|
||||
#include "OFstream.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
Foam::conformalVoronoiMesh::conformalVoronoiMesh(Istream& is)
|
||||
:
|
||||
base1(is),
|
||||
base2(is),
|
||||
member1(is),
|
||||
member2(is)
|
||||
{
|
||||
// Check state of Istream
|
||||
is.check("Foam::conformalVoronoiMesh::conformalVoronoiMesh(Foam::Istream&)");
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
|
||||
|
||||
Foam::Istream& Foam::operator>>(Istream& is, conformalVoronoiMesh&)
|
||||
{
|
||||
// Check state of Istream
|
||||
is.check
|
||||
void Foam::conformalVoronoiMesh::writePoints
|
||||
(
|
||||
"Foam::Istream& Foam::operator>>(Foam::Istream&, Foam::conformalVoronoiMesh&)"
|
||||
);
|
||||
|
||||
return is;
|
||||
}
|
||||
|
||||
|
||||
Foam::Ostream& Foam::operator<<(Ostream& os, const conformalVoronoiMesh&)
|
||||
const fileName& fName,
|
||||
bool internalOnly
|
||||
) const
|
||||
{
|
||||
// Check state of Ostream
|
||||
os.check
|
||||
(
|
||||
"Foam::Ostream& Foam::operator<<(Foam::Ostream&, "
|
||||
"const Foam::conformalVoronoiMesh&)"
|
||||
);
|
||||
Info<< nl << "Writing points to " << fName << endl;
|
||||
|
||||
return os;
|
||||
OFstream str(fName);
|
||||
|
||||
for
|
||||
(
|
||||
Triangulation::Finite_vertices_iterator vit = finite_vertices_begin();
|
||||
vit != finite_vertices_end();
|
||||
++vit
|
||||
)
|
||||
{
|
||||
if (!internalOnly || vit->internalOrBoundaryPoint())
|
||||
{
|
||||
meshTools::writeOBJ(str, topoint(vit->point()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,237 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "conformationSurfaces.H"
|
||||
#include "conformalVoronoiMesh.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::conformationSurfaces::conformationSurfaces
|
||||
(
|
||||
const conformalVoronoiMesh& cvMesh,
|
||||
const searchableSurfaces& allGeometry,
|
||||
const dictionary& surfaceConformationDict
|
||||
)
|
||||
:
|
||||
cvMesh_(cvMesh),
|
||||
allGeometry_(allGeometry),
|
||||
features_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"features",
|
||||
cvMesh_.time().constant(),
|
||||
"featureEdgeMesh",
|
||||
cvMesh_.time(),
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
pointField(0),
|
||||
edgeList(0)
|
||||
),
|
||||
locationInMesh_(surfaceConformationDict.lookup("locationInMesh")),
|
||||
surfaces_(0),
|
||||
bounds_()
|
||||
{
|
||||
const dictionary& surfacesDict
|
||||
(
|
||||
surfaceConformationDict.subDict("geometryToConformTo")
|
||||
);
|
||||
|
||||
surfaces_.setSize(surfacesDict.size());
|
||||
|
||||
label surfI = 0;
|
||||
|
||||
forAllConstIter(dictionary, surfacesDict, iter)
|
||||
{
|
||||
surfaces_[surfI] = allGeometry_.findSurfaceID(iter().keyword());
|
||||
|
||||
if (surfaces_[surfI] < 0)
|
||||
{
|
||||
FatalErrorIn("Foam::conformationSurfaces::conformationSurfaces")
|
||||
<< "No surface " << iter().keyword() << " found. "
|
||||
<< "Valid geometry is " << nl << allGeometry_.names()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
surfI++;
|
||||
}
|
||||
|
||||
bounds_ = searchableSurfacesQueries::bounds(allGeometry_, surfaces_);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::conformationSurfaces::~conformationSurfaces()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
||||
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::Field<bool> Foam::conformationSurfaces::inside
|
||||
(
|
||||
const pointField& samplePts
|
||||
) const
|
||||
{
|
||||
return wellInside(samplePts, 0.0);
|
||||
}
|
||||
|
||||
|
||||
Foam::Field<bool> Foam::conformationSurfaces::outside
|
||||
(
|
||||
const pointField& samplePts
|
||||
) const
|
||||
{
|
||||
return wellOutside(samplePts, 0.0);
|
||||
}
|
||||
|
||||
|
||||
Foam::Field<bool> Foam::conformationSurfaces::wellInside
|
||||
(
|
||||
const pointField& samplePts,
|
||||
const scalar dist2
|
||||
) const
|
||||
{
|
||||
// Look at all surfaces at determine whether the locationInMesh point is
|
||||
// inside or outside each, to establish a signature for the domain to be
|
||||
// meshed.
|
||||
|
||||
List<searchableSurface::volumeType> referenceVolumeTypes
|
||||
(
|
||||
surfaces_.size(),
|
||||
searchableSurface::UNKNOWN
|
||||
);
|
||||
|
||||
forAll(surfaces_, s)
|
||||
{
|
||||
const searchableSurface& surface(allGeometry_[surfaces_[s]]);
|
||||
|
||||
if (surface.hasVolumeType())
|
||||
{
|
||||
pointField pts(1, locationInMesh_);
|
||||
|
||||
List<searchableSurface::volumeType> vTypes
|
||||
(
|
||||
pts.size(),
|
||||
searchableSurface::UNKNOWN
|
||||
);
|
||||
|
||||
surface.getVolumeType(pts, vTypes);
|
||||
|
||||
referenceVolumeTypes[s] = vTypes[0];
|
||||
}
|
||||
}
|
||||
|
||||
List<List<searchableSurface::volumeType> > surfaceVolumeTests
|
||||
(
|
||||
surfaces_.size(),
|
||||
List<searchableSurface::volumeType>
|
||||
(
|
||||
samplePts.size(),
|
||||
searchableSurface::UNKNOWN
|
||||
)
|
||||
);
|
||||
|
||||
// Get lists for the volumeTypes for each sample wrt each surface
|
||||
forAll(surfaces_, s)
|
||||
{
|
||||
const searchableSurface& surface(allGeometry_[surfaces_[s]]);
|
||||
|
||||
if (surface.hasVolumeType())
|
||||
{
|
||||
surface.getVolumeType(samplePts, surfaceVolumeTests[s]);
|
||||
}
|
||||
}
|
||||
|
||||
// Compare the volumeType result for each point wrt to each surface with the
|
||||
// reference value and if the points are inside the surface by a given
|
||||
// distanceSquared
|
||||
|
||||
Field<bool> insidePoints(samplePts.size(), true);
|
||||
|
||||
//Check if the points are inside the surface by the given distance squared
|
||||
|
||||
scalarField testDistSqr(insidePoints.size(), dist2);
|
||||
|
||||
labelList hitSurfaces;
|
||||
|
||||
List<pointIndexHit> hitInfo;
|
||||
|
||||
searchableSurfacesQueries::findNearest
|
||||
(
|
||||
allGeometry_,
|
||||
surfaces_,
|
||||
samplePts,
|
||||
testDistSqr,
|
||||
hitSurfaces,
|
||||
hitInfo
|
||||
);
|
||||
|
||||
forAll(samplePts, i)
|
||||
{
|
||||
const pointIndexHit& pHit = hitInfo[i];
|
||||
|
||||
if (pHit.hit())
|
||||
{
|
||||
insidePoints[i] = false;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
forAll(surfaces_, s)
|
||||
{
|
||||
if (surfaceVolumeTests[s][i] != referenceVolumeTypes[s])
|
||||
{
|
||||
insidePoints[i] = false;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return insidePoints;
|
||||
}
|
||||
|
||||
|
||||
Foam::Field<bool> Foam::conformationSurfaces::wellOutside
|
||||
(
|
||||
const pointField& samplePts,
|
||||
const scalar dist2
|
||||
) const
|
||||
{
|
||||
notImplemented("Field<bool> Foam::conformationSurfaces::wellOutside");
|
||||
|
||||
return Field<bool>(samplePts.size(), true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -23,22 +23,23 @@ License
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
Foam::cvSearchableSurfaces
|
||||
Foam::conformationSurfaces
|
||||
|
||||
Description
|
||||
The surface geometry to be meshed with a conformalVoronoiMesh, adding
|
||||
inside/outside queries and features of the surface
|
||||
|
||||
SourceFiles
|
||||
cvSearchableSurfaces.C
|
||||
conformationSurfacesI.H
|
||||
conformationSurfaces.C
|
||||
conformationSurfacesIO.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef cvSearchableSurfaces_H
|
||||
#define cvSearchableSurfaces_H
|
||||
#ifndef conformationSurfaces_H
|
||||
#define conformationSurfaces_H
|
||||
|
||||
#include "searchableSurfaces.H"
|
||||
#include "surfaceFeatures.H"
|
||||
#include "searchableSurfacesQueries.H"
|
||||
#include "featureEdgeMesh.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -48,60 +49,101 @@ namespace Foam
|
||||
// Forward declaration of classes
|
||||
class conformalVoronoiMesh;
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class cvSearchableSurfaces Declaration
|
||||
Class conformationSurfaces Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class cvSearchableSurfaces
|
||||
:
|
||||
public searchableSurfaces
|
||||
class conformationSurfaces
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Reference to the conformalVoronoiMesh holding this cvControls object
|
||||
const conformalVoronoiMesh& cvMesh_;
|
||||
|
||||
//- Reference to the searchableSurfaces object holding all geometry data
|
||||
const searchableSurfaces& allGeometry_;
|
||||
|
||||
//- Feature Edges and points
|
||||
featureEdgeMesh features_;
|
||||
|
||||
//- The location in the mesh that specifies which portion of surfaces is
|
||||
// to be meshed.
|
||||
point locationInMesh_;
|
||||
|
||||
//- Indices of surfaces in allGeometry that are to be conformed to
|
||||
labelList surfaces_;
|
||||
|
||||
//- The overall boundBox of all of the surfaces to be conformed to
|
||||
boundBox bounds_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
cvSearchableSurfaces(const cvSearchableSurfaces&);
|
||||
conformationSurfaces(const conformationSurfaces&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const cvSearchableSurfaces&);
|
||||
void operator=(const conformationSurfaces&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
cvSearchableSurfaces
|
||||
//- Construct from references to conformalVoronoiMesh and
|
||||
//- searchableSurfaces
|
||||
conformationSurfaces
|
||||
(
|
||||
const conformalVoronoiMesh& cvMesh,
|
||||
const dictionary& geometryDict
|
||||
const searchableSurfaces& allGeometry,
|
||||
const dictionary& surfaceConformationDict
|
||||
);
|
||||
|
||||
//- Destructor
|
||||
~cvSearchableSurfaces();
|
||||
~conformationSurfaces();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Access
|
||||
|
||||
//- Return reference to the searchableSurfaces object containing all
|
||||
// of the geometry
|
||||
inline const searchableSurfaces& geometry() const;
|
||||
|
||||
//- Return the surface indices
|
||||
inline const labelList& surfaces() const;
|
||||
|
||||
//- Return the boundBox
|
||||
inline const boundBox& bounds() const;
|
||||
|
||||
|
||||
// Query
|
||||
|
||||
//- Check if point is inside surfacesToConformTo
|
||||
bool inside(const point& pt) const;
|
||||
//- Check if point is inside surfaces to conform to
|
||||
Field<bool> inside(const pointField& samplePts) const;
|
||||
|
||||
//- Check if point is outside surfacesToConformTo
|
||||
bool outside(const point& pt) const;
|
||||
//- Check if point is outside surfaces to conform to
|
||||
Field<bool> outside(const pointField& samplePts) const;
|
||||
|
||||
//- Check if point is inside surfacesToConformTo by at least dist2
|
||||
bool wellInside(const point& pt, const scalar dist2) const;
|
||||
//- Check if point is inside surfaces to conform to by at least
|
||||
// dist2
|
||||
Field<bool> wellInside
|
||||
(
|
||||
const pointField& samplePts,
|
||||
const scalar dist2
|
||||
) const;
|
||||
|
||||
//- Check if point is outside surfacesToConformTo by at least dist2
|
||||
bool wellOutside(const point& pt, const scalar dist2) const;
|
||||
//- Check if point is outside surfaces to conform to by at least
|
||||
// dist2
|
||||
Field<bool> wellOutside
|
||||
(
|
||||
const pointField& samplePts,
|
||||
const scalar dist2
|
||||
) const;
|
||||
|
||||
// Member Operators
|
||||
|
||||
};
|
||||
|
||||
@ -112,7 +154,7 @@ public:
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "cvSearchableSurfacesI.H"
|
||||
#include "conformationSurfacesI.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -26,31 +26,24 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructors * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * //
|
||||
const Foam::searchableSurfaces& Foam::conformationSurfaces::geometry() const
|
||||
{
|
||||
return allGeometry_;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
|
||||
const Foam::labelList& Foam::conformationSurfaces::surfaces() const
|
||||
{
|
||||
return surfaces_;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
|
||||
const Foam::boundBox& Foam::conformationSurfaces::bounds() const
|
||||
{
|
||||
return bounds_;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -1,99 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "cvSearchableSurfaces.H"
|
||||
#include "conformalVoronoiMesh.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::cvSearchableSurfaces::cvSearchableSurfaces
|
||||
(
|
||||
const conformalVoronoiMesh& cvMesh,
|
||||
const dictionary& geometryDict
|
||||
)
|
||||
:
|
||||
searchableSurfaces
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"cvSearchableSurfacesDirectory",
|
||||
cvMesh.time().constant(),
|
||||
"triSurface",
|
||||
cvMesh.time(),
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
geometryDict
|
||||
),
|
||||
cvMesh_(cvMesh)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::cvSearchableSurfaces::~cvSearchableSurfaces()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
||||
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::cvSearchableSurfaces::inside(const point& pt) const
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
bool Foam::cvSearchableSurfaces::outside(const point& pt) const
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
bool Foam::cvSearchableSurfaces::wellInside
|
||||
(
|
||||
const point& pt,
|
||||
const scalar dist2
|
||||
) const
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
bool Foam::cvSearchableSurfaces::wellOutside
|
||||
(
|
||||
const point& pt,
|
||||
const scalar dist2
|
||||
) const
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -68,14 +68,21 @@ std::vector<Vb::Point> pointFile::initialPoints() const
|
||||
|
||||
std::vector<Vb::Point> initialPoints;
|
||||
|
||||
forAll(points, i)
|
||||
{
|
||||
const point& p = points[i];
|
||||
Field<bool> insidePoints = cvMesh_.geometryToConformTo().wellInside
|
||||
(
|
||||
points,
|
||||
minimumSurfaceDistance_*minimumSurfaceDistance_
|
||||
);
|
||||
|
||||
// TODO Check if inside the surface
|
||||
forAll(insidePoints, i)
|
||||
{
|
||||
if (insidePoints[i])
|
||||
{
|
||||
const point& p(points[i]);
|
||||
|
||||
initialPoints.push_back(Vb::Point(p.x(), p.y(), p.z()));
|
||||
}
|
||||
}
|
||||
|
||||
label nPointsRejected = points.size() - initialPoints.size();
|
||||
|
||||
@ -85,7 +92,6 @@ std::vector<Vb::Point> pointFile::initialPoints() const
|
||||
<< pointFileName_.name() << endl;
|
||||
}
|
||||
|
||||
|
||||
return initialPoints;
|
||||
}
|
||||
|
||||
|
||||
@ -48,10 +48,9 @@ uniformGrid::uniformGrid
|
||||
initialPointsMethod(typeName, initialPointsDict, cvMesh),
|
||||
initialCellSize_(readScalar(detailsDict().lookup("initialCellSize"))),
|
||||
randomiseInitialGrid_(detailsDict().lookup("randomiseInitialGrid")),
|
||||
randomPerturbation_
|
||||
randomPerturbationCoeff_
|
||||
(
|
||||
readScalar(detailsDict().lookup("randomPerturbationCoeff"))
|
||||
*initialCellSize_
|
||||
)
|
||||
{}
|
||||
|
||||
@ -60,41 +59,35 @@ uniformGrid::uniformGrid
|
||||
|
||||
std::vector<Vb::Point> uniformGrid::initialPoints() const
|
||||
{
|
||||
// scalar x0 = qSurf_.bb().min().x();
|
||||
// scalar xR = qSurf_.bb().max().x() - x0;
|
||||
// int ni = int(xR/controls_.minCellSize) + 1;
|
||||
const boundBox& bb = cvMesh_.geometryToConformTo().bounds();
|
||||
|
||||
// scalar y0 = qSurf_.bb().min().y();
|
||||
// scalar yR = qSurf_.bb().max().y() - y0;
|
||||
// int nj = int(yR/controls_.minCellSize) + 1;
|
||||
Info<< bb << endl;
|
||||
|
||||
// scalar z0 = qSurf_.bb().min().z();
|
||||
// scalar zR = qSurf_.bb().max().z() - z0;
|
||||
// int nk = int(zR/controls_.minCellSize) + 1;
|
||||
scalar x0 = bb.min().x();
|
||||
scalar xR = bb.max().x() - x0;
|
||||
int ni = int(xR/initialCellSize_) + 1;
|
||||
|
||||
scalar y0 = bb.min().y();
|
||||
scalar yR = bb.max().y() - y0;
|
||||
int nj = int(yR/initialCellSize_) + 1;
|
||||
|
||||
scalar z0 = bb.min().z();
|
||||
scalar zR = bb.max().z() - z0;
|
||||
int nk = int(zR/initialCellSize_) + 1;
|
||||
|
||||
Info<< " Is this actually uniform? or is it fitting the span with an "
|
||||
<< "integer number?" << endl;
|
||||
|
||||
scalar x0 = 0.0;
|
||||
scalar xR = 1.0 - x0;
|
||||
int ni = int(xR/initialCellSize_) + 1;
|
||||
|
||||
scalar y0 = 0.0;
|
||||
scalar yR = 1.0 - y0;
|
||||
int nj = int(yR/initialCellSize_) + 1;
|
||||
|
||||
scalar z0 = 0.0;
|
||||
scalar zR = 1.0 - z0;
|
||||
int nk = int(zR/initialCellSize_) + 1;
|
||||
|
||||
vector delta(xR/ni, yR/nj, zR/nk);
|
||||
|
||||
delta *= pow((1.0),-(1.0/3.0));
|
||||
|
||||
Random rndGen(1735621);
|
||||
scalar pert = randomPerturbation_*cmptMin(delta);
|
||||
scalar pert = randomPerturbationCoeff_*cmptMin(delta);
|
||||
|
||||
std::vector<Vb::Point> initialPoints;
|
||||
pointField points(ni*nj*nk);
|
||||
|
||||
label pI = 0;
|
||||
|
||||
for (int i = 0; i < ni; i++)
|
||||
{
|
||||
@ -116,14 +109,29 @@ std::vector<Vb::Point> uniformGrid::initialPoints() const
|
||||
p.z() += pert*(rndGen.scalar01() - 0.5);
|
||||
}
|
||||
|
||||
// if (qSurf_.wellInside(p, 0.5*initialCellSize_2))
|
||||
// {
|
||||
initialPoints.push_back(Vb::Point(p.x(), p.y(), p.z()));
|
||||
// }
|
||||
points[pI++] = p;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<Vb::Point> initialPoints;
|
||||
|
||||
Field<bool> insidePoints = cvMesh_.geometryToConformTo().wellInside
|
||||
(
|
||||
points,
|
||||
minimumSurfaceDistance_*minimumSurfaceDistance_
|
||||
);
|
||||
|
||||
forAll(insidePoints, i)
|
||||
{
|
||||
if (insidePoints[i])
|
||||
{
|
||||
const point& p(points[i]);
|
||||
|
||||
initialPoints.push_back(Vb::Point(p.x(), p.y(), p.z()));
|
||||
}
|
||||
}
|
||||
|
||||
return initialPoints;
|
||||
}
|
||||
|
||||
|
||||
@ -66,7 +66,7 @@ private:
|
||||
Switch randomiseInitialGrid_;
|
||||
|
||||
//- Randomise the initial positions by fraction of the initialCellSize_
|
||||
scalar randomPerturbation_;
|
||||
scalar randomPerturbationCoeff_;
|
||||
|
||||
public:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user