Go to the documentation of this file.
49 regionToCell::typeName,
50 "\n Usage: regionToCell subCellSet (pt0 .. ptn) nErode\n\n"
51 " Select all cells in the connected region containing"
52 " points (pt0..ptn).\n"
65 const labelList& faceOwner = mesh_.faceOwner();
66 const labelList& faceNeighbour = mesh_.faceNeighbour();
67 forAll(faceNeighbour, faceI)
71 selectedCell[faceOwner[faceI]]
72 != selectedCell[faceNeighbour[faceI]]
75 regionFace[faceI] =
true;
81 syncTools::swapBoundaryCellList(mesh_, selectedCell, nbrSelected);
92 label bFaceI = faceI-mesh_.nInternalFaces();
95 selectedCell[faceCells[i]]
96 != selectedCell[nbrSelected[bFaceI]]
99 regionFace[faceI] =
true;
118 label cellI = mesh_.findCell(insidePoints_[i]);
120 label keepRegionI = -1;
121 label keepProcI = -1;
124 keepRegionI = cellRegion[cellI];
125 keepProcI = Pstream::myProcNo();
128 keepRegion[keepRegionI] =
true;
135 <<
"Did not find " << insidePoints_[i]
136 <<
" in mesh." <<
" Mesh bounds are " << mesh_.bounds()
142 Info<<
" Found location " << insidePoints_[i]
143 <<
" in cell " << cellI <<
" on processor " << keepProcI
144 <<
" in global region " << keepRegionI
145 <<
" out of " << cellRegion.
nRegions() <<
" regions." <<
endl;
159 boolList blockedFace(mesh_.nFaces(),
false);
160 markRegionFaces(selectedCell, blockedFace);
166 boolList keepRegion(findRegions(
true, cellRegion));
171 if (!keepRegion[cellRegion[cellI]])
173 selectedCell[cellI] =
false;
187 boolList boundaryPoint(mesh_.nPoints(),
false);
195 if (!pp.
coupled() && !isA<emptyPolyPatch>(pp))
199 const face&
f = pp[i];
202 boundaryPoint[
f[fp]] =
true;
208 forAll(selectedCell, cellI)
210 if (!selectedCell[cellI])
212 const labelList& cPoints = mesh_.cellPoints(cellI);
215 boundaryPoint[cPoints[i]] =
true;
220 syncTools::syncPointList(mesh_, boundaryPoint,
orEqOp<bool>(),
false);
227 forAll(boundaryPoint, pointI)
229 if (boundaryPoint[pointI])
231 const labelList& pCells = mesh_.pointCells(pointI);
234 label cellI = pCells[i];
235 if (selectedCell[cellI])
237 selectedCell[cellI] =
false;
244 <<
" cells." <<
endl;
257 boolList shrunkSelectedCell(selectedCell);
259 for (
label iter = 0; iter < nErode_; iter++)
261 shrinkRegions(shrunkSelectedCell);
270 boolList blockedFace(mesh_.nFaces(),
false);
271 markRegionFaces(shrunkSelectedCell, blockedFace);
277 boolList keepRegion(findRegions(
true, cellRegion));
281 boolList removeCell(mesh_.nCells(),
false);
284 if (shrunkSelectedCell[cellI] && !keepRegion[cellRegion[cellI]])
286 removeCell[cellI] =
true;
296 for (
label iter = 0; iter < nErode_; iter++)
299 boolList boundaryPoint(mesh_.nPoints(),
false);
302 if (removeCell[cellI])
304 const labelList& cPoints = mesh_.cellPoints(cellI);
307 boundaryPoint[cPoints[i]] =
true;
311 syncTools::syncPointList(mesh_, boundaryPoint,
orEqOp<bool>(),
false);
316 forAll(boundaryPoint, pointI)
318 if (boundaryPoint[pointI])
320 const labelList& pCells = mesh_.pointCells(pointI);
323 label cellI = pCells[i];
324 if (!removeCell[cellI])
326 removeCell[cellI] =
true;
341 if (removeCell[cellI])
343 selectedCell[cellI] =
false;
356 Info<<
" Loading subset " <<
setName_ <<
" to delimit search region."
360 selectedCell =
false;
363 selectedCell[iter.key()] =
true;
376 forAll(selectedCell, cellI)
378 if (selectedCell[cellI])
431 setName_(checkIs(is)),
432 insidePoints_(checkIs(is)),
453 Info<<
" Adding all cells of connected region containing points "
454 << insidePoints_ <<
" ..." <<
endl;
460 Info<<
" Removing all cells of connected region containing points "
461 << insidePoints_ <<
" ..." <<
endl;
A class for handling words, derived from string.
void markRegionFaces(const boolList &selectedCell, boolList ®ionFace) const
Mark faces inbetween selected and unselected elements.
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
#define forAll(list, i)
Loop across all elements in list.
boolList findRegions(const bool verbose, const regionSplit &) const
Determine for every disconnected region in the mesh whether.
void unselectOutsideRegions(boolList &selectedCell) const
Unselect regions not containing a locationInMesh.
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
AccessType combine(const List< T > &, AccessOp aop=accessOp< T >())
Combines sublists into one big list.
Class with constructor to add usage string to table.
virtual bool coupled() const
Return true if this patch is geometrically coupled (i.e. faces and.
const label nErode_
Number of layers to erode.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
T lookupOrDefault(const word &, const T &, bool recursive=false, bool patternMatch=true) const
Find and return a T,.
Ostream & endl(Ostream &os)
Add newline and flush stream.
setAction
Enumeration defining the valid actions.
Mesh consisting of general polyhedral cells.
regionToCell(const polyMesh &mesh, const word &setName, const pointField &insidePoints, const label nErode)
Construct from components.
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
bool found(const word &, bool recursive=false, bool patternMatch=true) const
Search dictionary for given keyword.
Pre-declare SubField and related Field type.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
A patch is a list of labels that address the faces in the global face list.
const word setName_
Name of cellSet to keep to.
void erode(boolList &selectedCell) const
Erode a given number of layers from selectedCell. Remove any.
This class separates the mesh into distinct unconnected regions, each of which is then given a label ...
General set of labels of mesh quantity (points, cells, faces).
label nRegions() const
Return total number of regions.
A list of keyword definitions, which are a keyword followed by any number of values (e....
void add(FieldField< Field1, typename typeOfSum< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
void combine(topoSet &set, const bool add) const
Macros for easy insertion into run-time selection tables.
virtual void applyToSet(const topoSetSource::setAction action, topoSet &) const
Base class of a source for a topoSet.
const labelUList & faceCells() const
Return face-cell addressing.
A collection of cell labels.
label start() const
Return start label of this patch in the polyMesh face list.
static addToUsageTable usage_
Add usage string.
errorManipArg< error, int > exit(error &err, const int errNo=1)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
void shrinkRegions(boolList &selectedCell) const
Unselect one layer of cells from selectedCell.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
label readLabel(Istream &is)
A face is a list of labels corresponding to mesh vertices.
defineTypeNameAndDebug(combustionModel, 0)
virtual ~regionToCell()
Destructor.
void addOrDelete(topoSet &set, const label cellI, const bool) const
Add (if bool) cellI to set or delete cellI from set.