Refinement of (split) hexes using polyTopoChange. More...
#include <hexRef8.H>
Public Member Functions | |
| ClassName ("hexRef8") | |
| Runtime type information. | |
| hexRef8 (const polyMesh &mesh, const bool readHistory=true) | |
| Construct from mesh, read_if_present refinement data. | |
| 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. | |
| hexRef8 (const polyMesh &mesh, const labelList &cellLevel, const labelList &pointLevel, const scalar level0Edge=-GREAT) | |
| Construct from mesh and refinement data and optional size of. | |
| 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. | |
| label | faceLevel (const label facei) const |
| Gets level such that the face has four points <= level. | |
| labelList | consistentRefinement (const labelUList &cellLevel, const labelList &cellsToRefine, const bool maxSet) const |
| Given valid mesh and current cell level and proposed. | |
| labelList | consistentRefinement (const labelList &cellsToRefine, const bool maxSet) const |
| Given valid mesh and current cell level and proposed. | |
| labelList | consistentSlowRefinement (const label maxFaceDiff, const labelList &cellsToRefine, const labelList &facesToCheck, const label maxPointDiff, const labelList &pointsToCheck) const |
| Like consistentRefinement but slower: | |
| labelList | consistentSlowRefinement2 (const label maxFaceDiff, const labelList &cellsToRefine, const labelList &facesToCheck) const |
| Like consistentSlowRefinement but uses different meshWave. | |
| labelListList | setRefinement (const labelList &cells, polyTopoChange &) |
| Insert refinement. All selected cells will be split into 8. | |
| void | updateMesh (const mapPolyMesh &) |
| Update local numbering for changed mesh. | |
| void | storeData (const labelList &pointsToStore, const labelList &facesToStore, const labelList &cellsToStore) |
| Signal points/face/cells for which to store data. | |
| void | updateMesh (const mapPolyMesh &, const Map< label > &pointsToRestore, const Map< label > &facesToRestore, const Map< label > &cellsToRestore) |
| Update local numbering + undo. | |
| void | subset (const labelList &pointMap, const labelList &faceMap, const labelList &cellMap) |
| Update local numbering for subsetted mesh. | |
| void | distribute (const mapDistributePolyMesh &) |
| Update local numbering for mesh redistribution. | |
| void | checkMesh () const |
| Debug: Check coupled mesh for correctness. | |
| void | checkRefinementLevels (const label maxPointDiff, const labelList &pointsToCheck) const |
| Debug: Check 2:1 consistency across faces. | |
| const cellShapeList & | cellShapes () const |
| Utility: get hexes as cell shapes. | |
| labelList | getSplitPoints () const |
| Return the points at the centre of top-level split cells. | |
| labelList | consistentUnrefinement (const labelList &pointsToUnrefine, const bool maxSet) const |
| Given proposed. | |
| void | setUnrefinement (const labelList &splitPointLabels, polyTopoChange &) |
| Remove some refinement. Needs to be supplied output of. | |
| void | setInstance (const fileName &inst) |
| bool | write (const bool writeOnProc=true) const |
| Force writing refinement+history to polyMesh directory. | |
Static Public Member Functions | |
| static void | removeFiles (const polyMesh &) |
| Helper: remove all relevant files from mesh instance. | |
Refinement of (split) hexes using polyTopoChange.
|
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 1904 of file hexRef8.C.
References checkMesh(), checkRefinementLevels(), Foam::dimLength, if(), mesh(), nPoints, IOobjectOption::READ_IF_PRESENT, and Foam::Zero.

| 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 2017 of file hexRef8.C.
References cellLevel(), checkMesh(), checkRefinementLevels(), Foam::dimLength, history(), if(), mesh(), and pointLevel().

| 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 2126 of file hexRef8.C.
References cellLevel(), checkMesh(), checkRefinementLevels(), Foam::dimLength, mesh(), and pointLevel().

| ClassName | ( | "hexRef8" | ) |
Runtime type information.
References cellLevel(), history(), mesh(), and pointLevel().

|
inline |
Definition at line 476 of file hexRef8.H.
Referenced by ClassName(), hexRef8(), hexRef8(), hexRef8(), and removeFiles().

|
inline |
Definition at line 481 of file hexRef8.H.
Referenced by ClassName(), consistentRefinement(), hexRef8(), and hexRef8().

|
inline |
Definition at line 486 of file hexRef8.H.
Referenced by ClassName(), hexRef8(), and hexRef8().

|
inline |
Definition at line 491 of file hexRef8.H.
Referenced by ClassName(), and hexRef8().

|
inline |
Typical edge length between unrefined points.
Definition at line 499 of file hexRef8.H.
Referenced by 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 f().
Referenced by setRefinement().


| 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 2228 of file hexRef8.C.
References cellLevel(), Foam::endl(), Foam::Pout, and Foam::reduce().
Referenced by consistentRefinement().


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 534 of file hexRef8.H.
References consistentRefinement().

| 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 2284 of file hexRef8.C.
References Foam::abort(), allCellInfo(), allFaceInfo(), DynamicList< T, SizeMin >::append(), DynamicList< T, SizeMin >::clear(), refinementData::count(), DynamicList< T, SizeMin >::emplace_back(), Foam::endl(), Foam::exit(), Foam::FatalError, FatalErrorInFunction, Foam::findIndices(), forAll, forAllConstIters, HashTable< T, Key, Hash >::insert(), FaceCellWave< Type, TrackingData >::iterate(), Foam::labelMin, Foam::mag(), Foam::max(), Foam::nl, Foam::Pout, FaceCellWaveBase::propagationTol(), DynamicList< T, SizeMin >::push_back(), Foam::reduce(), DynamicList< T, SizeMin >::setCapacity(), FaceCellWave< Type, TrackingData >::setFaceInfo(), DynamicList< T, SizeMin >::shrink(), HashTable< T, Key, Hash >::size(), UList< T >::size(), syncTools::swapBoundaryCellList(), syncTools::swapBoundaryFaceList(), syncTools::syncPointList(), refinementData::updateFace(), and Foam::Zero.

| 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.
noted: origin is different face (? or cell) between non-parallel
and parallel { const auto& cc = mesh_.cellCentres();
mkDir(mesh_.time().timePath()); OBJstream os(mesh_.time().timePath()/"origin_after_walk.obj"); forAll(allCellInfo, celli) { os.write(linePointRef(cc[celli], allCellInfo[celli].origin())); } }
Definition at line 2761 of file hexRef8.C.
References Foam::abort(), allCellInfo(), allFaceInfo(), DynamicList< T, SizeMin >::append(), Foam::endl(), Foam::exit(), Foam::FatalError, FatalErrorInFunction, Foam::findIndices(), forAll, HashSet< Key, Hash >::insert(), Foam::labelMax, level0EdgeLength(), VectorSpace< Form, Cmpt, Ncmpts >::max, Foam::nl, IOobject::objectPath(), patches, Foam::Pout, pp(), FaceCellWaveBase::propagationTol(), Foam::reduce(), bitSet::set(), DynamicList< T, SizeMin >::shrink(), HashTable< T, Key, Hash >::size(), UList< T >::size(), syncTools::swapBoundaryFaceList(), bitSet::test(), and regIOobject::write().

| 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 3301 of file hexRef8.C.
References Foam::abort(), DynamicList< T, SizeMin >::append(), checkMesh(), List< T >::clear(), e, Foam::endl(), f(), faceLevel(), 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(), setInstance(), List< T >::setSize(), HashTable< T, Key, Hash >::size(), UList< T >::size(), syncTools::swapBoundaryFaceList(), syncTools::syncBoundaryFacePositions(), syncTools::syncEdgeList(), syncTools::syncEdgePositions(), syncTools::syncFaceList(), bitSet::test(), DynamicList< T, SizeMin >::transfer(), List< T >::transfer(), bitSet::unset(), regIOobject::write(), Foam::meshTools::writeOBJ(), and Foam::Zero.

| void updateMesh | ( | const mapPolyMesh & | map | ) |
Update local numbering for changed mesh.
Definition at line 4343 of file hexRef8.C.
References updateMesh().
Referenced by updateMesh().


| void storeData | ( | const labelList & | pointsToStore, |
| const labelList & | facesToStore, | ||
| const labelList & | cellsToStore ) |
Signal points/face/cells for which to store data.
Definition at line 4315 of file hexRef8.C.
References List< T >::clear(), forAll, and UList< T >::size().

| 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 4354 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(), setInstance(), UList< T >::size(), and List< T >::transfer().

Update local numbering for subsetted mesh.
Gets new-to-old maps. Not compatible with unrefinement.
Definition at line 4544 of file hexRef8.C.
References Foam::abort(), Foam::endl(), Foam::faceMap(), Foam::FatalError, FatalErrorInFunction, forAll, newPointi, Foam::nl, Foam::Pout, setInstance(), UList< T >::size(), and WarningInFunction.

| void distribute | ( | const mapDistributePolyMesh & | map | ) |
Update local numbering for mesh redistribution.
Definition at line 4628 of file hexRef8.C.
References mapDistributePolyMesh::distributeCellData(), mapDistributePolyMesh::distributePointData(), Foam::endl(), and Foam::Pout.

| void checkMesh | ( | ) | const |
Debug: Check coupled mesh for correctness.
Definition at line 4656 of file hexRef8.C.
References Foam::abort(), e, Foam::endl(), f(), Foam::FatalError, FatalErrorInFunction, forAll, Foam::mag(), patches, Foam::Pout, pp(), UList< T >::size(), and syncTools::swapBoundaryFaceList().
Referenced by hexRef8(), hexRef8(), hexRef8(), setRefinement(), and setUnrefinement().


| 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 (returnReduceOr(nHanging)) { FatalErrorInFunction << "Detected a point used by two edges only (hanging point)" << nl << "This is not allowed" << abort(FatalError); } }
Definition at line 4864 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 getSplitPoints(), hexRef8(), hexRef8(), and hexRef8().


| const Foam::cellShapeList & cellShapes | ( | ) | const |
Utility: get hexes as cell shapes.
Definition at line 5120 of file hexRef8.C.
References Foam::endl(), forAll, Foam::nl, and Foam::Pout.

| Foam::labelList getSplitPoints | ( | ) | const |
Return the points at the centre of top-level split cells.
that can be unsplit.
Definition at line 5180 of file hexRef8.C.
References Foam::abort(), checkRefinementLevels(), Foam::endl(), f(), Foam::FatalError, FatalErrorInFunction, forAll, Foam::Pout, UList< T >::size(), and Foam::Zero.

| 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 5383 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().

| 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 5606 of file hexRef8.C.
References Foam::abort(), checkMesh(), Foam::endl(), Foam::FatalError, FatalErrorInFunction, forAll, HashSet< Key, Hash >::insert(), Foam::min(), Foam::nl, IOobject::objectPath(), pFaces, Foam::Pout, setInstance(), HashTable< T, Key, Hash >::size(), UList< T >::size(), HashTable< T, Key, Hash >::toc(), and regIOobject::write().

| void setInstance | ( | const fileName & | inst | ) |
Definition at line 1730 of file hexRef8.C.
References Foam::endl(), and Foam::Pout.
Referenced by setRefinement(), setUnrefinement(), subset(), and updateMesh().


| bool write | ( | const bool | writeOnProc = true | ) | const |
Force writing refinement+history to polyMesh directory.
Definition at line 5808 of file hexRef8.C.
References refinementHistory::removeFiles().

|
static |
Helper: remove all relevant files from mesh instance.
Definition at line 5828 of file hexRef8.C.
References DebugVar, Foam::exists(), io, mesh(), polyMesh::meshSubDir, refinementHistory::removeFiles(), and Foam::rm().
Referenced by meshRefinement::removeFiles().

