27 #include "surfaceInterpolate.H" 39 namespace fvMeshTopoChangers
49 Foam::label Foam::fvMeshTopoChangers::refiner::count
51 const PackedBoolList& l,
52 const unsigned int val
75 void Foam::fvMeshTopoChangers::refiner::calculateProtectedCells
77 PackedBoolList& unrefineableCells
80 if (protectedCells_.empty())
82 unrefineableCells.clear();
86 const labelList& cellLevel = meshCutter_.cellLevel();
88 unrefineableCells = protectedCells_;
96 facei <
mesh().nFaces();
100 neiLevel[facei -
mesh().nInternalFaces()] =
101 cellLevel[
mesh().faceOwner()[facei]];
113 const label own =
mesh().faceOwner()[facei];
114 const bool ownProtected = unrefineableCells.get(own);
115 const label nei =
mesh().faceNeighbour()[facei];
116 const bool neiProtected = unrefineableCells.get(nei);
118 if (ownProtected && (cellLevel[nei] > cellLevel[own]))
120 seedFace[facei] =
true;
122 else if (neiProtected && (cellLevel[own] > cellLevel[nei]))
124 seedFace[facei] =
true;
131 facei <
mesh().nFaces();
135 const label own =
mesh().faceOwner()[facei];
136 const bool ownProtected = unrefineableCells.get(own);
141 && (neiLevel[facei-
mesh().nInternalFaces()] > cellLevel[own])
144 seedFace[facei] =
true;
152 bool hasExtended =
false;
154 for (
label facei = 0; facei <
mesh().nInternalFaces(); facei++)
158 const label own =
mesh().faceOwner()[facei];
159 if (unrefineableCells.get(own) == 0)
161 unrefineableCells.set(own, 1);
165 const label nei =
mesh().faceNeighbour()[facei];
166 if (unrefineableCells.get(nei) == 0)
168 unrefineableCells.set(nei, 1);
177 facei <
mesh().nFaces();
183 const label own =
mesh().faceOwner()[facei];
185 if (unrefineableCells.get(own) == 0)
187 unrefineableCells.set(own, 1);
201 void Foam::fvMeshTopoChangers::refiner::readDict()
203 refineInterval_ = dict_.lookup<
label>(
"refineInterval");
205 if (refineInterval_ < 0)
208 <<
"Illegal refineInterval " << refineInterval_ <<
nl 209 <<
"The refineInterval setting in the dynamicMeshDict should" 214 maxCells_ = dict_.lookup<
label>(
"maxCells");
219 <<
"Illegal maximum number of cells " << maxCells_ <<
nl 220 <<
"The maxCells setting in the dynamicMeshDict should" 225 nBufferLayers_ = dict_.lookup<
label>(
"nBufferLayers");
227 const List<Pair<word>> fluxVelocities = List<Pair<word>>
229 dict_.lookup(
"correctFluxes")
233 correctFluxes_.resize(fluxVelocities.size());
236 correctFluxes_.insert(fluxVelocities[i][0], fluxVelocities[i][1]);
239 dumpLevel_ = Switch(dict_.lookup(
"dumpLevel"));
244 Foam::fvMeshTopoChangers::refiner::refine
250 polyTopoChange meshMod(
mesh());
253 meshCutter_.setRefinement(cellsToRefine, meshMod);
257 autoPtr<polyTopoChangeMap> map = meshMod.changeMesh(
mesh(),
false);
259 Info<<
"Refined from " 261 <<
" to " <<
mesh().globalData().nTotalCells() <<
" cells." <<
endl;
266 for (
label facei = 0; facei <
mesh().nInternalFaces(); facei++)
268 const label oldFacei = map().faceMap()[facei];
270 if (oldFacei >=
mesh().nInternalFaces())
273 <<
"New internal face:" << facei
274 <<
" fc:" <<
mesh().faceCentres()[facei]
275 <<
" originates from boundary oldFace:" << oldFacei
282 mesh().topoChange(map);
287 const labelList& faceMap = map().faceMap();
288 const labelList& reverseFaceMap = map().reverseFaceMap();
297 const label oldFacei = faceMap[facei];
301 const label masterFacei = reverseFaceMap[oldFacei];
306 <<
"Problem: should not have removed faces" 310 else if (masterFacei != facei)
312 masterFaces.insert(masterFacei);
318 Pout<<
"Found " << masterFaces.size() <<
" split faces " <<
endl;
321 refineFluxes(masterFaces, map());
322 refineUfs(masterFaces, map());
326 if (protectedCells_.size())
328 PackedBoolList newProtectedCell(
mesh().nCells());
330 forAll(newProtectedCell, celli)
332 const label oldCelli = map().cellMap()[celli];
333 newProtectedCell.set(celli, protectedCells_.get(oldCelli));
335 protectedCells_.transfer(newProtectedCell);
339 meshCutter_.checkRefinementLevels(-1,
labelList(0));
346 Foam::fvMeshTopoChangers::refiner::unrefine
351 polyTopoChange meshMod(
mesh());
354 meshCutter_.setUnrefinement(splitPoints, meshMod);
363 Map<label> faceToSplitPoint(3*splitPoints.size());
368 const label pointi = splitPoints[i];
373 const label otherPointi =
374 mesh().edges()[pEdges[j]].otherVertex(pointi);
380 faceToSplitPoint.insert(pFaces[pFacei], otherPointi);
389 autoPtr<polyTopoChangeMap> map = meshMod.changeMesh(
mesh(),
false);
391 Info<<
"Unrefined from " 393 <<
" to " <<
mesh().globalData().nTotalCells() <<
" cells." 397 mesh().topoChange(map);
400 unrefineFluxes(faceToSplitPoint, map());
403 unrefineUfs(faceToSplitPoint, map());
406 if (protectedCells_.size())
408 PackedBoolList newProtectedCell(
mesh().nCells());
410 forAll(newProtectedCell, celli)
412 const label oldCelli = map().cellMap()[celli];
415 newProtectedCell.set(celli, protectedCells_.get(oldCelli));
418 protectedCells_.transfer(newProtectedCell);
422 meshCutter_.checkRefinementLevels(-1,
labelList(0));
428 Foam::word Foam::fvMeshTopoChangers::refiner::Uname
433 const word UfName(Uf.member());
439 ? word(UfName(UfName.size() - 1))
440 : UfName.compare(UfName.size() - 3, 3,
"f_0") == 0
441 ? word(UfName(UfName.size() - 3) +
"_0")
448 void Foam::fvMeshTopoChangers::refiner::refineFluxes
451 const polyTopoChangeMap& map
456 const labelList& faceMap = map.faceMap();
457 const labelList& reverseFaceMap = map.reverseFaceMap();
459 HashTable<surfaceScalarField*> fluxes
461 mesh().lookupClass<surfaceScalarField>()
463 forAllIter(HashTable<surfaceScalarField*>, fluxes, iter)
465 if (!correctFluxes_.found(iter.key()))
468 <<
"Cannot find surfaceScalarField " << iter.key()
469 <<
" in user-provided flux mapping table " 470 << correctFluxes_ <<
endl 471 <<
" The flux mapping table is used to recreate the" 472 <<
" flux on newly created faces." <<
endl 473 <<
" Either add the entry if it is a flux or use (" 474 << iter.key() <<
" none) to suppress this warning." 479 const word& Uname = correctFluxes_[iter.key()];
488 Pout<<
"Setting surfaceScalarField " << iter.key()
489 <<
" to NaN" <<
endl;
500 Pout<<
"Mapping flux " << iter.key()
501 <<
" using interpolated flux " << Uname
513 for (
label facei = 0; facei <
mesh().nInternalFaces(); facei++)
515 const label oldFacei = faceMap[facei];
520 phi[facei] = phiU[facei];
522 else if (reverseFaceMap[oldFacei] != facei)
525 phi[facei] = phiU[facei];
537 phiU.boundaryField()[
patchi];
539 label facei = patchPhi.patch().start();
543 const label oldFacei = faceMap[facei];
548 patchPhi[i] = patchPhiU[i];
550 else if (reverseFaceMap[oldFacei] != facei)
553 patchPhi[i] = patchPhiU[i];
563 const label facei = iter.key();
565 if (
mesh().isInternalFace(facei))
567 phi[facei] = phiU[facei];
572 mesh().boundaryMesh().whichPatch(facei);
575 facei -
mesh().boundaryMesh()[
patchi].start();
584 void Foam::fvMeshTopoChangers::refiner::refineUfs
587 const polyTopoChangeMap& map
590 const labelList& faceMap = map.faceMap();
591 const labelList& reverseFaceMap = map.reverseFaceMap();
594 HashTable<surfaceVectorField*> Ufs
596 mesh().lookupClass<surfaceVectorField>()
598 forAllIter(HashTable<surfaceVectorField*>, Ufs, iter)
602 const word Uname(this->Uname(Uf));
610 mesh().lookupObject<volVectorField>(Uname)
615 for (
label facei = 0; facei <
mesh().nInternalFaces(); facei++)
617 label oldFacei = faceMap[facei];
622 Uf[facei] = UfU[facei];
624 else if (reverseFaceMap[oldFacei] != facei)
627 Uf[facei] = UfU[facei];
637 UfU.boundaryField()[
patchi];
639 label facei = patchUf.patch().start();
643 label oldFacei = faceMap[facei];
648 patchUf[i] = patchUfU[i];
650 else if (reverseFaceMap[oldFacei] != facei)
653 patchUf[i] = patchUfU[i];
663 label facei = iter.key();
665 if (
mesh().isInternalFace(facei))
667 Uf[facei] = UfU[facei];
672 mesh().boundaryMesh().whichPatch(facei);
674 facei -
mesh().boundaryMesh()[
patchi].start();
677 UfU.boundaryField()[
patchi];
681 patchUf[i] = patchUfU[i];
689 void Foam::fvMeshTopoChangers::refiner::unrefineFluxes
691 const Map<label>& faceToSplitPoint,
692 const polyTopoChangeMap& map
695 const labelList& reversePointMap = map.reversePointMap();
696 const labelList& reverseFaceMap = map.reverseFaceMap();
698 HashTable<surfaceScalarField*> fluxes
700 mesh().lookupClass<surfaceScalarField>()
702 forAllIter(HashTable<surfaceScalarField*>, fluxes, iter)
704 if (!correctFluxes_.found(iter.key()))
707 <<
"Cannot find surfaceScalarField " << iter.key()
708 <<
" in user-provided flux mapping table " 709 << correctFluxes_ <<
endl 710 <<
" The flux mapping table is used to recreate the" 711 <<
" flux on newly created faces." <<
endl 712 <<
" Either add the entry if it is a flux or use (" 713 << iter.key() <<
" none) to suppress this warning." 718 const word& Uname = correctFluxes_[iter.key()];
727 Info<<
"Mapping flux " << iter.key()
728 <<
" using interpolated flux " << Uname
743 const label oldFacei = iter.key();
744 const label oldPointi = iter();
746 if (reversePointMap[oldPointi] < 0)
749 const label facei = reverseFaceMap[oldFacei];
753 if (
mesh().isInternalFace(facei))
755 phi[facei] = phiU[facei];
760 mesh().boundaryMesh().whichPatch(facei);
763 facei -
mesh().boundaryMesh()[
patchi].start();
774 void Foam::fvMeshTopoChangers::refiner::unrefineUfs
776 const Map<label>& faceToSplitPoint,
777 const polyTopoChangeMap& map
780 const labelList& reversePointMap = map.reversePointMap();
781 const labelList& reverseFaceMap = map.reverseFaceMap();
784 HashTable<surfaceVectorField*> Ufs
786 mesh().lookupClass<surfaceVectorField>()
788 forAllIter(HashTable<surfaceVectorField*>, Ufs, iter)
792 const word Uname(this->Uname(Uf));
805 const label oldFacei = iter.key();
806 const label oldPointi = iter();
808 if (reversePointMap[oldPointi] < 0)
811 const label facei = reverseFaceMap[oldFacei];
815 if (
mesh().isInternalFace(facei))
817 Uf[facei] = UfU[facei];
822 mesh().boundaryMesh().whichPatch(facei);
824 facei -
mesh().boundaryMesh()[
patchi].start();
836 const Foam::cellZone& Foam::fvMeshTopoChangers::refiner::findCellZone
838 const word& cellZoneName
841 const label cellZoneID =
mesh().cellZones().findZoneID(cellZoneName);
843 bool cellZoneFound = (cellZoneID != -1);
844 reduce(cellZoneFound, orOp<bool>());
849 <<
"cannot find cellZone " << cellZoneName
858 Foam::fvMeshTopoChangers::refiner::cellToPoint(
const scalarField& vFld)
const 869 sum += vFld[pCells[i]];
871 pFld[pointi] = sum/pCells.size();
881 const scalar minLevel,
882 const scalar maxLevel
889 scalar err =
min(fld[celli] - minLevel, maxLevel - fld[celli]);
905 const scalar minLevel,
906 const scalar maxLevel
913 const label celli = cells[i];
915 scalar err =
min(fld[celli] - minLevel, maxLevel - fld[celli]);
927 void Foam::fvMeshTopoChangers::refiner::selectRefineCandidates
929 PackedBoolList& candidateCells,
930 const scalar lowerRefineLevel,
931 const scalar upperRefineLevel,
932 const scalar maxRefinement,
940 error(vFld, lowerRefineLevel, upperRefineLevel)
946 if (cellError[celli] > 0)
948 candidateCells.set(celli, 1);
954 void Foam::fvMeshTopoChangers::refiner::selectRefineCandidates
956 PackedBoolList& candidateCells,
957 const scalar lowerRefineLevel,
958 const scalar upperRefineLevel,
959 const scalar maxRefinement,
968 error(vFld, cells, lowerRefineLevel, upperRefineLevel)
974 if (cellError[celli] > 0)
976 candidateCells.set(celli, 1);
982 Foam::scalar Foam::fvMeshTopoChangers::refiner::selectRefineCandidates
984 PackedBoolList& candidateCells,
985 const dictionary& refineDict
988 const word fieldName(refineDict.lookup(
"field"));
992 const scalar lowerRefineLevel =
993 refineDict.lookup<scalar>(
"lowerRefineLevel");
994 const scalar upperRefineLevel =
995 refineDict.lookup<scalar>(
"upperRefineLevel");
997 const label maxRefinement = refineDict.lookup<
label>(
"maxRefinement");
999 if (maxRefinement <= 0)
1002 <<
"Illegal maximum refinement level " << maxRefinement <<
nl 1003 <<
"The maxCells setting in the dynamicMeshDict should" 1008 if (refineDict.found(
"cellZone"))
1011 selectRefineCandidates
1018 findCellZone(refineDict.lookup(
"cellZone"))
1024 selectRefineCandidates
1034 return maxRefinement;
1040 const label maxCells,
1041 const label maxRefinement,
1042 const PackedBoolList& candidateCells
1046 const label nTotToRefine = (maxCells -
mesh().globalData().nTotalCells())/7;
1048 const labelList& cellLevel = meshCutter_.cellLevel();
1052 PackedBoolList unrefineableCells;
1053 calculateProtectedCells(unrefineableCells);
1056 const label nLocalCandidates =
count(candidateCells, 1);
1060 DynamicList<label> candidates(nLocalCandidates);
1062 if (nCandidates < nTotToRefine)
1064 forAll(candidateCells, celli)
1068 candidateCells.get(celli)
1070 unrefineableCells.empty()
1071 || !unrefineableCells.get(celli)
1075 candidates.append(celli);
1082 for (
label level = 0; level < maxRefinement; level++)
1084 forAll(candidateCells, celli)
1088 cellLevel[celli] == level
1089 && candidateCells.get(celli)
1091 unrefineableCells.empty()
1092 || !unrefineableCells.get(celli)
1096 candidates.append(celli);
1100 if (
returnReduce(candidates.size(), sumOp<label>()) > nTotToRefine)
1110 meshCutter_.consistentRefinement
1112 candidates.shrink(),
1118 <<
" cells for refinement out of " <<
mesh().globalData().nTotalCells()
1121 return consistentSet;
1125 Foam::labelList Foam::fvMeshTopoChangers::refiner::selectUnrefinePoints
1127 const PackedBoolList& markedCell
1131 const labelList splitPoints(meshCutter_.getSplitPoints());
1133 DynamicList<label> newSplitPoints(splitPoints.size());
1137 const label pointi = splitPoints[i];
1142 bool hasMarked =
false;
1146 if (markedCell.get(pCells[pCelli]))
1155 newSplitPoints.append(pointi);
1160 newSplitPoints.shrink();
1165 meshCutter_.consistentUnrefinement
1173 <<
" split points out of a possible " 1177 return consistentSet;
1181 void Foam::fvMeshTopoChangers::refiner::extendMarkedCells
1183 PackedBoolList& markedCell
1189 forAll(markedCell, celli)
1191 if (markedCell.get(celli))
1193 const cell& cFaces =
mesh().cells()[celli];
1197 markedFace[cFaces[i]] =
true;
1205 for (
label facei = 0; facei <
mesh().nInternalFaces(); facei++)
1207 if (markedFace[facei])
1209 markedCell.set(
mesh().faceOwner()[facei], 1);
1210 markedCell.set(
mesh().faceNeighbour()[facei], 1);
1217 facei <
mesh().nFaces();
1221 if (markedFace[facei])
1223 markedCell.set(
mesh().faceOwner()[facei], 1);
1229 void Foam::fvMeshTopoChangers::refiner::checkEightAnchorPoints
1231 PackedBoolList& protectedCell,
1235 const labelList& cellLevel = meshCutter_.cellLevel();
1236 const labelList& pointLevel = meshCutter_.pointLevel();
1240 forAll(pointLevel, pointi)
1246 const label celli = pCells[pCelli];
1248 if (pointLevel[pointi] <= cellLevel[celli])
1251 if (nAnchorPoints[celli] == 8)
1253 if (protectedCell.set(celli,
true))
1259 if (!protectedCell[celli])
1261 nAnchorPoints[celli]++;
1267 forAll(protectedCell, celli)
1269 if (!protectedCell[celli] && nAnchorPoints[celli] != 8)
1271 protectedCell.set(celli,
true);
1286 nRefinementIterations_(0),
1287 protectedCells_(mesh.nCells(), 0),
1288 changedSinceWrite_(false),
1307 label nProtected = 0;
1315 const label celli = pCells[i];
1317 if (!protectedCells_.
get(celli))
1319 if (pointLevel[pointi] <= cellLevel[celli])
1323 if (nAnchors[celli] > 8)
1325 protectedCells_.
set(celli, 1);
1354 neiLevel[facei] = cellLevel[mesh.
faceOwner()[facei]];
1375 if (pointLevel[f[fp]] <= faceLevel)
1381 protectedFace[facei] =
true;
1392 if (protectedFace[facei])
1408 if (protectedFace[facei])
1418 const cell& cFaces = mesh.
cells()[celli];
1420 if (cFaces.
size() < 6)
1422 if (protectedCells_.
set(celli, 1))
1431 if (mesh.
faces()[cFaces[cFacei]].
size() < 4)
1433 if (protectedCells_.
set(celli, 1))
1444 checkEightAnchorPoints(protectedCells_, nProtected);
1449 protectedCells_.
clear();
1453 cellSet protectedCells(mesh,
"protectedCells", nProtected);
1454 forAll(protectedCells_, celli)
1456 if (protectedCells_[celli])
1458 protectedCells.
insert(celli);
1463 <<
" cells that are protected from refinement." 1464 <<
" Writing these to cellSet " 1465 << protectedCells.
name()
1468 protectedCells.
write();
1493 bool hasChanged =
false;
1495 if (refineInterval_ == 0)
1512 label maxRefinement = 0;
1514 if (dict_.
isDict(
"refinementRegions"))
1518 dict_.
subDict(
"refinementRegions")
1525 selectRefineCandidates
1536 maxRefinement = selectRefineCandidates(refineCells, dict_);
1541 for (
label i = 0; i < nBufferLayers_; i++)
1543 extendMarkedCells(refineCells);
1554 if (cellLevel[celli] >= maxRefinement)
1556 refinableCells.
unset(celli);
1561 if (
mesh().globalData().nTotalCells() < maxCells_)
1580 if (nCellsToRefine > 0)
1588 const labelList& cellMap = map().cellMap();
1589 const labelList& reverseCellMap = map().reverseCellMap();
1595 const label oldCelli = cellMap[celli];
1599 newRefineCell.set(celli, 1);
1601 else if (reverseCellMap[oldCelli] != celli)
1603 newRefineCell.set(celli, 1);
1610 refinableCells.
get(oldCelli)
1614 refinableCells.
transfer(newRefineCell);
1623 const labelList pointsToUnrefine(selectUnrefinePoints(refineCells));
1627 pointsToUnrefine.
size(),
1631 if (nSplitPoints > 0)
1634 unrefine(pointsToUnrefine);
1641 if ((nRefinementIterations_ % 10) == 0)
1647 nRefinementIterations_++;
1652 changedSinceWrite_ =
true;
1687 if (changedSinceWrite_)
1692 bool writeOk = meshCutter_.
write(write);
1715 scalarCellLevel[celli] = cellLevel[celli];
1718 writeOk = writeOk && scalarCellLevel.
write();
1721 changedSinceWrite_ =
false;
const char *const group
Group name for atomic constants.
fvsPatchField< vector > fvsPatchVectorField
fvsPatchField< scalar > fvsPatchScalarField
const refinementHistory & history() const
#define forAll(list, i)
Loop across all elements in list.
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
FvWallInfoData< WallInfo, label > label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
const word & name() const
Return name.
fvMesh & mesh()
Return the fvMesh.
errorManipArg< error, int > exit(error &err, const int errNo=1)
unsigned int get(const label) const
Get value at index I.
A face is a list of labels corresponding to mesh vertices.
const labelIOList & pointLevel() const
A list of keyword definitions, which are a keyword followed by any number of values (e...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
label nInternalFaces() const
virtual const labelList & faceNeighbour() const
Return face neighbour.
refiner(fvMesh &mesh, const dictionary &dict)
Construct from fvMesh and dictionary.
#define forAllIter(Container, container, iter)
Iterate across all elements in the container object of type.
void size(const label)
Override size to be inconsistent with allocated storage.
GeometricField< vector, fvsPatchField, surfaceMesh > surfaceVectorField
Ostream & endl(Ostream &os)
Add newline and flush stream.
label count(const ListType &l, typename ListType::const_reference x)
Count the number of occurrences of a value in a list.
Encapsulates queries for volume refinement ('refine all cells within shell').
const cellList & cells() const
GeometricBoundaryField< scalar, fvsPatchField, surfaceMesh > Boundary
Type of the boundary field.
const dimensionSet dimless
const Time & time() const
Return the top-level database.
addToRunTimeSelectionTable(fvMeshTopoChanger, list, fvMesh)
bool insert(const Key &key)
Insert a new entry.
const dimensionedScalar c
Speed of light in a vacuum.
void distribute(const polyDistributionMap &)
Update local numbering for mesh redistribution.
virtual bool write(const bool write=true) const
Write using given format, version and compression.
Macros for easy insertion into run-time selection tables.
void topoChange(const polyTopoChangeMap &)
Update local numbering for changed mesh.
bool isDict(const word &) const
Check if entry is a sub-dictionary.
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
DynamicID< meshCellZones > cellZoneID
Foam::cellZoneID.
const dictionary & subDict(const word &) const
Find and return a sub-dictionary.
List< bool > boolList
Bool container classes.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
HashSet< label, Hash< label > > labelHashSet
A HashSet with label keys.
virtual bool update()
Update the mesh for both mesh motion and topology change.
virtual void mapMesh(const polyMeshMap &)
Update from another mesh using the given map.
void set(const PackedList< 1 > &)
Set specified bits.
Pre-declare SubField and related Field type.
static word timeName(const scalar, const int precision=curPrecision_)
Return time name of given scalar time.
Refinement of (split) hexes using polyTopoChange.
A class for handling words, derived from string.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
static word groupName(Name name, const word &group)
bool write(const bool write=true) const
Force writing refinement+history to polyMesh directory.
virtual const labelList & faceOwner() const
Return face owner.
static const word null
An empty word.
layerAndWeight min(const layerAndWeight &a, const layerAndWeight &b)
List< label > labelList
A List of labels.
virtual const faceList & faces() const
Return raw faces.
static void fillNan(UList< scalar > &)
Fill block of data with NaN.
errorManip< error > abort(error &err)
void clear()
Clear the list, i.e. set addressable size to zero.
const labelListList & pointCells() const
Info<< "Finished reading KIVA file"<< endl;cellShapeList cellShapes(nPoints);labelList cellZoning(nPoints, -1);const cellModel &hex=*(cellModeller::lookup("hex"));labelList hexLabels(8);label activeCells=0;labelList pointMap(nPoints);forAll(pointMap, i){ pointMap[i]=i;}for(label i=0;i< nPoints;i++){ if(f[i] > 0.0) { hexLabels[0]=i;hexLabels[1]=i1tab[i];hexLabels[2]=i3tab[i1tab[i]];hexLabels[3]=i3tab[i];hexLabels[4]=i8tab[i];hexLabels[5]=i1tab[i8tab[i]];hexLabels[6]=i3tab[i1tab[i8tab[i]]];hexLabels[7]=i3tab[i8tab[i]];cellShapes[activeCells]=cellShape(hex, hexLabels);edgeList edges=cellShapes[activeCells].edges();forAll(edges, ei) { if(edges[ei].mag(points)< small) { label start=pointMap[edges[ei].start()];while(start !=pointMap[start]) { start=pointMap[start];} label end=pointMap[edges[ei].end()];while(end !=pointMap[end]) { end=pointMap[end];} label minLabel=min(start, end);pointMap[start]=pointMap[end]=minLabel;} } cellZoning[activeCells]=idreg[i];activeCells++;}}cellShapes.setSize(activeCells);cellZoning.setSize(activeCells);forAll(cellShapes, celli){ cellShape &cs=cellShapes[celli];forAll(cs, i) { cs[i]=pointMap[cs[i]];} cs.collapse();}label bcIDs[11]={-1, 0, 2, 4, -1, 5, -1, 6, 7, 8, 9};const label nBCs=12;const word *kivaPatchTypes[nBCs]={ &wallPolyPatch::typeName, &wallPolyPatch::typeName, &wallPolyPatch::typeName, &wallPolyPatch::typeName, &symmetryPolyPatch::typeName, &wedgePolyPatch::typeName, &polyPatch::typeName, &polyPatch::typeName, &polyPatch::typeName, &polyPatch::typeName, &symmetryPolyPatch::typeName, &mergedCyclicPolyPatch::typeName};enum patchTypeNames{ PISTON, VALVE, LINER, CYLINDERHEAD, AXIS, WEDGE, INFLOW, OUTFLOW, PRESIN, PRESOUT, SYMMETRYPLANE, CYCLIC};const char *kivaPatchNames[nBCs]={ "piston", "valve", "liner", "cylinderHead", "axis", "wedge", "inflow", "outflow", "presin", "presout", "symmetryPlane", "cyclic"};List< SLList< face > > pFaces[nBCs]
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
static tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > interpolate(const GeometricField< Type, fvPatchField, volMesh > &tvf, const surfaceScalarField &faceFlux, Istream &schemeData)
Interpolate field onto faces using scheme given by Istream.
label timeIndex() const
Return current time index.
void transfer(PackedBoolList &)
Transfer the contents of the argument list into this list.
#define WarningInFunction
Report a warning using Foam::Warning.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
A cell is defined as a list of faces with extra functionality.
A collection of cell labels.
prefixOSstream Pout(cout, "Pout")
Mesh data needed to do the Finite Volume discretisation.
const hexRef8 & meshCutter() const
Direct access to the refinement engine.
void unset(const PackedList< 1 > &)
Unset specified bits.
virtual void topoChange(const polyTopoChangeMap &)
Update corresponding to the given map.
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
virtual bool write(const bool write=true) const
Write using setting from DB.
All refinement history. Used in unrefinement.
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
Class containing mesh-to-mesh mapping information.
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
virtual void distribute(const polyDistributionMap &)
Update corresponding to the given distribution map.
virtual ~refiner()
Destructor.
defineTypeNameAndDebug(list, 0)
const labelIOList & cellLevel() const
Abstract base class for fvMesh movers.