mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: edgeIntersections: added merging
This commit is contained in:
@ -700,11 +700,12 @@ Foam::label Foam::edgeIntersections::removeDegenerates
|
||||
}
|
||||
|
||||
|
||||
void Foam::edgeIntersections::replace
|
||||
void Foam::edgeIntersections::merge
|
||||
(
|
||||
const edgeIntersections& subInfo,
|
||||
const labelList& edgeMap,
|
||||
const labelList& faceMap
|
||||
const labelList& faceMap,
|
||||
const bool merge
|
||||
)
|
||||
{
|
||||
forAll(subInfo, subI)
|
||||
@ -716,19 +717,63 @@ void Foam::edgeIntersections::replace
|
||||
List<pointIndexHit>& intersections = operator[](edgeI);
|
||||
labelList& intersectionTypes = classification_[edgeI];
|
||||
|
||||
intersections.setSize(subHits.size());
|
||||
intersectionTypes.setSize(subHits.size());
|
||||
// Count unique hits. Assume edge can hit face only once
|
||||
label sz = 0;
|
||||
if (merge)
|
||||
{
|
||||
sz = intersections.size();
|
||||
}
|
||||
|
||||
label nNew = 0;
|
||||
forAll(subHits, i)
|
||||
{
|
||||
const pointIndexHit& subHit = subHits[i];
|
||||
|
||||
bool foundFace = false;
|
||||
for (label interI = 0; interI < sz; interI++)
|
||||
{
|
||||
if (intersections[interI].index() == faceMap[subHit.index()])
|
||||
{
|
||||
foundFace = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!foundFace)
|
||||
{
|
||||
nNew++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
intersections.setSize(sz+nNew);
|
||||
intersectionTypes.setSize(sz+nNew);
|
||||
nNew = sz;
|
||||
|
||||
forAll(subHits, i)
|
||||
{
|
||||
const pointIndexHit& subHit = subHits[i];
|
||||
intersections[i] = pointIndexHit
|
||||
|
||||
bool foundFace = false;
|
||||
for (label interI = 0; interI < sz; interI++)
|
||||
{
|
||||
if (intersections[interI].index() == faceMap[subHit.index()])
|
||||
{
|
||||
foundFace = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!foundFace)
|
||||
{
|
||||
intersections[nNew] = pointIndexHit
|
||||
(
|
||||
subHit.hit(),
|
||||
subHit.rawPoint(),
|
||||
faceMap[subHit.index()]
|
||||
);
|
||||
intersectionTypes[i] = subClass[i];
|
||||
intersectionTypes[nNew] = subClass[i];
|
||||
nNew++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -198,13 +198,15 @@ public:
|
||||
pointField& points1
|
||||
);
|
||||
|
||||
//- Replace edge intersection for a subset (given as edge map and
|
||||
// face map - for face indices stored in pointIndexHit.index())
|
||||
void replace
|
||||
//- Merge (or override) edge intersection for a subset
|
||||
// (given as edge map and face map - for face indices stored in
|
||||
// pointIndexHit.index())
|
||||
void merge
|
||||
(
|
||||
const edgeIntersections&,
|
||||
const labelList& edgeMap,
|
||||
const labelList& faceMap
|
||||
const labelList& faceMap,
|
||||
const bool merge = true
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user