ENH: Snap points to feature points

This commit is contained in:
laurence
2013-04-11 20:15:29 +01:00
parent c1cb0c4f17
commit 9356f9c669
3 changed files with 49 additions and 13 deletions

View File

@ -516,9 +516,6 @@ void Foam::conformalVoronoiMesh::calcDualMesh
wordList& patchTypes,
wordList& patchNames,
PtrList<dictionary>& patchDicts,
//labelList& patchSizes,
//labelList& patchStarts,
//labelList& procNeighbours,
pointField& cellCentres,
labelList& cellToDelaunayVertex,
labelListList& patchToDelaunayVertex,
@ -566,9 +563,6 @@ void Foam::conformalVoronoiMesh::calcDualMesh
patchTypes,
patchNames,
patchDicts,
// patchSizes,
// patchStarts,
// procNeighbours,
patchToDelaunayVertex, // from patch face to Delaunay vertex (slavePp)
boundaryFacesToRemove,
false
@ -1246,6 +1240,8 @@ Foam::conformalVoronoiMesh::createPolyMeshFromPoints
// Do not create empty processor patches
if (totalPatchSize > 0)
{
patchDicts[p].set("transform", "coincidentFullMatch");
patches[nValidPatches] = new processorPolyPatch
(
patchNames[p],
@ -1773,6 +1769,31 @@ void Foam::conformalVoronoiMesh::indexDualVertices
pts[cit->cellIndex()] = cit->dual();
}
if (cit->featurePointDualVertex())
{
pointFromPoint dual = cit->dual();
pointIndexHit fpHit;
label featureHit;
// Find nearest feature point and compare
geometryToConformTo_.findFeaturePointNearest
(
dual,
sqr(targetCellSize(dual)),
fpHit,
featureHit
);
if (fpHit.hit())
{
Info<< "Dual = " << dual << nl
<< " Nearest = " << fpHit.hitPoint() << endl;
pts[cit->cellIndex()] = fpHit.hitPoint();
}
}
if (cit->boundaryDualVertex())
{
if (cit->featureEdgeDualVertex())
@ -1973,11 +1994,11 @@ void Foam::conformalVoronoiMesh::createFacesOwnerNeighbourAndPatches
if (patchDicts[patchI].found("neighbProcNo"))
{
procNeighbours[patchI] =
(
patchDicts[patchI].found("neighbProcNo")
? readLabel(patchDicts[patchI].lookup("neighbProcNo"))
: -1
);
(
patchDicts[patchI].found("neighbProcNo")
? readLabel(patchDicts[patchI].lookup("neighbProcNo"))
: -1
);
}
}
@ -2449,7 +2470,6 @@ void Foam::conformalVoronoiMesh::addPatches
{
patchDicts[p].set("nFaces", patchFaces[p].size());
patchDicts[p].set("startFace", nInternalFaces + nBoundaryFaces);
patchDicts[p].set("transform", "noOrdering");
nBoundaryFaces += patchFaces[p].size();
}

View File

@ -220,6 +220,9 @@ public:
//- A dual vertex on a feature edge will result from this Delaunay cell
inline bool featureEdgeDualVertex() const;
//- A dual vertex on a feature point will result from this Delaunay cell
inline bool featurePointDualVertex() const;
inline bool nearProcBoundary() const;
inline bool potentialCoplanarCell() const;

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -432,6 +432,19 @@ inline bool CGAL::indexedCell<Gt, Cb>::featureEdgeDualVertex() const
}
template<class Gt, class Cb>
inline bool CGAL::indexedCell<Gt, Cb>::featurePointDualVertex() const
{
return
(
this->vertex(0)->featurePoint()
&& this->vertex(1)->featurePoint()
&& this->vertex(2)->featurePoint()
&& this->vertex(3)->featurePoint()
);
}
template<class Gt, class Cb>
inline bool CGAL::indexedCell<Gt, Cb>::nearProcBoundary() const
{