mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
BUG: stitchTriangles : work on triSurface points
This commit is contained in:
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -331,7 +331,7 @@ bool triSurface::readAC(const fileName& ACfileName)
|
|||||||
|
|
||||||
*this = triSurface(faces, patches, allPoints, true);
|
*this = triSurface(faces, patches, allPoints, true);
|
||||||
|
|
||||||
stitchTriangles(allPoints);
|
stitchTriangles();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -422,6 +422,7 @@ bool triSurface::readSTLASCII(const fileName& STLfileName)
|
|||||||
setSize(lexer.nTriangles());
|
setSize(lexer.nTriangles());
|
||||||
DynamicList<label>& STLlabels = lexer.STLlabels();
|
DynamicList<label>& STLlabels = lexer.STLlabels();
|
||||||
|
|
||||||
|
// Assign triangles
|
||||||
label pointi = 0;
|
label pointi = 0;
|
||||||
forAll(*this, i)
|
forAll(*this, i)
|
||||||
{
|
{
|
||||||
@ -433,8 +434,11 @@ bool triSurface::readSTLASCII(const fileName& STLfileName)
|
|||||||
|
|
||||||
STLlabels.clear();
|
STLlabels.clear();
|
||||||
|
|
||||||
|
// Assign coordinates
|
||||||
|
storedPoints().transfer(rawPoints);
|
||||||
|
|
||||||
// Stitch all points within SMALL meters.
|
// Stitch all points within SMALL meters.
|
||||||
stitchTriangles(rawPoints);
|
stitchTriangles();
|
||||||
|
|
||||||
// Convert solidNames into regionNames
|
// Convert solidNames into regionNames
|
||||||
patches_.setSize(lexer.STLsolidNames().size());
|
patches_.setSize(lexer.STLsolidNames().size());
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -123,7 +123,11 @@ bool Foam::triSurface::readSTLBINARY(const fileName& STLfileName)
|
|||||||
|
|
||||||
//STLfile.close();
|
//STLfile.close();
|
||||||
|
|
||||||
stitchTriangles(rawPoints);
|
// Assign coordinates
|
||||||
|
storedPoints().transfer(rawPoints);
|
||||||
|
|
||||||
|
// Stitch all points within SMALL meters.
|
||||||
|
stitchTriangles();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -138,6 +138,7 @@ bool Foam::triSurface::readTRI(const fileName& TRIfileName)
|
|||||||
|
|
||||||
setSize(STLlabels.size());
|
setSize(STLlabels.size());
|
||||||
|
|
||||||
|
// Assign triangles
|
||||||
pointI = 0;
|
pointI = 0;
|
||||||
SLList<label>::const_iterator iter = STLlabels.begin();
|
SLList<label>::const_iterator iter = STLlabels.begin();
|
||||||
forAll(*this, i)
|
forAll(*this, i)
|
||||||
@ -149,7 +150,10 @@ bool Foam::triSurface::readTRI(const fileName& TRIfileName)
|
|||||||
++iter;
|
++iter;
|
||||||
}
|
}
|
||||||
|
|
||||||
stitchTriangles(rawPoints);
|
// Assign coordinates
|
||||||
|
storedPoints().transfer(rawPoints);
|
||||||
|
// Merge duplicate points
|
||||||
|
stitchTriangles();
|
||||||
|
|
||||||
// Convert solidNames into regionNames
|
// Convert solidNames into regionNames
|
||||||
stringList names(STLsolidNames.toc());
|
stringList names(STLsolidNames.toc());
|
||||||
|
|||||||
@ -31,30 +31,28 @@ License
|
|||||||
|
|
||||||
bool Foam::triSurface::stitchTriangles
|
bool Foam::triSurface::stitchTriangles
|
||||||
(
|
(
|
||||||
const pointField& rawPoints,
|
|
||||||
const scalar tol,
|
const scalar tol,
|
||||||
bool verbose
|
bool verbose
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
pointField& ps = storedPoints();
|
||||||
|
|
||||||
// Merge points
|
// Merge points
|
||||||
labelList pointMap;
|
labelList pointMap;
|
||||||
pointField newPoints;
|
pointField newPoints;
|
||||||
bool hasMerged = mergePoints(rawPoints, tol, verbose, pointMap, newPoints);
|
bool hasMerged = mergePoints(ps, tol, verbose, pointMap, newPoints);
|
||||||
|
|
||||||
if (hasMerged)
|
if (hasMerged)
|
||||||
{
|
{
|
||||||
pointField& ps = storedPoints();
|
if (verbose)
|
||||||
|
{
|
||||||
|
Pout<< "stitchTriangles : Merged from " << ps.size()
|
||||||
|
<< " points down to " << newPoints.size() << endl;
|
||||||
|
}
|
||||||
|
|
||||||
// Set the coordinates to the merged ones
|
// Set the coordinates to the merged ones
|
||||||
ps.transfer(newPoints);
|
ps.transfer(newPoints);
|
||||||
|
|
||||||
|
|
||||||
if (verbose)
|
|
||||||
{
|
|
||||||
Pout<< "stitchTriangles : Merged from " << rawPoints.size()
|
|
||||||
<< " points down to " << ps.size() << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Reset the triangle point labels to the unique points array
|
// Reset the triangle point labels to the unique points array
|
||||||
label newTriangleI = 0;
|
label newTriangleI = 0;
|
||||||
forAll(*this, i)
|
forAll(*this, i)
|
||||||
@ -151,11 +149,6 @@ bool Foam::triSurface::stitchTriangles
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
// Can happen for e.g. single triangle or cloud of unconnected triangles
|
|
||||||
storedPoints() = rawPoints;
|
|
||||||
}
|
|
||||||
|
|
||||||
return hasMerged;
|
return hasMerged;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -809,7 +809,7 @@ void Foam::triSurface::scalePoints(const scalar scaleFactor)
|
|||||||
void Foam::triSurface::cleanup(const bool verbose)
|
void Foam::triSurface::cleanup(const bool verbose)
|
||||||
{
|
{
|
||||||
// Merge points (already done for STL, TRI)
|
// Merge points (already done for STL, TRI)
|
||||||
stitchTriangles(points(), SMALL, verbose);
|
stitchTriangles(SMALL, verbose);
|
||||||
|
|
||||||
// Merging points might have changed geometric factors
|
// Merging points might have changed geometric factors
|
||||||
clearOut();
|
clearOut();
|
||||||
|
|||||||
@ -112,7 +112,6 @@ class triSurface
|
|||||||
// Returns true if any points merged
|
// Returns true if any points merged
|
||||||
bool stitchTriangles
|
bool stitchTriangles
|
||||||
(
|
(
|
||||||
const pointField& rawPoints,
|
|
||||||
const scalar tol = SMALL,
|
const scalar tol = SMALL,
|
||||||
const bool verbose = false
|
const bool verbose = false
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user