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_;
91 labelList neiLevel(mesh().nFaces() - mesh().nInternalFaces());
95 label facei = mesh().nInternalFaces();
96 facei < mesh().nFaces();
100 neiLevel[facei - mesh().nInternalFaces()] =
101 cellLevel[mesh().faceOwner()[facei]];
109 boolList seedFace(mesh().nFaces(),
false);
111 forAll(mesh().faceNeighbour(), 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;
130 label facei = mesh().nInternalFaces();
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);
176 label facei = mesh().nInternalFaces();
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 if (dict_.found(
"correctFluxes"))
229 const List<Pair<word>> fluxVelocities = List<Pair<word>>
231 dict_.lookup(
"correctFluxes")
235 correctFluxes_.resize(fluxVelocities.size());
238 correctFluxes_.insert(fluxVelocities[i][0], fluxVelocities[i][1]);
242 dumpLevel_ = Switch(dict_.lookup(
"dumpLevel"));
247 Foam::fvMeshTopoChangers::refiner::refine
253 polyTopoChange meshMod(mesh());
256 meshCutter_.setRefinement(cellsToRefine, meshMod);
260 autoPtr<polyTopoChangeMap> map = meshMod.changeMesh(mesh());
262 Info<<
"Refined from "
264 <<
" to " << mesh().globalData().nTotalCells() <<
" cells." <<
endl;
269 for (
label facei = 0; facei < mesh().nInternalFaces(); facei++)
271 const label oldFacei = map().faceMap()[facei];
273 if (oldFacei >= mesh().nInternalFaces())
276 <<
"New internal face:" << facei
277 <<
" fc:" << mesh().faceCentres()[facei]
278 <<
" originates from boundary oldFace:" << oldFacei
285 mesh().topoChange(map);
291 const labelList& reverseFaceMap = map().reverseFaceMap();
304 const label masterFacei = reverseFaceMap[oldFacei];
309 <<
"Problem: should not have removed faces"
313 else if (masterFacei != facei)
315 masterFaces.insert(masterFacei);
321 Pout<<
"Found " << masterFaces.size() <<
" split faces " <<
endl;
324 refineFluxes(masterFaces, map());
325 refineUfs(masterFaces, map());
329 if (protectedCells_.size())
331 PackedBoolList newProtectedCell(mesh().nCells());
333 forAll(newProtectedCell, celli)
335 const label oldCelli = map().cellMap()[celli];
336 newProtectedCell.set(celli, protectedCells_.get(oldCelli));
338 protectedCells_.transfer(newProtectedCell);
342 meshCutter_.checkRefinementLevels(-1,
labelList(0));
349 Foam::fvMeshTopoChangers::refiner::unrefine
354 polyTopoChange meshMod(mesh());
357 meshCutter_.setUnrefinement(splitPoints, meshMod);
366 Map<label> faceToSplitPoint(3*splitPoints.size());
371 const label pointi = splitPoints[i];
372 const labelList& pEdges = mesh().pointEdges()[pointi];
376 const label otherPointi =
377 mesh().edges()[pEdges[j]].otherVertex(pointi);
383 faceToSplitPoint.insert(
pFaces[pFacei], otherPointi);
391 autoPtr<polyTopoChangeMap> map = meshMod.changeMesh(mesh());
393 Info<<
"Unrefined from "
395 <<
" to " << mesh().globalData().nTotalCells() <<
" cells."
399 mesh().topoChange(map);
402 unrefineFluxes(faceToSplitPoint, map());
405 unrefineUfs(faceToSplitPoint, map());
408 if (protectedCells_.size())
410 PackedBoolList newProtectedCell(mesh().nCells());
412 forAll(newProtectedCell, celli)
414 const label oldCelli = map().cellMap()[celli];
417 newProtectedCell.set(celli, protectedCells_.get(oldCelli));
420 protectedCells_.transfer(newProtectedCell);
424 meshCutter_.checkRefinementLevels(-1,
labelList(0));
430 Foam::word Foam::fvMeshTopoChangers::refiner::Uname
435 const word UfName(Uf.member());
441 ? word(UfName(UfName.size() - 1))
442 : UfName.compare(UfName.size() - 3, 3,
"f_0") == 0
443 ? word(UfName(UfName.size() - 3) +
"_0")
450 void Foam::fvMeshTopoChangers::refiner::refineFluxes
453 const polyTopoChangeMap& map
456 if (correctFluxes_.size())
458 UPtrList<surfaceScalarField> fluxes
460 mesh().fields<surfaceScalarField>()
467 if (!correctFluxes_.found(
flux.name()))
470 <<
"Cannot find surfaceScalarField " <<
flux.name()
471 <<
" in user-provided flux mapping table "
472 << correctFluxes_ <<
endl
473 <<
" The flux mapping table is used to recreate the"
474 <<
" flux on newly created faces." <<
endl
475 <<
" Either add the entry if it is a flux or use ("
476 <<
flux.name() <<
" none) to suppress this warning."
481 const word& method = correctFluxes_[
flux.name()];
483 if (method ==
"none")
485 else if (method ==
"NaN")
487 Pout<<
"Setting surfaceScalarField " <<
flux.name()
488 <<
" to NaN" <<
endl;
495 <<
"Unknown refinement method " << method
496 <<
" for surfaceScalarField " <<
flux.name()
497 <<
" in user-provided flux mapping table "
507 void Foam::fvMeshTopoChangers::refiner::unrefineFluxes
509 const Map<label>& faceToSplitPoint,
510 const polyTopoChangeMap& map
513 if (correctFluxes_.size())
515 UPtrList<surfaceScalarField> fluxes
517 mesh().fields<surfaceScalarField>()
524 if (!correctFluxes_.found(
flux.name()))
527 <<
"Cannot find surfaceScalarField " <<
flux.name()
528 <<
" in user-provided flux mapping table "
529 << correctFluxes_ <<
endl
530 <<
" The flux mapping table is used to recreate the"
531 <<
" flux on newly created faces." <<
endl
532 <<
" Either add the entry if it is a flux or use ("
533 <<
flux.name() <<
" none) to suppress this warning."
538 const word& method = correctFluxes_[
flux.name()];
540 if (method !=
"none")
543 <<
"Unknown unrefinement method " << method
544 <<
" for surfaceScalarField " <<
flux.name()
545 <<
" in user-provided flux mapping table "
555 void Foam::fvMeshTopoChangers::refiner::refineUfs
558 const polyTopoChangeMap& map
562 const labelList& reverseFaceMap = map.reverseFaceMap();
565 UPtrList<surfaceVectorField> Ufs(mesh().fields<surfaceVectorField>());
571 const word Uname(this->Uname(Uf));
581 for (
label facei = 0; facei < mesh().nInternalFaces(); facei++)
588 Uf[facei] = UfU[facei];
590 else if (reverseFaceMap[oldFacei] != facei)
593 Uf[facei] = UfU[facei];
603 UfU.boundaryField()[
patchi];
605 label facei = patchUf.patch().start();
614 patchUf[i] = patchUfU[i];
616 else if (reverseFaceMap[oldFacei] != facei)
619 patchUf[i] = patchUfU[i];
629 label facei = iter.key();
631 if (mesh().isInternalFace(facei))
633 Uf[facei] = UfU[facei];
638 mesh().boundaryMesh().whichPatch(facei);
640 facei - mesh().boundaryMesh()[
patchi].start();
643 UfU.boundaryField()[
patchi];
647 patchUf[i] = patchUfU[i];
655 void Foam::fvMeshTopoChangers::refiner::unrefineUfs
657 const Map<label>& faceToSplitPoint,
658 const polyTopoChangeMap& map
661 const labelList& reversePointMap = map.reversePointMap();
662 const labelList& reverseFaceMap = map.reverseFaceMap();
665 UPtrList<surfaceVectorField> Ufs(mesh().fields<surfaceVectorField>());
671 const word Uname(this->Uname(Uf));
684 const label oldFacei = iter.key();
685 const label oldPointi = iter();
687 if (reversePointMap[oldPointi] < 0)
690 const label facei = reverseFaceMap[oldFacei];
694 if (mesh().isInternalFace(facei))
696 Uf[facei] = UfU[facei];
701 mesh().boundaryMesh().whichPatch(facei);
703 facei - mesh().boundaryMesh()[
patchi].start();
715 const Foam::cellZone& Foam::fvMeshTopoChangers::refiner::findCellZone
717 const word& cellZoneName
720 const label cellZoneID = mesh().cellZones().findIndex(cellZoneName);
722 bool cellZoneFound = (cellZoneID != -1);
723 reduce(cellZoneFound, orOp<bool>());
728 <<
"cannot find cellZone " << cellZoneName
732 return mesh().cellZones()[cellZoneID];
737 Foam::fvMeshTopoChangers::refiner::cellToPoint(
const scalarField& vFld)
const
741 forAll(mesh().pointCells(), pointi)
743 const labelList& pCells = mesh().pointCells()[pointi];
748 sum += vFld[pCells[i]];
750 pFld[pointi] =
sum/pCells.size();
760 const scalar minLevel,
761 const scalar maxLevel
768 scalar err =
min(
fld[celli] - minLevel, maxLevel -
fld[celli]);
784 const scalar minLevel,
785 const scalar maxLevel
794 scalar err =
min(
fld[celli] - minLevel, maxLevel -
fld[celli]);
806 void Foam::fvMeshTopoChangers::refiner::selectRefineCandidates
808 PackedBoolList& candidateCells,
809 const scalar lowerRefineLevel,
810 const scalar upperRefineLevel,
811 const scalar maxRefinement,
819 error(vFld, lowerRefineLevel, upperRefineLevel)
825 if (cellError[celli] > 0)
827 candidateCells.set(celli, 1);
833 void Foam::fvMeshTopoChangers::refiner::selectRefineCandidates
835 PackedBoolList& candidateCells,
836 const scalar lowerRefineLevel,
837 const scalar upperRefineLevel,
838 const scalar maxRefinement,
847 error(vFld,
cells, lowerRefineLevel, upperRefineLevel)
853 if (cellError[celli] > 0)
855 candidateCells.set(celli, 1);
861 Foam::scalar Foam::fvMeshTopoChangers::refiner::selectRefineCandidates
863 PackedBoolList& candidateCells,
864 const dictionary& refineDict
867 const word fieldName(refineDict.lookup(
"field"));
871 const scalar lowerRefineLevel =
872 refineDict.lookup<scalar>(
"lowerRefineLevel");
873 const scalar upperRefineLevel =
874 refineDict.lookup<scalar>(
"upperRefineLevel");
876 const label maxRefinement = refineDict.lookup<
label>(
"maxRefinement");
878 if (maxRefinement <= 0)
881 <<
"Illegal maximum refinement level " << maxRefinement <<
nl
882 <<
"The maxCells setting in the dynamicMeshDict should"
887 if (refineDict.found(
"cellZone"))
890 selectRefineCandidates
897 findCellZone(refineDict.lookup(
"cellZone"))
903 selectRefineCandidates
913 return maxRefinement;
919 const label maxCells,
920 const label maxRefinement,
921 const PackedBoolList& candidateCells
925 const label nTotToRefine = (maxCells - mesh().globalData().nTotalCells())/7;
927 const labelList& cellLevel = meshCutter_.cellLevel();
931 PackedBoolList unrefineableCells;
932 calculateProtectedCells(unrefineableCells);
935 const label nLocalCandidates =
count(candidateCells, 1);
939 DynamicList<label> candidates(nLocalCandidates);
941 if (nCandidates < nTotToRefine)
943 forAll(candidateCells, celli)
947 candidateCells.get(celli)
949 unrefineableCells.empty()
950 || !unrefineableCells.get(celli)
954 candidates.append(celli);
961 for (
label level = 0; level < maxRefinement; level++)
963 forAll(candidateCells, celli)
967 cellLevel[celli] == level
968 && candidateCells.get(celli)
970 unrefineableCells.empty()
971 || !unrefineableCells.get(celli)
975 candidates.append(celli);
979 if (
returnReduce(candidates.size(), sumOp<label>()) > nTotToRefine)
989 meshCutter_.consistentRefinement
997 <<
" cells for refinement out of " << mesh().globalData().nTotalCells()
1000 return consistentSet;
1004 Foam::labelList Foam::fvMeshTopoChangers::refiner::selectUnrefinePoints
1006 const PackedBoolList& markedCell
1010 const labelList splitPoints(meshCutter_.getSplitPoints());
1012 DynamicList<label> newSplitPoints(splitPoints.size());
1016 const label pointi = splitPoints[i];
1019 const labelList& pCells = mesh().pointCells()[pointi];
1021 bool hasMarked =
false;
1025 if (markedCell.get(pCells[pCelli]))
1034 newSplitPoints.append(pointi);
1039 newSplitPoints.shrink();
1044 meshCutter_.consistentUnrefinement
1052 <<
" split points out of a possible "
1056 return consistentSet;
1060 void Foam::fvMeshTopoChangers::refiner::extendMarkedCells
1062 PackedBoolList& markedCell
1066 boolList markedFace(mesh().nFaces(),
false);
1068 forAll(markedCell, celli)
1070 if (markedCell.get(celli))
1072 const cell& cFaces = mesh().cells()[celli];
1076 markedFace[cFaces[i]] =
true;
1084 for (
label facei = 0; facei < mesh().nInternalFaces(); facei++)
1086 if (markedFace[facei])
1088 markedCell.set(mesh().faceOwner()[facei], 1);
1089 markedCell.set(mesh().faceNeighbour()[facei], 1);
1095 label facei = mesh().nInternalFaces();
1096 facei < mesh().nFaces();
1100 if (markedFace[facei])
1102 markedCell.set(mesh().faceOwner()[facei], 1);
1108 void Foam::fvMeshTopoChangers::refiner::checkEightAnchorPoints
1110 PackedBoolList& protectedCell,
1114 const labelList& cellLevel = meshCutter_.cellLevel();
1115 const labelList& pointLevel = meshCutter_.pointLevel();
1117 labelList nAnchorPoints(mesh().nCells(), 0);
1119 forAll(pointLevel, pointi)
1121 const labelList& pCells = mesh().pointCells(pointi);
1125 const label celli = pCells[pCelli];
1127 if (pointLevel[pointi] <= cellLevel[celli])
1130 if (nAnchorPoints[celli] == 8)
1132 if (protectedCell.set(celli,
true))
1138 if (!protectedCell[celli])
1140 nAnchorPoints[celli]++;
1146 forAll(protectedCell, celli)
1148 if (!protectedCell[celli] && nAnchorPoints[celli] != 8)
1150 protectedCell.set(celli,
true);
1165 nRefinementIterations_(0),
1166 protectedCells_(mesh.nCells(), 0),
1167 changedSinceWrite_(false),
1186 label nProtected = 0;
1194 const label celli = pCells[i];
1196 if (!protectedCells_.
get(celli))
1198 if (pointLevel[pointi] <= cellLevel[celli])
1202 if (nAnchors[celli] > 8)
1204 protectedCells_.
set(celli, 1);
1254 if (pointLevel[
f[fp]] <= faceLevel)
1260 protectedFace[facei] =
true;
1271 if (protectedFace[facei])
1287 if (protectedFace[facei])
1299 if (cFaces.
size() < 6)
1301 if (protectedCells_.
set(celli, 1))
1312 if (protectedCells_.
set(celli, 1))
1323 checkEightAnchorPoints(protectedCells_, nProtected);
1328 protectedCells_.
clear();
1332 cellSet protectedCells(
mesh,
"protectedCells", nProtected);
1333 forAll(protectedCells_, celli)
1335 if (protectedCells_[celli])
1337 protectedCells.
insert(celli);
1342 <<
" cells that are protected from refinement."
1343 <<
" Writing these to cellSet "
1344 << protectedCells.
name()
1347 protectedCells.
write();
1363 if (timeIndex_ != mesh().time().
timeIndex())
1365 timeIndex_ = mesh().time().timeIndex();
1372 bool hasChanged =
false;
1374 if (refineInterval_ == 0)
1385 && mesh().time().
timeIndex() % refineInterval_ == 0
1391 label maxRefinement = 0;
1393 if (dict_.isDict(
"refinementRegions"))
1397 dict_.subDict(
"refinementRegions")
1404 selectRefineCandidates
1415 maxRefinement = selectRefineCandidates(refineCells, dict_);
1420 for (
label i = 0; i < nBufferLayers_; i++)
1422 extendMarkedCells(refineCells);
1428 const labelList& cellLevel = meshCutter_.cellLevel();
1433 if (cellLevel[celli] >= maxRefinement)
1435 refinableCells.
unset(celli);
1440 if (mesh().globalData().nTotalCells() < maxCells_)
1459 if (nCellsToRefine > 0)
1467 const labelList& cellMap = map().cellMap();
1468 const labelList& reverseCellMap = map().reverseCellMap();
1474 const label oldCelli = cellMap[celli];
1478 newRefineCell.
set(celli, 1);
1480 else if (reverseCellMap[oldCelli] != celli)
1482 newRefineCell.
set(celli, 1);
1489 refinableCells.
get(oldCelli)
1493 refinableCells.
transfer(newRefineCell);
1502 const labelList pointsToUnrefine(selectUnrefinePoints(refineCells));
1506 pointsToUnrefine.
size(),
1510 if (nSplitPoints > 0)
1513 unrefine(pointsToUnrefine);
1520 if ((nRefinementIterations_ % 10) == 0)
1526 nRefinementIterations_++;
1531 changedSinceWrite_ =
true;
1541 meshCutter_.topoChange(map);
1560 meshCutter_.distribute(map);
1566 if (changedSinceWrite_)
1569 const_cast<hexRef8&
>(meshCutter_).setInstance(mesh().time().name());
1580 mesh().time().
name(),
1590 const labelList& cellLevel = meshCutter_.cellLevel();
1594 scalarCellLevel[celli] = cellLevel[celli];
1597 writeOk = writeOk && scalarCellLevel.
write();
1600 changedSinceWrite_ =
false;
#define forAll(list, i)
Loop across all elements in list.
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
Macros for easy insertion into run-time selection tables.
Generic GeometricField class.
GeometricBoundaryField< Type, PatchField, GeoMesh > Boundary
Type of the boundary field.
bool insert(const Key &key)
Insert a new entry.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
const word & name() const
Return name.
static word groupName(Name name, const word &group)
void size(const label)
Override size to be inconsistent with allocated storage.
void set(const PackedList< 1 > &)
Set specified bits.
void transfer(PackedBoolList &)
Transfer the contents of the argument list into this list.
void unset(const PackedList< 1 > &)
Unset specified bits.
unsigned int get(const label) const
Get value at index I.
void clear()
Clear the list, i.e. set addressable size to zero.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
A collection of cell labels.
A cell is defined as a list of faces with extra functionality.
A list of keyword definitions, which are a keyword followed by any number of values (e....
A face is a list of labels corresponding to mesh vertices.
Abstract base class for fvMesh topology changers.
fvMesh & mesh()
Return the fvMesh.
Dynamic mesh refinement/unrefinement based on volScalarField values.
virtual void topoChange(const polyTopoChangeMap &)
Update corresponding to the given map.
virtual void distribute(const polyDistributionMap &)
Update corresponding to the given distribution map.
virtual ~refiner()
Destructor.
virtual void mapMesh(const polyMeshMap &)
Update from another mesh using the given map.
virtual bool write(const bool write=true) const
Write using given format, version and compression.
virtual bool update()
Update the mesh for both mesh motion and topology change.
refiner(fvMesh &mesh, const dictionary &dict)
Construct from fvMesh and dictionary.
Mesh data needed to do the Finite Volume discretisation.
Refinement of (split) hexes using polyTopoChange.
bool write(const bool write=true) const
Force writing refinement+history to polyMesh directory.
const labelIOList & cellLevel() const
const labelIOList & pointLevel() const
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
Class containing mesh-to-mesh mapping information.
virtual const faceList & faces() const
Return raw faces.
virtual const labelList & faceOwner() const
Return face owner.
virtual const labelList & faceNeighbour() const
Return face neighbour.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
const labelListList & pointCells() const
label nInternalFaces() const
const cellList & cells() const
All refinement history. Used in unrefinement.
Encapsulates queries for volume refinement ('refine all cells within shell').
virtual bool write(const bool write=true) const
Write using setting from DB.
static void fillNan(UList< scalar > &)
Fill block of data with NaN.
A class for handling words, derived from string.
static const word null
An empty word.
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
gmvFile<< "tracers "<< particles.size()<< nl;{ pointField positions(particles.size());label particlei=0;forAllConstIter(Cloud< passiveParticle >, particles, iter) { positions[particlei++]=iter().position(mesh);} for(i=0;i< pTraits< point >::nComponents;i++) { forAll(positions, particlei) { gmvFile<< component(positions[particlei], i)<< ' ';} gmvFile<< nl;}}forAll(lagrangianScalarNames, i){ const word &name=lagrangianScalarNames[i];IOField< scalar > fld(IOobject(name, runTime.name(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
#define WarningInFunction
Report a warning using Foam::Warning.
const dimensionedScalar c
Speed of light in a vacuum.
defineTypeNameAndDebug(list, 0)
addToRunTimeSelectionTable(fvMeshTopoChanger, list, fvMesh)
tmp< SurfaceField< typename innerProduct< vector, Type >::type > > flux(const VolField< Type > &vf)
Return the face-flux field obtained from the given volVectorField.
static tmp< SurfaceField< Type > > interpolate(const VolField< Type > &tvf, const surfaceScalarField &faceFlux, Istream &schemeData)
Interpolate field onto faces using scheme given by Istream.
void write(std::ostream &os, const bool binary, List< floatScalar > &fField)
Write floats ascii or binary.
errorManipArg< error, int > exit(error &err, const int errNo=1)
List< label > labelList
A List of labels.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Ostream & endl(Ostream &os)
Add newline and flush stream.
word name(const bool)
Return a word representation of a bool.
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
errorManip< error > abort(error &err)
const dimensionSet dimless
SurfaceField< scalar > surfaceScalarField
List< bool > boolList
Bool container classes.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
layerAndWeight min(const layerAndWeight &a, const layerAndWeight &b)
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
VolField< scalar > volScalarField
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
prefixOSstream Pout(cout, "Pout")
HashSet< label, Hash< label > > labelHashSet
A HashSet with label keys.
label count(const ListType &l, typename ListType::const_reference x)
Count the number of occurrences of a value in a list.
SurfaceField< vector > surfaceVectorField
fvsPatchField< vector > fvsPatchVectorField
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
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]