Public Member Functions | List of all members
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 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...
 

Detailed Description

Refinement of (split) hexes using polyTopoChange.

Source files

Definition at line 64 of file hexRef8.H.

Constructor & Destructor Documentation

◆ hexRef8() [1/3]

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

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 1929 of file hexRef8.C.

References Foam::abort(), refinementHistory::active(), hexRef8::checkMesh(), hexRef8::checkRefinementLevels(), Foam::endl(), Foam::FatalError, FatalErrorInFunction, IOobject::fileModificationChecking, regIOobject::headerOk(), primitiveMesh::nCells(), primitiveMesh::nPoints(), IOobject::objectPath(), refinementHistory::read(), IOobject::READ_IF_PRESENT, IOobject::readOpt(), List< T >::size(), IOobject::timeStamp, 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 2049 of file hexRef8.C.

References Foam::abort(), refinementHistory::active(), hexRef8::checkMesh(), hexRef8::checkRefinementLevels(), Foam::endl(), Foam::FatalError, FatalErrorInFunction, List< 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 2158 of file hexRef8.C.

References Foam::abort(), hexRef8::checkMesh(), hexRef8::checkRefinementLevels(), hexRef8::consistentRefinement(), Foam::endl(), Foam::FatalError, FatalErrorInFunction, and List< 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 384 of file hexRef8.H.

◆ cellLevel()

const labelIOList& cellLevel ( ) const
inline

Definition at line 389 of file hexRef8.H.

Referenced by backgroundMeshDecomposition::cellLevel(), dynamicRefineFvMesh::dynamicRefineFvMesh(), and dynamicRefineFvMesh::writeObject().

Here is the caller graph for this function:

◆ pointLevel()

const labelIOList& pointLevel ( ) const
inline

Definition at line 394 of file hexRef8.H.

Referenced by dynamicRefineFvMesh::dynamicRefineFvMesh(), and backgroundMeshDecomposition::pointLevel().

Here is the caller graph for this function:

◆ history()

const refinementHistory& history ( ) const
inline

Definition at line 399 of file hexRef8.H.

Referenced by dynamicRefineFvMesh::update().

Here is the caller graph for this function:

◆ level0EdgeLength()

scalar level0EdgeLength ( ) const
inline

◆ faceLevel()

Foam::label faceLevel ( const label  facei) const

◆ consistentRefinement()

Foam::labelList consistentRefinement ( 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 2259 of file hexRef8.C.

References hexRef8::consistentSlowRefinement(), Foam::endl(), forAll, PackedList< nBits >::get(), Foam::Pout, Foam::reduce(), and PackedBoolList::set().

Referenced by hexRef8::hexRef8(), and hexRef8::level0EdgeLength().

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

◆ 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 2334 of file hexRef8.C.

References Foam::abort(), List< T >::append(), hexRef8::consistentSlowRefinement2(), refinementData::count(), Foam::endl(), Foam::exit(), Foam::FatalError, FatalErrorInFunction, Foam::findIndices(), forAll, forAllConstIter(), refinementData::isRefined(), FaceCellWave< Type, TrackingData >::iterate(), Foam::labelMin, Foam::mag(), Foam::max(), Foam::nl, patchi, Foam::Pout, Foam::reduce(), refinementData::refinementCount(), FaceCellWave< Type, TrackingData >::setFaceInfo(), List< T >::size(), syncTools::swapBoundaryFaceList(), syncTools::syncPointList(), and refinementData::updateFace().

Referenced by hexRef8::consistentRefinement(), and hexRef8::level0EdgeLength().

Here is the call graph for this function:
Here is the caller 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 2818 of file hexRef8.C.

References Foam::abort(), List< T >::append(), Foam::endl(), Foam::exit(), Foam::FatalError, FatalErrorInFunction, Foam::findIndices(), forAll, PackedList< nBits >::get(), hexRef8::level0EdgeLength(), Foam::nl, IOobject::objectPath(), Foam::Pout, Foam::reduce(), PackedBoolList::set(), hexRef8::setRefinement(), List< T >::size(), HashTable< T, Key, Hash >::size(), Ostream::write(), and regIOobject::write().

Referenced by hexRef8::consistentSlowRefinement(), and hexRef8::level0EdgeLength().

Here is the call graph for this function:
Here is the caller 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 3243 of file hexRef8.C.

References Foam::abort(), refinementHistory::active(), DynamicList< T, SizeInc, SizeMult, SizeDiv >::append(), List< T >::append(), edge::centre(), hexRef8::checkMesh(), HashTable< T, Key, Hash >::clear(), Foam::e, Foam::endl(), hexRef8::faceLevel(), Foam::FatalError, FatalErrorInFunction, forAll, Foam::labelMax, Foam::labelMin, Foam::max(), Foam::min(), OSstream::name(), Foam::nl, Foam::Pout, refinementHistory::resize(), polyTopoChange::setAction(), hexRef8::setInstance(), List< T >::setSize(), List< T >::size(), hexRef8::storeData(), refinementHistory::storeSplit(), syncTools::swapBoundaryFaceList(), syncTools::syncBoundaryFacePositions(), syncTools::syncEdgeList(), syncTools::syncEdgePositions(), syncTools::syncFaceList(), List< T >::transfer(), Ostream::write(), and Foam::meshTools::writeOBJ().

Referenced by hexRef8::consistentSlowRefinement2(), and hexRef8::level0EdgeLength().

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

◆ updateMesh() [1/2]

void updateMesh ( const mapPolyMesh map)

Update local numbering for changed mesh.

Definition at line 4288 of file hexRef8.C.

Referenced by hexRef8::level0EdgeLength().

Here is the caller graph for this function:

◆ storeData()

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

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

Definition at line 4263 of file hexRef8.C.

References forAll, HashTable< T, Key, Hash >::insert(), HashTable< T, Key, Hash >::resize(), and List< T >::size().

Referenced by hexRef8::level0EdgeLength(), and hexRef8::setRefinement().

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

◆ updateMesh() [2/2]

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

◆ 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 4490 of file hexRef8.C.

References Foam::abort(), refinementHistory::active(), Foam::endl(), Foam::FatalError, FatalErrorInFunction, Foam::findIndex(), forAll, newPointi, Foam::nl, Foam::Pout, hexRef8::setInstance(), List< T >::size(), refinementHistory::subset(), List< T >::transfer(), and WarningInFunction.

Referenced by hexRef8::level0EdgeLength(), and hexRef8::updateMesh().

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

◆ distribute()

void distribute ( const mapDistributePolyMesh map)

Update local numbering for mesh redistribution.

Definition at line 4573 of file hexRef8.C.

References refinementHistory::active(), removeFaces::distribute(), refinementHistory::distribute(), mapDistributePolyMesh::distributeCellData(), mapDistributePolyMesh::distributePointData(), Foam::endl(), and Foam::Pout.

Referenced by hexRef8::level0EdgeLength().

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

◆ checkMesh()

void checkMesh ( ) const

◆ 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 4811 of file hexRef8.C.

References Foam::abort(), Foam::endl(), Foam::FatalError, FatalErrorInFunction, forAll, Foam::labelMax, Foam::labelMin, Foam::mag(), Foam::max(), Foam::nl, patchi, Foam::Pout, List< T >::size(), syncTools::swapBoundaryFaceList(), and syncTools::syncPointList().

Referenced by hexRef8::checkMesh(), hexRef8::getSplitPoints(), hexRef8::hexRef8(), and hexRef8::level0EdgeLength().

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 5063 of file hexRef8.C.

References Foam::endl(), forAll, Foam::nl, Foam::Pout, List< T >::size(), and DynamicList< T, SizeInc, SizeMult, SizeDiv >::xfer().

Referenced by hexRef8::level0EdgeLength().

Here is the call graph for this function:
Here is the caller 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 5123 of file hexRef8.C.

References Foam::abort(), refinementHistory::active(), hexRef8::checkRefinementLevels(), hexRef8::consistentUnrefinement(), Foam::endl(), Foam::FatalError, FatalErrorInFunction, forAll, refinementHistory::parentIndex(), Foam::Pout, List< T >::size(), and refinementHistory::visibleCells().

Referenced by hexRef8::level0EdgeLength().

Here is the call graph for this function:
Here is the caller 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 5327 of file hexRef8.C.

References Foam::abort(), Foam::endl(), Foam::FatalError, FatalErrorInFunction, forAll, Foam::Pout, Foam::reduce(), hexRef8::setUnrefinement(), and syncTools::swapBoundaryFaceList().

Referenced by hexRef8::getSplitPoints(), and hexRef8::level0EdgeLength().

Here is the call graph for this function:
Here is the caller 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 5561 of file hexRef8.C.

References Foam::abort(), refinementHistory::active(), hexRef8::checkMesh(), refinementHistory::combineCells(), removeFaces::compatibleRemoves(), Foam::endl(), Foam::FatalError, FatalErrorInFunction, forAll, Foam::min(), Foam::nl, IOobject::objectPath(), pFaces, Foam::Pout, hexRef8::setInstance(), removeFaces::setRefinement(), List< T >::size(), HashTable< T, Key, Hash >::size(), and regIOobject::write().

Referenced by hexRef8::consistentUnrefinement(), and hexRef8::level0EdgeLength().

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

◆ setInstance()

void setInstance ( const fileName inst)

◆ write()

bool write ( const bool  valid = true) const

Force writing refinement+history to polyMesh directory.

Definition at line 5750 of file hexRef8.C.

References refinementHistory::active(), and regIOobject::write().

Referenced by hexRef8::level0EdgeLength(), and dynamicRefineFvMesh::writeObject().

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

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