58 meshRefiner_(meshRefiner),
59 cellWalker_(cellWalker),
79 Time& runTime =
const_cast<Time&
>(mesh_.time());
83 label oldRefCells = -1;
102 Pout<<
"refinementIterator : refining " 103 << currentRefCells.
size() <<
" cells." <<
endl;
107 cellCuts cuts(mesh_, cellWalker_, currentRefCells);
116 Pout<<
"refinementIterator : exiting iteration since no valid" 117 <<
" loops found for " << currentRefCells.
size()
121 fileName cutsFile(
"failedCuts_" + runTime.timeName() +
".obj");
123 Pout<<
"Writing cuts for time " << runTime.timeName()
124 <<
" to " << cutsFile <<
endl;
130 forAll(currentRefCells, i)
132 refCellsDebug[i] = currentRefCells[i].cellNo();
149 fileName cutsFile(
"cuts_" + runTime.timeName() +
".obj");
151 Pout<<
"Writing cuts for time " << runTime.timeName()
152 <<
" to " << cutsFile <<
endl;
155 cuts.writeOBJ(cutsStream);
160 meshRefiner_.setRefinement(cuts, meshMod);
174 if (morphMap().hasMotionPoints())
176 mesh_.movePoints(morphMap().preMotionPoints());
180 meshRefiner_.updateMesh(morphMap());
187 Pout<<
"Writing refined polyMesh to time " 188 << runTime.timeName() <<
endl;
211 const Map<label>& addedNow = meshRefiner_.addedCells();
215 if (!addedCells.insert(iter.key(), iter()))
218 <<
"Master cell " << iter.key()
219 <<
" already has been refined" <<
endl 239 forAll(currentRefCells, refI)
241 const refineCell& refCell = currentRefCells[refI];
243 if (!addedNow.found(refCell.
cellNo()))
245 if (nRefCells != refI)
247 currentRefCells[nRefCells++] =
257 oldRefCells = currentRefCells.
size();
259 currentRefCells.
setSize(nRefCells);
267 stop = (nRefCells == 0) || (nRefCells == oldRefCells);
276 <<
"stopped refining." 277 <<
"Did not manage to refine a single cell" <<
endl 278 <<
"Wanted :" << oldRefCells <<
endl;
#define forAll(list, i)
Loop across all elements in list.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
A class for handling file names.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Map< label > setRefinement(const List< refineCell > &)
Try to refine cells in given direction. Constructs intermediate.
void size(const label)
Override size to be inconsistent with allocated storage.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Abstract base class. Concrete implementations know how to cut a cell (i.e. determine a loop around th...
The main refinement handler. Gets cellCuts which is structure that describes which cells are to be cu...
Description of cuts across cells.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
const vector & direction() const
~refinementIterator()
Destructor.
Combines edge or vertex in single label. Used to specify cuts across cell circumference.
Container with cells to refine. Refinement given as single direction.
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
errorManip< error > abort(error &err)
const labelList & reverseCellMap() const
Reverse cell map.
defineTypeNameAndDebug(combustionModel, 0)
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
void setSize(const label)
Reset size of List.
label nLoops() const
Number of valid cell loops.
#define WarningInFunction
Report a warning using Foam::Warning.
prefixOSstream Pout(cout, "Pout")
Direct mesh changes based on v1.3 polyTopoChange syntax.
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 Ostream & write(const token &)=0
Write next token to stream.
Mesh consisting of general polyhedral cells.
autoPtr< mapPolyMesh > changeMesh(polyMesh &mesh, const bool inflate, const bool syncParallel=true, const bool orderCells=false, const bool orderPoints=false)
Inplace changes mesh without change of patches.
refinementIterator(polyMesh &mesh, undoableMeshCutter &meshRefiner, const cellLooper &cellWalker, const bool writeMesh=false)
Construct from mesh, refinementEngine and cell walking routine.
A HashTable to objects of type <T> with a label key.