60 meshRefiner_(meshRefiner),
61 cellWalker_(cellWalker),
83 label nRefCells = refCells.
size();
85 label oldRefCells = -1;
100 polyTopoChange meshMod(mesh_);
104 Pout<<
"refinementIterator : refining " 105 << currentRefCells.size() <<
" cells." <<
endl;
109 cellCuts cuts(mesh_, cellWalker_, currentRefCells);
115 Pout<<
"refinementIterator : exiting iteration since no valid" 116 <<
" loops found for " << currentRefCells.size()
123 <<
" to " << cutsFile <<
endl;
125 OFstream cutsStream(cutsFile);
128 labelList refCellsDebug(currentRefCells.size());
129 forAll(currentRefCells, i)
131 refCellsDebug[i] = currentRefCells[i].cellNo();
151 <<
" to " << cutsFile <<
endl;
153 OFstream cutsStream(cutsFile);
154 cuts.writeOBJ(cutsStream);
159 meshRefiner_.setRefinement(cuts, meshMod);
166 autoPtr<mapPolyMesh> morphMap = meshMod.changeMesh
173 if (morphMap().hasMotionPoints())
175 mesh_.movePoints(morphMap().preMotionPoints());
179 meshRefiner_.updateMesh(morphMap());
186 Pout<<
"Writing refined polyMesh to time " 197 morphMap->reverseCellMap(),
204 morphMap->reverseCellMap(),
210 const Map<label>& addedNow = meshRefiner_.addedCells();
214 if (!addedCells.insert(iter.key(), iter.val()))
217 <<
"Master cell " << iter.key()
218 <<
" already has been refined" <<
endl 231 morphMap->reverseCellMap(),
238 forAll(currentRefCells, refI)
240 const refineCell& refCell = currentRefCells[refI];
242 if (!addedNow.found(refCell.cellNo()))
244 if (nRefCells != refI)
246 currentRefCells[nRefCells++] =
256 oldRefCells = currentRefCells.size();
258 currentRefCells.setSize(nRefCells);
274 <<
"stopped refining." 275 <<
"Did not manage to refine a single cell" <<
endl 276 <<
"Wanted :" << oldRefCells <<
endl;
void size(const label n)
Older name for setAddressableSize.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Map< label > setRefinement(const List< refineCell > &)
Try to refine cells in given direction. Constructs intermediate.
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...
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
#define forAll(list, i)
Loop across all elements in list.
~refinementIterator()
Destructor.
bool returnReduceAnd(const bool value, const label comm=UPstream::worldComm)
Perform logical (and) MPI Allreduce on a copy. Uses UPstream::reduceAnd.
Combines edge or vertex in single label. Used to specify cuts across cell circumference.
virtual bool write(const token &tok)=0
Write token to stream or otherwise handle it.
errorManip< error > abort(error &err)
static word timeName(const scalar t, const int precision=precision_)
Return a time name for the given scalar time value formatted with the given precision.
Utility class to do iterating meshCutter until all requests satisfied.
int debug
Static debugging option.
defineTypeNameAndDebug(combustionModel, 0)
#define WarningInFunction
Report a warning using Foam::Warning.
Mesh consisting of general polyhedral cells.
List< label > labelList
A List of labels.
bool returnReduceOr(const bool value, const label comm=UPstream::worldComm)
Perform logical (or) MPI Allreduce on a copy. Uses UPstream::reduceOr.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
refinementIterator(polyMesh &mesh, undoableMeshCutter &meshRefiner, const cellLooper &cellWalker, const bool writeMesh=false)
Construct from mesh, refinementEngine and cell walking routine.
forAllConstIters(mixture.phases(), phase)
A HashTable to objects of type <T> with a label key.