hexRef8 Class Reference

Refinement of (split) hexes using polyTopoChange. More...

Public Member Functions

 ClassName ("hexRef8")
 Runtime type information. More...
 
 hexRef8 (const polyMesh &mesh, const bool readHistory=true)
 Construct from mesh, read_if_present refinement data. More...
 
 hexRef8 (const polyMesh &mesh, const labelList &cellLevel, const labelList &pointLevel, const refinementHistory &history, const scalar level0Edge=-GREAT)
 Construct from mesh and un/refinement data and optional size of. More...
 
 hexRef8 (const polyMesh &mesh, const labelList &cellLevel, const labelList &pointLevel, const scalar level0Edge=-GREAT)
 Construct from mesh and refinement data and optional size of. More...
 
const polyMeshmesh () const
 
const labelIOListcellLevel () const
 
const labelIOListpointLevel () const
 
const refinementHistoryhistory () const
 
scalar level0EdgeLength () const
 Typical edge length between unrefined points. More...
 
label faceLevel (const label facei) const
 Gets level such that the face has four points <= level. More...
 
labelList consistentRefinement (const labelUList &cellLevel, const labelList &cellsToRefine, const bool maxSet) const
 Given valid mesh and current cell level and proposed. More...
 
labelList consistentRefinement (const labelList &cellsToRefine, const bool maxSet) const
 Given valid mesh and current cell level and proposed. More...
 
labelList consistentSlowRefinement (const label maxFaceDiff, const labelList &cellsToRefine, const labelList &facesToCheck, const label maxPointDiff, const labelList &pointsToCheck) const
 Like consistentRefinement but slower: More...
 
labelList consistentSlowRefinement2 (const label maxFaceDiff, const labelList &cellsToRefine, const labelList &facesToCheck) const
 Like consistentSlowRefinement but uses different meshWave. More...
 
labelListList setRefinement (const labelList &cells, polyTopoChange &)
 Insert refinement. All selected cells will be split into 8. More...
 
void updateMesh (const mapPolyMesh &)
 Update local numbering for changed mesh. More...
 
void storeData (const labelList &pointsToStore, const labelList &facesToStore, const labelList &cellsToStore)
 Signal points/face/cells for which to store data. More...
 
void updateMesh (const mapPolyMesh &, const Map< label > &pointsToRestore, const Map< label > &facesToRestore, const Map< label > &cellsToRestore)
 Update local numbering + undo. More...
 
void subset (const labelList &pointMap, const labelList &faceMap, const labelList &cellMap)
 Update local numbering for subsetted mesh. More...
 
void distribute (const mapDistributePolyMesh &)
 Update local numbering for mesh redistribution. More...
 
void checkMesh () const
 Debug: Check coupled mesh for correctness. More...
 
void checkRefinementLevels (const label maxPointDiff, const labelList &pointsToCheck) const
 Debug: Check 2:1 consistency across faces. More...
 
const cellShapeListcellShapes () const
 Utility: get hexes as cell shapes. More...
 
labelList getSplitPoints () const
 Return the points at the centre of top-level split cells. More...
 
labelList consistentUnrefinement (const labelList &pointsToUnrefine, const bool maxSet) const
 Given proposed. More...
 
void setUnrefinement (const labelList &splitPointLabels, polyTopoChange &)
 Remove some refinement. Needs to be supplied output of. More...
 
void setInstance (const fileName &inst)
 
bool write (const bool valid=true) const
 Force writing refinement+history to polyMesh directory. More...
 

Static Public Member Functions

static void removeFiles (const polyMesh &)
 Helper: remove all relevant files from mesh instance. More...
 

Detailed Description

Refinement of (split) hexes using polyTopoChange.

Source files

Definition at line 67 of file hexRef8.H.

Constructor & Destructor Documentation

◆ hexRef8() [1/3]

hexRef8 ( const polyMesh mesh,
const bool  readHistory = true 
)
explicit

Construct from mesh, read_if_present refinement data.

(from write below). If readHistory is true does read_if_present of refinement history. If false clears all history

Definition at line 1925 of file hexRef8.C.

References Foam::abort(), refinementHistory::active(), hexRef8::checkMesh(), hexRef8::checkRefinementLevels(), Foam::endl(), Foam::FatalError, FatalErrorInFunction, primitiveMesh::nCells(), primitiveMesh::nPoints(), IOobject::objectPath(), refinementHistory::read(), IOobject::READ_IF_PRESENT, IOobject::readOpt(), UList< T >::size(), IOobject::typeHeaderOk(), and refinementHistory::visibleCells().

Here is the call graph for this function:

◆ hexRef8() [2/3]

hexRef8 ( const polyMesh mesh,
const labelList cellLevel,
const labelList pointLevel,
const refinementHistory history,
const scalar  level0Edge = -GREAT 
)

Construct from mesh and un/refinement data and optional size of.

starting cells

Definition at line 2038 of file hexRef8.C.

References Foam::abort(), refinementHistory::active(), hexRef8::checkMesh(), hexRef8::checkRefinementLevels(), Foam::endl(), Foam::FatalError, FatalErrorInFunction, primitiveMesh::nCells(), primitiveMesh::nPoints(), UList< T >::size(), and refinementHistory::visibleCells().

Here is the call graph for this function:

◆ hexRef8() [3/3]

hexRef8 ( const polyMesh mesh,
const labelList cellLevel,
const labelList pointLevel,
const scalar  level0Edge = -GREAT 
)

Construct from mesh and refinement data and optional size of.

starting cells

Definition at line 2147 of file hexRef8.C.

References Foam::abort(), hexRef8::checkMesh(), hexRef8::checkRefinementLevels(), Foam::endl(), Foam::FatalError, FatalErrorInFunction, primitiveMesh::nCells(), primitiveMesh::nPoints(), and UList< T >::size().

Here is the call graph for this function:

Member Function Documentation

◆ ClassName()

ClassName ( "hexRef8"  )

Runtime type information.

◆ mesh()

const polyMesh & mesh ( ) const
inline

Definition at line 392 of file hexRef8.H.

◆ cellLevel()

const labelIOList & cellLevel ( ) const
inline

Definition at line 397 of file hexRef8.H.

Referenced by snappyLayerDriver::addLayersSinglePass(), and dynamicRefineFvMesh::calculateProtectedCells().

Here is the caller graph for this function:

◆ pointLevel()

const labelIOList & pointLevel ( ) const
inline

Definition at line 402 of file hexRef8.H.

◆ history()

const refinementHistory & history ( ) const
inline

Definition at line 407 of file hexRef8.H.

◆ level0EdgeLength()

scalar level0EdgeLength ( ) const
inline

Typical edge length between unrefined points.

Definition at line 413 of file hexRef8.H.

References dimensioned< Type >::value().

Referenced by snappyLayerDriver::addLayersSinglePass(), and snappyVoxelMeshDriver::snappyVoxelMeshDriver().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ faceLevel()

Foam::label faceLevel ( const label  facei) const

Gets level such that the face has four points <= level.

Definition at line 797 of file hexRef8.C.

References f(), and UList< T >::size().

Here is the call graph for this function:

◆ consistentRefinement() [1/2]

Foam::labelList consistentRefinement ( const labelUList cellLevel,
const labelList cellsToRefine,
const bool  maxSet 
) const

Given valid mesh and current cell level and proposed.

cells to refine calculate any clashes (due to 2:1) and return ok list of cells to refine. Either adds cells to refine to set (maxSet = true) or removes cells to refine (maxSet = false)

Definition at line 2249 of file hexRef8.C.

References Foam::endl(), Foam::Pout, and Foam::reduce().

Here is the call graph for this function:

◆ consistentRefinement() [2/2]

labelList consistentRefinement ( const labelList cellsToRefine,
const bool  maxSet 
) const
inline

Given valid mesh and current cell level and proposed.

cells to refine calculate any clashes (due to 2:1) and return ok list of cells to refine. Either adds cells to refine to set (maxSet = true) or removes cells to refine (maxSet = false)

Definition at line 440 of file hexRef8.H.

◆ consistentSlowRefinement()

Foam::labelList consistentSlowRefinement ( const label  maxFaceDiff,
const labelList cellsToRefine,
const labelList facesToCheck,
const label  maxPointDiff,
const labelList pointsToCheck 
) const

Like consistentRefinement but slower:

  • specify number of cells between consecutive refinement levels (consistentRefinement equivalent to 1)
  • specify max level difference between point-connected cells. (-1 to disable) Note that with normal 2:1 limitation (maxFaceDiff=1) there can be 8:1 size difference across point connected cells so maxPointDiff allows you to make that less. cellsToRefine : cells we're thinking about refining. It will extend this set. All refinement levels will be at least maxFaceDiff layers thick. facesToCheck : additional faces where to implement the maxFaceDiff thickness (usually only boundary faces)

Definition at line 2305 of file hexRef8.C.

References Foam::abort(), DynamicList< T, SizeMin >::append(), DynamicList< T, SizeMin >::clear(), refinementData::count(), Foam::endl(), Foam::exit(), Foam::FatalError, FatalErrorInFunction, Foam::findIndices(), forAll, forAllConstIters, HashTable< T, Key, Hash >::insert(), FaceCellWave< Type, TrackingData >::iterate(), Foam::labelMin, UList< T >::last(), Foam::mag(), Foam::max(), Foam::nl, Foam::Pout, Foam::reduce(), DynamicList< T, SizeMin >::setCapacity(), FaceCellWave< Type, TrackingData >::setFaceInfo(), DynamicList< T, SizeMin >::shrink(), HashTable< T, Key, Hash >::size(), UList< T >::size(), syncTools::swapBoundaryFaceList(), syncTools::syncPointList(), refinementData::updateFace(), and Foam::Zero.

Here is the call graph for this function:

◆ consistentSlowRefinement2()

Foam::labelList consistentSlowRefinement2 ( const label  maxFaceDiff,
const labelList cellsToRefine,
const labelList facesToCheck 
) const

Like consistentSlowRefinement but uses different meshWave.

(proper distance instead of toplogical count). No point checks yet.

Definition at line 2789 of file hexRef8.C.

References Foam::abort(), DynamicList< T, SizeMin >::append(), Foam::endl(), Foam::exit(), Foam::FatalError, FatalErrorInFunction, Foam::findIndices(), forAll, HashSet< Key, Hash >::insert(), Foam::nl, IOobject::objectPath(), Foam::Pout, FaceCellWave< Type, TrackingData >::propagationTol(), Foam::reduce(), DynamicList< T, SizeMin >::shrink(), HashTable< T, Key, Hash >::size(), UList< T >::size(), bitSet::test(), and regIOobject::write().

Here is the call graph for this function:

◆ setRefinement()

Foam::labelListList setRefinement ( const labelList cells,
polyTopoChange meshMod 
)

Insert refinement. All selected cells will be split into 8.

Returns per element in cells the 8 cells they were split into. Guarantees that the 0th element is the original cell label. Mapping: -split cells: 7 new ones get added from original -split faces: original gets modified; 3 new ones get added from original -added internal faces: added from original cell face(if that was internal) or created out-of-nothing (so will not get mapped!). Note: could make this inflate from point but that will allocate interpolation. -points added to split edge: added from edge start() -midpoints added: added from cellPoints[0].

Definition at line 3189 of file hexRef8.C.

References Foam::abort(), DynamicList< T, SizeMin >::append(), e, Foam::endl(), f(), Foam::FatalError, FatalErrorInFunction, forAll, HashSet< Key, Hash >::insert(), Foam::labelMax, Foam::labelMin, Foam::max(), Foam::min(), OFstream::name(), Foam::nl, IOobject::objectPath(), Foam::Pout, bitSet::set(), polyTopoChange::setAction(), List< T >::setSize(), HashTable< T, Key, Hash >::size(), UList< T >::size(), syncTools::swapBoundaryFaceList(), syncTools::syncBoundaryFacePositions(), syncTools::syncEdgeList(), syncTools::syncEdgePositions(), syncTools::syncFaceList(), bitSet::test(), List< T >::transfer(), bitSet::unset(), regIOobject::write(), Foam::meshTools::writeOBJ(), and Foam::Zero.

Here is the call graph for this function:

◆ updateMesh() [1/2]

void updateMesh ( const mapPolyMesh map)

Update local numbering for changed mesh.

Definition at line 4231 of file hexRef8.C.

◆ storeData()

void storeData ( const labelList pointsToStore,
const labelList facesToStore,
const labelList cellsToStore 
)

Signal points/face/cells for which to store data.

Definition at line 4203 of file hexRef8.C.

References List< T >::clear(), forAll, and UList< T >::size().

Here is the call graph for this function:

◆ updateMesh() [2/2]

void updateMesh ( const mapPolyMesh map,
const Map< label > &  pointsToRestore,
const Map< label > &  facesToRestore,
const Map< label > &  cellsToRestore 
)

Update local numbering + undo.

Data to restore given as new pointlabel + stored pointlabel (i.e. what was in pointsToStore)

Definition at line 4242 of file hexRef8.C.

References Foam::abort(), mapPolyMesh::cellMap(), Foam::endl(), Foam::FatalError, FatalErrorInFunction, forAll, forAllConstIters, newPointi, mapPolyMesh::nOldCells(), mapPolyMesh::nOldPoints(), mapPolyMesh::pointMap(), Foam::Pout, Foam::reorder(), mapPolyMesh::reverseCellMap(), mapPolyMesh::reversePointMap(), UList< T >::size(), and List< T >::transfer().

Here is the call graph for this function:

◆ subset()

void subset ( const labelList pointMap,
const labelList faceMap,
const labelList cellMap 
)

Update local numbering for subsetted mesh.

Gets new-to-old maps. Not compatible with unrefinement.

Definition at line 4432 of file hexRef8.C.

References Foam::abort(), Foam::endl(), Foam::faceMap(), Foam::FatalError, FatalErrorInFunction, forAll, newPointi, Foam::nl, Foam::Pout, UList< T >::size(), List< T >::transfer(), and WarningInFunction.

Here is the call graph for this function:

◆ distribute()

void distribute ( const mapDistributePolyMesh map)

Update local numbering for mesh redistribution.

Definition at line 4516 of file hexRef8.C.

References hexRef8::distribute(), mapDistributePolyMesh::distributeCellData(), mapDistributePolyMesh::distributePointData(), Foam::endl(), and Foam::Pout.

Referenced by hexRef8::distribute().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ checkMesh()

void checkMesh ( ) const

Debug: Check coupled mesh for correctness.

Definition at line 4544 of file hexRef8.C.

References Foam::abort(), polyPatch::coupled(), e, Foam::endl(), f(), Foam::FatalError, FatalErrorInFunction, forAll, Foam::mag(), IOstream::name(), patchIdentifier::name(), patches, Foam::Pout, UList< T >::size(), polyPatch::start(), and syncTools::swapBoundaryFaceList().

Referenced by edgeCollapser::checkBadFaces(), snappyLayerDriver::doLayers(), snappySnapDriver::doSnap(), hexRef8::hexRef8(), meshRefinement::mergeEdgesUndo(), meshRefinement::mergePatchFacesUndo(), and meshRefinement::splitFacesUndo().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ checkRefinementLevels()

void checkRefinementLevels ( const label  maxPointDiff,
const labelList pointsToCheck 
) const

Debug: Check 2:1 consistency across faces.

maxPointDiff==-1 : only check 2:1 across faces maxPointDiff!=-1 : check point-connected cells.

Gives problems after first splitting off inside mesher.

// Hanging points { Any patches with points having only two edges.

boolList isHangingPoint(mesh_.nPoints(), false);

const polyBoundaryMesh& patches = mesh_.boundaryMesh();

forAll(patches, patchi) { const polyPatch& pp = patches[patchi];

const labelList& meshPoints = pp.meshPoints();

forAll(meshPoints, i) { label pointi = meshPoints[i];

const labelList& pEdges = mesh_.pointEdges()[pointi];

if (pEdges.size() == 2) { isHangingPoint[pointi] = true; } } }

syncTools::syncPointList ( mesh_, isHangingPoint, andEqOp<bool>(), // only if all decide it is hanging point true, // null false // no separation );

OFstream str(mesh_.time().path()/"hangingPoints.obj");

label nHanging = 0;

forAll(isHangingPoint, pointi) { if (isHangingPoint[pointi]) { nHanging++;

Pout<< "Hanging boundary point " << pointi << " at " << mesh_.points()[pointi] << endl; meshTools::writeOBJ(str, mesh_.points()[pointi]); } }

if (returnReduce(nHanging, sumOp<label>()) > 0) { FatalErrorInFunction << "Detected a point used by two edges only (hanging point)" << nl << "This is not allowed" << abort(FatalError); } }

Definition at line 4752 of file hexRef8.C.

References Foam::abort(), Foam::endl(), Foam::FatalError, FatalErrorInFunction, forAll, Foam::labelMax, Foam::labelMin, Foam::mag(), Foam::max(), Foam::nl, Foam::Pout, syncTools::swapBoundaryFaceList(), syncTools::syncPointList(), and Foam::Zero.

Referenced by hexRef8::hexRef8().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cellShapes()

const Foam::cellShapeList & cellShapes ( ) const

Utility: get hexes as cell shapes.

Definition at line 5005 of file hexRef8.C.

References Foam::endl(), forAll, Foam::nl, and Foam::Pout.

Here is the call graph for this function:

◆ getSplitPoints()

Foam::labelList getSplitPoints ( ) const

Return the points at the centre of top-level split cells.

that can be unsplit.

Definition at line 5065 of file hexRef8.C.

References Foam::abort(), Foam::endl(), f(), Foam::FatalError, FatalErrorInFunction, forAll, Foam::Pout, UList< T >::size(), and Foam::Zero.

Here is the call graph for this function:

◆ consistentUnrefinement()

Foam::labelList consistentUnrefinement ( const labelList pointsToUnrefine,
const bool  maxSet 
) const

Given proposed.

splitPoints to unrefine according to calculate any clashes (due to 2:1) and return ok list of points to unrefine. Either adds points to refine to set (maxSet = true) or removes points to refine (maxSet = false)

Definition at line 5268 of file hexRef8.C.

References Foam::abort(), Foam::endl(), Foam::FatalError, FatalErrorInFunction, forAll, PackedList< Width >::get(), Foam::Pout, Foam::reduce(), bitSet::set(), syncTools::swapBoundaryFaceList(), bitSet::test(), and bitSet::unset().

Here is the call graph for this function:

◆ setUnrefinement()

void setUnrefinement ( const labelList splitPointLabels,
polyTopoChange meshMod 
)

Remove some refinement. Needs to be supplied output of.

consistentUnrefinement. Only call if undoable set. All 8 pointCells of a split point will be combined into the lowest numbered cell of those 8.

Definition at line 5491 of file hexRef8.C.

References Foam::abort(), Foam::endl(), Foam::FatalError, FatalErrorInFunction, forAll, HashSet< Key, Hash >::insert(), Foam::min(), Foam::nl, IOobject::objectPath(), pFaces, Foam::Pout, HashTable< T, Key, Hash >::size(), UList< T >::size(), HashTable< T, Key, Hash >::toc(), and regIOobject::write().

Here is the call graph for this function:

◆ setInstance()

void setInstance ( const fileName inst)

Definition at line 1732 of file hexRef8.C.

References Foam::endl(), and Foam::Pout.

Here is the call graph for this function:

◆ write()

bool write ( const bool  valid = true) const

Force writing refinement+history to polyMesh directory.

Definition at line 5693 of file hexRef8.C.

References faMesh::removeFiles().

Here is the call graph for this function:

◆ removeFiles()

void removeFiles ( const polyMesh mesh)
static

Helper: remove all relevant files from mesh instance.

Definition at line 5713 of file hexRef8.C.

References DebugVar, Foam::exists(), polyMesh::facesInstance(), io(), mesh, polyMesh::meshSubDir, IOobject::path(), faMesh::removeFiles(), and Foam::rm().

Here is the call graph for this function:

The documentation for this class was generated from the following files: