Updates to polyhedralRefinement.?

This commit is contained in:
Vuko Vukcevic 2018-01-12 15:59:24 +01:00
parent 6e33ee25f0
commit 9e34a1e234
2 changed files with 3604 additions and 370 deletions

View file

@ -55,7 +55,7 @@ Notes
#include "polyMeshModifier.H" #include "polyMeshModifier.H"
#include "labelIOList.H" #include "labelIOList.H"
#include "polyRefinementHistory.H" #include "polyRefinementHistory.H"
#include "removeFaces.H" #include "removePolyFaces.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -72,26 +72,41 @@ class polyhedralRefinement
{ {
// Private data // Private data
//- Cell refinement level //- Reference to polyMesh for easy access in helper functions
labelIOList cellLevel_; polyMesh& mesh_;
//- Point refinement level
labelIOList pointLevel_;
//- Typical edge length between unrefined points // Refinement control and handling
const scalar level0EdgeLength_;
//- Refinement history //- List of cells to refine in this time step
polyRefinementHistory history_; labelList cellsToRefine_;
//- Face remover engine //- List of split point labels to unrefine in this time step
removeFaces faceRemover_; labelList splitPointsToUnrefine_;
//- List of cells to refine in this time step //- Cell refinement level
labelList cellsToRefine_; labelIOList cellLevel_;
//- List of split point labels to unrefine in this time step //- Point refinement level
labelList splitPointLabels_; labelIOList pointLevel_;
//- Typical edge length between unrefined points
const scalar level0EdgeLength_;
//- Refinement history
polyRefinementHistory history_;
//- Face remover engine
removePolyFaces faceRemover_;
//- Switch whether to use point based consistency on refinement
Switch pointBasedRefinement_;
//- Number of buffer layers for refinement
label nBufferLayers_;
//- Number of refinement/unrefinement iterations done so far
label nRefinementIterations_;
// Private Member Functions // Private Member Functions
@ -112,13 +127,17 @@ class polyhedralRefinement
// points smaller than the level // points smaller than the level
label getAnchorLevel(const label faceI) const; label getAnchorLevel(const label faceI) const;
//- Get points of a cell by going through its faces (without using
// cellPoints addressing)
Xfer<labelList> cellPoints(const label cellI) const;
//- Calculate level0EdgeLength_ (constructor helper) //- Calculate level0EdgeLength_ (constructor helper)
void calcLevel0EdgeLength() const; void calcLevel0EdgeLength() const;
//- Set file instance for cellLevel_, pointLevel_ and history_
void setInstance(const fileName& inst);
//- Extend cells to refine. Given a markup field of refinement
// candidates (true for cells to refine), marks the neigbhours of
// marked cells as well
void extendMarkedCells(boolList& refineCell) const;
// Global topology modification functions (operate on whole polyMesh) // Global topology modification functions (operate on whole polyMesh)
// and directly use local topology modification functions below // and directly use local topology modification functions below
@ -136,13 +155,13 @@ class polyhedralRefinement
// that will allocate interpolation. // that will allocate interpolation.
// -points added to split edge: added from edge start() // -points added to split edge: added from edge start()
// -midpoints added: added from cellPoints[0]. // -midpoints added: added from cellPoints[0].
void setPolyhedralRefinement() const; void setPolyhedralRefinement(polyTopoChange& ref);
//- Remove some of the previously performed refinement. Uses //- Remove some of the previously performed refinement. Uses
// splitPointLabels_ to determine the unrefinement. // splitPointLabels_ to determine the unrefinement.
// All n pointCells of a split point will be combined into // All n pointCells of a split point will be combined into
// the lowest numbered cell of those n. // the lowest numbered cell of those n.
void setUnrefinement() const; void setPolyhedralUnrefinement(polyTopoChange& ref);
// Local topology modification functions (operate on cells/faces) // Local topology modification functions (operate on cells/faces)
@ -150,7 +169,7 @@ class polyhedralRefinement
//- Adds a face on top of existing faceI. Reverses if nessecary //- Adds a face on top of existing faceI. Reverses if nessecary
label addFace label addFace
( (
polyTopoChange& meshMod, polyTopoChange& ref,
const label faceI, const label faceI,
const face& newFace, const face& newFace,
const label own, const label own,
@ -160,7 +179,7 @@ class polyhedralRefinement
//- Adds internal face from point. No checks on reversal //- Adds internal face from point. No checks on reversal
label addInternalFace label addInternalFace
( (
polyTopoChange& meshMod, polyTopoChange& ref,
const label meshFaceI, const label meshFaceI,
const label meshPointI, const label meshPointI,
const face& newFace, const face& newFace,
@ -172,7 +191,7 @@ class polyhedralRefinement
// points. Reverses if nessecary // points. Reverses if nessecary
void modifyFace void modifyFace
( (
polyTopoChange& meshMod, polyTopoChange& ref,
const label faceI, const label faceI,
const face& newFace, const face& newFace,
const label own, const label own,
@ -190,7 +209,7 @@ class polyhedralRefinement
const labelList& faceAnchorLevel, const labelList& faceAnchorLevel,
const labelList& edgeMidPoint, const labelList& edgeMidPoint,
const label cellI, const label cellI,
polyTopoChange& meshMod polyTopoChange& ref
) const; ) const;
@ -243,7 +262,7 @@ class polyhedralRefinement
//- Get index of point with minimum or maximum point level //- Get index of point with minimum or maximum point level
template<class BinaryOp> template<class BinaryOp>
label findMinMaxLevel(const labelList& f) const; label findMinMaxLevel(const labelList& f, BinaryOp& op) const;
//- Count number of vertices <= anchorLevel for a given face //- Count number of vertices <= anchorLevel for a given face
label countAnchors label countAnchors
@ -278,7 +297,7 @@ class polyhedralRefinement
Map<edge>& midPointToAnchors, Map<edge>& midPointToAnchors,
Map<edge>& midPointToFaceMids, Map<edge>& midPointToFaceMids,
polyTopoChange& meshMod polyTopoChange& ref
) const; ) const;
//- If p0 and p1 are existing vertices check if edge is split and insert //- If p0 and p1 are existing vertices check if edge is split and insert
@ -297,7 +316,7 @@ class polyhedralRefinement
//- Check orientation of added internal face //- Check orientation of added internal face
void checkInternalOrientation void checkInternalOrientation
( (
polyTopoChange& meshMod, polyTopoChange& ref,
const label cellI, const label cellI,
const label faceI, const label faceI,
const point& ownPt, const point& ownPt,
@ -308,7 +327,7 @@ class polyhedralRefinement
//- Check orientation of a new boundary face //- Check orientation of a new boundary face
void checkBoundaryOrientation void checkBoundaryOrientation
( (
polyTopoChange& meshMod, polyTopoChange& ref,
const label cellI, const label cellI,
const label faceI, const label faceI,
const point& ownPt, const point& ownPt,
@ -319,45 +338,24 @@ class polyhedralRefinement
// Refinement/unrefinement consistency checks // Refinement/unrefinement consistency checks
//- Given valid mesh, current cell level and proposed //- Updates cellsToRefine such that a face consistent 2:1 refinement
// cells to refine calculate any clashes (due to 2:1) and return
// ok list of cells to refine.
Xfer<labelList> consistentRefinement
(
const labelList& cellsToRefine,
const bool pointBasedRefinement
) const;
//- Given proposed splitPoints to unrefine calculate
// any clashes (due to 2:1) and return ok list of points to
// unrefine.
Xfer<labelList> consistentUnrefinement
(
const labelList& pointsToUnrefine,
const bool pointBasedUnrefinement
) const;
//- Updates refineCell such that a face consistent 2:1 refinement
// is obtained. Returns local number of cells changed // is obtained. Returns local number of cells changed
label faceConsistentRefinement(PackedBoolList& refineCell) const; label faceConsistentRefinement(boolList& cellsToRefine) const;
//- Updates refineCell such that a point consistent 4:1 refinement //- Updates cellsToRefine such that a point consistent 4:1 refinement
// is obtained. Returns local number of cells changed // is obtained. Returns local number of cells changed
label pointConsistentRefinement(PackedBoolList& refineCell) const; label pointConsistentRefinement(boolList& cellsToRefine) const;
//- Updates unrefineCell such that a face consistent 2:1 //- Updates cellsToUnrefine such that a face consistent 2:1
// unrefinement is obtained. Returns local number of cells changed // unrefinement is obtained. Returns local number of points changed
label faceConsistentUnrefinement label faceConsistentUnrefinement(boolList& cellsToUnrefine) const;
(
PackedBoolList& unrefineCell
) const;
//- Updates unrefineCell such that a point consistent 4:1 //- Updates cellsToUnrefine such that a point consistent 4:1
// unrefinement is obtained. Returns local number of cells changed // unrefinement is obtained. Returns local number of points changed
label pointConsistentUnrefinement label pointConsistentUnrefinement
( (
const PackedBoolList& unrefinePoints, const boolList& splitPointsToUnrefine,
PackedBoolList& unrefineCell boolList& cellsToUnrefine
) const; ) const;
@ -421,14 +419,26 @@ public:
// Edit // Edit
//- Set cells to refine //- Set cells to refine given a list of refinement
void setCellsToRefine(const labelList& cellsToRefine); // candidates. Refinement candidates are extended within the
// function due to possible 4:1 conflicts and specified number of
// buffer layers.
// Note: must be called BEFORE setSplitPointsToUnrefine
void setCellsToRefine(const labelList& refinementCellCandidates);
//- Update split points to unrefine //- Set split points to unrefine given a list of all mesh points
void updateSplitPointsToUnrefine(); // that are candidates for unrefinement. Split points are
// determined as a subset of unrefinement candidates, avoiding
// splitting points of cells that are going to be refined at the
// same time and ensuring consistent unrefinement.
// Note: must be called AFTER setCellsToRefine
void setSplitPointsToUnrefine
(
const labelList& unrefinementPointCandidates
);
// polyMeshModifier interface // Inherited interface from polyMeshModifier
//- Check for topology change //- Check for topology change
virtual bool changeTopology() const; virtual bool changeTopology() const;