uniform cellSizeFunction implemented. Check applied in cellSizeFunction base

class to surface for hasVolumeType - defaulting to BOTHSIDES if not a closed
surface.  Test point for cell sizes in conformalVoronoiMesh.C.
This commit is contained in:
graham
2009-07-07 17:34:36 +01:00
parent 67acfcb7e2
commit 254f98f56b
3 changed files with 67 additions and 17 deletions

View File

@ -57,23 +57,35 @@ cellSizeFunction::cellSizeFunction
{ {
word mode = cellSizeFunctionDict.lookup("mode"); word mode = cellSizeFunctionDict.lookup("mode");
if (mode == "inside") if (surface_.hasVolumeType())
{ {
sideMode_ = INSIDE; if (mode == "inside")
} {
else if (mode == "outside") sideMode_ = INSIDE;
{ }
sideMode_ = OUTSIDE; else if (mode == "outside")
} {
else if (mode == "bothSides") sideMode_ = OUTSIDE;
{ }
sideMode_ = BOTHSIDES; else if (mode == "bothSides")
} {
else sideMode_ = BOTHSIDES;
{ }
FatalErrorIn("cellSizeFunction::cellSizeFunction") else
{
FatalErrorIn("cellSizeFunction::cellSizeFunction")
<< "Unknown mode, expected: inside, outside or bothSides" << nl << "Unknown mode, expected: inside, outside or bothSides" << nl
<< exit(FatalError); << exit(FatalError);
}
}
else if (mode != BOTHSIDES)
{
WarningIn("cellSizeFunction::cellSizeFunction")
<< "surface does not support volumeType, defaulting mode to "
<< "bothSides."
<< endl;
sideMode_ = BOTHSIDES;
} }
} }

View File

@ -55,9 +55,44 @@ uniform::uniform
bool uniform::cellSize(const point& pt, scalar& size) const bool uniform::cellSize(const point& pt, scalar& size) const
{ {
size = cellSize_; if (sideMode_ == BOTHSIDES)
{
size = cellSize_;
return true; return true;
}
pointField ptF(1, pt);
List<searchableSurface::volumeType> vTL(1);
surface_.getVolumeType(ptF, vTL);
size = 0;
bool functionApplied = false;
if
(
sideMode_ == INSIDE
&& vTL[1] == searchableSurface::INSIDE
)
{
size = cellSize_;
functionApplied = true;
}
else if
(
sideMode_ == OUTSIDE
&& vTL[1] == searchableSurface::OUTSIDE
)
{
size = cellSize_;
functionApplied = true;
}
return functionApplied;
} }

View File

@ -100,6 +100,9 @@ Foam::conformalVoronoiMesh::conformalVoronoiMesh
{ {
timeCheck(); timeCheck();
point sizeTestPt = vector(0.5, 0.3, 0.6);
Info<< nl << cellSizeControl().cellSize(sizeTestPt) << endl;
createFeaturePoints(); createFeaturePoints();
timeCheck(); timeCheck();