mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
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:
@ -1479,24 +1479,9 @@ void Foam::conformalVoronoiMesh::calcDualMesh
|
||||
|
||||
// ~~~~~~~~~~~~ dual face and owner neighbour construction ~~~~~~~~~~~~~~~~~
|
||||
|
||||
//label nPatches = qSurf_.patches().size() + 1;
|
||||
patchNames = geometryToConformTo_.patchNames();
|
||||
|
||||
//label defaultPatchIndex = qSurf_.patches().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";
|
||||
label nPatches = patchNames.size();
|
||||
|
||||
patchSizes.setSize(nPatches);
|
||||
|
||||
@ -1622,20 +1607,13 @@ void Foam::conformalVoronoiMesh::calcDualMesh
|
||||
|
||||
point ptB = topoint(vB->point());
|
||||
|
||||
//pointIndexHit pHit = qSurf_.tree().findLineAny(ptA, ptB);
|
||||
|
||||
//label patchIndex = qSurf_[pHit.index()].region();
|
||||
|
||||
label patchIndex = defaultPatchIndex;
|
||||
label patchIndex = geometryToConformTo_.findPatch(ptA, ptB);
|
||||
|
||||
if (patchIndex == -1)
|
||||
{
|
||||
patchIndex = defaultPatchIndex;
|
||||
|
||||
WarningIn("Foam::conformalVoronoiMesh::calcDualMesh")
|
||||
<< "Dual face found that is not on a surface "
|
||||
<< "patch. Adding to "
|
||||
<< patchNames[defaultPatchIndex]
|
||||
<< "patch. Adding to " << patchNames[0]
|
||||
<< endl;
|
||||
}
|
||||
|
||||
@ -2253,12 +2231,25 @@ void Foam::conformalVoronoiMesh::move()
|
||||
)
|
||||
{
|
||||
// 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
|
||||
(
|
||||
@ -2325,6 +2316,20 @@ void Foam::conformalVoronoiMesh::move()
|
||||
vit,
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -41,7 +41,10 @@ Foam::conformationSurfaces::conformationSurfaces
|
||||
features_(),
|
||||
locationInMesh_(surfaceConformationDict.lookup("locationInMesh")),
|
||||
surfaces_(),
|
||||
allGeometryToSurfaces_(),
|
||||
baffleSurfaces_(),
|
||||
patchNames_(0),
|
||||
patchOffsets_(),
|
||||
bounds_()
|
||||
{
|
||||
const dictionary& surfacesDict
|
||||
@ -53,10 +56,14 @@ Foam::conformationSurfaces::conformationSurfaces
|
||||
|
||||
surfaces_.setSize(surfacesDict.size());
|
||||
|
||||
allGeometryToSurfaces_.setSize(allGeometry_.size(), -1);
|
||||
|
||||
baffleSurfaces_.setSize(surfacesDict.size());
|
||||
|
||||
features_.setSize(surfacesDict.size());
|
||||
|
||||
patchOffsets_.setSize(surfacesDict.size());
|
||||
|
||||
label surfI = 0;
|
||||
|
||||
forAllConstIter(dictionary, surfacesDict, iter)
|
||||
@ -65,6 +72,8 @@ Foam::conformationSurfaces::conformationSurfaces
|
||||
|
||||
surfaces_[surfI] = allGeometry_.findSurfaceID(surfaceName);
|
||||
|
||||
allGeometryToSurfaces_[surfaces_[surfI]] = surfI;
|
||||
|
||||
if (surfaces_[surfI] < 0)
|
||||
{
|
||||
FatalErrorIn("Foam::conformationSurfaces::conformationSurfaces")
|
||||
@ -73,6 +82,10 @@ Foam::conformationSurfaces::conformationSurfaces
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
patchOffsets_[surfI] = patchNames_.size();
|
||||
|
||||
patchNames_.append(allGeometry.regionNames()[surfaces_[surfI]]);
|
||||
|
||||
const dictionary& surfaceSubDict(surfacesDict.subDict(surfaceName));
|
||||
|
||||
baffleSurfaces_[surfI] = Switch
|
||||
@ -307,8 +320,8 @@ Foam::Field<bool> Foam::conformationSurfaces::wellOutside
|
||||
|
||||
bool Foam::conformationSurfaces::findSurfaceAnyIntersection
|
||||
(
|
||||
point start,
|
||||
point end
|
||||
const point& start,
|
||||
const point& end
|
||||
) const
|
||||
{
|
||||
labelList hitSurfaces;
|
||||
@ -330,8 +343,8 @@ bool Foam::conformationSurfaces::findSurfaceAnyIntersection
|
||||
|
||||
void Foam::conformationSurfaces::findSurfaceAnyIntersection
|
||||
(
|
||||
point start,
|
||||
point end,
|
||||
const point& start,
|
||||
const point& end,
|
||||
pointIndexHit& surfHit,
|
||||
label& hitSurface
|
||||
) const
|
||||
@ -364,8 +377,8 @@ void Foam::conformationSurfaces::findSurfaceAnyIntersection
|
||||
|
||||
void Foam::conformationSurfaces::findSurfaceNearestIntersection
|
||||
(
|
||||
point start,
|
||||
point end,
|
||||
const point& start,
|
||||
const point& end,
|
||||
pointIndexHit& surfHit,
|
||||
label& hitSurface
|
||||
) 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]];
|
||||
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -74,10 +74,23 @@ class conformationSurfaces
|
||||
//- Indices of surfaces in allGeometry that are to be conformed to
|
||||
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
|
||||
// is to be treated as a baffle
|
||||
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
|
||||
boundBox bounds_;
|
||||
|
||||
@ -122,6 +135,9 @@ public:
|
||||
//- Return the surface indices
|
||||
inline const labelList& surfaces() const;
|
||||
|
||||
//- Return the patch names
|
||||
inline const List<word>& patchNames() const;
|
||||
|
||||
//- Return the boundBox
|
||||
inline const boundBox& bounds() const;
|
||||
|
||||
@ -151,14 +167,18 @@ public:
|
||||
) const;
|
||||
|
||||
// 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
|
||||
// and returning the hit and surface information
|
||||
void findSurfaceAnyIntersection
|
||||
(
|
||||
point start,
|
||||
point end,
|
||||
const point& start,
|
||||
const point& end,
|
||||
pointIndexHit& surfHit,
|
||||
label& hitSurface
|
||||
) const;
|
||||
@ -166,8 +186,8 @@ public:
|
||||
//- Finding the nearestIntersection of the surface to start
|
||||
void findSurfaceNearestIntersection
|
||||
(
|
||||
point start,
|
||||
point end,
|
||||
const point& start,
|
||||
const point& end,
|
||||
pointIndexHit& surfHit,
|
||||
label& hitSurface
|
||||
) const;
|
||||
@ -217,6 +237,10 @@ public:
|
||||
List<label>& featureHit
|
||||
) 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 all components of all the featureEdgeMeshes as an obj 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
|
||||
{
|
||||
return bounds_;
|
||||
|
||||
Reference in New Issue
Block a user