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 polyMesh & | mesh () const |
const labelIOList & | cellLevel () const |
const labelIOList & | pointLevel () const |
const refinementHistory & | history () 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 cellShapeList & | cellShapes () 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... | |
Refinement of (split) hexes using polyTopoChange.
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 1928 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().
Referenced by hexRef8::hexRef8().
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 2048 of file hexRef8.C.
References Foam::abort(), refinementHistory::active(), hexRef8::checkMesh(), hexRef8::checkRefinementLevels(), Foam::endl(), Foam::FatalError, FatalErrorInFunction, hexRef8::hexRef8(), List< T >::size(), and refinementHistory::visibleCells().
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 2156 of file hexRef8.C.
References Foam::abort(), hexRef8::checkMesh(), hexRef8::checkRefinementLevels(), hexRef8::consistentRefinement(), Foam::endl(), Foam::FatalError, FatalErrorInFunction, and List< T >::size().
ClassName | ( | "hexRef8" | ) |
Runtime type information.
|
inline |
Definition at line 385 of file hexRef8.H.
Referenced by backgroundMeshDecomposition::cellLevel(), dynamicRefineFvMesh::dynamicRefineFvMesh(), and dynamicRefineFvMesh::writeObject().
|
inline |
Definition at line 390 of file hexRef8.H.
Referenced by dynamicRefineFvMesh::dynamicRefineFvMesh(), and backgroundMeshDecomposition::pointLevel().
|
inline |
Definition at line 395 of file hexRef8.H.
Referenced by dynamicRefineFvMesh::update().
|
inline |
Typical edge length between unrefined points.
Definition at line 401 of file hexRef8.H.
References cells, hexRef8::cellShapes(), hexRef8::checkMesh(), hexRef8::checkRefinementLevels(), hexRef8::consistentRefinement(), hexRef8::consistentSlowRefinement(), hexRef8::consistentSlowRefinement2(), hexRef8::consistentUnrefinement(), hexRef8::distribute(), hexRef8::faceLevel(), Foam::faceMap(), hexRef8::getSplitPoints(), hexRef8::operator=(), hexRef8::setInstance(), hexRef8::setRefinement(), hexRef8::setUnrefinement(), hexRef8::storeData(), hexRef8::subset(), hexRef8::updateMesh(), dimensioned< Type >::value(), and hexRef8::write().
Referenced by hexRef8::consistentSlowRefinement2().
Foam::label faceLevel | ( | const label | facei | ) | const |
Gets level such that the face has four points <= level.
Definition at line 796 of file hexRef8.C.
References Foam::abort(), DynamicList< T, SizeInc, SizeMult, SizeDiv >::append(), face::area(), face::centre(), Foam::e, HashTableCore::end(), Foam::endl(), f(), Foam::FatalError, FatalErrorInFunction, UList< T >::fcIndex(), HashTable< T, label, Hash< label > >::find(), Foam::meshTools::findEdge(), face::flip(), forAll, PackedList< nBits >::get(), Foam::identity(), HashTable< T, label, Hash< label > >::insert(), Foam::mag(), Foam::magSqr(), Foam::nl, edge::otherVertex(), patchi, polyTopoChange::points(), UList< T >::rcIndex(), s(), PackedBoolList::set(), List< T >::size(), syncTools::swapBoundaryFaceList(), List< T >::transfer(), PackedBoolList::unset(), and WarningInFunction.
Referenced by hexRef8::level0EdgeLength(), and hexRef8::setRefinement().
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 2256 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().
Foam::labelList consistentSlowRefinement | ( | const label | maxFaceDiff, |
const labelList & | cellsToRefine, | ||
const labelList & | facesToCheck, | ||
const label | maxPointDiff, | ||
const labelList & | pointsToCheck | ||
) | const |
Like consistentRefinement but slower:
Definition at line 2331 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().
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 2815 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().
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 3240 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().
void updateMesh | ( | const mapPolyMesh & | map | ) |
Update local numbering for changed mesh.
Definition at line 4285 of file hexRef8.C.
Referenced by hexRef8::level0EdgeLength().
void storeData | ( | const labelList & | pointsToStore, |
const labelList & | facesToStore, | ||
const labelList & | cellsToStore | ||
) |
Signal points/face/cells for which to store data.
Definition at line 4260 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().
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 4297 of file hexRef8.C.
References Foam::abort(), refinementHistory::active(), mapPolyMesh::cellMap(), HashTableCore::end(), Foam::endl(), Foam::FatalError, FatalErrorInFunction, HashTable< T, Key, Hash >::find(), forAll, forAllConstIter(), newPointi, mapPolyMesh::nOldCells(), mapPolyMesh::nOldPoints(), mapPolyMesh::pointMap(), Foam::Pout, mapPolyMesh::reverseCellMap(), mapPolyMesh::reversePointMap(), hexRef8::setInstance(), List< T >::size(), hexRef8::subset(), List< T >::transfer(), removeFaces::updateMesh(), and refinementHistory::updateMesh().
Update local numbering for subsetted mesh.
Gets new-to-old maps. Not compatible with unrefinement.
Definition at line 4487 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().
void distribute | ( | const mapDistributePolyMesh & | map | ) |
Update local numbering for mesh redistribution.
Definition at line 4570 of file hexRef8.C.
References refinementHistory::active(), removeFaces::distribute(), refinementHistory::distribute(), mapDistributePolyMesh::distributeCellData(), mapDistributePolyMesh::distributePointData(), Foam::endl(), and Foam::Pout.
Referenced by hexRef8::level0EdgeLength().
void checkMesh | ( | ) | const |
Debug: Check coupled mesh for correctness.
Definition at line 4598 of file hexRef8.C.
References Foam::abort(), hexRef8::checkRefinementLevels(), polyPatch::coupled(), Foam::e, Foam::endl(), f(), Foam::FatalError, FatalErrorInFunction, forAll, Foam::mag(), patchIdentifier::name(), IOstream::name(), patches, patchi, Foam::Pout, List< T >::size(), polyPatch::start(), and syncTools::swapBoundaryFaceList().
Referenced by hexRef8::hexRef8(), hexRef8::level0EdgeLength(), hexRef8::setRefinement(), and hexRef8::setUnrefinement().
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 4808 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().
const Foam::cellShapeList & cellShapes | ( | ) | const |
Utility: get hexes as cell shapes.
Definition at line 5060 of file hexRef8.C.
References Foam::endl(), forAll, Foam::nl, Foam::Pout, and List< T >::size().
Referenced by hexRef8::level0EdgeLength().
Foam::labelList getSplitPoints | ( | ) | const |
Return the points at the centre of top-level split cells.
that can be unsplit.
Definition at line 5120 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().
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 5324 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().
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 5558 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().
void setInstance | ( | const fileName & | inst | ) |
Definition at line 1732 of file hexRef8.C.
References DynamicList< T, SizeInc, SizeMult, SizeDiv >::append(), List< T >::append(), DynamicList< T, SizeInc, SizeMult, SizeDiv >::clear(), Foam::endl(), f(), Foam::findIndex(), forAll, forAllConstIter(), UList< T >::last(), pFaces, points, Foam::Pout, Foam::reverse(), face::reverseFace(), List< T >::size(), and List< T >::transfer().
Referenced by hexRef8::level0EdgeLength(), hexRef8::setRefinement(), hexRef8::setUnrefinement(), hexRef8::subset(), and hexRef8::updateMesh().
bool write | ( | const bool | write = true | ) | const |
Force writing refinement+history to polyMesh directory.
Definition at line 5746 of file hexRef8.C.
References refinementHistory::active(), and regIOobject::write().
Referenced by hexRef8::level0EdgeLength(), and dynamicRefineFvMesh::writeObject().
|
delete |
Disallow default bitwise assignment.
Referenced by hexRef8::level0EdgeLength().