Go to the documentation of this file.
60 refCells.
setSize(newRefI + splitMap.size());
62 for (
label refI = 0; refI < oldSize; refI++)
68 if (iter == splitMap.end())
71 <<
"Problem : cannot find added cell for cell "
88 field.setSize(field.size() + splitMap.size());
92 field[iter()] = field[iter.key()];
110 labels[newCellI++] = iter();
126 forAll(addedCells_, cellI)
128 const labelList& added = addedCells_[cellI];
132 label slave = added[i];
134 if (origCell[slave] == -1)
136 origCell[slave] = cellI;
138 else if (origCell[slave] != cellI)
141 <<
"Added cell " << slave <<
" has two different masters:"
142 << origCell[slave] <<
" , " << cellI
151 label masterI = iter.key();
152 label newCellI = iter();
154 while (origCell[masterI] != -1 && origCell[masterI] != masterI)
156 masterI = origCell[masterI];
159 if (masterI >= addedCells_.size())
162 <<
"Map of added cells contains master cell " << masterI
163 <<
" which is not a valid cell number" <<
endl
164 <<
"This means that the mesh is not consistent with the"
165 <<
" done refinement" <<
endl
177 else if (
findIndex(added, newCellI) == -1)
181 added[sz] = newCellI;
207 hexLabels[hexI++] = cellI;
211 nonHexLabels[nonHexI++] = cellI;
234 Pout<<
"multiDirRefinement : Refining hexes " << hexCells.
size()
278 hexCellSet.insert(hexCells[i], 1);
282 forAll(consistentCells, i)
284 const label cellI = consistentCells[i];
288 if (iter == hexCellSet.end())
291 <<
"Resulting mesh would not satisfy 2:1 ratio"
307 <<
"Resulting mesh would not satisfy 2:1 ratio"
308 <<
" when refining cell " << iter.key()
333 Pout<<
"multiDirRefinement : updated mesh at time "
341 forAll(consistentCells, i)
343 addedCells_[consistentCells[i]].setSize(8);
345 labelList nAddedCells(addedCells_.size(), 0);
351 const label oldCellI = cellMap[cellI];
353 if (addedCells_[oldCellI].size())
355 addedCells_[oldCellI][nAddedCells[oldCellI]++] = cellI;
373 forAll(cellDirections, dirI)
377 Pout<<
"multiDirRefinement : Refining " << cellLabels_.size()
378 <<
" cells in direction " << dirI <<
endl
382 const vectorField& dirField = cellDirections[dirI];
389 if (dirField.size() == 1)
394 Pout<<
"multiDirRefinement : Uniform refinement:"
395 << dirField[0] <<
endl;
400 label cellI = cellLabels_[refI];
402 refCells[refI] =
refineCell(cellI, dirField[0]);
410 const label cellI = cellLabels_[refI];
412 refCells[refI] =
refineCell(cellI, dirField[cellI]);
420 addCells(
mesh, splitMap);
423 addCells(splitMap, cellLabels_);
426 if (dirField.size() != 1)
430 update(splitMap, cellDirections[i]);
436 Pout<<
"multiDirRefinement : Done refining direction " << dirI
437 <<
" resulting in " << cellLabels_.size() <<
" cells" <<
nl
471 refineAllDirs(
mesh, cellDirections, cellWalker(), cutter,
writeMesh);
486 cellLabels_(cellLabels),
495 if (useHex && dirNames.
size() == 3)
503 label nRemainingCells = cellLabels_.size();
507 if (nRemainingCells > 0)
529 cellLabels_(cellLabels),
538 if (useHex && dirNames.
size() == 3)
546 label nRemainingCells = cellLabels_.size();
550 if (nRemainingCells > 0)
574 cellLabels_(cellLabels),
580 refineAllDirs(
mesh, cellDirections, cellWalker, cutter,
writeMesh);
const cellShapeList & cellShapes
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
labelList consistentRefinement(const labelList &cellsToRefine, const bool maxSet) const
Given valid mesh and current cell level and proposed.
List< label > labelList
A List of labels.
labelList splitOffHex(const primitiveMesh &mesh)
Remove hexes from cellLabels_ and return these in a list.
#define forAll(list, i)
Loop across all elements in list.
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurence of given element and return index,.
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.
void refineHex8(polyMesh &mesh, const labelList &hexCells, const bool writeMesh)
Refine cells (hex only) in all 3 directions.
Map< label > setRefinement(const List< refineCell > &)
Try to refine cells in given direction. Constructs intermediate.
Utility class to do iterating meshCutter until all requests satisfied.
static word meshSubDir
Return the mesh sub-directory name (usually "polyMesh")
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
Direct mesh changes based on v1.3 polyTopoChange syntax.
void transfer(List< T > &)
Transfer the contents of the argument List into this list.
const fileName & facesInstance() const
Return the current instance directory for faces.
void updateMesh(const mapPolyMesh &)
Update local numbering for changed mesh.
virtual tmp< scalarField > movePoints(const pointField &)
Move points, returns volumes swept by faces in motion.
Ostream & endl(Ostream &os)
Add newline and flush stream.
const pointField & preMotionPoints() const
Pre-motion point positions.
Set of directions for each cell in the mesh. Either uniform and size=1 or one set of directions per c...
Mesh consisting of general polyhedral cells.
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
virtual bool write() const
Write mesh using IO settings from time.
All refinement history. Used in unrefinement.
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
labelListList setRefinement(const labelList &cells, polyTopoChange &)
Insert refinement. All selected cells will be split into 8.
void refineAllDirs(polyMesh &mesh, List< vectorField > &cellDirections, const cellLooper &cellWalker, undoableMeshCutter &cutter, const bool writeMesh)
Refine cells in cellLabels_ in directions mentioned.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Pre-declare SubField and related Field type.
multiDirRefinement(const multiDirRefinement &)
Disallow default bitwise copy construct.
static const cellModel * lookup(const word &)
Look up a model by name and return a pointer to the model or NULL.
Abstract base class. Concrete implementations know how to cut a cell (i.e. determine a loop around th...
Implementation of cellLooper. Does pure geometric cut through cell.
const vector & direction() const
A list of keyword definitions, which are a keyword followed by any number of values (e....
static void update(const Map< label > &, vectorField &)
Given map from original to added cell set the vectorField for.
errorManip< error > abort(error &err)
IOstream & hex(IOstream &io)
void refineFromDict(polyMesh &mesh, List< vectorField > &cellDirections, const dictionary &dict, const bool writeMesh)
Refine based on dictionary. Calls refineAllDirs.
static void addCells(const Map< label > &, List< refineCell > &)
Given map from original to added cell set the refineCell for.
void setSize(const label)
Reset size of List.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Container with cells to refine. Refinement given as single direction.
labelList cellLabels_
Current set of cells to refine. Extended with added cells.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Refinement of (split) hexes using polyTopoChange.
prefixOSstream Pout(cout, "Pout")
static word timeName(const scalar, const int precision=precision_)
Return time name of given scalar time.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
bool hasMotionPoints() const
Has valid preMotionPoints?
void reset(T *=0)
If object pointer already set, delete object and set to given.
const Time & time() const
Return the top-level database.
Maps a geometry to a set of cell primitives, which enables geometric cell data to be calculated witho...
void size(const label)
Override size to be inconsistent with allocated storage.
defineTypeNameAndDebug(combustionModel, 0)
Implementation of cellLooper.
const labelList & cellMap() const
Old cell map.
void writeMesh(const string &msg, const meshRefinement &meshRefiner, const meshRefinement::debugType debugLevel, const meshRefinement::writeType writeLevel)
The main refinement handler. Gets cellCuts which is structure that describes which cells are to be cu...
Cell-face mesh analysis engine.