Merge branch 'cvMesh-automaticCellSize'

This commit is contained in:
laurence
2012-03-16 11:27:56 +00:00
91 changed files with 3298 additions and 513 deletions

View File

@ -60,7 +60,7 @@ void PrimitivePatchInterpolation<Patch>::makeFaceToPointWeights() const
}
const pointField& points = patch_.localPoints();
const faceList& faces = patch_.localFaces();
const List<typename Patch::FaceType>& faces = patch_.localFaces();
faceToPointWeightsPtr_ = new scalarListList(points.size());
scalarListList& weights = *faceToPointWeightsPtr_;
@ -118,7 +118,7 @@ void PrimitivePatchInterpolation<Patch>::makeFaceToEdgeWeights() const
}
const pointField& points = patch_.localPoints();
const faceList& faces = patch_.localFaces();
const List<typename Patch::FaceType>& faces = patch_.localFaces();
const edgeList& edges = patch_.edges();
const labelListList& edgeFaces = patch_.edgeFaces();
@ -261,7 +261,7 @@ tmp<Field<Type> > PrimitivePatchInterpolation<Patch>::pointToFaceInterpolate
Field<Type>& result = tresult();
const faceList& localFaces = patch_.localFaces();
const List<typename Patch::FaceType>& localFaces = patch_.localFaces();
forAll(result, facei)
{

View File

@ -27,6 +27,7 @@ License
#include "mergePoints.H"
#include "addToRunTimeSelectionTable.H"
#include "addToMemberFunctionSelectionTable.H"
#include "ListOps.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -112,35 +113,7 @@ void Foam::edgeMesh::calcPointEdges() const
pointEdgesPtr_.reset(new labelListList(points_.size()));
labelListList& pointEdges = pointEdgesPtr_();
// Count
labelList nEdgesPerPoint(points_.size(), 0);
forAll(edges_, edgeI)
{
const edge& e = edges_[edgeI];
nEdgesPerPoint[e[0]]++;
nEdgesPerPoint[e[1]]++;
}
// Size
forAll(pointEdges, pointI)
{
pointEdges[pointI].setSize(nEdgesPerPoint[pointI]);
}
// Fill
nEdgesPerPoint = 0;
forAll(edges_, edgeI)
{
const edge& e = edges_[edgeI];
const label p0 = e[0];
const label p1 = e[1];
pointEdges[p0][nEdgesPerPoint[p0]++] = edgeI;
pointEdges[p1][nEdgesPerPoint[p1]++] = edgeI;
}
invertManyToMany(pointEdges.size(), edges_, pointEdges);
}

View File

@ -819,6 +819,39 @@ void Foam::extendedFeatureEdgeMesh::nearestFeatureEdgeByType
}
void Foam::extendedFeatureEdgeMesh::allNearestFeaturePoints
(
const point& sample,
scalar searchRadiusSqr,
List<pointIndexHit>& info
) const
{
DynamicList<pointIndexHit> dynPointHit;
// Pick up all the feature points that intersect the search sphere
labelList elems = pointTree().findSphere
(
sample,
searchRadiusSqr
);
forAll(elems, elemI)
{
label index = elems[elemI];
label ptI = pointTree().shapes().pointLabels()[index];
const point& pt = points()[ptI];
pointIndexHit nearHit;
nearHit = pointIndexHit(true, pt, index);
dynPointHit.append(nearHit);
}
info.transfer(dynPointHit);
}
void Foam::extendedFeatureEdgeMesh::allNearestFeatureEdges
(
const point& sample,

View File

@ -283,6 +283,14 @@ public:
List<pointIndexHit>& info
) const;
//- Find all the feature points within searchDistSqr of sample
void allNearestFeaturePoints
(
const point& sample,
scalar searchRadiusSqr,
List<pointIndexHit>& info
) const;
//- Find all the feature edges within searchDistSqr of sample
void allNearestFeatureEdges
(
@ -291,6 +299,7 @@ public:
List<pointIndexHit>& info
) const;
// Access
//- Return the index of the start of the convex feature points

View File

@ -93,6 +93,25 @@ bool Foam::treeDataPoint::overlaps
}
// Check if any point on shape is inside sphere.
bool Foam::treeDataPoint::overlaps
(
const label index,
const point& centre,
const scalar radiusSqr
) const
{
label pointI = (useSubset_ ? pointLabels_[index] : index);
if (magSqr(points_[pointI] - centre) <= radiusSqr)
{
return true;
}
return false;
}
// Calculate nearest point to sample. Updates (if any) nearestDistSqr, minIndex,
// nearestPoint.
void Foam::treeDataPoint::findNearest

View File

@ -128,6 +128,14 @@ public:
const treeBoundBox& sampleBb
) const;
//- Does shape at index overlap the sphere
bool overlaps
(
const label index,
const point& centre,
const scalar radiusSqr
) const;
//- Calculates nearest (to sample) point in shape.
// Returns actual point and distance (squared)
void findNearest