mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
STYLE: isoSurface: remove unusued code
This commit is contained in:
@ -497,43 +497,6 @@ void Foam::isoSurface::calcCutTypes
|
||||
}
|
||||
|
||||
|
||||
//// Return the two common points between two triangles
|
||||
//Foam::labelPair Foam::isoSurface::findCommonPoints
|
||||
//(
|
||||
// const labelledTri& tri0,
|
||||
// const labelledTri& tri1
|
||||
//)
|
||||
//{
|
||||
// labelPair common(-1, -1);
|
||||
//
|
||||
// label fp0 = 0;
|
||||
// label fp1 = findIndex(tri1, tri0[fp0]);
|
||||
//
|
||||
// if (fp1 == -1)
|
||||
// {
|
||||
// fp0 = 1;
|
||||
// fp1 = findIndex(tri1, tri0[fp0]);
|
||||
// }
|
||||
//
|
||||
// if (fp1 != -1)
|
||||
// {
|
||||
// // So tri0[fp0] is tri1[fp1]
|
||||
//
|
||||
// // Find next common point
|
||||
// label fp0p1 = tri0.fcIndex(fp0);
|
||||
// label fp1p1 = tri1.fcIndex(fp1);
|
||||
// label fp1m1 = tri1.rcIndex(fp1);
|
||||
//
|
||||
// if (tri0[fp0p1] == tri1[fp1p1] || tri0[fp0p1] == tri1[fp1m1])
|
||||
// {
|
||||
// common[0] = tri0[fp0];
|
||||
// common[1] = tri0[fp0p1];
|
||||
// }
|
||||
// }
|
||||
// return common;
|
||||
//}
|
||||
|
||||
|
||||
// Caculate centre of surface.
|
||||
Foam::point Foam::isoSurface::calcCentre(const triSurface& s)
|
||||
{
|
||||
@ -547,73 +510,6 @@ Foam::point Foam::isoSurface::calcCentre(const triSurface& s)
|
||||
}
|
||||
|
||||
|
||||
//// Replace surface (localPoints, localTris) with single point. Returns
|
||||
//// point. Destructs arguments.
|
||||
//Foam::pointIndexHit Foam::isoSurface::collapseSurface
|
||||
//(
|
||||
// pointField& localPoints,
|
||||
// DynamicList<labelledTri, 64>& localTris
|
||||
//)
|
||||
//{
|
||||
// pointIndexHit info(false, vector::zero, localTris.size());
|
||||
//
|
||||
// if (localTris.size() == 1)
|
||||
// {
|
||||
// const labelledTri& tri = localTris[0];
|
||||
// info.setPoint(tri.centre(localPoints));
|
||||
// info.setHit();
|
||||
// }
|
||||
// else if (localTris.size() == 2)
|
||||
// {
|
||||
// // Check if the two triangles share an edge.
|
||||
// const labelledTri& tri0 = localTris[0];
|
||||
// const labelledTri& tri1 = localTris[0];
|
||||
//
|
||||
// labelPair shared = findCommonPoints(tri0, tri1);
|
||||
//
|
||||
// if (shared[0] != -1)
|
||||
// {
|
||||
// info.setPoint
|
||||
// (
|
||||
// 0.5
|
||||
// * (
|
||||
// tri0.centre(localPoints)
|
||||
// + tri1.centre(localPoints)
|
||||
// )
|
||||
// );
|
||||
// info.setHit();
|
||||
// }
|
||||
// }
|
||||
// else if (localTris.size())
|
||||
// {
|
||||
// // Check if single region. Rare situation.
|
||||
// triSurface surf
|
||||
// (
|
||||
// localTris,
|
||||
// geometricSurfacePatchList(0),
|
||||
// localPoints,
|
||||
// true
|
||||
// );
|
||||
// localTris.clearStorage();
|
||||
//
|
||||
// labelList faceZone;
|
||||
// label nZones = surf.markZones
|
||||
// (
|
||||
// boolList(surf.nEdges(), false),
|
||||
// faceZone
|
||||
// );
|
||||
//
|
||||
// if (nZones == 1)
|
||||
// {
|
||||
// info.setPoint(calcCentre(surf));
|
||||
// info.setHit();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return info;
|
||||
//}
|
||||
|
||||
|
||||
// Determine per cell centre whether all the intersections get collapsed
|
||||
// to a single point
|
||||
void Foam::isoSurface::calcSnappedCc
|
||||
@ -1442,437 +1338,6 @@ bool Foam::isoSurface::validTri(const triSurface& surf, const label faceI)
|
||||
}
|
||||
|
||||
|
||||
//void Foam::isoSurface::calcAddressing
|
||||
//(
|
||||
// const triSurface& surf,
|
||||
// List<FixedList<label, 3> >& faceEdges,
|
||||
// labelList& edgeFace0,
|
||||
// labelList& edgeFace1,
|
||||
// Map<labelList>& edgeFacesRest
|
||||
//) const
|
||||
//{
|
||||
// const pointField& points = surf.points();
|
||||
//
|
||||
// pointField edgeCentres(3*surf.size());
|
||||
// label edgeI = 0;
|
||||
// forAll(surf, triI)
|
||||
// {
|
||||
// const labelledTri& tri = surf[triI];
|
||||
// edgeCentres[edgeI++] = 0.5*(points[tri[0]]+points[tri[1]]);
|
||||
// edgeCentres[edgeI++] = 0.5*(points[tri[1]]+points[tri[2]]);
|
||||
// edgeCentres[edgeI++] = 0.5*(points[tri[2]]+points[tri[0]]);
|
||||
// }
|
||||
//
|
||||
// pointField mergedCentres;
|
||||
// labelList oldToMerged;
|
||||
// bool hasMerged = mergePoints
|
||||
// (
|
||||
// edgeCentres,
|
||||
// mergeDistance_,
|
||||
// false,
|
||||
// oldToMerged,
|
||||
// mergedCentres
|
||||
// );
|
||||
//
|
||||
// if (debug)
|
||||
// {
|
||||
// Pout<< "isoSurface : detected "
|
||||
// << mergedCentres.size()
|
||||
// << " geometric edges on " << surf.size() << " triangles." << endl;
|
||||
// }
|
||||
//
|
||||
// if (!hasMerged)
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
//
|
||||
// // Determine faceEdges
|
||||
// faceEdges.setSize(surf.size());
|
||||
// edgeI = 0;
|
||||
// forAll(surf, triI)
|
||||
// {
|
||||
// faceEdges[triI][0] = oldToMerged[edgeI++];
|
||||
// faceEdges[triI][1] = oldToMerged[edgeI++];
|
||||
// faceEdges[triI][2] = oldToMerged[edgeI++];
|
||||
// }
|
||||
//
|
||||
//
|
||||
// // Determine edgeFaces
|
||||
// edgeFace0.setSize(mergedCentres.size());
|
||||
// edgeFace0 = -1;
|
||||
// edgeFace1.setSize(mergedCentres.size());
|
||||
// edgeFace1 = -1;
|
||||
// edgeFacesRest.clear();
|
||||
//
|
||||
// // Overflow edge faces for geometric shared edges that turned
|
||||
// // out to be different anyway.
|
||||
// EdgeMap<labelList> extraEdgeFaces(mergedCentres.size()/100);
|
||||
//
|
||||
// forAll(oldToMerged, oldEdgeI)
|
||||
// {
|
||||
// label triI = oldEdgeI / 3;
|
||||
// label edgeI = oldToMerged[oldEdgeI];
|
||||
//
|
||||
// if (edgeFace0[edgeI] == -1)
|
||||
// {
|
||||
// // First triangle for edge
|
||||
// edgeFace0[edgeI] = triI;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// //- Check that the two triangles actually topologically
|
||||
// // share an edge
|
||||
// const labelledTri& prevTri = surf[edgeFace0[edgeI]];
|
||||
// const labelledTri& tri = surf[triI];
|
||||
//
|
||||
// label fp = oldEdgeI % 3;
|
||||
//
|
||||
// edge e(tri[fp], tri[tri.fcIndex(fp)]);
|
||||
//
|
||||
// label prevTriIndex = -1;
|
||||
//
|
||||
// forAll(prevTri, i)
|
||||
// {
|
||||
// if (edge(prevTri[i], prevTri[prevTri.fcIndex(i)]) == e)
|
||||
// {
|
||||
// prevTriIndex = i;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if (prevTriIndex == -1)
|
||||
// {
|
||||
// // Different edge. Store for later.
|
||||
// EdgeMap<labelList>::iterator iter = extraEdgeFaces.find(e);
|
||||
//
|
||||
// if (iter != extraEdgeFaces.end())
|
||||
// {
|
||||
// labelList& eFaces = iter();
|
||||
// label sz = eFaces.size();
|
||||
// eFaces.setSize(sz+1);
|
||||
// eFaces[sz] = triI;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// extraEdgeFaces.insert(e, labelList(1, triI));
|
||||
// }
|
||||
// }
|
||||
// else if (edgeFace1[edgeI] == -1)
|
||||
// {
|
||||
// edgeFace1[edgeI] = triI;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// //WarningIn("orientSurface(triSurface&)")
|
||||
// // << "Edge " << edgeI << " with centre "
|
||||
// // << mergedCentres[edgeI]
|
||||
// // << " used by more than two triangles: "
|
||||
// // << edgeFace0[edgeI] << ", "
|
||||
// // << edgeFace1[edgeI] << " and " << triI << endl;
|
||||
// Map<labelList>::iterator iter = edgeFacesRest.find(edgeI);
|
||||
//
|
||||
// if (iter != edgeFacesRest.end())
|
||||
// {
|
||||
// labelList& eFaces = iter();
|
||||
// label sz = eFaces.size();
|
||||
// eFaces.setSize(sz+1);
|
||||
// eFaces[sz] = triI;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// edgeFacesRest.insert(edgeI, labelList(1, triI));
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// // Add extraEdgeFaces
|
||||
// edgeI = edgeFace0.size();
|
||||
//
|
||||
// edgeFace0.setSize(edgeI + extraEdgeFaces.size());
|
||||
// edgeFace1.setSize(edgeI + extraEdgeFaces.size(), -1);
|
||||
//
|
||||
// forAllConstIter(EdgeMap<labelList>, extraEdgeFaces, iter)
|
||||
// {
|
||||
// const labelList& eFaces = iter();
|
||||
//
|
||||
// // The current edge will become edgeI. Replace all occurrences in
|
||||
// // faceEdges
|
||||
// forAll(eFaces, i)
|
||||
// {
|
||||
// label triI = eFaces[i];
|
||||
// const labelledTri& tri = surf[triI];
|
||||
//
|
||||
// FixedList<label, 3>& fEdges = faceEdges[triI];
|
||||
// forAll(tri, fp)
|
||||
// {
|
||||
// edge e(tri[fp], tri[tri.fcIndex(fp)]);
|
||||
//
|
||||
// if (e == iter.key())
|
||||
// {
|
||||
// fEdges[fp] = edgeI;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
// // Add face to edgeFaces
|
||||
//
|
||||
// edgeFace0[edgeI] = eFaces[0];
|
||||
//
|
||||
// if (eFaces.size() >= 2)
|
||||
// {
|
||||
// edgeFace1[edgeI] = eFaces[1];
|
||||
//
|
||||
// if (eFaces.size() > 2)
|
||||
// {
|
||||
// edgeFacesRest.insert
|
||||
// (
|
||||
// edgeI,
|
||||
// SubList<label>(eFaces, eFaces.size()-2, 2)
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// edgeI++;
|
||||
// }
|
||||
//}
|
||||
//
|
||||
//
|
||||
//void Foam::isoSurface::walkOrientation
|
||||
//(
|
||||
// const triSurface& surf,
|
||||
// const List<FixedList<label, 3> >& faceEdges,
|
||||
// const labelList& edgeFace0,
|
||||
// const labelList& edgeFace1,
|
||||
// const label seedTriI,
|
||||
// labelList& flipState
|
||||
//)
|
||||
//{
|
||||
// // Do walk for consistent orientation.
|
||||
// DynamicList<label> changedFaces(surf.size());
|
||||
//
|
||||
// changedFaces.append(seedTriI);
|
||||
//
|
||||
// while (changedFaces.size())
|
||||
// {
|
||||
// DynamicList<label> newChangedFaces(changedFaces.size());
|
||||
//
|
||||
// forAll(changedFaces, i)
|
||||
// {
|
||||
// label triI = changedFaces[i];
|
||||
// const labelledTri& tri = surf[triI];
|
||||
// const FixedList<label, 3>& fEdges = faceEdges[triI];
|
||||
//
|
||||
// forAll(fEdges, fp)
|
||||
// {
|
||||
// label edgeI = fEdges[fp];
|
||||
//
|
||||
// // my points:
|
||||
// label p0 = tri[fp];
|
||||
// label p1 = tri[tri.fcIndex(fp)];
|
||||
//
|
||||
// label nbrI =
|
||||
// (
|
||||
// edgeFace0[edgeI] != triI
|
||||
// ? edgeFace0[edgeI]
|
||||
// : edgeFace1[edgeI]
|
||||
// );
|
||||
//
|
||||
// if (nbrI != -1 && flipState[nbrI] == -1)
|
||||
// {
|
||||
// const labelledTri& nbrTri = surf[nbrI];
|
||||
//
|
||||
// // nbr points
|
||||
// label nbrFp = findIndex(nbrTri, p0);
|
||||
//
|
||||
// if (nbrFp == -1)
|
||||
// {
|
||||
// FatalErrorIn("isoSurface::walkOrientation(..)")
|
||||
// << "triI:" << triI
|
||||
// << " tri:" << tri
|
||||
// << " p0:" << p0
|
||||
// << " p1:" << p1
|
||||
// << " fEdges:" << fEdges
|
||||
// << " edgeI:" << edgeI
|
||||
// << " edgeFace0:" << edgeFace0[edgeI]
|
||||
// << " edgeFace1:" << edgeFace1[edgeI]
|
||||
// << " nbrI:" << nbrI
|
||||
// << " nbrTri:" << nbrTri
|
||||
// << abort(FatalError);
|
||||
// }
|
||||
//
|
||||
//
|
||||
// label nbrP1 = nbrTri[nbrTri.rcIndex(nbrFp)];
|
||||
//
|
||||
// bool sameOrientation = (p1 == nbrP1);
|
||||
//
|
||||
// if (flipState[triI] == 0)
|
||||
// {
|
||||
// flipState[nbrI] = (sameOrientation ? 0 : 1);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// flipState[nbrI] = (sameOrientation ? 1 : 0);
|
||||
// }
|
||||
// newChangedFaces.append(nbrI);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// changedFaces.transfer(newChangedFaces);
|
||||
// }
|
||||
//}
|
||||
//
|
||||
//
|
||||
//void Foam::isoSurface::orientSurface
|
||||
//(
|
||||
// triSurface& surf,
|
||||
// const List<FixedList<label, 3> >& faceEdges,
|
||||
// const labelList& edgeFace0,
|
||||
// const labelList& edgeFace1,
|
||||
// const Map<labelList>& edgeFacesRest
|
||||
//)
|
||||
//{
|
||||
// // -1 : unvisited
|
||||
// // 0 : leave as is
|
||||
// // 1 : flip
|
||||
// labelList flipState(surf.size(), -1);
|
||||
//
|
||||
// label seedTriI = 0;
|
||||
//
|
||||
// while (true)
|
||||
// {
|
||||
// // Find first unvisited triangle
|
||||
// for
|
||||
// (
|
||||
// ;
|
||||
// seedTriI < surf.size() && flipState[seedTriI] != -1;
|
||||
// seedTriI++
|
||||
// )
|
||||
// {}
|
||||
//
|
||||
// if (seedTriI == surf.size())
|
||||
// {
|
||||
// break;
|
||||
// }
|
||||
//
|
||||
// // Note: Determine orientation of seedTriI?
|
||||
// // for now assume it is ok
|
||||
// flipState[seedTriI] = 0;
|
||||
//
|
||||
// walkOrientation
|
||||
// (
|
||||
// surf,
|
||||
// faceEdges,
|
||||
// edgeFace0,
|
||||
// edgeFace1,
|
||||
// seedTriI,
|
||||
// flipState
|
||||
// );
|
||||
// }
|
||||
//
|
||||
// // Do actual flipping
|
||||
// surf.clearOut();
|
||||
// forAll(surf, triI)
|
||||
// {
|
||||
// if (flipState[triI] == 1)
|
||||
// {
|
||||
// labelledTri tri(surf[triI]);
|
||||
//
|
||||
// surf[triI][0] = tri[0];
|
||||
// surf[triI][1] = tri[2];
|
||||
// surf[triI][2] = tri[1];
|
||||
// }
|
||||
// else if (flipState[triI] == -1)
|
||||
// {
|
||||
// FatalErrorIn
|
||||
// (
|
||||
// "isoSurface::orientSurface(triSurface&, const label)"
|
||||
// ) << "problem" << abort(FatalError);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
//
|
||||
//
|
||||
//// Checks if triangle is connected through edgeI only.
|
||||
//bool Foam::isoSurface::danglingTriangle
|
||||
//(
|
||||
// const FixedList<label, 3>& fEdges,
|
||||
// const labelList& edgeFace1
|
||||
//)
|
||||
//{
|
||||
// label nOpen = 0;
|
||||
// forAll(fEdges, i)
|
||||
// {
|
||||
// if (edgeFace1[fEdges[i]] == -1)
|
||||
// {
|
||||
// nOpen++;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if (nOpen == 1 || nOpen == 2 || nOpen == 3)
|
||||
// {
|
||||
// return true;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
//}
|
||||
//
|
||||
//
|
||||
//// Mark triangles to keep. Returns number of dangling triangles.
|
||||
//Foam::label Foam::isoSurface::markDanglingTriangles
|
||||
//(
|
||||
// const List<FixedList<label, 3> >& faceEdges,
|
||||
// const labelList& edgeFace0,
|
||||
// const labelList& edgeFace1,
|
||||
// const Map<labelList>& edgeFacesRest,
|
||||
// boolList& keepTriangles
|
||||
//)
|
||||
//{
|
||||
// keepTriangles.setSize(faceEdges.size());
|
||||
// keepTriangles = true;
|
||||
//
|
||||
// label nDangling = 0;
|
||||
//
|
||||
// // Remove any dangling triangles
|
||||
// forAllConstIter(Map<labelList>, edgeFacesRest, iter)
|
||||
// {
|
||||
// // These are all the non-manifold edges. Filter out all triangles
|
||||
// // with only one connected edge (= this edge)
|
||||
//
|
||||
// label edgeI = iter.key();
|
||||
// const labelList& otherEdgeFaces = iter();
|
||||
//
|
||||
// // Remove all dangling triangles
|
||||
// if (danglingTriangle(faceEdges[edgeFace0[edgeI]], edgeFace1))
|
||||
// {
|
||||
// keepTriangles[edgeFace0[edgeI]] = false;
|
||||
// nDangling++;
|
||||
// }
|
||||
// if (danglingTriangle(faceEdges[edgeFace1[edgeI]], edgeFace1))
|
||||
// {
|
||||
// keepTriangles[edgeFace1[edgeI]] = false;
|
||||
// nDangling++;
|
||||
// }
|
||||
// forAll(otherEdgeFaces, i)
|
||||
// {
|
||||
// label triI = otherEdgeFaces[i];
|
||||
// if (danglingTriangle(faceEdges[triI], edgeFace1))
|
||||
// {
|
||||
// keepTriangles[triI] = false;
|
||||
// nDangling++;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return nDangling;
|
||||
//}
|
||||
|
||||
|
||||
Foam::triSurface Foam::isoSurface::subsetMesh
|
||||
(
|
||||
const triSurface& s,
|
||||
@ -2305,75 +1770,7 @@ Foam::isoSurface::isoSurface
|
||||
// Copied from surfaceCheck
|
||||
validTri(*this, triI);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//if (false)
|
||||
//{
|
||||
// List<FixedList<label, 3> > faceEdges;
|
||||
// labelList edgeFace0, edgeFace1;
|
||||
// Map<labelList> edgeFacesRest;
|
||||
//
|
||||
//
|
||||
// while (true)
|
||||
// {
|
||||
// // Calculate addressing
|
||||
// calcAddressing
|
||||
// (
|
||||
// *this,
|
||||
// faceEdges,
|
||||
// edgeFace0,
|
||||
// edgeFace1,
|
||||
// edgeFacesRest
|
||||
// );
|
||||
//
|
||||
// // See if any dangling triangles
|
||||
// boolList keepTriangles;
|
||||
// label nDangling = markDanglingTriangles
|
||||
// (
|
||||
// faceEdges,
|
||||
// edgeFace0,
|
||||
// edgeFace1,
|
||||
// edgeFacesRest,
|
||||
// keepTriangles
|
||||
// );
|
||||
//
|
||||
// if (debug)
|
||||
// {
|
||||
// Pout<< "isoSurface : detected " << nDangling
|
||||
// << " dangling triangles." << endl;
|
||||
// }
|
||||
//
|
||||
// if (nDangling == 0)
|
||||
// {
|
||||
// break;
|
||||
// }
|
||||
//
|
||||
// // Create face map (new to old)
|
||||
// labelList subsetTriMap(findIndices(keepTriangles, true));
|
||||
//
|
||||
// labelList subsetPointMap;
|
||||
// labelList reversePointMap;
|
||||
// triSurface::operator=
|
||||
// (
|
||||
// subsetMesh
|
||||
// (
|
||||
// *this,
|
||||
// subsetTriMap,
|
||||
// reversePointMap,
|
||||
// subsetPointMap
|
||||
// )
|
||||
// );
|
||||
// meshCells_ = labelField(meshCells_, subsetTriMap);
|
||||
// inplaceRenumber(reversePointMap, triPointMergeMap_);
|
||||
// }
|
||||
//
|
||||
// orientSurface(*this, faceEdges, edgeFace0, edgeFace1, edgeFacesRest);
|
||||
//}
|
||||
|
||||
|
||||
if (debug)
|
||||
{
|
||||
fileName stlFile = mesh_.time().path() + ".stl";
|
||||
Pout<< "Dumping surface to " << stlFile << endl;
|
||||
triSurface::write(stlFile);
|
||||
|
||||
@ -1645,8 +1645,6 @@ Foam::isoSurfaceCell::isoSurfaceCell
|
||||
meshCells_ = labelField(meshCells_, subsetTriMap);
|
||||
inplaceRenumber(reversePointMap, triPointMergeMap_);
|
||||
}
|
||||
|
||||
//orientSurface(*this, faceEdges, edgeFace0, edgeFace1, edgeFacesRest);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user