ENH: cv2DMesh and cvMesh: Addition of 2D mesher.

cv2DMesh: Initial commit
cvMesh: Constructors take Time argument instead of conformalVoronoiMesh
This commit is contained in:
laurence
2011-11-11 09:55:46 +00:00
parent f93ae77a86
commit 7b88ff0824
43 changed files with 5628 additions and 75 deletions

View File

@ -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;
}

View File

@ -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
);

View File

@ -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)
);
}

View File

@ -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
);

View File

@ -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"))),

View File

@ -87,7 +87,6 @@ public:
linearDistance
(
const dictionary& initialPointsDict,
const conformalVoronoiMesh& cvMesh,
const searchableSurface& surface
);

View File

@ -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")),

View File

@ -85,7 +85,6 @@ public:
linearSpatial
(
const dictionary& initialPointsDict,
const conformalVoronoiMesh& cvMesh,
const searchableSurface& surface
);

View File

@ -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"))),

View File

@ -94,7 +94,6 @@ public:
surfaceOffsetLinearDistance
(
const dictionary& initialPointsDict,
const conformalVoronoiMesh& cvMesh,
const searchableSurface& surface
);

View File

@ -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")))
{}

View File

@ -69,7 +69,6 @@ public:
uniform
(
const dictionary& initialPointsDict,
const conformalVoronoiMesh& cvMesh,
const searchableSurface& surface
);

View File

@ -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_))

View File

@ -75,7 +75,6 @@ public:
uniformDistance
(
const dictionary& initialPointsDict,
const conformalVoronoiMesh& cvMesh,
const searchableSurface& surface
);

View File

@ -1925,13 +1925,13 @@ Foam::conformalVoronoiMesh::conformalVoronoiMesh
),
geometryToConformTo_
(
*this,
runTime_,
rndGen_,
allGeometry_,
cvMeshDict.subDict("surfaceConformation")
),
cellSizeControl_
(
*this,
allGeometry_,
cvMeshDict.subDict("motionControl")
),

View File

@ -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;

View File

@ -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
);