mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: Add edgeCollapser utility and libraries.
edgeCollapser collapses small edges and faces. Works in parallel by using PointEdgeWave.
This commit is contained in:
@ -1,4 +1,3 @@
|
|||||||
collapseEdges.C
|
collapseEdges.C
|
||||||
pointEdgeCollapse/pointEdgeCollapse.C
|
|
||||||
|
|
||||||
EXE = $(FOAM_APPBIN)/collapseEdges
|
EXE = $(FOAM_APPBIN)/collapseEdges
|
||||||
|
|||||||
@ -1,8 +1,7 @@
|
|||||||
EXE_INC = \
|
EXE_INC = \
|
||||||
-I$(LIB_SRC)/dynamicMesh/lnInclude \
|
-I$(LIB_SRC)/dynamicMesh/lnInclude \
|
||||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
-I$(LIB_SRC)/finiteVolume/lnInclude
|
||||||
-IpointEdgeCollapse
|
|
||||||
|
|
||||||
EXE_LIBS = \
|
EXE_LIBS = \
|
||||||
-ldynamicMesh \
|
-ldynamicMesh \
|
||||||
|
|||||||
@ -0,0 +1,85 @@
|
|||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||||
|
| \\ / O peration | Version: dev |
|
||||||
|
| \\ / A nd | Web: http://www.openfoam.org |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2.0;
|
||||||
|
format ascii;
|
||||||
|
|
||||||
|
root "";
|
||||||
|
case "";
|
||||||
|
instance "";
|
||||||
|
local "";
|
||||||
|
|
||||||
|
class dictionary;
|
||||||
|
object collapseDict;
|
||||||
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
collapseEdgesCoeffs
|
||||||
|
{
|
||||||
|
// Edges shorter than this absolute value will be merged
|
||||||
|
minimumEdgeLength 1e-8;
|
||||||
|
|
||||||
|
// The maximum angle between two edges that share a point attached to
|
||||||
|
// no other edges
|
||||||
|
maximumMergeAngle 30;
|
||||||
|
|
||||||
|
// The amount that minimumEdgeLength will be reduced by for each
|
||||||
|
// edge if that edge's collapse generates a poor quality face
|
||||||
|
reductionFactor 0.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
collapseFacesCoeffs
|
||||||
|
{
|
||||||
|
// The initial face length factor
|
||||||
|
initialFaceLengthFactor 0.5;
|
||||||
|
|
||||||
|
// The amount that initialFaceLengthFactor will be reduced by for each
|
||||||
|
// face if its collapse generates a poor quality face
|
||||||
|
reductionFactor $initialFaceLengthFactor;
|
||||||
|
|
||||||
|
// If the face can't be collapsed to an edge, and it has a span less than
|
||||||
|
// the target face length multiplied by this coefficient, collapse it
|
||||||
|
// to a point.
|
||||||
|
maxCollapseFaceToPointSideLengthCoeff 0.3;
|
||||||
|
|
||||||
|
// Allow early collapse of edges to a point
|
||||||
|
allowEarlyCollapseToPoint on;
|
||||||
|
|
||||||
|
// Fraction to premultiply maxCollapseFaceToPointSideLengthCoeff by if
|
||||||
|
// allowEarlyCollapseToPoint is enabled
|
||||||
|
allowEarlyCollapseCoeff 0.2;
|
||||||
|
|
||||||
|
// Defining how close to the midpoint (M) of the projected
|
||||||
|
// vertices line a projected vertex (X) can be before making this
|
||||||
|
// an invalid edge collapse
|
||||||
|
//
|
||||||
|
// X---X-g----------------M----X-----------g----X--X
|
||||||
|
//
|
||||||
|
// Only allow a collapse if all projected vertices are outwith
|
||||||
|
// guardFraction (g) of the distance form the face centre to the
|
||||||
|
// furthest vertex in the considered direction
|
||||||
|
guardFraction 0.1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
meshQualityCoeffs
|
||||||
|
{
|
||||||
|
// Name of the dictionary that has the mesh quality coefficients used
|
||||||
|
// by motionSmoother::checkMesh
|
||||||
|
meshQualityCoeffDict meshQualityDict;
|
||||||
|
|
||||||
|
// Maximum number of outer iterations is mesh quality checking is enabled
|
||||||
|
maximumIterations 30;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
File diff suppressed because it is too large
Load Diff
@ -55,6 +55,7 @@ Description
|
|||||||
#include "edgeCollapser.H"
|
#include "edgeCollapser.H"
|
||||||
#include "meshTools.H"
|
#include "meshTools.H"
|
||||||
#include "Pair.H"
|
#include "Pair.H"
|
||||||
|
#include "globalIndex.H"
|
||||||
|
|
||||||
using namespace Foam;
|
using namespace Foam;
|
||||||
|
|
||||||
@ -569,26 +570,47 @@ int main(int argc, char *argv[])
|
|||||||
// Mesh change engine
|
// Mesh change engine
|
||||||
edgeCollapser cutter(mesh);
|
edgeCollapser cutter(mesh);
|
||||||
|
|
||||||
pointField newPoints(mesh.points());
|
const edgeList& edges = mesh.edges();
|
||||||
|
const pointField& points = mesh.points();
|
||||||
|
|
||||||
|
pointField newPoints(points);
|
||||||
|
|
||||||
|
PackedBoolList collapseEdge(mesh.nEdges());
|
||||||
|
Map<point> collapsePointToLocation(mesh.nPoints());
|
||||||
|
|
||||||
// Get new positions and construct collapse network
|
// Get new positions and construct collapse network
|
||||||
forAllConstIter(Map<point>, edgeToPos, iter)
|
forAllConstIter(Map<point>, edgeToPos, iter)
|
||||||
{
|
{
|
||||||
label edgeI = iter.key();
|
label edgeI = iter.key();
|
||||||
const edge& e = mesh.edges()[edgeI];
|
const edge& e = edges[edgeI];
|
||||||
|
|
||||||
|
collapseEdge[edgeI] = true;
|
||||||
|
collapsePointToLocation.set(e[1], points[e[0]]);
|
||||||
|
|
||||||
cutter.collapseEdge(edgeI, e[0]);
|
|
||||||
newPoints[e[0]] = iter();
|
newPoints[e[0]] = iter();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Move master point to destination.
|
// Move master point to destination.
|
||||||
mesh.movePoints(newPoints);
|
mesh.movePoints(newPoints);
|
||||||
|
|
||||||
|
List<pointEdgeCollapse> allPointInfo;
|
||||||
|
const globalIndex globalPoints(mesh.nPoints());
|
||||||
|
labelList pointPriority(mesh.nPoints(), 0);
|
||||||
|
|
||||||
|
cutter.consistentCollapse
|
||||||
|
(
|
||||||
|
globalPoints,
|
||||||
|
pointPriority,
|
||||||
|
collapsePointToLocation,
|
||||||
|
collapseEdge,
|
||||||
|
allPointInfo
|
||||||
|
);
|
||||||
|
|
||||||
// Topo change container
|
// Topo change container
|
||||||
polyTopoChange meshMod(mesh);
|
polyTopoChange meshMod(mesh);
|
||||||
|
|
||||||
// Insert
|
// Insert
|
||||||
cutter.setRefinement(meshMod);
|
cutter.setRefinement(allPointInfo, meshMod);
|
||||||
|
|
||||||
// Do changes
|
// Do changes
|
||||||
autoPtr<mapPolyMesh> morphMap = meshMod.changeMesh(mesh, false);
|
autoPtr<mapPolyMesh> morphMap = meshMod.changeMesh(mesh, false);
|
||||||
|
|||||||
@ -473,6 +473,7 @@ int main(int argc, char *argv[])
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
label nbrProcI = patchToNbrProc[patchI];
|
label nbrProcI = patchToNbrProc[patchI];
|
||||||
|
|
||||||
word name =
|
word name =
|
||||||
"procBoundary"
|
"procBoundary"
|
||||||
+ Foam::name(Pstream::myProcNo())
|
+ Foam::name(Pstream::myProcNo())
|
||||||
@ -755,6 +756,9 @@ int main(int argc, char *argv[])
|
|||||||
const edgeList& edges = mesh.edges();
|
const edgeList& edges = mesh.edges();
|
||||||
const pointField& points = mesh.points();
|
const pointField& points = mesh.points();
|
||||||
|
|
||||||
|
PackedBoolList collapseEdge(mesh.nEdges());
|
||||||
|
Map<point> collapsePointToLocation(mesh.nPoints());
|
||||||
|
|
||||||
forAll(edges, edgeI)
|
forAll(edges, edgeI)
|
||||||
{
|
{
|
||||||
const edge& e = edges[edgeI];
|
const edge& e = edges[edgeI];
|
||||||
@ -766,15 +770,29 @@ int main(int argc, char *argv[])
|
|||||||
Info<< "Merging edge " << e << " since length " << d
|
Info<< "Merging edge " << e << " since length " << d
|
||||||
<< " << " << mergeDim << nl;
|
<< " << " << mergeDim << nl;
|
||||||
|
|
||||||
// Collapse edge to e[0]
|
collapseEdge[edgeI] = true;
|
||||||
collapser.collapseEdge(edgeI, e[0]);
|
collapsePointToLocation.set(e[1], points[e[0]]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
List<pointEdgeCollapse> allPointInfo;
|
||||||
|
const globalIndex globalPoints(mesh.nPoints());
|
||||||
|
labelList pointPriority(mesh.nPoints(), 0);
|
||||||
|
|
||||||
|
collapser.consistentCollapse
|
||||||
|
(
|
||||||
|
globalPoints,
|
||||||
|
pointPriority,
|
||||||
|
collapsePointToLocation,
|
||||||
|
collapseEdge,
|
||||||
|
allPointInfo
|
||||||
|
);
|
||||||
|
|
||||||
// Topo change container
|
// Topo change container
|
||||||
polyTopoChange meshMod(mesh);
|
polyTopoChange meshMod(mesh);
|
||||||
|
|
||||||
// Put all modifications into meshMod
|
// Put all modifications into meshMod
|
||||||
bool anyChange = collapser.setRefinement(meshMod);
|
bool anyChange = collapser.setRefinement(allPointInfo, meshMod);
|
||||||
|
|
||||||
if (anyChange)
|
if (anyChange)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -43,6 +43,7 @@ Note
|
|||||||
#include "edgeCollapser.H"
|
#include "edgeCollapser.H"
|
||||||
#include "addPatchCellLayer.H"
|
#include "addPatchCellLayer.H"
|
||||||
#include "patchToPoly2DMesh.H"
|
#include "patchToPoly2DMesh.H"
|
||||||
|
#include "globalIndex.H"
|
||||||
|
|
||||||
using namespace Foam;
|
using namespace Foam;
|
||||||
|
|
||||||
@ -260,6 +261,9 @@ int main(int argc, char *argv[])
|
|||||||
const boundBox& bb = mesh().bounds();
|
const boundBox& bb = mesh().bounds();
|
||||||
const scalar mergeDim = 1e-4 * bb.minDim();
|
const scalar mergeDim = 1e-4 * bb.minDim();
|
||||||
|
|
||||||
|
PackedBoolList collapseEdge(mesh().nEdges());
|
||||||
|
Map<point> collapsePointToLocation(mesh().nPoints());
|
||||||
|
|
||||||
forAll(edges, edgeI)
|
forAll(edges, edgeI)
|
||||||
{
|
{
|
||||||
const edge& e = edges[edgeI];
|
const edge& e = edges[edgeI];
|
||||||
@ -271,14 +275,27 @@ int main(int argc, char *argv[])
|
|||||||
Info<< "Merging edge " << e << " since length " << d
|
Info<< "Merging edge " << e << " since length " << d
|
||||||
<< " << " << mergeDim << nl;
|
<< " << " << mergeDim << nl;
|
||||||
|
|
||||||
// Collapse edge to e[0]
|
collapseEdge[edgeI] = true;
|
||||||
collapser.collapseEdge(edgeI, e[0]);
|
collapsePointToLocation.set(e[1], points[e[0]]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
List<pointEdgeCollapse> allPointInfo;
|
||||||
|
const globalIndex globalPoints(mesh().nPoints());
|
||||||
|
labelList pointPriority(mesh().nPoints(), 0);
|
||||||
|
|
||||||
|
collapser.consistentCollapse
|
||||||
|
(
|
||||||
|
globalPoints,
|
||||||
|
pointPriority,
|
||||||
|
collapsePointToLocation,
|
||||||
|
collapseEdge,
|
||||||
|
allPointInfo
|
||||||
|
);
|
||||||
|
|
||||||
polyTopoChange meshModCollapse(mesh());
|
polyTopoChange meshModCollapse(mesh());
|
||||||
|
|
||||||
collapser.setRefinement(meshModCollapse);
|
collapser.setRefinement(allPointInfo, meshModCollapse);
|
||||||
|
|
||||||
// Create a mesh from topo changes.
|
// Create a mesh from topo changes.
|
||||||
autoPtr<mapPolyMesh> morphMap
|
autoPtr<mapPolyMesh> morphMap
|
||||||
|
|||||||
@ -25,6 +25,7 @@ polyTopoChange/polyTopoChange/topoAction/topoActions.C
|
|||||||
polyTopoChange/polyTopoChanger/polyTopoChanger.C
|
polyTopoChange/polyTopoChanger/polyTopoChanger.C
|
||||||
polyTopoChange/polyTopoChange/polyTopoChange.C
|
polyTopoChange/polyTopoChange/polyTopoChange.C
|
||||||
polyTopoChange/polyTopoChange/addPatchCellLayer.C
|
polyTopoChange/polyTopoChange/addPatchCellLayer.C
|
||||||
|
polyTopoChange/polyTopoChange/pointEdgeCollapse/pointEdgeCollapse.C
|
||||||
polyTopoChange/polyTopoChange/edgeCollapser.C
|
polyTopoChange/polyTopoChange/edgeCollapser.C
|
||||||
polyTopoChange/polyTopoChange/faceCollapser.C
|
polyTopoChange/polyTopoChange/faceCollapser.C
|
||||||
polyTopoChange/polyTopoChange/hexRef8.C
|
polyTopoChange/polyTopoChange/hexRef8.C
|
||||||
@ -97,5 +98,6 @@ createShellMesh/createShellMesh.C
|
|||||||
|
|
||||||
extrudePatchMesh/extrudePatchMesh.C
|
extrudePatchMesh/extrudePatchMesh.C
|
||||||
|
|
||||||
|
polyMeshFilter/polyMeshFilter.C
|
||||||
|
|
||||||
LIB = $(FOAM_LIBBIN)/libdynamicMesh
|
LIB = $(FOAM_LIBBIN)/libdynamicMesh
|
||||||
|
|||||||
1082
src/dynamicMesh/polyMeshFilter/polyMeshFilter.C
Normal file
1082
src/dynamicMesh/polyMeshFilter/polyMeshFilter.C
Normal file
File diff suppressed because it is too large
Load Diff
238
src/dynamicMesh/polyMeshFilter/polyMeshFilter.H
Normal file
238
src/dynamicMesh/polyMeshFilter/polyMeshFilter.H
Normal file
@ -0,0 +1,238 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::polyMeshFilter
|
||||||
|
|
||||||
|
Description
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
polyMeshFilter.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef polyMeshFilter_H
|
||||||
|
#define polyMeshFilter_H
|
||||||
|
|
||||||
|
#include "IOdictionary.H"
|
||||||
|
#include "Time.H"
|
||||||
|
#include "List.H"
|
||||||
|
#include "autoPtr.H"
|
||||||
|
#include "scalarField.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
class polyMesh;
|
||||||
|
class fvMesh;
|
||||||
|
class PackedBoolList;
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class polyMeshFilter Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class polyMeshFilter
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- Reference to the original mesh
|
||||||
|
const fvMesh& mesh_;
|
||||||
|
|
||||||
|
//- Copy of the original mesh to perform the filtering on
|
||||||
|
autoPtr<fvMesh> newMeshPtr_;
|
||||||
|
|
||||||
|
//- Dictionary containing the coefficient sub-dictionaries
|
||||||
|
const IOdictionary dict_;
|
||||||
|
|
||||||
|
//- Coefficients for collapsing edges
|
||||||
|
const dictionary& collapseEdgesCoeffDict_;
|
||||||
|
|
||||||
|
//- Coefficients for collapsing faces
|
||||||
|
const dictionary& collapseFacesCoeffDict_;
|
||||||
|
|
||||||
|
//- Coefficients for controlling the mesh quality
|
||||||
|
const dictionary& meshQualityCoeffDict_;
|
||||||
|
|
||||||
|
//- Remove edges shorter than this length
|
||||||
|
const scalar minLen_;
|
||||||
|
|
||||||
|
//- Merge points that are only attached to two edges and have an angle
|
||||||
|
// between the edge greater than this value
|
||||||
|
const scalar maxCos_;
|
||||||
|
|
||||||
|
//- The amount that the local minimum edge length will be reduced by if
|
||||||
|
// the edge is part of a collapse string that generates poor quality
|
||||||
|
// faces
|
||||||
|
const scalar edgeReductionFactor_;
|
||||||
|
|
||||||
|
//- Maximum number of outer iterations
|
||||||
|
const label maxIterations_;
|
||||||
|
|
||||||
|
//- Maximum number of smoothing iterations of minEdgeLen_ and
|
||||||
|
// faceFilterFactor_
|
||||||
|
const label maxSmoothIters_;
|
||||||
|
|
||||||
|
//- Initialisation value of faceFilterFactor_
|
||||||
|
const scalar initialFaceLengthFactor_;
|
||||||
|
|
||||||
|
//- The amount that the local face size factor will be reduced by if
|
||||||
|
// the face is part of a collapse string that generates poor quality
|
||||||
|
// faces
|
||||||
|
const scalar faceReductionFactor_;
|
||||||
|
|
||||||
|
//-
|
||||||
|
const label maxPointErrorCount_;
|
||||||
|
|
||||||
|
|
||||||
|
//- The minimum edge length for each edge
|
||||||
|
scalarField minEdgeLen_;
|
||||||
|
|
||||||
|
//- The face filter factor for each face
|
||||||
|
scalarField faceFilterFactor_;
|
||||||
|
|
||||||
|
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Increment pointErrorCount for points attached to a bad face
|
||||||
|
void updatePointErrorCount
|
||||||
|
(
|
||||||
|
const PackedBoolList& isErrorPoint,
|
||||||
|
const labelList& oldToNewMesh,
|
||||||
|
labelList& pointErrorCount
|
||||||
|
) const;
|
||||||
|
|
||||||
|
|
||||||
|
//- Given the new points that are part of bad faces, and a map from the
|
||||||
|
// old mesh points to the new mesh points, relax minEdgeLen_
|
||||||
|
void checkMeshEdgesAndRelaxEdges
|
||||||
|
(
|
||||||
|
const polyMesh& newMesh,
|
||||||
|
const labelList& oldToNewMesh,
|
||||||
|
const PackedBoolList& isErrorPoint,
|
||||||
|
const labelList& pointErrorCount
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Given the new points that are part of bad faces, and a map from the
|
||||||
|
// old mesh points to the new mesh points, relax faceFilterFactor_
|
||||||
|
void checkMeshFacesAndRelaxEdges
|
||||||
|
(
|
||||||
|
const polyMesh& newMesh,
|
||||||
|
const labelList& oldToNewMesh,
|
||||||
|
const PackedBoolList& isErrorPoint,
|
||||||
|
const labelList& pointErrorCount
|
||||||
|
);
|
||||||
|
|
||||||
|
// Mark boundary points
|
||||||
|
// boundaryPoint:
|
||||||
|
// + -1 : point not on boundary
|
||||||
|
// + 0 : point on a real boundary
|
||||||
|
// + >0 : point on a processor patch with that ID
|
||||||
|
// @todo Need to mark boundaryEdges as well, as an edge may have two
|
||||||
|
// boundary points but not itself lie on a boundary
|
||||||
|
labelList findBoundaryPoints(const polyMesh& mesh) const;
|
||||||
|
|
||||||
|
//- Print min/mean/max data for a field
|
||||||
|
void printScalarFieldStats
|
||||||
|
(
|
||||||
|
const string desc,
|
||||||
|
const scalarField& fld
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Update minEdgeLen_ for the new mesh based upon the movement of the
|
||||||
|
// old points to the new points
|
||||||
|
void mapOldMeshEdgeFieldToNewMesh
|
||||||
|
(
|
||||||
|
const polyMesh& newMesh,
|
||||||
|
const labelList& pointMap,
|
||||||
|
scalarField& newMeshMinEdgeLen
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Update faceFilterFactor_ for the new mesh based upon the movement
|
||||||
|
// of the old faces to the new faces
|
||||||
|
void mapOldMeshFaceFieldToNewMesh
|
||||||
|
(
|
||||||
|
const polyMesh& newMesh,
|
||||||
|
const labelList& faceMap,
|
||||||
|
scalarField& newMeshFaceFilterFactor
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Maintain a map of the original mesh points to the latest version of
|
||||||
|
// the filtered mesh.
|
||||||
|
void updateOldToNewPointMap
|
||||||
|
(
|
||||||
|
const labelList& currToNew,
|
||||||
|
labelList& origToCurrentPointMap
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Disallow default bitwise copy construct
|
||||||
|
polyMeshFilter(const polyMeshFilter&);
|
||||||
|
|
||||||
|
//- Disallow default bitwise assignment
|
||||||
|
void operator=(const polyMeshFilter&);
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from fvMesh
|
||||||
|
explicit polyMeshFilter(const fvMesh& mesh);
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
~polyMeshFilter();
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
// Access
|
||||||
|
|
||||||
|
//- Return reference to the filtered mesh. Does not check if the
|
||||||
|
// mesh has actually been filtered.
|
||||||
|
const autoPtr<fvMesh>& filteredMesh() const;
|
||||||
|
|
||||||
|
|
||||||
|
// Edit
|
||||||
|
|
||||||
|
//- Return a copy of an fvMesh
|
||||||
|
static autoPtr<fvMesh> copyMesh(const fvMesh& mesh);
|
||||||
|
|
||||||
|
//- Filter edges and faces
|
||||||
|
label filter(const label nOriginalBadFaces);
|
||||||
|
|
||||||
|
//- Filter edges only.
|
||||||
|
label filterEdges(const label nOriginalBadFaces);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
File diff suppressed because it is too large
Load Diff
@ -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) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -37,10 +37,15 @@ SourceFiles
|
|||||||
#ifndef edgeCollapser_H
|
#ifndef edgeCollapser_H
|
||||||
#define edgeCollapser_H
|
#define edgeCollapser_H
|
||||||
|
|
||||||
#include "labelList.H"
|
#include "pointEdgeCollapse.H"
|
||||||
#include "DynamicList.H"
|
#include "DynamicList.H"
|
||||||
#include "point.H"
|
#include "Field.H"
|
||||||
|
#include "pointFieldFwd.H"
|
||||||
|
#include "Map.H"
|
||||||
|
#include "labelPair.H"
|
||||||
|
#include "HashSet.H"
|
||||||
#include "typeInfo.H"
|
#include "typeInfo.H"
|
||||||
|
#include "Switch.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -49,9 +54,11 @@ namespace Foam
|
|||||||
|
|
||||||
// Forward declaration of classes
|
// Forward declaration of classes
|
||||||
class polyMesh;
|
class polyMesh;
|
||||||
|
class PackedBoolList;
|
||||||
class polyTopoChange;
|
class polyTopoChange;
|
||||||
|
class globalIndex;
|
||||||
class face;
|
class face;
|
||||||
class mapPolyMesh;
|
class edge;
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class edgeCollapser Declaration
|
Class edgeCollapser Declaration
|
||||||
@ -59,59 +66,169 @@ class mapPolyMesh;
|
|||||||
|
|
||||||
class edgeCollapser
|
class edgeCollapser
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
// The type of collapse of a face
|
||||||
|
enum collapseType
|
||||||
|
{
|
||||||
|
noCollapse = 0,
|
||||||
|
toPoint = 1,
|
||||||
|
toEdge = 2
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
//- Reference to mesh
|
//- Reference to mesh
|
||||||
const polyMesh& mesh_;
|
const polyMesh& mesh_;
|
||||||
|
|
||||||
//- For every point -1 or region number
|
const scalar guardFraction_;
|
||||||
labelList pointRegion_;
|
|
||||||
|
|
||||||
//- Actual location of the point to collapse to for every region master
|
const scalar maxCollapseFaceToPointSideLengthCoeff_;
|
||||||
// point. This will be forced to be consistent across processors
|
|
||||||
DynamicList<point> pointRegionMasterLocation_;
|
|
||||||
|
|
||||||
//- -1 or master vertex for region number
|
const Switch allowEarlyCollapseToPoint_;
|
||||||
DynamicList<label> pointRegionMaster_;
|
|
||||||
|
|
||||||
//- Stack of free region numbers. Corresponds to -1 in pointRegionMaster
|
const scalar allowEarlyCollapseCoeff_;
|
||||||
SLList<label> freeRegions_;
|
|
||||||
|
|
||||||
|
|
||||||
// Static Functions
|
|
||||||
|
|
||||||
//- Find val in list. Search starts at start, continues to size-1.
|
|
||||||
static label findIndex
|
|
||||||
(
|
|
||||||
const labelList&,
|
|
||||||
const label start,
|
|
||||||
const label size,
|
|
||||||
const label val
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
//- Determine points connected through edgesToRemove_.
|
//- Create an edgeList of edges in faceI which have both their points
|
||||||
// Note: Only routine that uses edgesToRemove!
|
// in pointLabels
|
||||||
label changePointRegion
|
labelList edgesFromPoints
|
||||||
|
(
|
||||||
|
const label& faceI,
|
||||||
|
const labelList& pointLabels
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Collapse a face to an edge, marking the collapsed edges and new
|
||||||
|
// locations for points that will move as a result of the collapse
|
||||||
|
void collapseToEdge
|
||||||
|
(
|
||||||
|
const label faceI,
|
||||||
|
const pointField& pts,
|
||||||
|
const labelList& pointPriority,
|
||||||
|
const vector& collapseAxis,
|
||||||
|
const point& fC,
|
||||||
|
const labelList& facePtsNeg,
|
||||||
|
const labelList& facePtsPos,
|
||||||
|
const scalarList& dNeg,
|
||||||
|
const scalarList& dPos,
|
||||||
|
const scalar dShift,
|
||||||
|
PackedBoolList& collapseEdge,
|
||||||
|
Map<point>& collapsePointToLocation
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Collapse a face to a point, marking the collapsed edges and new
|
||||||
|
// locations for points that will move as a result of the collapse
|
||||||
|
void collapseToPoint
|
||||||
|
(
|
||||||
|
const label& faceI,
|
||||||
|
const pointField& pts,
|
||||||
|
const labelList& pointPriority,
|
||||||
|
const point& fC,
|
||||||
|
const labelList& facePts,
|
||||||
|
PackedBoolList& collapseEdge,
|
||||||
|
Map<point>& collapsePointToLocation
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Do an eigenvector analysis of the face to get its collapse axis
|
||||||
|
// and aspect ratio
|
||||||
|
void faceCollapseAxisAndAspectRatio
|
||||||
|
(
|
||||||
|
const face& f,
|
||||||
|
const point& fC,
|
||||||
|
vector& collapseAxis,
|
||||||
|
scalar& aspectRatio
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Return the target length scale for each face
|
||||||
|
scalarField calcTargetFaceSizes() const;
|
||||||
|
|
||||||
|
//- Decides whether a face should be collapsed (and if so it it is to a
|
||||||
|
// point or an edge)
|
||||||
|
collapseType collapseFace
|
||||||
|
(
|
||||||
|
const labelList& pointPriority,
|
||||||
|
const face& f,
|
||||||
|
const label faceI,
|
||||||
|
const scalar targetFaceSize,
|
||||||
|
PackedBoolList& collapseEdge,
|
||||||
|
Map<point>& collapsePointToLocation,
|
||||||
|
const scalarField& faceFilterFactor
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Return label of point that has the highest priority. This will be
|
||||||
|
// the point on the edge that will be collapsed to.
|
||||||
|
label edgeMaster(const labelList& pointPriority, const edge& e) const;
|
||||||
|
|
||||||
|
//- Decides which points in an edge to collapse, based on their priority
|
||||||
|
void checkBoundaryPointMergeEdges
|
||||||
(
|
(
|
||||||
const label pointI,
|
const label pointI,
|
||||||
const label oldRegion,
|
const label otherPointI,
|
||||||
const label newRegion
|
const labelList& pointPriority,
|
||||||
);
|
Map<point>& collapsePointToLocation
|
||||||
|
) const;
|
||||||
|
|
||||||
//- Whether point is master of region or has been removed
|
//- Helper function that breaks strings of collapses if an edge is not
|
||||||
bool pointRemoved(const label) const;
|
// labelled to collapse, but its points both collapse to the same
|
||||||
|
// location
|
||||||
|
label breakStringsAtEdges
|
||||||
|
(
|
||||||
|
const PackedBoolList& markedEdges,
|
||||||
|
PackedBoolList& collapseEdge,
|
||||||
|
List<pointEdgeCollapse>& allPointInfo
|
||||||
|
) const;
|
||||||
|
|
||||||
//- Renumber f with new vertices. Removes duplicates.
|
//- Prevent face pinching by finding points in a face that will be
|
||||||
void filterFace(const label faceI, face&) const;
|
// collapsed to the same location, but that are not ordered
|
||||||
|
// consecutively in the face
|
||||||
|
void determineDuplicatePointsOnFace
|
||||||
|
(
|
||||||
|
const face& f,
|
||||||
|
PackedBoolList& markedPoints,
|
||||||
|
labelHashSet& uniqueCollapses,
|
||||||
|
labelHashSet& duplicateCollapses,
|
||||||
|
List<pointEdgeCollapse>& allPointInfo
|
||||||
|
) const;
|
||||||
|
|
||||||
//- Some debugging printing
|
//- Count the number of edges on the face that will exist as a result
|
||||||
void printRegions() const;
|
// of the collapse
|
||||||
|
label countEdgesOnFace
|
||||||
|
(
|
||||||
|
const face& f,
|
||||||
|
List<pointEdgeCollapse>& allPointInfo
|
||||||
|
) const;
|
||||||
|
|
||||||
//- Collapse list of edges. Tries to find master to collapse to.
|
//- Does the face have fewer than 3 edges as a result of the potential
|
||||||
void collapseEdges(const labelList& edgeLabels);
|
// collapse
|
||||||
|
bool isFaceCollapsed
|
||||||
|
(
|
||||||
|
const face& f,
|
||||||
|
List<pointEdgeCollapse>& allPointInfo
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Given the collapse information, propagates the information using
|
||||||
|
// PointEdgeWave. Result is a list of new point locations and indices
|
||||||
|
label syncCollapse
|
||||||
|
(
|
||||||
|
const globalIndex& globalPoints,
|
||||||
|
const labelList& boundaryPoint,
|
||||||
|
const PackedBoolList& collapseEdge,
|
||||||
|
const Map<point>& collapsePointToLocation,
|
||||||
|
List<pointEdgeCollapse>& allPointInfo
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Renumber f with new vertices. Removes consecutive duplicates
|
||||||
|
void filterFace
|
||||||
|
(
|
||||||
|
const Map<DynamicList<label> >& collapseStrings,
|
||||||
|
const List<pointEdgeCollapse>& allPointInfo,
|
||||||
|
face& f
|
||||||
|
) const;
|
||||||
|
|
||||||
//- Disallow default bitwise copy construct
|
//- Disallow default bitwise copy construct
|
||||||
edgeCollapser(const edgeCollapser&);
|
edgeCollapser(const edgeCollapser&);
|
||||||
@ -128,43 +245,92 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from mesh.
|
//- Construct from mesh
|
||||||
edgeCollapser(const polyMesh& mesh);
|
edgeCollapser(const polyMesh& mesh);
|
||||||
|
|
||||||
|
//- Construct from mesh and dict
|
||||||
|
edgeCollapser(const polyMesh& mesh, const dictionary& dict);
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
// Access
|
// Check
|
||||||
|
|
||||||
//- For every point the region it belongs to or -1.
|
//- Find the longest edge in a face
|
||||||
const labelList& pointRegion() const
|
static label longestEdge(const face& f, const pointField& pts);
|
||||||
{
|
|
||||||
return pointRegion_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- For every region the master (i.e. the point the region will
|
//- Calls motionSmoother::checkMesh and returns a set of bad faces
|
||||||
// be replaced by)
|
static HashSet<label> checkBadFaces
|
||||||
const DynamicList<label>& pointRegionMaster() const
|
(
|
||||||
{
|
const polyMesh& mesh,
|
||||||
return pointRegionMaster_;
|
const dictionary& meshQualityDict
|
||||||
}
|
);
|
||||||
|
|
||||||
//- Check that edge is not marked for anything
|
// Check mesh and mark points on faces in error
|
||||||
bool unaffectedEdge(const label edgeI) const;
|
// Returns boolList with points in error set
|
||||||
|
static label checkMeshQuality
|
||||||
|
(
|
||||||
|
const polyMesh& mesh,
|
||||||
|
const dictionary& meshQualityDict,
|
||||||
|
PackedBoolList& isErrorPoint
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Ensure that the collapse is parallel consistent and update
|
||||||
|
// allPointInfo.
|
||||||
|
// Returns a list of edge collapses that is consistent across
|
||||||
|
// coupled boundaries and a list of pointEdgeCollapses.
|
||||||
|
void consistentCollapse
|
||||||
|
(
|
||||||
|
const globalIndex& globalPoints,
|
||||||
|
const labelList& pointPriority,
|
||||||
|
const Map<point>& collapsePointToLocation,
|
||||||
|
PackedBoolList& collapseEdge,
|
||||||
|
List<pointEdgeCollapse>& allPointInfo,
|
||||||
|
const bool allowCellCollapse = false
|
||||||
|
) const;
|
||||||
|
|
||||||
|
|
||||||
// Edit
|
// Query
|
||||||
|
|
||||||
//- Set edge to collapse and point to collapse it to.
|
//- Play commands into polyTopoChange to create mesh.
|
||||||
// Return true if collapse is valid.
|
// Return true if anything changed.
|
||||||
// (always true at the moment)
|
bool setRefinement
|
||||||
bool collapseEdge(const label edgeI, const label master);
|
(
|
||||||
|
const List<pointEdgeCollapse>& allPointInfo,
|
||||||
|
polyTopoChange& meshMod
|
||||||
|
) const;
|
||||||
|
|
||||||
//- Play commands into polyTopoChange to create mesh. Return true
|
// Mark (in collapseEdge) any edges to collapse
|
||||||
// if anything changed.
|
label markSmallEdges
|
||||||
bool setRefinement(polyTopoChange&);
|
(
|
||||||
|
const scalarField& minEdgeLen,
|
||||||
|
const labelList& pointPriority,
|
||||||
|
PackedBoolList& collapseEdge,
|
||||||
|
Map<point>& collapsePointToLocation
|
||||||
|
) const;
|
||||||
|
|
||||||
void updateMesh(const mapPolyMesh&);
|
// Mark (in collapseEdge) any edges to merge
|
||||||
|
label markMergeEdges
|
||||||
|
(
|
||||||
|
const scalar maxCos,
|
||||||
|
const labelList& pointPriority,
|
||||||
|
PackedBoolList& collapseEdge,
|
||||||
|
Map<point>& collapsePointToLocation
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Find small faces and sliver faces in the mesh and mark the
|
||||||
|
// edges that need to be collapsed in order to remove these faces.
|
||||||
|
// Also returns a map of new locations for points that will move
|
||||||
|
// as a result of the collapse.
|
||||||
|
// Use in conjuctions with edgeCollapser to synchronise the
|
||||||
|
// collapses and modify the mesh
|
||||||
|
labelPair markSmallSliverFaces
|
||||||
|
(
|
||||||
|
const scalarField& faceFilterFactor,
|
||||||
|
const labelList& pointPriority,
|
||||||
|
PackedBoolList& collapseEdge,
|
||||||
|
Map<point>& collapsePointToLocation
|
||||||
|
) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -34,7 +34,9 @@ Foam::Ostream& Foam::operator<<
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
return os
|
return os
|
||||||
<< wDist.collapsePoint_ << wDist.collapseIndex_;
|
<< wDist.collapsePoint_
|
||||||
|
<< wDist.collapseIndex_
|
||||||
|
<< wDist.collapsePriority_;
|
||||||
}
|
}
|
||||||
|
|
||||||
Foam::Istream& Foam::operator>>
|
Foam::Istream& Foam::operator>>
|
||||||
@ -44,7 +46,9 @@ Foam::Istream& Foam::operator>>
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
return is
|
return is
|
||||||
>> wDist.collapsePoint_ >> wDist.collapseIndex_;
|
>> wDist.collapsePoint_
|
||||||
|
>> wDist.collapseIndex_
|
||||||
|
>> wDist.collapsePriority_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -62,6 +62,9 @@ class pointEdgeCollapse
|
|||||||
//- Collapse string index
|
//- Collapse string index
|
||||||
label collapseIndex_;
|
label collapseIndex_;
|
||||||
|
|
||||||
|
//- Priority of the collapse
|
||||||
|
label collapsePriority_;
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
@ -89,7 +92,8 @@ public:
|
|||||||
inline pointEdgeCollapse
|
inline pointEdgeCollapse
|
||||||
(
|
(
|
||||||
const point& collapsePoint,
|
const point& collapsePoint,
|
||||||
const label collapseIndex
|
const label collapseIndex,
|
||||||
|
const label collapsePriority
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -101,6 +105,8 @@ public:
|
|||||||
|
|
||||||
inline label collapseIndex() const;
|
inline label collapseIndex() const;
|
||||||
|
|
||||||
|
inline label collapsePriority() const;
|
||||||
|
|
||||||
|
|
||||||
// Needed by meshWave
|
// Needed by meshWave
|
||||||
|
|
||||||
@ -43,48 +43,58 @@ inline bool Foam::pointEdgeCollapse::update
|
|||||||
<< "problem." << abort(FatalError);
|
<< "problem." << abort(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!valid(td))
|
||||||
|
{
|
||||||
|
operator=(w2);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (w2.collapseIndex_ == -1 || collapseIndex_ == -1)
|
if (w2.collapseIndex_ == -1 || collapseIndex_ == -1)
|
||||||
{
|
{
|
||||||
// Not marked for collapse; only happens on edges.
|
// Not marked for collapse; only happens on edges.
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!valid(td))
|
if (w2.collapsePriority_ < collapsePriority_)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else if (w2.collapsePriority_ > collapsePriority_)
|
||||||
{
|
{
|
||||||
operator=(w2);
|
operator=(w2);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
// Take over w2 if it is 'better'
|
|
||||||
|
|
||||||
if (w2.collapseIndex_ < collapseIndex_)
|
// Get overwritten by w2 if it has a higher priority
|
||||||
|
if (w2.collapseIndex_ < collapseIndex_)
|
||||||
|
{
|
||||||
|
operator=(w2);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if (w2.collapseIndex_ == collapseIndex_)
|
||||||
|
{
|
||||||
|
bool identicalPoint = samePoint(w2.collapsePoint_);
|
||||||
|
|
||||||
|
bool nearer = magSqr(w2.collapsePoint_)
|
||||||
|
< magSqr(collapsePoint_);
|
||||||
|
|
||||||
|
if (nearer)
|
||||||
{
|
{
|
||||||
// Take over string index and coordinate from w2
|
|
||||||
operator=(w2);
|
operator=(w2);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
else if (w2.collapseIndex_ == collapseIndex_)
|
|
||||||
{
|
if (identicalPoint)
|
||||||
bool identicalPoint = samePoint(w2.collapsePoint_);
|
|
||||||
bool nearer = magSqr(w2.collapsePoint_) < magSqr(collapsePoint_);
|
|
||||||
if (nearer)
|
|
||||||
{
|
|
||||||
operator=(w2);
|
|
||||||
}
|
|
||||||
if (identicalPoint)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return nearer;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return nearer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -95,7 +105,8 @@ inline bool Foam::pointEdgeCollapse::update
|
|||||||
inline Foam::pointEdgeCollapse::pointEdgeCollapse()
|
inline Foam::pointEdgeCollapse::pointEdgeCollapse()
|
||||||
:
|
:
|
||||||
collapsePoint_(GREAT, GREAT, GREAT),
|
collapsePoint_(GREAT, GREAT, GREAT),
|
||||||
collapseIndex_(-2)
|
collapseIndex_(-2),
|
||||||
|
collapsePriority_(-2)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -103,11 +114,13 @@ inline Foam::pointEdgeCollapse::pointEdgeCollapse()
|
|||||||
inline Foam::pointEdgeCollapse::pointEdgeCollapse
|
inline Foam::pointEdgeCollapse::pointEdgeCollapse
|
||||||
(
|
(
|
||||||
const point& collapsePoint,
|
const point& collapsePoint,
|
||||||
const label collapseIndex
|
const label collapseIndex,
|
||||||
|
const label collapsePriority
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
collapsePoint_(collapsePoint),
|
collapsePoint_(collapsePoint),
|
||||||
collapseIndex_(collapseIndex)
|
collapseIndex_(collapseIndex),
|
||||||
|
collapsePriority_(collapsePriority)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -125,6 +138,12 @@ inline Foam::label Foam::pointEdgeCollapse::collapseIndex() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline Foam::label Foam::pointEdgeCollapse::collapsePriority() const
|
||||||
|
{
|
||||||
|
return collapsePriority_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
inline bool Foam::pointEdgeCollapse::samePoint(const point& pt) const
|
inline bool Foam::pointEdgeCollapse::samePoint(const point& pt) const
|
||||||
{
|
{
|
||||||
bool isLegal1 = (cmptMin(collapsePoint_) < 0.5*GREAT);
|
bool isLegal1 = (cmptMin(collapsePoint_) < 0.5*GREAT);
|
||||||
@ -268,6 +287,7 @@ inline bool Foam::pointEdgeCollapse::operator==
|
|||||||
{
|
{
|
||||||
return
|
return
|
||||||
collapseIndex_ == rhs.collapseIndex_
|
collapseIndex_ == rhs.collapseIndex_
|
||||||
|
&& collapsePriority_ == rhs.collapsePriority_
|
||||||
&& samePoint(rhs.collapsePoint_);
|
&& samePoint(rhs.collapsePoint_);
|
||||||
}
|
}
|
||||||
|
|
||||||
Reference in New Issue
Block a user