Merge branch 'cvm' of /home/noisy3/OpenFOAM/OpenFOAM-dev into cvm

This commit is contained in:
mattijs
2011-06-24 16:23:17 +01:00
22 changed files with 116 additions and 166 deletions

View File

@ -42,8 +42,7 @@ defineTypeNameAndDebug(cellSizeControlSurfaces, 0);
bool Foam::cellSizeControlSurfaces::evalCellSizeFunctions
(
const point& pt,
scalar& minSize,
bool isSurfacePoint
scalar& minSize
) const
{
bool anyFunctionFound = false;
@ -71,7 +70,7 @@ bool Foam::cellSizeControlSurfaces::evalCellSizeFunctions
// scalar sizeI;
// if (cSF.cellSize(pt, sizeI, isSurfacePoint))
// if (cSF.cellSize(pt, sizeI))
// {
// anyFunctionFound = true;
@ -119,7 +118,7 @@ bool Foam::cellSizeControlSurfaces::evalCellSizeFunctions
scalar sizeI;
if (cSF.cellSize(pt, sizeI, isSurfacePoint))
if (cSF.cellSize(pt, sizeI))
{
anyFunctionFound = true;
@ -280,18 +279,12 @@ Foam::cellSizeControlSurfaces::~cellSizeControlSurfaces()
Foam::scalar Foam::cellSizeControlSurfaces::cellSize
(
const point& pt,
bool isSurfacePoint
const point& pt
) const
{
if (isSurfacePoint)
{
// Pout<< "WARNING: isSurfacePoint is broken!" << endl;
}
scalar size = defaultCellSize_;
bool anyFunctionFound = evalCellSizeFunctions(pt, size, isSurfacePoint);
bool anyFunctionFound = evalCellSizeFunctions(pt, size);
if (!anyFunctionFound)
{
@ -317,30 +310,12 @@ Foam::scalar Foam::cellSizeControlSurfaces::cellSize
(
"Foam::scalar Foam::cellSizeControlSurfaces::cellSize"
"("
"const point& pt, "
"bool isSurfacePoint"
"const point& pt"
") const"
)
<< "Point " << pt << " did not find a nearest surface point"
<< nl << exit(FatalError) << endl;
}
else
{
// FatalErrorIn
// (
// "Foam::scalar Foam::cellSizeControlSurfaces::cellSize"
// "("
// "const point& pt, "
// "bool isSurfacePoint"
// ") const"
// )
// << "Point " << pt
// << " Cannot use isSurfacePoint here, or at all!"
// << nl << exit(FatalError) << endl;
// Evaluating the cell size at the nearest surface
evalCellSizeFunctions(surfHit.hitPoint(), size, true);
}
}
}
@ -350,31 +325,14 @@ Foam::scalar Foam::cellSizeControlSurfaces::cellSize
Foam::scalarField Foam::cellSizeControlSurfaces::cellSize
(
const pointField& pts,
const List<bool>& isSurfacePoint
const pointField& pts
) const
{
if (pts.size() != isSurfacePoint.size())
{
FatalErrorIn
(
"Foam::cellSizeControlSurfaces::cellSizeControlSurfaces \
( \
const pointField& pts, \
const List<bool>& isSurfacePoint \
) \
const"
) << "Size of pointField (" << pts.size()
<< ") and List<bool> (" << isSurfacePoint.size()
<< ") do not match." << nl
<< exit(FatalError);
}
scalarField cellSizes(pts.size());
forAll(pts, i)
{
cellSizes[i] = cellSize(pts[i], isSurfacePoint[i]);
cellSizes[i] = cellSize(pts[i]);
}
return cellSizes;

View File

@ -84,8 +84,7 @@ class cellSizeControlSurfaces
bool evalCellSizeFunctions
(
const point& pt,
scalar& minSize,
bool isSurfacePoint
scalar& minSize
) const;
//- Disallow default bitwise copy construct
@ -130,18 +129,10 @@ public:
// Query
//- Return the cell size at the given location
scalar cellSize
(
const point& pt,
bool isSurfacePoint = false
) const;
scalar cellSize(const point& pt) const;
//- Return the cell size at the given locations
scalarField cellSize
(
const pointField& pts,
const List<bool>& isSurfacePoint
) const;
scalarField cellSize(const pointField& pts) const;
};

View File

@ -174,8 +174,7 @@ public:
virtual bool cellSize
(
const point& pt,
scalar& size,
bool isSurfacePoint = false
scalar& size
) const = 0;
};

View File

@ -68,17 +68,9 @@ scalar linearDistance::sizeFunction(scalar d) const
bool linearDistance::cellSize
(
const point& pt,
scalar& size,
bool isSurfacePoint
scalar& size
) const
{
if (isSurfacePoint)
{
size = surfaceCellSize_;
return true;
}
size = 0;
List<pointIndexHit> hits;

View File

@ -106,8 +106,7 @@ public:
virtual bool cellSize
(
const point& pt,
scalar& size,
bool isSurfacePoint = false
scalar& size
) const;
};

View File

@ -71,11 +71,10 @@ scalar linearSpatial::sizeFunction(const point& pt) const
bool linearSpatial::cellSize
(
const point& pt,
scalar& size,
bool isSurfacePoint
scalar& size
) const
{
if (sideMode_ == rmBothsides || isSurfacePoint)
if (sideMode_ == rmBothsides)
{
size = sizeFunction(pt);

View File

@ -104,8 +104,7 @@ public:
virtual bool cellSize
(
const point& pt,
scalar& size,
bool isSurfacePoint = false
scalar& size
) const;
};

View File

@ -139,17 +139,9 @@ scalar surfaceOffsetLinearDistance::sizeFunction(scalar d) const
bool surfaceOffsetLinearDistance::cellSize
(
const point& pt,
scalar& size,
bool isSurfacePoint
scalar& size
) const
{
if (isSurfacePoint)
{
size = surfaceCellSize_;
return true;
}
size = 0;
List<pointIndexHit> hits;

View File

@ -113,8 +113,7 @@ public:
virtual bool cellSize
(
const point& pt,
scalar& size,
bool isSurfacePoint = false
scalar& size
) const;
};

View File

@ -55,11 +55,10 @@ uniform::uniform
bool uniform::cellSize
(
const point& pt,
scalar& size,
bool isSurfacePoint
scalar& size
) const
{
if (sideMode_ == rmBothsides || isSurfacePoint)
if (sideMode_ == rmBothsides)
{
size = cellSize_;

View File

@ -88,8 +88,7 @@ public:
virtual bool cellSize
(
const point& pt,
scalar& size,
bool isSurfacePoint = false
scalar& size
) const;
};

View File

@ -57,17 +57,9 @@ uniformDistance::uniformDistance
bool uniformDistance::cellSize
(
const point& pt,
scalar& size,
bool isSurfacePoint
scalar& size
) const
{
if (isSurfacePoint)
{
size = cellSize_;
return true;
}
size = 0;
List<pointIndexHit> hits;

View File

@ -94,8 +94,7 @@ public:
virtual bool cellSize
(
const point& pt,
scalar& size,
bool isSurfacePoint = false
scalar& size
) const;
};

View File

@ -1213,8 +1213,6 @@ void Foam::conformalVoronoiMesh::insertBoundingPoints()
void Foam::conformalVoronoiMesh::insertInitialPoints()
{
startOfInternalPoints_ = number_of_vertices();
Info<< nl << "Inserting initial points" << endl;
timeCheck("Before initial points call");
@ -1487,8 +1485,7 @@ void Foam::conformalVoronoiMesh::storeSizesAndAlignments
storedSizes_[i] = cellSizeControl().cellSize
(
sizeAndAlignmentLocations_[i],
false
sizeAndAlignmentLocations_[i]
);
storedAlignments_[i] = requiredAlignment(sizeAndAlignmentLocations_[i]);
@ -1580,7 +1577,7 @@ void Foam::conformalVoronoiMesh::setVertexSizeAndAlignment()
vit->alignment() = requiredAlignment(pt);
vit->targetCellSize() = cellSizeControl().cellSize(pt, false);
vit->targetCellSize() = cellSizeControl().cellSize(pt);
}
}
}
@ -1896,6 +1893,8 @@ Foam::conformalVoronoiMesh::conformalVoronoiMesh
insertFeaturePoints();
startOfInternalPoints_ = number_of_vertices();
insertInitialPoints();
// Improve the guess that the backgroundMeshDecomposition makes with the

View File

@ -181,11 +181,7 @@ private:
//- Return the local target cell size at the given location. Takes
// boolean argument to allow speed-up of queries if the point is going
// to be on a surface.
inline scalar targetCellSize
(
const Foam::point& pt,
bool isSurfacePoint = false
) const;
inline scalar targetCellSize(const Foam::point& pt) const;
//- Return the target cell size from that stored on a pair of
// Delaunay vertices, using a mean function.

View File

@ -58,9 +58,70 @@ void Foam::conformalVoronoiMesh::calcDualMesh
++cit
)
{
cit->filterCount() = 0;
if
(
!cit->vertex(0)->real()
|| !cit->vertex(1)->real()
|| !cit->vertex(2)->real()
|| !cit->vertex(3)->real()
)
{
cit->filterCount() = 100;
}
else
{
cit->filterCount() = 0;
}
}
for
(
Delaunay::Finite_vertices_iterator vit = finite_vertices_begin();
vit != finite_vertices_end();
vit++
)
{
std::list<Cell_handle> cells;
incident_cells(vit, std::back_inserter(cells));
bool hasProcPt = false;
for
(
std::list<Cell_handle>::iterator cit=cells.begin();
cit != cells.end();
++cit
)
{
if
(
!(*cit)->vertex(0)->real()
|| !(*cit)->vertex(1)->real()
|| !(*cit)->vertex(2)->real()
|| !(*cit)->vertex(3)->real()
)
{
hasProcPt = true;
break;
}
}
if (hasProcPt)
{
for
(
std::list<Cell_handle>::iterator cit=cells.begin();
cit != cells.end();
++cit
)
{
(*cit)->filterCount() = 100;
}
}
}
PackedBoolList boundaryPts(number_of_cells(), false);
indexDualVertices(points, boundaryPts);
@ -82,6 +143,8 @@ void Foam::conformalVoronoiMesh::calcDualMesh
{
label nInitialBadQualityFaces = checkPolyMeshQuality(points).size();
reduce(nInitialBadQualityFaces, sumOp<label>());
Info<< nl << "Initial check before face collapse, found "
<< nInitialBadQualityFaces << " bad quality faces"
<< endl;
@ -145,10 +208,16 @@ void Foam::conformalVoronoiMesh::calcDualMesh
nBadQualityFaces = wrongFaces.size();
reduce(nBadQualityFaces, sumOp<label>());
Info<< nl << "Found " << nBadQualityFaces
<< " bad quality faces" << endl;
if (lastWrongFaces == wrongFaces)
bool sameFacesAsLastTime(lastWrongFaces == wrongFaces);
reduce(sameFacesAsLastTime, andOp<bool>());
if (sameFacesAsLastTime)
{
Info<< nl << "Consecutive iterations found the same set "
<< "of bad quality faces." << endl;
@ -523,6 +592,8 @@ void Foam::conformalVoronoiMesh::smoothSurface
dualPtIndexMap
);
reduce(nCollapsedFaces, sumOp<label>());
reindexDualVertices(dualPtIndexMap);
mergeCloseDualVertices(pts, boundaryPts);
@ -759,6 +830,8 @@ void Foam::conformalVoronoiMesh::collapseFaces
deferredCollapseFaces
);
reduce(nCollapsedFaces, sumOp<label>());
reindexDualVertices(dualPtIndexMap);
mergeCloseDualVertices(pts, boundaryPts);

View File

@ -27,11 +27,10 @@ License
inline Foam::scalar Foam::conformalVoronoiMesh::targetCellSize
(
const Foam::point& pt,
bool isSurfacePoint
const Foam::point& pt
) const
{
return cellSizeControl().cellSize(pt, isSurfacePoint);
return cellSizeControl().cellSize(pt);
}
@ -139,10 +138,7 @@ inline Foam::scalar Foam::conformalVoronoiMesh::pointPairDistance
const Foam::point& pt
) const
{
// Point pair distances are always going to be at the surface, so the
// targetCellSize can be told to do a quick, surface only check.
return targetCellSize(pt, true)*cvMeshControls().pointPairDistanceCoeff();
return targetCellSize(pt)*cvMeshControls().pointPairDistanceCoeff();
}
@ -162,13 +158,10 @@ inline Foam::scalar Foam::conformalVoronoiMesh::featurePointExclusionDistanceSqr
const Foam::point& pt
) const
{
// Exclusion distance tests are always going to be at the surface, so the
// targetCellSize can be told to do a quick, surface only check.
return
sqr
(
targetCellSize(pt, true)
targetCellSize(pt)
*cvMeshControls().featurePointExclusionDistanceCoeff()
);
}
@ -179,13 +172,10 @@ inline Foam::scalar Foam::conformalVoronoiMesh::featureEdgeExclusionDistanceSqr
const Foam::point& pt
) const
{
// Exclusion distance tests are always going to be at the surface, so the
// targetCellSize can be told to do a quick, surface only check.
return
sqr
(
targetCellSize(pt, true)
targetCellSize(pt)
*cvMeshControls().featureEdgeExclusionDistanceCoeff()
);
}

View File

@ -339,11 +339,7 @@ bool Foam::autoDensity::fillBox
pointField corners(bb.points());
scalarField cornerSizes = cvMesh_.cellSizeControl().cellSize
(
corners,
List<bool>(8, false)
);
scalarField cornerSizes = cvMesh_.cellSizeControl().cellSize(corners);
Field<bool> insideCorners = combinedWellInside(corners, cornerSizes);
@ -452,11 +448,7 @@ bool Foam::autoDensity::fillBox
);
}
lineSizes = cvMesh_.cellSizeControl().cellSize
(
linePoints,
List<bool>(nLine, false)
);
lineSizes = cvMesh_.cellSizeControl().cellSize(linePoints);
Field<bool> insideLines = combinedWellInside
(
@ -557,8 +549,7 @@ bool Foam::autoDensity::fillBox
scalarField sampleSizes = cvMesh_.cellSizeControl().cellSize
(
samplePoints,
List<bool>(samplePoints.size(), false)
samplePoints
);
Field<bool> insidePoints = combinedWellInside

View File

@ -167,11 +167,7 @@ std::list<Vb::Point> bodyCentredCubic::initialPoints() const
minimumSurfaceDistanceCoeffSqr_
*sqr
(
cvMesh_.cellSizeControl().cellSize
(
points,
List<bool>(points.size(), false)
)
cvMesh_.cellSizeControl().cellSize(points)
)
);

View File

@ -228,11 +228,7 @@ std::list<Vb::Point> faceCentredCubic::initialPoints() const
minimumSurfaceDistanceCoeffSqr_
*sqr
(
cvMesh_.cellSizeControl().cellSize
(
points,
List<bool>(points.size(), false)
)
cvMesh_.cellSizeControl().cellSize(points)
)
);

View File

@ -134,11 +134,7 @@ std::list<Vb::Point> pointFile::initialPoints() const
minimumSurfaceDistanceCoeffSqr_
*sqr
(
cvMesh_.cellSizeControl().cellSize
(
points,
List<bool>(points.size(), false)
)
cvMesh_.cellSizeControl().cellSize(points)
)
);

View File

@ -143,11 +143,7 @@ std::list<Vb::Point> uniformGrid::initialPoints() const
minimumSurfaceDistanceCoeffSqr_
*sqr
(
cvMesh_.cellSizeControl().cellSize
(
points,
List<bool>(points.size(), false)
)
cvMesh_.cellSizeControl().cellSize(points)
)
);