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;
128 labelList refCellsDebug(currentRefCells.size());
129 forAll(currentRefCells, i)
131 refCellsDebug[i] = currentRefCells[i].cellNo();
151 <<
" to " << cutsFile <<
endl;
154 cuts.writeOBJ(cutsStream);
159 meshRefiner_.setRefinement(cuts, meshMod);
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;
bool found(const Key &key) const
Same as contains().
bool insert(const Key &key, const T &obj)
Copy insert a new entry, not overwriting existing entries.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
void setSize(label n)
Alias for resize().
A HashTable to objects of type <T> with a label key.
Output to file stream as an OSstream, normally using std::ofstream for the actual output.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
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.
void size(const label n)
Older name for setAddressableSize.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Description of cuts across cells.
label nLoops() const
Number of valid cell loops.
Abstract base class. Concrete implementations know how to cut a cell (i.e. determine a loop around th...
Combines edge or vertex in single label. Used to specify cuts across cell circumference.
const polyMesh & mesh() const
static void updateLabels(const labelList &map, List< refineCell > &)
Update refine list from map. Used to update cell/face labels.
A class for handling file names.
Mesh consisting of general polyhedral cells.
Direct mesh changes based on v1.3 polyTopoChange syntax.
autoPtr< mapPolyMesh > changeMesh(polyMesh &mesh, const labelUList &patchMap, const bool inflate, const bool syncParallel=true, const bool orderCells=false, const bool orderPoints=false)
Inplace changes mesh without change of patches.
Container with cells to refine. Refinement given as single direction.
const vector & direction() const
Utility class to do iterating meshCutter until all requests satisfied.
~refinementIterator()
Destructor.
refinementIterator(polyMesh &mesh, undoableMeshCutter &meshRefiner, const cellLooper &cellWalker, const bool writeMesh=false)
Construct from mesh, refinementEngine and cell walking routine.
Map< label > setRefinement(const List< refineCell > &)
Try to refine cells in given direction. Constructs intermediate.
The main refinement handler. Gets cellCuts which is structure that describes which cells are to be cu...
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
#define WarningInFunction
Report a warning using Foam::Warning.
Namespace for handling debugging switches.
bool returnReduceOr(const bool value, const int communicator=UPstream::worldComm)
Perform logical (or) MPI Allreduce on a copy. Uses UPstream::reduceOr.
List< label > labelList
A List of labels.
Ostream & endl(Ostream &os)
Add newline and flush stream.
bool returnReduceAnd(const bool value, const int communicator=UPstream::worldComm)
Perform logical (and) MPI Allreduce on a copy. Uses UPstream::reduceAnd.
errorManip< error > abort(error &err)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
#define forAll(list, i)
Loop across all elements in list.
#define forAllConstIters(container, iter)
Iterate across all elements of the container object with const access.