mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: isoSurfaceCell: orientation of triangles
This commit is contained in:
@ -255,6 +255,7 @@ surfaces
|
|||||||
distance 0.0;
|
distance 0.0;
|
||||||
|
|
||||||
interpolate false;
|
interpolate false;
|
||||||
|
regularise false; // Optional: do not simplify
|
||||||
// mergeTol 1e-10; // Optional: fraction of mesh bounding box
|
// mergeTol 1e-10; // Optional: fraction of mesh bounding box
|
||||||
// to merge points (default=1e-6)
|
// to merge points (default=1e-6)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -287,16 +287,16 @@ Foam::pointIndexHit Foam::isoSurfaceCell::collapseSurface
|
|||||||
|
|
||||||
if (shared[0] != -1)
|
if (shared[0] != -1)
|
||||||
{
|
{
|
||||||
//vector n0 = tri0.normal(localPoints);
|
vector n0 = tri0.normal(localPoints);
|
||||||
//n0 /= mag(n0);
|
n0 /= mag(n0);
|
||||||
//vector n1 = tri1.normal(localPoints);
|
vector n1 = tri1.normal(localPoints);
|
||||||
//n1 /= mag(n1);
|
n1 /= mag(n1);
|
||||||
//
|
|
||||||
//if ((n0 & n1) < 0)
|
if ((n0 & n1) < 0)
|
||||||
//{
|
{
|
||||||
// // Too big an angle. Do not simplify.
|
// Too big an angle. Do not simplify.
|
||||||
//}
|
}
|
||||||
//else
|
else
|
||||||
{
|
{
|
||||||
info.setPoint
|
info.setPoint
|
||||||
(
|
(
|
||||||
@ -332,18 +332,18 @@ Foam::pointIndexHit Foam::isoSurfaceCell::collapseSurface
|
|||||||
if (nZones == 1)
|
if (nZones == 1)
|
||||||
{
|
{
|
||||||
// Check that all normals make a decent angle
|
// Check that all normals make a decent angle
|
||||||
//scalar minCos = GREAT;
|
scalar minCos = GREAT;
|
||||||
//const vector& n0 = surf.faceNormals()[0];
|
const vector& n0 = surf.faceNormals()[0];
|
||||||
//for (label i = 1; i < surf.size(); i++)
|
for (label i = 1; i < surf.size(); i++)
|
||||||
//{
|
{
|
||||||
// scalar cosAngle = (n0 & surf.faceNormals()[i]);
|
scalar cosAngle = (n0 & surf.faceNormals()[i]);
|
||||||
// if (cosAngle < minCos)
|
if (cosAngle < minCos)
|
||||||
// {
|
{
|
||||||
// minCos = cosAngle;
|
minCos = cosAngle;
|
||||||
// }
|
}
|
||||||
//}
|
}
|
||||||
//
|
|
||||||
//if (minCos > 0)
|
if (minCos > 0)
|
||||||
{
|
{
|
||||||
info.setPoint(calcCentre(surf));
|
info.setPoint(calcCentre(surf));
|
||||||
info.setHit();
|
info.setHit();
|
||||||
@ -443,7 +443,7 @@ void Foam::isoSurfaceCell::calcSnappedCc
|
|||||||
label faceI = cFaces[cFaceI];
|
label faceI = cFaces[cFaceI];
|
||||||
const face& f = mesh_.faces()[faceI];
|
const face& f = mesh_.faces()[faceI];
|
||||||
|
|
||||||
// Do a tetrahedrisation. Each face to cc becomes pyr.
|
// Do a tetrahedralisation. Each face to cc becomes pyr.
|
||||||
// Each pyr gets split into tets by diagonalisation
|
// Each pyr gets split into tets by diagonalisation
|
||||||
// of face.
|
// of face.
|
||||||
|
|
||||||
@ -467,14 +467,18 @@ void Foam::isoSurfaceCell::calcSnappedCc
|
|||||||
&& (s[2] >= 0.0 && s[2] <= 0.5)
|
&& (s[2] >= 0.0 && s[2] <= 0.5)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (mesh_.faceOwner()[faceI] == cellI)
|
if
|
||||||
|
(
|
||||||
|
(mesh_.faceOwner()[faceI] == cellI)
|
||||||
|
== (cVal >= pVals[tri[0]])
|
||||||
|
)
|
||||||
{
|
{
|
||||||
localTris.append
|
localTris.append
|
||||||
(
|
(
|
||||||
labelledTri
|
labelledTri
|
||||||
(
|
(
|
||||||
pointToLocal[tri[0]],
|
|
||||||
pointToLocal[tri[1]],
|
pointToLocal[tri[1]],
|
||||||
|
pointToLocal[tri[0]],
|
||||||
pointToLocal[tri[2]],
|
pointToLocal[tri[2]],
|
||||||
0
|
0
|
||||||
)
|
)
|
||||||
@ -486,8 +490,8 @@ void Foam::isoSurfaceCell::calcSnappedCc
|
|||||||
(
|
(
|
||||||
labelledTri
|
labelledTri
|
||||||
(
|
(
|
||||||
pointToLocal[tri[1]],
|
|
||||||
pointToLocal[tri[0]],
|
pointToLocal[tri[0]],
|
||||||
|
pointToLocal[tri[1]],
|
||||||
pointToLocal[tri[2]],
|
pointToLocal[tri[2]],
|
||||||
0
|
0
|
||||||
)
|
)
|
||||||
@ -575,7 +579,11 @@ void Foam::isoSurfaceCell::genPointTris
|
|||||||
point p1 = (1.0-s[1])*pts[pointI] + s[1]*pts[c];
|
point p1 = (1.0-s[1])*pts[pointI] + s[1]*pts[c];
|
||||||
point p2 = (1.0-s[2])*pts[pointI] + s[2]*cc[cellI];
|
point p2 = (1.0-s[2])*pts[pointI] + s[2]*cc[cellI];
|
||||||
|
|
||||||
if (mesh_.faceOwner()[faceI] == cellI)
|
if
|
||||||
|
(
|
||||||
|
(mesh_.faceOwner()[faceI] == cellI)
|
||||||
|
== (pointValues[pointI] > cellValues[cellI])
|
||||||
|
)
|
||||||
{
|
{
|
||||||
localTriPoints.append(p0);
|
localTriPoints.append(p0);
|
||||||
localTriPoints.append(p1);
|
localTriPoints.append(p1);
|
||||||
@ -754,7 +762,7 @@ void Foam::isoSurfaceCell::calcSnappedPoint
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Loop over all pointCells (by using pointFaces)
|
// Do a pointCells walk (by using pointFaces)
|
||||||
|
|
||||||
localPointCells.clear();
|
localPointCells.clear();
|
||||||
localTriPoints.clear();
|
localTriPoints.clear();
|
||||||
@ -766,6 +774,8 @@ void Foam::isoSurfaceCell::calcSnappedPoint
|
|||||||
|
|
||||||
if (isTet.get(own) == 1)
|
if (isTet.get(own) == 1)
|
||||||
{
|
{
|
||||||
|
// Since tets have no cell centre to include make sure
|
||||||
|
// we only generate a triangle once per point.
|
||||||
if (localPointCells.insert(own))
|
if (localPointCells.insert(own))
|
||||||
{
|
{
|
||||||
genPointTris(pVals, pointI, faceI, own, localTriPoints);
|
genPointTris(pVals, pointI, faceI, own, localTriPoints);
|
||||||
@ -848,20 +858,19 @@ void Foam::isoSurfaceCell::calcSnappedPoint
|
|||||||
|
|
||||||
if (nZones == 1)
|
if (nZones == 1)
|
||||||
{
|
{
|
||||||
//// Check that all normals make a decent angle
|
// Check that all normals make a decent angle
|
||||||
//scalar minCos = GREAT;
|
scalar minCos = GREAT;
|
||||||
//const vector& n0 = surf.faceNormals()[0];
|
const vector& n0 = surf.faceNormals()[0];
|
||||||
//for (label i = 1; i < surf.size(); i++)
|
for (label i = 1; i < surf.size(); i++)
|
||||||
//{
|
{
|
||||||
// const vector& n = surf.faceNormals()[i];
|
const vector& n = surf.faceNormals()[i];
|
||||||
// scalar cosAngle = (n0 & n);
|
scalar cosAngle = (n0 & n);
|
||||||
// if (cosAngle < minCos)
|
if (cosAngle < minCos)
|
||||||
// {
|
{
|
||||||
// minCos = cosAngle;
|
minCos = cosAngle;
|
||||||
// }
|
}
|
||||||
//}
|
}
|
||||||
//
|
if (minCos > 0)
|
||||||
//if (minCos > 0)
|
|
||||||
{
|
{
|
||||||
collapsedPoint[pointI] = calcCentre(surf);
|
collapsedPoint[pointI] = calcCentre(surf);
|
||||||
}
|
}
|
||||||
@ -882,7 +891,9 @@ void Foam::isoSurfaceCell::calcSnappedPoint
|
|||||||
|
|
||||||
forAll(collapsedPoint, pointI)
|
forAll(collapsedPoint, pointI)
|
||||||
{
|
{
|
||||||
if (collapsedPoint[pointI] != greatPoint)
|
// Cannot do == comparison since might be transformed so have
|
||||||
|
// truncation errors.
|
||||||
|
if (magSqr(collapsedPoint[pointI]) < 0.5*magSqr(greatPoint))
|
||||||
{
|
{
|
||||||
snappedPoint[pointI] = snappedPoints.size();
|
snappedPoint[pointI] = snappedPoints.size();
|
||||||
snappedPoints.append(collapsedPoint[pointI]);
|
snappedPoints.append(collapsedPoint[pointI]);
|
||||||
@ -1208,142 +1219,142 @@ void Foam::isoSurfaceCell::calcAddressing
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::isoSurfaceCell::walkOrientation
|
//void Foam::isoSurfaceCell::walkOrientation
|
||||||
(
|
//(
|
||||||
const triSurface& surf,
|
// const triSurface& surf,
|
||||||
const List<FixedList<label, 3> >& faceEdges,
|
// const List<FixedList<label, 3> >& faceEdges,
|
||||||
const labelList& edgeFace0,
|
// const labelList& edgeFace0,
|
||||||
const labelList& edgeFace1,
|
// const labelList& edgeFace1,
|
||||||
const label seedTriI,
|
// const label seedTriI,
|
||||||
labelList& flipState
|
// labelList& flipState
|
||||||
)
|
//)
|
||||||
{
|
//{
|
||||||
// Do walk for consistent orientation.
|
// // Do walk for consistent orientation.
|
||||||
DynamicList<label> changedFaces(surf.size());
|
// DynamicList<label> changedFaces(surf.size());
|
||||||
|
//
|
||||||
changedFaces.append(seedTriI);
|
// changedFaces.append(seedTriI);
|
||||||
|
//
|
||||||
while (changedFaces.size())
|
// while (changedFaces.size())
|
||||||
{
|
// {
|
||||||
DynamicList<label> newChangedFaces(changedFaces.size());
|
// DynamicList<label> newChangedFaces(changedFaces.size());
|
||||||
|
//
|
||||||
forAll(changedFaces, i)
|
// forAll(changedFaces, i)
|
||||||
{
|
// {
|
||||||
label triI = changedFaces[i];
|
// label triI = changedFaces[i];
|
||||||
const labelledTri& tri = surf[triI];
|
// const labelledTri& tri = surf[triI];
|
||||||
const FixedList<label, 3>& fEdges = faceEdges[triI];
|
// const FixedList<label, 3>& fEdges = faceEdges[triI];
|
||||||
|
//
|
||||||
forAll(fEdges, fp)
|
// forAll(fEdges, fp)
|
||||||
{
|
// {
|
||||||
label edgeI = fEdges[fp];
|
// label edgeI = fEdges[fp];
|
||||||
|
//
|
||||||
// my points:
|
// // my points:
|
||||||
label p0 = tri[fp];
|
// label p0 = tri[fp];
|
||||||
label p1 = tri[tri.fcIndex(fp)];
|
// label p1 = tri[tri.fcIndex(fp)];
|
||||||
|
//
|
||||||
label nbrI =
|
// label nbrI =
|
||||||
(
|
// (
|
||||||
edgeFace0[edgeI] != triI
|
// edgeFace0[edgeI] != triI
|
||||||
? edgeFace0[edgeI]
|
// ? edgeFace0[edgeI]
|
||||||
: edgeFace1[edgeI]
|
// : edgeFace1[edgeI]
|
||||||
);
|
// );
|
||||||
|
//
|
||||||
if (nbrI != -1 && flipState[nbrI] == -1)
|
// if (nbrI != -1 && flipState[nbrI] == -1)
|
||||||
{
|
// {
|
||||||
const labelledTri& nbrTri = surf[nbrI];
|
// const labelledTri& nbrTri = surf[nbrI];
|
||||||
|
//
|
||||||
// nbr points
|
// // nbr points
|
||||||
label nbrFp = findIndex(nbrTri, p0);
|
// label nbrFp = findIndex(nbrTri, p0);
|
||||||
label nbrP1 = nbrTri[nbrTri.rcIndex(nbrFp)];
|
// label nbrP1 = nbrTri[nbrTri.rcIndex(nbrFp)];
|
||||||
|
//
|
||||||
bool sameOrientation = (p1 == nbrP1);
|
// bool sameOrientation = (p1 == nbrP1);
|
||||||
|
//
|
||||||
if (flipState[triI] == 0)
|
// if (flipState[triI] == 0)
|
||||||
{
|
// {
|
||||||
flipState[nbrI] = (sameOrientation ? 0 : 1);
|
// flipState[nbrI] = (sameOrientation ? 0 : 1);
|
||||||
}
|
// }
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
flipState[nbrI] = (sameOrientation ? 1 : 0);
|
// flipState[nbrI] = (sameOrientation ? 1 : 0);
|
||||||
}
|
// }
|
||||||
newChangedFaces.append(nbrI);
|
// newChangedFaces.append(nbrI);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
changedFaces.transfer(newChangedFaces);
|
// changedFaces.transfer(newChangedFaces);
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
//
|
||||||
|
//
|
||||||
void Foam::isoSurfaceCell::orientSurface
|
//void Foam::isoSurfaceCell::orientSurface
|
||||||
(
|
//(
|
||||||
triSurface& surf,
|
// triSurface& surf,
|
||||||
const List<FixedList<label, 3> >& faceEdges,
|
// const List<FixedList<label, 3> >& faceEdges,
|
||||||
const labelList& edgeFace0,
|
// const labelList& edgeFace0,
|
||||||
const labelList& edgeFace1,
|
// const labelList& edgeFace1,
|
||||||
const Map<labelList>& edgeFacesRest
|
// const Map<labelList>& edgeFacesRest
|
||||||
)
|
//)
|
||||||
{
|
//{
|
||||||
// -1 : unvisited
|
// // -1 : unvisited
|
||||||
// 0 : leave as is
|
// // 0 : leave as is
|
||||||
// 1 : flip
|
// // 1 : flip
|
||||||
labelList flipState(surf.size(), -1);
|
// labelList flipState(surf.size(), -1);
|
||||||
|
//
|
||||||
label seedTriI = 0;
|
// label seedTriI = 0;
|
||||||
|
//
|
||||||
while (true)
|
// while (true)
|
||||||
{
|
// {
|
||||||
// Find first unvisited triangle
|
// // Find first unvisited triangle
|
||||||
for
|
// for
|
||||||
(
|
// (
|
||||||
;
|
// ;
|
||||||
seedTriI < surf.size() && flipState[seedTriI] != -1;
|
// seedTriI < surf.size() && flipState[seedTriI] != -1;
|
||||||
seedTriI++
|
// seedTriI++
|
||||||
)
|
// )
|
||||||
{}
|
// {}
|
||||||
|
//
|
||||||
if (seedTriI == surf.size())
|
// if (seedTriI == surf.size())
|
||||||
{
|
// {
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
// Note: Determine orientation of seedTriI?
|
// // Note: Determine orientation of seedTriI?
|
||||||
// for now assume it is ok
|
// // for now assume it is ok
|
||||||
flipState[seedTriI] = 0;
|
// flipState[seedTriI] = 0;
|
||||||
|
//
|
||||||
walkOrientation
|
// walkOrientation
|
||||||
(
|
// (
|
||||||
surf,
|
// surf,
|
||||||
faceEdges,
|
// faceEdges,
|
||||||
edgeFace0,
|
// edgeFace0,
|
||||||
edgeFace1,
|
// edgeFace1,
|
||||||
seedTriI,
|
// seedTriI,
|
||||||
flipState
|
// flipState
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
// Do actual flipping
|
// // Do actual flipping
|
||||||
surf.clearOut();
|
// surf.clearOut();
|
||||||
forAll(surf, triI)
|
// forAll(surf, triI)
|
||||||
{
|
// {
|
||||||
if (flipState[triI] == 1)
|
// if (flipState[triI] == 1)
|
||||||
{
|
// {
|
||||||
labelledTri tri(surf[triI]);
|
// labelledTri tri(surf[triI]);
|
||||||
|
//
|
||||||
surf[triI][0] = tri[0];
|
// surf[triI][0] = tri[0];
|
||||||
surf[triI][1] = tri[2];
|
// surf[triI][1] = tri[2];
|
||||||
surf[triI][2] = tri[1];
|
// surf[triI][2] = tri[1];
|
||||||
}
|
// }
|
||||||
else if (flipState[triI] == -1)
|
// else if (flipState[triI] == -1)
|
||||||
{
|
// {
|
||||||
FatalErrorIn
|
// FatalErrorIn
|
||||||
(
|
// (
|
||||||
"isoSurfaceCell::orientSurface(triSurface&, const label)"
|
// "isoSurfaceCell::orientSurface(triSurface&, const label)"
|
||||||
) << "problem" << abort(FatalError);
|
// ) << "problem" << abort(FatalError);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|
||||||
|
|
||||||
// Checks if triangle is connected through edgeI only.
|
// Checks if triangle is connected through edgeI only.
|
||||||
@ -1625,7 +1636,7 @@ Foam::isoSurfaceCell::isoSurfaceCell
|
|||||||
(
|
(
|
||||||
stitchTriPoints
|
stitchTriPoints
|
||||||
(
|
(
|
||||||
true, // check for duplicate tris
|
regularise, // check for duplicate tris
|
||||||
triPoints,
|
triPoints,
|
||||||
triPointMergeMap_, // unmerged to merged point
|
triPointMergeMap_, // unmerged to merged point
|
||||||
triMap
|
triMap
|
||||||
@ -1657,7 +1668,7 @@ Foam::isoSurfaceCell::isoSurfaceCell
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (false)
|
if (regularise)
|
||||||
{
|
{
|
||||||
List<FixedList<label, 3> > faceEdges;
|
List<FixedList<label, 3> > faceEdges;
|
||||||
labelList edgeFace0, edgeFace1;
|
labelList edgeFace0, edgeFace1;
|
||||||
@ -1717,7 +1728,7 @@ Foam::isoSurfaceCell::isoSurfaceCell
|
|||||||
inplaceRenumber(reversePointMap, triPointMergeMap_);
|
inplaceRenumber(reversePointMap, triPointMergeMap_);
|
||||||
}
|
}
|
||||||
|
|
||||||
orientSurface(*this, faceEdges, edgeFace0, edgeFace1, edgeFacesRest);
|
//orientSurface(*this, faceEdges, edgeFace0, edgeFace1, edgeFacesRest);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -214,15 +214,19 @@ class isoSurfaceCell
|
|||||||
void generateTriPoints
|
void generateTriPoints
|
||||||
(
|
(
|
||||||
const DynamicList<Type>& snapped,
|
const DynamicList<Type>& snapped,
|
||||||
|
const scalar isoVal0,
|
||||||
const scalar s0,
|
const scalar s0,
|
||||||
const Type& p0,
|
const Type& p0,
|
||||||
const label p0Index,
|
const label p0Index,
|
||||||
|
const scalar isoVal1,
|
||||||
const scalar s1,
|
const scalar s1,
|
||||||
const Type& p1,
|
const Type& p1,
|
||||||
const label p1Index,
|
const label p1Index,
|
||||||
|
const scalar isoVal2,
|
||||||
const scalar s2,
|
const scalar s2,
|
||||||
const Type& p2,
|
const Type& p2,
|
||||||
const label p2Index,
|
const label p2Index,
|
||||||
|
const scalar isoVal3,
|
||||||
const scalar s3,
|
const scalar s3,
|
||||||
const Type& p3,
|
const Type& p3,
|
||||||
const label p3Index,
|
const label p3Index,
|
||||||
@ -267,26 +271,26 @@ class isoSurfaceCell
|
|||||||
Map<labelList>& edgeFacesRest
|
Map<labelList>& edgeFacesRest
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Determine orientation
|
////- Determine orientation
|
||||||
static void walkOrientation
|
//static void walkOrientation
|
||||||
(
|
//(
|
||||||
const triSurface& surf,
|
// const triSurface& surf,
|
||||||
const List<FixedList<label, 3> >& faceEdges,
|
// const List<FixedList<label, 3> >& faceEdges,
|
||||||
const labelList& edgeFace0,
|
// const labelList& edgeFace0,
|
||||||
const labelList& edgeFace1,
|
// const labelList& edgeFace1,
|
||||||
const label seedTriI,
|
// const label seedTriI,
|
||||||
labelList& flipState
|
// labelList& flipState
|
||||||
);
|
//);
|
||||||
|
|
||||||
//- Orient surface
|
////- Orient surface
|
||||||
static void orientSurface
|
//static void orientSurface
|
||||||
(
|
//(
|
||||||
triSurface&,
|
// triSurface&,
|
||||||
const List<FixedList<label, 3> >& faceEdges,
|
// const List<FixedList<label, 3> >& faceEdges,
|
||||||
const labelList& edgeFace0,
|
// const labelList& edgeFace0,
|
||||||
const labelList& edgeFace1,
|
// const labelList& edgeFace1,
|
||||||
const Map<labelList>& edgeFacesRest
|
// const Map<labelList>& edgeFacesRest
|
||||||
);
|
//);
|
||||||
|
|
||||||
//- Is triangle (given by 3 edges) not fully connected?
|
//- Is triangle (given by 3 edges) not fully connected?
|
||||||
static bool danglingTriangle
|
static bool danglingTriangle
|
||||||
|
|||||||
@ -76,23 +76,27 @@ void Foam::isoSurfaceCell::generateTriPoints
|
|||||||
(
|
(
|
||||||
const DynamicList<Type>& snapped,
|
const DynamicList<Type>& snapped,
|
||||||
|
|
||||||
|
const scalar isoVal0,
|
||||||
const scalar s0,
|
const scalar s0,
|
||||||
const Type& p0,
|
const Type& p0,
|
||||||
const label p0Index,
|
const label p0Index,
|
||||||
|
|
||||||
|
const scalar isoVal1,
|
||||||
const scalar s1,
|
const scalar s1,
|
||||||
const Type& p1,
|
const Type& p1,
|
||||||
const label p1Index,
|
const label p1Index,
|
||||||
|
|
||||||
|
const scalar isoVal2,
|
||||||
const scalar s2,
|
const scalar s2,
|
||||||
const Type& p2,
|
const Type& p2,
|
||||||
const label p2Index,
|
const label p2Index,
|
||||||
|
|
||||||
|
const scalar isoVal3,
|
||||||
const scalar s3,
|
const scalar s3,
|
||||||
const Type& p3,
|
const Type& p3,
|
||||||
const label p3Index,
|
const label p3Index,
|
||||||
|
|
||||||
DynamicList<Type>& points
|
DynamicList<Type>& pts
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
int triIndex = 0;
|
int triIndex = 0;
|
||||||
@ -122,77 +126,160 @@ void Foam::isoSurfaceCell::generateTriPoints
|
|||||||
|
|
||||||
case 0x0E:
|
case 0x0E:
|
||||||
case 0x01:
|
case 0x01:
|
||||||
points.append(generatePoint(snapped,s0,p0,p0Index,s1,p1,p1Index));
|
{
|
||||||
points.append(generatePoint(snapped,s0,p0,p0Index,s2,p2,p2Index));
|
// 0 is common point. Orient such that normal points in positive
|
||||||
points.append(generatePoint(snapped,s0,p0,p0Index,s3,p3,p3Index));
|
// gradient direction
|
||||||
|
if (isoVal0 >= isoVal1)
|
||||||
|
{
|
||||||
|
pts.append(generatePoint(snapped,s0,p0,p0Index,s1,p1,p1Index));
|
||||||
|
pts.append(generatePoint(snapped,s0,p0,p0Index,s2,p2,p2Index));
|
||||||
|
pts.append(generatePoint(snapped,s0,p0,p0Index,s3,p3,p3Index));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pts.append(generatePoint(snapped,s0,p0,p0Index,s2,p2,p2Index));
|
||||||
|
pts.append(generatePoint(snapped,s0,p0,p0Index,s1,p1,p1Index));
|
||||||
|
pts.append(generatePoint(snapped,s0,p0,p0Index,s3,p3,p3Index));
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x0D:
|
case 0x0D:
|
||||||
case 0x02:
|
case 0x02:
|
||||||
points.append(generatePoint(snapped,s1,p1,p1Index,s0,p0,p0Index));
|
{
|
||||||
points.append(generatePoint(snapped,s1,p1,p1Index,s3,p3,p3Index));
|
// 1 is common point
|
||||||
points.append(generatePoint(snapped,s1,p1,p1Index,s2,p2,p2Index));
|
if (isoVal1 >= isoVal0)
|
||||||
|
{
|
||||||
|
pts.append(generatePoint(snapped,s1,p1,p1Index,s0,p0,p0Index));
|
||||||
|
pts.append(generatePoint(snapped,s1,p1,p1Index,s3,p3,p3Index));
|
||||||
|
pts.append(generatePoint(snapped,s1,p1,p1Index,s2,p2,p2Index));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pts.append(generatePoint(snapped,s1,p1,p1Index,s3,p3,p3Index));
|
||||||
|
pts.append(generatePoint(snapped,s1,p1,p1Index,s0,p0,p0Index));
|
||||||
|
pts.append(generatePoint(snapped,s1,p1,p1Index,s2,p2,p2Index));
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x0C:
|
case 0x0C:
|
||||||
case 0x03:
|
case 0x03:
|
||||||
{
|
{
|
||||||
Type tp1 = generatePoint(snapped,s0,p0,p0Index,s2,p2,p2Index);
|
Type s02 = generatePoint(snapped,s0,p0,p0Index,s2,p2,p2Index);
|
||||||
Type tp2 = generatePoint(snapped,s1,p1,p1Index,s3,p3,p3Index);
|
Type s13 = generatePoint(snapped,s1,p1,p1Index,s3,p3,p3Index);
|
||||||
|
|
||||||
points.append(generatePoint(snapped,s0,p0,p0Index,s3,p3,p3Index));
|
if (isoVal0 >= isoVal3)
|
||||||
points.append(tp1);
|
{
|
||||||
points.append(tp2);
|
pts.append(generatePoint(snapped,s0,p0,p0Index,s3,p3,p3Index));
|
||||||
points.append(tp2);
|
pts.append(s02);
|
||||||
points.append(generatePoint(snapped,s1,p1,p1Index,s2,p2,p2Index));
|
pts.append(s13);
|
||||||
points.append(tp1);
|
pts.append(s13);
|
||||||
|
pts.append(generatePoint(snapped,s1,p1,p1Index,s2,p2,p2Index));
|
||||||
|
pts.append(s02);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pts.append(s02);
|
||||||
|
pts.append(generatePoint(snapped,s0,p0,p0Index,s3,p3,p3Index));
|
||||||
|
pts.append(s13);
|
||||||
|
pts.append(generatePoint(snapped,s1,p1,p1Index,s2,p2,p2Index));
|
||||||
|
pts.append(s13);
|
||||||
|
pts.append(s02);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x0B:
|
case 0x0B:
|
||||||
case 0x04:
|
case 0x04:
|
||||||
{
|
{
|
||||||
points.append(generatePoint(snapped,s2,p2,p2Index,s0,p0,p0Index));
|
// 2 is common point
|
||||||
points.append(generatePoint(snapped,s2,p2,p2Index,s1,p1,p1Index));
|
if (isoVal2 >= isoVal0)
|
||||||
points.append(generatePoint(snapped,s2,p2,p2Index,s3,p3,p3Index));
|
{
|
||||||
|
pts.append(generatePoint(snapped,s2,p2,p2Index,s0,p0,p0Index));
|
||||||
|
pts.append(generatePoint(snapped,s2,p2,p2Index,s1,p1,p1Index));
|
||||||
|
pts.append(generatePoint(snapped,s2,p2,p2Index,s3,p3,p3Index));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pts.append(generatePoint(snapped,s2,p2,p2Index,s1,p1,p1Index));
|
||||||
|
pts.append(generatePoint(snapped,s2,p2,p2Index,s0,p0,p0Index));
|
||||||
|
pts.append(generatePoint(snapped,s2,p2,p2Index,s3,p3,p3Index));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x0A:
|
case 0x0A:
|
||||||
case 0x05:
|
case 0x05:
|
||||||
{
|
{
|
||||||
Type tp0 = generatePoint(snapped,s0,p0,p0Index,s1,p1,p1Index);
|
Type s01 = generatePoint(snapped,s0,p0,p0Index,s1,p1,p1Index);
|
||||||
Type tp1 = generatePoint(snapped,s2,p2,p2Index,s3,p3,p3Index);
|
Type s23 = generatePoint(snapped,s2,p2,p2Index,s3,p3,p3Index);
|
||||||
|
|
||||||
points.append(tp0);
|
if (isoVal3 >= isoVal0)
|
||||||
points.append(tp1);
|
{
|
||||||
points.append(generatePoint(snapped,s0,p0,p0Index,s3,p3,p3Index));
|
pts.append(s01);
|
||||||
points.append(tp0);
|
pts.append(s23);
|
||||||
points.append(generatePoint(snapped,s1,p1,p1Index,s2,p2,p2Index));
|
pts.append(generatePoint(snapped,s0,p0,p0Index,s3,p3,p3Index));
|
||||||
points.append(tp1);
|
pts.append(s01);
|
||||||
|
pts.append(generatePoint(snapped,s1,p1,p1Index,s2,p2,p2Index));
|
||||||
|
pts.append(s23);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pts.append(s23);
|
||||||
|
pts.append(s01);
|
||||||
|
pts.append(generatePoint(snapped,s0,p0,p0Index,s3,p3,p3Index));
|
||||||
|
pts.append(generatePoint(snapped,s1,p1,p1Index,s2,p2,p2Index));
|
||||||
|
pts.append(s01);
|
||||||
|
pts.append(s23);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x09:
|
case 0x09:
|
||||||
case 0x06:
|
case 0x06:
|
||||||
{
|
{
|
||||||
Type tp0 = generatePoint(snapped,s0,p0,p0Index,s1,p1,p1Index);
|
Type s01 = generatePoint(snapped,s0,p0,p0Index,s1,p1,p1Index);
|
||||||
Type tp1 = generatePoint(snapped,s2,p2,p2Index,s3,p3,p3Index);
|
Type s23 = generatePoint(snapped,s2,p2,p2Index,s3,p3,p3Index);
|
||||||
|
|
||||||
points.append(tp0);
|
if (isoVal3 >= isoVal1)
|
||||||
points.append(generatePoint(snapped,s1,p1,p1Index,s3,p3,p3Index));
|
{
|
||||||
points.append(tp1);
|
pts.append(s01);
|
||||||
points.append(tp0);
|
pts.append(generatePoint(snapped,s1,p1,p1Index,s3,p3,p3Index));
|
||||||
points.append(generatePoint(snapped,s0,p0,p0Index,s2,p2,p2Index));
|
pts.append(s23);
|
||||||
points.append(tp1);
|
pts.append(s01);
|
||||||
|
pts.append(generatePoint(snapped,s0,p0,p0Index,s2,p2,p2Index));
|
||||||
|
pts.append(s23);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pts.append(generatePoint(snapped,s1,p1,p1Index,s3,p3,p3Index));
|
||||||
|
pts.append(s01);
|
||||||
|
pts.append(s23);
|
||||||
|
pts.append(generatePoint(snapped,s0,p0,p0Index,s2,p2,p2Index));
|
||||||
|
pts.append(s01);
|
||||||
|
pts.append(s23);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x07:
|
case 0x07:
|
||||||
case 0x08:
|
case 0x08:
|
||||||
points.append(generatePoint(snapped,s3,p3,p3Index,s0,p0,p0Index));
|
{
|
||||||
points.append(generatePoint(snapped,s3,p3,p3Index,s2,p2,p2Index));
|
// 3 is common point
|
||||||
points.append(generatePoint(snapped,s3,p3,p3Index,s1,p1,p1Index));
|
if (isoVal3 >= isoVal0)
|
||||||
|
{
|
||||||
|
pts.append(generatePoint(snapped,s3,p3,p3Index,s0,p0,p0Index));
|
||||||
|
pts.append(generatePoint(snapped,s3,p3,p3Index,s2,p2,p2Index));
|
||||||
|
pts.append(generatePoint(snapped,s3,p3,p3Index,s1,p1,p1Index));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pts.append(generatePoint(snapped,s3,p3,p3Index,s2,p2,p2Index));
|
||||||
|
pts.append(generatePoint(snapped,s3,p3,p3Index,s0,p0,p0Index));
|
||||||
|
pts.append(generatePoint(snapped,s3,p3,p3Index,s1,p1,p1Index));
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -252,18 +339,23 @@ void Foam::isoSurfaceCell::generateTriPoints
|
|||||||
generateTriPoints
|
generateTriPoints
|
||||||
(
|
(
|
||||||
snappedPoints,
|
snappedPoints,
|
||||||
|
|
||||||
|
pVals_[f0[1]],
|
||||||
pVals[f0[1]],
|
pVals[f0[1]],
|
||||||
pCoords[f0[1]],
|
pCoords[f0[1]],
|
||||||
snappedPoint[f0[1]],
|
snappedPoint[f0[1]],
|
||||||
|
|
||||||
|
pVals_[f0[0]],
|
||||||
pVals[f0[0]],
|
pVals[f0[0]],
|
||||||
pCoords[f0[0]],
|
pCoords[f0[0]],
|
||||||
snappedPoint[f0[0]],
|
snappedPoint[f0[0]],
|
||||||
|
|
||||||
|
pVals_[f0[2]],
|
||||||
pVals[f0[2]],
|
pVals[f0[2]],
|
||||||
pCoords[f0[2]],
|
pCoords[f0[2]],
|
||||||
snappedPoint[f0[2]],
|
snappedPoint[f0[2]],
|
||||||
|
|
||||||
|
pVals_[oppositeI],
|
||||||
pVals[oppositeI],
|
pVals[oppositeI],
|
||||||
pCoords[oppositeI],
|
pCoords[oppositeI],
|
||||||
snappedPoint[oppositeI],
|
snappedPoint[oppositeI],
|
||||||
@ -276,18 +368,23 @@ void Foam::isoSurfaceCell::generateTriPoints
|
|||||||
generateTriPoints
|
generateTriPoints
|
||||||
(
|
(
|
||||||
snappedPoints,
|
snappedPoints,
|
||||||
|
|
||||||
|
pVals_[f0[0]],
|
||||||
pVals[f0[0]],
|
pVals[f0[0]],
|
||||||
pCoords[f0[0]],
|
pCoords[f0[0]],
|
||||||
snappedPoint[f0[0]],
|
snappedPoint[f0[0]],
|
||||||
|
|
||||||
|
pVals_[f0[1]],
|
||||||
pVals[f0[1]],
|
pVals[f0[1]],
|
||||||
pCoords[f0[1]],
|
pCoords[f0[1]],
|
||||||
snappedPoint[f0[1]],
|
snappedPoint[f0[1]],
|
||||||
|
|
||||||
|
pVals_[f0[2]],
|
||||||
pVals[f0[2]],
|
pVals[f0[2]],
|
||||||
pCoords[f0[2]],
|
pCoords[f0[2]],
|
||||||
snappedPoint[f0[2]],
|
snappedPoint[f0[2]],
|
||||||
|
|
||||||
|
pVals_[oppositeI],
|
||||||
pVals[oppositeI],
|
pVals[oppositeI],
|
||||||
pCoords[oppositeI],
|
pCoords[oppositeI],
|
||||||
snappedPoint[oppositeI],
|
snappedPoint[oppositeI],
|
||||||
@ -321,18 +418,22 @@ void Foam::isoSurfaceCell::generateTriPoints
|
|||||||
(
|
(
|
||||||
snappedPoints,
|
snappedPoints,
|
||||||
|
|
||||||
|
pVals_[tri[1]],
|
||||||
pVals[tri[1]],
|
pVals[tri[1]],
|
||||||
pCoords[tri[1]],
|
pCoords[tri[1]],
|
||||||
snappedPoint[tri[1]],
|
snappedPoint[tri[1]],
|
||||||
|
|
||||||
|
pVals_[tri[0]],
|
||||||
pVals[tri[0]],
|
pVals[tri[0]],
|
||||||
pCoords[tri[0]],
|
pCoords[tri[0]],
|
||||||
snappedPoint[tri[0]],
|
snappedPoint[tri[0]],
|
||||||
|
|
||||||
|
pVals_[tri[2]],
|
||||||
pVals[tri[2]],
|
pVals[tri[2]],
|
||||||
pCoords[tri[2]],
|
pCoords[tri[2]],
|
||||||
snappedPoint[tri[2]],
|
snappedPoint[tri[2]],
|
||||||
|
|
||||||
|
cVals_[cellI],
|
||||||
cVals[cellI],
|
cVals[cellI],
|
||||||
cCoords[cellI],
|
cCoords[cellI],
|
||||||
snappedCc[cellI],
|
snappedCc[cellI],
|
||||||
@ -346,18 +447,22 @@ void Foam::isoSurfaceCell::generateTriPoints
|
|||||||
(
|
(
|
||||||
snappedPoints,
|
snappedPoints,
|
||||||
|
|
||||||
|
pVals_[tri[0]],
|
||||||
pVals[tri[0]],
|
pVals[tri[0]],
|
||||||
pCoords[tri[0]],
|
pCoords[tri[0]],
|
||||||
snappedPoint[tri[0]],
|
snappedPoint[tri[0]],
|
||||||
|
|
||||||
|
pVals_[tri[1]],
|
||||||
pVals[tri[1]],
|
pVals[tri[1]],
|
||||||
pCoords[tri[1]],
|
pCoords[tri[1]],
|
||||||
snappedPoint[tri[1]],
|
snappedPoint[tri[1]],
|
||||||
|
|
||||||
|
pVals_[tri[2]],
|
||||||
pVals[tri[2]],
|
pVals[tri[2]],
|
||||||
pCoords[tri[2]],
|
pCoords[tri[2]],
|
||||||
snappedPoint[tri[2]],
|
snappedPoint[tri[2]],
|
||||||
|
|
||||||
|
cVals_[cellI],
|
||||||
cVals[cellI],
|
cVals[cellI],
|
||||||
cCoords[cellI],
|
cCoords[cellI],
|
||||||
snappedCc[cellI],
|
snappedCc[cellI],
|
||||||
|
|||||||
Reference in New Issue
Block a user