Adding patching information for all surfaces.

Adding check when inseting a new vertex on a long Delaunay edge that the edge
does not pierce the surface, causing a span between thin parts of the surface.
Contains temporary checking code for internalPoints that are not inside the
surface.

Was passing points by copy rather than const reference to conformationSurfaces
...Intersection queries, rectified.
This commit is contained in:
graham
2009-07-15 19:38:48 +01:00
parent 89f7c43eab
commit e61bc5c9fe
4 changed files with 120 additions and 42 deletions

View File

@ -1479,24 +1479,9 @@ void Foam::conformalVoronoiMesh::calcDualMesh
// ~~~~~~~~~~~~ dual face and owner neighbour construction ~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~ dual face and owner neighbour construction ~~~~~~~~~~~~~~~~~
//label nPatches = qSurf_.patches().size() + 1; patchNames = geometryToConformTo_.patchNames();
//label defaultPatchIndex = qSurf_.patches().size(); label nPatches = patchNames.size();
label nPatches = 1;
label defaultPatchIndex = 0;
patchNames.setSize(nPatches);
//const geometricSurfacePatchList& surfacePatches = qSurf_.patches();
// forAll(surfacePatches, sP)
// {
// patchNames[sP] = surfacePatches[sP].name();
// }
patchNames[defaultPatchIndex] = "cvMesh_defaultPatch";
patchSizes.setSize(nPatches); patchSizes.setSize(nPatches);
@ -1622,20 +1607,13 @@ void Foam::conformalVoronoiMesh::calcDualMesh
point ptB = topoint(vB->point()); point ptB = topoint(vB->point());
//pointIndexHit pHit = qSurf_.tree().findLineAny(ptA, ptB); label patchIndex = geometryToConformTo_.findPatch(ptA, ptB);
//label patchIndex = qSurf_[pHit.index()].region();
label patchIndex = defaultPatchIndex;
if (patchIndex == -1) if (patchIndex == -1)
{ {
patchIndex = defaultPatchIndex;
WarningIn("Foam::conformalVoronoiMesh::calcDualMesh") WarningIn("Foam::conformalVoronoiMesh::calcDualMesh")
<< "Dual face found that is not on a surface " << "Dual face found that is not on a surface "
<< "patch. Adding to " << "patch. Adding to " << patchNames[0]
<< patchNames[defaultPatchIndex]
<< endl; << endl;
} }
@ -2253,12 +2231,25 @@ void Foam::conformalVoronoiMesh::move()
) )
{ {
// Point insertion // Point insertion
pointsToInsert.push_back
(
toPoint(0.5*(dVA + dVB))
);
pointsAdded++; if
(
!geometryToConformTo_.findSurfaceAnyIntersection
(
dVA,
dVB
)
)
{
// Prevent insertions spanning surfaces
pointsToInsert.push_back
(
toPoint(0.5*(dVA + dVB))
);
pointsAdded++;
}
} }
else if else if
( (
@ -2325,6 +2316,20 @@ void Foam::conformalVoronoiMesh::move()
vit, vit,
displacementAccumulator[vit->index()] displacementAccumulator[vit->index()]
); );
// TEMPORARY: CHECK IF ALL INTERNAL POINTS ARE INSIDE
if
(
geometryToConformTo_.inside
(
pointField(1, topoint(vit->point()))
)[0] == false
)
{
Info<< "INTERNAL POINT " << topoint(vit->point())
<< " NOT INSIDE" << endl;
}
} }
} }

View File

@ -41,7 +41,10 @@ Foam::conformationSurfaces::conformationSurfaces
features_(), features_(),
locationInMesh_(surfaceConformationDict.lookup("locationInMesh")), locationInMesh_(surfaceConformationDict.lookup("locationInMesh")),
surfaces_(), surfaces_(),
allGeometryToSurfaces_(),
baffleSurfaces_(), baffleSurfaces_(),
patchNames_(0),
patchOffsets_(),
bounds_() bounds_()
{ {
const dictionary& surfacesDict const dictionary& surfacesDict
@ -53,10 +56,14 @@ Foam::conformationSurfaces::conformationSurfaces
surfaces_.setSize(surfacesDict.size()); surfaces_.setSize(surfacesDict.size());
allGeometryToSurfaces_.setSize(allGeometry_.size(), -1);
baffleSurfaces_.setSize(surfacesDict.size()); baffleSurfaces_.setSize(surfacesDict.size());
features_.setSize(surfacesDict.size()); features_.setSize(surfacesDict.size());
patchOffsets_.setSize(surfacesDict.size());
label surfI = 0; label surfI = 0;
forAllConstIter(dictionary, surfacesDict, iter) forAllConstIter(dictionary, surfacesDict, iter)
@ -65,6 +72,8 @@ Foam::conformationSurfaces::conformationSurfaces
surfaces_[surfI] = allGeometry_.findSurfaceID(surfaceName); surfaces_[surfI] = allGeometry_.findSurfaceID(surfaceName);
allGeometryToSurfaces_[surfaces_[surfI]] = surfI;
if (surfaces_[surfI] < 0) if (surfaces_[surfI] < 0)
{ {
FatalErrorIn("Foam::conformationSurfaces::conformationSurfaces") FatalErrorIn("Foam::conformationSurfaces::conformationSurfaces")
@ -73,6 +82,10 @@ Foam::conformationSurfaces::conformationSurfaces
<< exit(FatalError); << exit(FatalError);
} }
patchOffsets_[surfI] = patchNames_.size();
patchNames_.append(allGeometry.regionNames()[surfaces_[surfI]]);
const dictionary& surfaceSubDict(surfacesDict.subDict(surfaceName)); const dictionary& surfaceSubDict(surfacesDict.subDict(surfaceName));
baffleSurfaces_[surfI] = Switch baffleSurfaces_[surfI] = Switch
@ -307,8 +320,8 @@ Foam::Field<bool> Foam::conformationSurfaces::wellOutside
bool Foam::conformationSurfaces::findSurfaceAnyIntersection bool Foam::conformationSurfaces::findSurfaceAnyIntersection
( (
point start, const point& start,
point end const point& end
) const ) const
{ {
labelList hitSurfaces; labelList hitSurfaces;
@ -330,8 +343,8 @@ bool Foam::conformationSurfaces::findSurfaceAnyIntersection
void Foam::conformationSurfaces::findSurfaceAnyIntersection void Foam::conformationSurfaces::findSurfaceAnyIntersection
( (
point start, const point& start,
point end, const point& end,
pointIndexHit& surfHit, pointIndexHit& surfHit,
label& hitSurface label& hitSurface
) const ) const
@ -364,8 +377,8 @@ void Foam::conformationSurfaces::findSurfaceAnyIntersection
void Foam::conformationSurfaces::findSurfaceNearestIntersection void Foam::conformationSurfaces::findSurfaceNearestIntersection
( (
point start, const point& start,
point end, const point& end,
pointIndexHit& surfHit, pointIndexHit& surfHit,
label& hitSurface label& hitSurface
) const ) const
@ -607,4 +620,34 @@ void Foam::conformationSurfaces::writeFeatureObj
} }
Foam::label Foam::conformationSurfaces::findPatch
(
const point& ptA,
const point& ptB
) const
{
pointIndexHit surfHit;
label hitSurface;
findSurfaceAnyIntersection(ptA, ptB, surfHit, hitSurface);
if (!surfHit.hit())
{
return -1;
}
labelList surfLocalRegion;
allGeometry_[hitSurface].getRegion
(
List<pointIndexHit>(1, surfHit),
surfLocalRegion
);
return
surfLocalRegion[0] + patchOffsets_[allGeometryToSurfaces_[hitSurface]];
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -74,10 +74,23 @@ class conformationSurfaces
//- Indices of surfaces in allGeometry that are to be conformed to //- Indices of surfaces in allGeometry that are to be conformed to
labelList surfaces_; labelList surfaces_;
//- Reverse mapping, which entry in surfaces corresponds to the surface
// in allGeometry specified by the list index. -1 for a surface that
// isn't used.
labelList allGeometryToSurfaces_;
//- A boolean value for each surface to be conformed to specifying if it //- A boolean value for each surface to be conformed to specifying if it
// is to be treated as a baffle // is to be treated as a baffle
boolList baffleSurfaces_; boolList baffleSurfaces_;
//- A flat list of all of the names of the patches from all of the
// surfaces to be reproduced in the meshed geometry
List<word> patchNames_;
//- The offset between the patch indices of the individual surface and
// the entry in the overall patch list
labelList patchOffsets_;
//- The overall boundBox of all of the surfaces to be conformed to //- The overall boundBox of all of the surfaces to be conformed to
boundBox bounds_; boundBox bounds_;
@ -122,6 +135,9 @@ public:
//- Return the surface indices //- Return the surface indices
inline const labelList& surfaces() const; inline const labelList& surfaces() const;
//- Return the patch names
inline const List<word>& patchNames() const;
//- Return the boundBox //- Return the boundBox
inline const boundBox& bounds() const; inline const boundBox& bounds() const;
@ -151,14 +167,18 @@ public:
) const; ) const;
// Finding if the line joining start and end intersects the surface // Finding if the line joining start and end intersects the surface
bool findSurfaceAnyIntersection(point start, point end) const; bool findSurfaceAnyIntersection
(
const point& start,
const point& end
) const;
//- Finding if the line joining start and end intersects the surface //- Finding if the line joining start and end intersects the surface
// and returning the hit and surface information // and returning the hit and surface information
void findSurfaceAnyIntersection void findSurfaceAnyIntersection
( (
point start, const point& start,
point end, const point& end,
pointIndexHit& surfHit, pointIndexHit& surfHit,
label& hitSurface label& hitSurface
) const; ) const;
@ -166,8 +186,8 @@ public:
//- Finding the nearestIntersection of the surface to start //- Finding the nearestIntersection of the surface to start
void findSurfaceNearestIntersection void findSurfaceNearestIntersection
( (
point start, const point& start,
point end, const point& end,
pointIndexHit& surfHit, pointIndexHit& surfHit,
label& hitSurface label& hitSurface
) const; ) const;
@ -217,6 +237,10 @@ public:
List<label>& featureHit List<label>& featureHit
) const; ) const;
//- Find which patch is intersected by the line from one point to
// another
label findPatch(const point& dVA, const point& dVB) const;
// Write // Write
//- Write all components of all the featureEdgeMeshes as an obj file //- Write all components of all the featureEdgeMeshes as an obj file

View File

@ -45,6 +45,12 @@ const Foam::labelList& Foam::conformationSurfaces::surfaces() const
} }
const Foam::List<Foam::word>& Foam::conformationSurfaces::patchNames() const
{
return patchNames_;
}
const Foam::boundBox& Foam::conformationSurfaces::bounds() const const Foam::boundBox& Foam::conformationSurfaces::bounds() const
{ {
return bounds_; return bounds_;