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...
 
 hexRef8 (const hexRef8 &)=delete
 Disallow default bitwise copy construction. 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 topoChange (const polyTopoChangeMap &)
 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 topoChange (const polyTopoChangeMap &, 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 polyDistributionMap &)
 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 write=true) const
 Force writing refinement+history to polyMesh directory. More...
 
void operator= (const hexRef8 &)=delete
 Disallow default bitwise assignment. More...
 

Detailed Description

Refinement of (split) hexes using polyTopoChange.

Source files

Definition at line 64 of file hexRef8.H.

Constructor & Destructor Documentation

◆ hexRef8() [1/4]

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 1789 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(), regIOobject::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/4]

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

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

Here is the call graph for this function:

◆ hexRef8() [3/4]

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

References Foam::abort(), hexRef8::checkMesh(), hexRef8::checkRefinementLevels(), Foam::endl(), Foam::FatalError, FatalErrorInFunction, primitiveMesh::nCells(), and primitiveMesh::nPoints().

Here is the call graph for this function:

◆ hexRef8() [4/4]

hexRef8 ( const hexRef8 )
delete

Disallow default bitwise copy construction.

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 refiner::refiner().

Here is the caller graph for this function:

◆ pointLevel()

const labelIOList& pointLevel ( ) const
inline

Definition at line 402 of file hexRef8.H.

Referenced by refiner::refiner().

Here is the caller graph for this function:

◆ 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 UniformDimensionedField< Type >::value().

Referenced by meshRefinement::meshRefinement().

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

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

Here is the call graph for this function:

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

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

Here is the call 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 2183 of file hexRef8.C.

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

Here is the call graph for this function:

◆ consistentSlowRefinement2()

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

◆ 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!). -points added to split edge: added from edge start() -midpoints added: added from cellPoints[0].

Definition at line 3089 of file hexRef8.C.

References Foam::abort(), polyTopoChange::addCell(), polyTopoChange::addPoint(), DynamicList< T, SizeInc, SizeMult, SizeDiv >::append(), Foam::meshCheck::checkMesh(), Foam::e, Foam::endl(), f(), Foam::FatalError, FatalErrorInFunction, forAll, PackedList< nBits >::get(), HashSet< Key, Hash >::insert(), Foam::labelMax, Foam::labelMin, Foam::max(), Foam::min(), OFstream::name(), Foam::nl, regIOobject::objectPath(), Foam::Pout, PackedBoolList::set(), List< T >::setSize(), HashTable< T, Key, Hash >::size(), List< T >::size(), syncTools::swapBoundaryFaceList(), syncTools::syncBoundaryFacePositions(), syncTools::syncEdgeList(), syncTools::syncEdgePositions(), syncTools::syncFaceList(), List< T >::transfer(), PackedBoolList::unset(), regIOobject::write(), and Foam::meshTools::writeOBJ().

Here is the call graph for this function:

◆ topoChange() [1/2]

void topoChange ( const polyTopoChangeMap map)

Update local numbering for changed mesh.

Called after the mesh change. setRefinement will already have made sure the pointLevel_ and cellLevel_ are the size of the new mesh so we only need to account for reordering.

Definition at line 4108 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 4085 of file hexRef8.C.

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

Here is the call graph for this function:

◆ topoChange() [2/2]

void topoChange ( const polyTopoChangeMap 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 4274 of file hexRef8.C.

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

Here is the call graph for this function:

◆ distribute()

void distribute ( const polyDistributionMap map)

Update local numbering for mesh redistribution.

Definition at line 4357 of file hexRef8.C.

References polyDistributionMap::distributeCellData(), polyDistributionMap::distributePointData(), Foam::endl(), and Foam::Pout.

Here is the call graph for this function:

◆ checkMesh()

void checkMesh ( ) const

Debug: Check coupled mesh for correctness.

Definition at line 4386 of file hexRef8.C.

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

Referenced by hexRef8::hexRef8().

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 4595 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, syncTools::swapBoundaryFaceList(), and syncTools::syncPointList().

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

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

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

References Foam::abort(), Foam::endl(), Foam::FatalError, FatalErrorInFunction, forAll, PackedList< nBits >::get(), Foam::Pout, Foam::reduce(), PackedBoolList::set(), syncTools::swapBoundaryFaceList(), and PackedBoolList::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 5283 of file hexRef8.C.

References Foam::abort(), Foam::meshCheck::checkMesh(), Foam::endl(), Foam::FatalError, FatalErrorInFunction, forAll, HashSet< Key, Hash >::insert(), Foam::min(), Foam::nl, regIOobject::objectPath(), pFaces, Foam::Pout, HashTable< T, Key, Hash >::size(), List< 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 1595 of file hexRef8.C.

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

Here is the call graph for this function:

◆ write()

bool write ( const bool  write = true) const

Force writing refinement+history to polyMesh directory.

Definition at line 5472 of file hexRef8.C.

References Foam::abort(), Foam::FatalError, FatalErrorInFunction, and Foam::vtkWriteOps::write().

Referenced by refiner::write().

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

◆ operator=()

void operator= ( const hexRef8 )
delete

Disallow default bitwise assignment.


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