mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-12-28 03:37:59 +00:00
ENH: cv2DMesh and cvMesh: Addition of 2D mesher.
cv2DMesh: Initial commit cvMesh: Constructors take Time argument instead of conformalVoronoiMesh
This commit is contained in:
@ -152,12 +152,10 @@ bool Foam::cellSizeControlSurfaces::evalCellSizeFunctions
|
||||
|
||||
Foam::cellSizeControlSurfaces::cellSizeControlSurfaces
|
||||
(
|
||||
const conformalVoronoiMesh& cvMesh,
|
||||
const searchableSurfaces& allGeometry,
|
||||
const dictionary& motionControlDict
|
||||
)
|
||||
:
|
||||
cvMesh_(cvMesh),
|
||||
allGeometry_(allGeometry),
|
||||
surfaces_(),
|
||||
cellSizeFunctions_(),
|
||||
@ -223,7 +221,6 @@ Foam::cellSizeControlSurfaces::cellSizeControlSurfaces
|
||||
cellSizeFunction::New
|
||||
(
|
||||
surfaceSubDict,
|
||||
cvMesh,
|
||||
surface
|
||||
)
|
||||
);
|
||||
@ -286,38 +283,38 @@ Foam::scalar Foam::cellSizeControlSurfaces::cellSize
|
||||
|
||||
bool anyFunctionFound = evalCellSizeFunctions(pt, size);
|
||||
|
||||
if (!anyFunctionFound)
|
||||
{
|
||||
// Check if the point in question was actually inside the domain, if
|
||||
// not, then it may be falling back to an inappropriate default size.
|
||||
// if (!anyFunctionFound)
|
||||
// {
|
||||
// // Check if the point in question was actually inside the domain, if
|
||||
// // not, then it may be falling back to an inappropriate default size.
|
||||
|
||||
if (cvMesh_.geometryToConformTo().outside(pt))
|
||||
{
|
||||
pointIndexHit surfHit;
|
||||
label hitSurface;
|
||||
// if (cvMesh_.geometryToConformTo().outside(pt))
|
||||
// {
|
||||
// pointIndexHit surfHit;
|
||||
// label hitSurface;
|
||||
|
||||
cvMesh_.geometryToConformTo().findSurfaceNearest
|
||||
(
|
||||
pt,
|
||||
sqr(GREAT),
|
||||
surfHit,
|
||||
hitSurface
|
||||
);
|
||||
// cvMesh_.geometryToConformTo().findSurfaceNearest
|
||||
// (
|
||||
// pt,
|
||||
// sqr(GREAT),
|
||||
// surfHit,
|
||||
// hitSurface
|
||||
// );
|
||||
|
||||
if (!surfHit.hit())
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"Foam::scalar Foam::cellSizeControlSurfaces::cellSize"
|
||||
"("
|
||||
"const point& pt"
|
||||
") const"
|
||||
)
|
||||
<< "Point " << pt << " did not find a nearest surface point"
|
||||
<< nl << exit(FatalError) << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
// if (!surfHit.hit())
|
||||
// {
|
||||
// FatalErrorIn
|
||||
// (
|
||||
// "Foam::scalar Foam::cellSizeControlSurfaces::cellSize"
|
||||
// "("
|
||||
// "const point& pt"
|
||||
// ") const"
|
||||
// )
|
||||
// << "Point " << pt << " did not find a nearest surface point"
|
||||
// << nl << exit(FatalError) << endl;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
@ -57,9 +57,6 @@ class cellSizeControlSurfaces
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Reference to the conformalVoronoiMesh holding this object
|
||||
const conformalVoronoiMesh& cvMesh_;
|
||||
|
||||
//- Reference to the searchableSurfaces object holding all geometry data
|
||||
const searchableSurfaces& allGeometry_;
|
||||
|
||||
@ -106,7 +103,6 @@ public:
|
||||
// searchableSurfaces
|
||||
cellSizeControlSurfaces
|
||||
(
|
||||
const conformalVoronoiMesh& cvMesh,
|
||||
const searchableSurfaces& allGeometry,
|
||||
const dictionary& motionControlDict
|
||||
);
|
||||
|
||||
@ -45,12 +45,10 @@ cellSizeFunction::cellSizeFunction
|
||||
(
|
||||
const word& type,
|
||||
const dictionary& cellSizeFunctionDict,
|
||||
const conformalVoronoiMesh& cvMesh,
|
||||
const searchableSurface& surface
|
||||
)
|
||||
:
|
||||
dictionary(cellSizeFunctionDict),
|
||||
cvMesh_(cvMesh),
|
||||
surface_(surface),
|
||||
coeffsDict_(subDict(type + "Coeffs")),
|
||||
sideMode_(),
|
||||
@ -99,7 +97,6 @@ cellSizeFunction::cellSizeFunction
|
||||
autoPtr<cellSizeFunction> cellSizeFunction::New
|
||||
(
|
||||
const dictionary& cellSizeFunctionDict,
|
||||
const conformalVoronoiMesh& cvMesh,
|
||||
const searchableSurface& surface
|
||||
)
|
||||
{
|
||||
@ -130,7 +127,7 @@ autoPtr<cellSizeFunction> cellSizeFunction::New
|
||||
|
||||
return autoPtr<cellSizeFunction>
|
||||
(
|
||||
cstrIter()(cellSizeFunctionDict, cvMesh, surface)
|
||||
cstrIter()(cellSizeFunctionDict, surface)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -81,9 +81,6 @@ protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
//- Reference to the conformalVoronoiMesh holding this cvs object
|
||||
const conformalVoronoiMesh& cvMesh_;
|
||||
|
||||
//- Reference to the searchableSurface that cellSizeFunction
|
||||
// relates to
|
||||
const searchableSurface& surface_;
|
||||
@ -120,10 +117,9 @@ public:
|
||||
dictionary,
|
||||
(
|
||||
const dictionary& cellSizeFunctionDict,
|
||||
const conformalVoronoiMesh& cvMesh,
|
||||
const searchableSurface& surface
|
||||
),
|
||||
(cellSizeFunctionDict, cvMesh, surface)
|
||||
(cellSizeFunctionDict, surface)
|
||||
);
|
||||
|
||||
|
||||
@ -134,7 +130,6 @@ public:
|
||||
(
|
||||
const word& type,
|
||||
const dictionary& cellSizeFunctionDict,
|
||||
const conformalVoronoiMesh& cvMesh,
|
||||
const searchableSurface& surface
|
||||
);
|
||||
|
||||
@ -145,7 +140,6 @@ public:
|
||||
static autoPtr<cellSizeFunction> New
|
||||
(
|
||||
const dictionary& cellSizeFunctionDict,
|
||||
const conformalVoronoiMesh& cvMesh,
|
||||
const searchableSurface& surface
|
||||
);
|
||||
|
||||
|
||||
@ -42,11 +42,10 @@ addToRunTimeSelectionTable(cellSizeFunction, linearDistance, dictionary);
|
||||
linearDistance::linearDistance
|
||||
(
|
||||
const dictionary& initialPointsDict,
|
||||
const conformalVoronoiMesh& cvMesh,
|
||||
const searchableSurface& surface
|
||||
)
|
||||
:
|
||||
cellSizeFunction(typeName, initialPointsDict, cvMesh, surface),
|
||||
cellSizeFunction(typeName, initialPointsDict, surface),
|
||||
surfaceCellSize_(readScalar(coeffsDict().lookup("surfaceCellSize"))),
|
||||
distanceCellSize_(readScalar(coeffsDict().lookup("distanceCellSize"))),
|
||||
distance_(readScalar(coeffsDict().lookup("distance"))),
|
||||
|
||||
@ -87,7 +87,6 @@ public:
|
||||
linearDistance
|
||||
(
|
||||
const dictionary& initialPointsDict,
|
||||
const conformalVoronoiMesh& cvMesh,
|
||||
const searchableSurface& surface
|
||||
);
|
||||
|
||||
|
||||
@ -42,11 +42,10 @@ addToRunTimeSelectionTable(cellSizeFunction, linearSpatial, dictionary);
|
||||
linearSpatial::linearSpatial
|
||||
(
|
||||
const dictionary& initialPointsDict,
|
||||
const conformalVoronoiMesh& cvMesh,
|
||||
const searchableSurface& surface
|
||||
)
|
||||
:
|
||||
cellSizeFunction(typeName, initialPointsDict, cvMesh, surface),
|
||||
cellSizeFunction(typeName, initialPointsDict, surface),
|
||||
referencePoint_(coeffsDict().lookup("referencePoint")),
|
||||
referenceCellSize_(readScalar(coeffsDict().lookup("referenceCellSize"))),
|
||||
direction_(coeffsDict().lookup("direction")),
|
||||
|
||||
@ -85,7 +85,6 @@ public:
|
||||
linearSpatial
|
||||
(
|
||||
const dictionary& initialPointsDict,
|
||||
const conformalVoronoiMesh& cvMesh,
|
||||
const searchableSurface& surface
|
||||
);
|
||||
|
||||
|
||||
@ -46,11 +46,10 @@ addToRunTimeSelectionTable
|
||||
surfaceOffsetLinearDistance::surfaceOffsetLinearDistance
|
||||
(
|
||||
const dictionary& initialPointsDict,
|
||||
const conformalVoronoiMesh& cvMesh,
|
||||
const searchableSurface& surface
|
||||
)
|
||||
:
|
||||
cellSizeFunction(typeName, initialPointsDict, cvMesh, surface),
|
||||
cellSizeFunction(typeName, initialPointsDict, surface),
|
||||
surfaceCellSize_(readScalar(coeffsDict().lookup("surfaceCellSize"))),
|
||||
distanceCellSize_(readScalar(coeffsDict().lookup("distanceCellSize"))),
|
||||
surfaceOffset_(readScalar(coeffsDict().lookup("surfaceOffset"))),
|
||||
|
||||
@ -94,7 +94,6 @@ public:
|
||||
surfaceOffsetLinearDistance
|
||||
(
|
||||
const dictionary& initialPointsDict,
|
||||
const conformalVoronoiMesh& cvMesh,
|
||||
const searchableSurface& surface
|
||||
);
|
||||
|
||||
|
||||
@ -41,11 +41,10 @@ addToRunTimeSelectionTable(cellSizeFunction, uniform, dictionary);
|
||||
uniform::uniform
|
||||
(
|
||||
const dictionary& initialPointsDict,
|
||||
const conformalVoronoiMesh& cvMesh,
|
||||
const searchableSurface& surface
|
||||
)
|
||||
:
|
||||
cellSizeFunction(typeName, initialPointsDict, cvMesh, surface),
|
||||
cellSizeFunction(typeName, initialPointsDict, surface),
|
||||
cellSize_(readScalar(coeffsDict().lookup("cellSize")))
|
||||
{}
|
||||
|
||||
|
||||
@ -69,7 +69,6 @@ public:
|
||||
uniform
|
||||
(
|
||||
const dictionary& initialPointsDict,
|
||||
const conformalVoronoiMesh& cvMesh,
|
||||
const searchableSurface& surface
|
||||
);
|
||||
|
||||
|
||||
@ -41,11 +41,10 @@ addToRunTimeSelectionTable(cellSizeFunction, uniformDistance, dictionary);
|
||||
uniformDistance::uniformDistance
|
||||
(
|
||||
const dictionary& initialPointsDict,
|
||||
const conformalVoronoiMesh& cvMesh,
|
||||
const searchableSurface& surface
|
||||
)
|
||||
:
|
||||
cellSizeFunction(typeName, initialPointsDict, cvMesh, surface),
|
||||
cellSizeFunction(typeName, initialPointsDict, surface),
|
||||
cellSize_(readScalar(coeffsDict().lookup("cellSize"))),
|
||||
distance_(readScalar(coeffsDict().lookup("distance"))),
|
||||
distanceSqr_(sqr(distance_))
|
||||
|
||||
@ -75,7 +75,6 @@ public:
|
||||
uniformDistance
|
||||
(
|
||||
const dictionary& initialPointsDict,
|
||||
const conformalVoronoiMesh& cvMesh,
|
||||
const searchableSurface& surface
|
||||
);
|
||||
|
||||
|
||||
@ -1925,13 +1925,13 @@ Foam::conformalVoronoiMesh::conformalVoronoiMesh
|
||||
),
|
||||
geometryToConformTo_
|
||||
(
|
||||
*this,
|
||||
runTime_,
|
||||
rndGen_,
|
||||
allGeometry_,
|
||||
cvMeshDict.subDict("surfaceConformation")
|
||||
),
|
||||
cellSizeControl_
|
||||
(
|
||||
*this,
|
||||
allGeometry_,
|
||||
cvMeshDict.subDict("motionControl")
|
||||
),
|
||||
|
||||
@ -30,12 +30,14 @@ License
|
||||
|
||||
Foam::conformationSurfaces::conformationSurfaces
|
||||
(
|
||||
const conformalVoronoiMesh& cvMesh,
|
||||
const Time& runTime,
|
||||
Random& rndGen,
|
||||
const searchableSurfaces& allGeometry,
|
||||
const dictionary& surfaceConformationDict
|
||||
)
|
||||
:
|
||||
cvMesh_(cvMesh),
|
||||
runTime_(runTime),
|
||||
rndGen_(rndGen),
|
||||
allGeometry_(allGeometry),
|
||||
features_(),
|
||||
locationInMesh_(surfaceConformationDict.lookup("locationInMesh")),
|
||||
@ -139,9 +141,9 @@ Foam::conformationSurfaces::conformationSurfaces
|
||||
IOobject
|
||||
(
|
||||
feMeshName,
|
||||
cvMesh_.time().constant(),
|
||||
runTime_.time().constant(),
|
||||
"extendedFeatureEdgeMesh",
|
||||
cvMesh_.time(),
|
||||
runTime_.time(),
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
@ -211,9 +213,9 @@ Foam::conformationSurfaces::conformationSurfaces
|
||||
IOobject
|
||||
(
|
||||
feMeshName,
|
||||
cvMesh_.time().constant(),
|
||||
runTime_.time().constant(),
|
||||
"extendedFeatureEdgeMesh",
|
||||
cvMesh_.time(),
|
||||
runTime_.time(),
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
@ -232,7 +234,7 @@ Foam::conformationSurfaces::conformationSurfaces
|
||||
|
||||
// Extend the global bounds to stop the bound box sitting on the surfaces
|
||||
// to be conformed to
|
||||
globalBounds_ = globalBounds_.extend(cvMesh_.rndGen(), 1e-4);
|
||||
globalBounds_ = globalBounds_.extend(rndGen_, 1e-4);
|
||||
|
||||
// Look at all surfaces at determine whether the locationInMesh point is
|
||||
// inside or outside each, to establish a signature for the domain to be
|
||||
@ -730,7 +732,7 @@ void Foam::conformationSurfaces::findEdgeNearestByType
|
||||
|
||||
void Foam::conformationSurfaces::writeFeatureObj(const fileName& prefix) const
|
||||
{
|
||||
OFstream ftStr(cvMesh_.time().path()/prefix + "_allFeatures.obj");
|
||||
OFstream ftStr(runTime_.time().path()/prefix + "_allFeatures.obj");
|
||||
|
||||
Pout<< nl << "Writing all features to " << ftStr.name() << endl;
|
||||
|
||||
|
||||
@ -56,8 +56,9 @@ class conformationSurfaces
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Reference to the conformalVoronoiMesh holding this object
|
||||
const conformalVoronoiMesh& cvMesh_;
|
||||
const Time& runTime_;
|
||||
|
||||
Random& rndGen_;
|
||||
|
||||
//- Reference to the searchableSurfaces object holding all geometry data
|
||||
const searchableSurfaces& allGeometry_;
|
||||
@ -114,7 +115,8 @@ public:
|
||||
// searchableSurfaces
|
||||
conformationSurfaces
|
||||
(
|
||||
const conformalVoronoiMesh& cvMesh,
|
||||
const Time& runTime,
|
||||
Random& rndGen,
|
||||
const searchableSurfaces& allGeometry,
|
||||
const dictionary& surfaceConformationDict
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user