72 void writeSet(
const cellSet& cells,
const string& msg)
74 Info<<
"Writing " << msg <<
" (" << cells.
size() <<
") to cellSet " 100 const bool selectCut,
101 const bool selectInside,
102 const bool selectOutside,
103 const scalar nearDist,
121 writeSet(inside,
"inside cells");
125 writeSet(outside,
"outside cells");
129 writeSet(cutCells,
"cells cut by surface");
140 label cType = cellType[celli];
146 cellType[celli] = MESH;
150 cellType[celli] = NONMESH;
157 cellType[celli] = MESH;
161 cellType[celli] = NONMESH;
168 cellType[celli] = MESH;
172 cellType[celli] = NONMESH;
178 <<
"Multiple mesh regions in original mesh" << endl
179 <<
"Please use splitMeshRegions to separate these" 187 Info<<
"Removing cells with points closer than " << nearDist
188 <<
" to the surface ..." <<
nl <<
endl;
197 const point& pt = pts[pointi];
207 if (cellType[pCells[i]] != NONMESH)
209 cellType[pCells[i]] = NONMESH;
238 Info<<
"Removed " << nRemoved <<
" cells since too close to surface" 247 label selectOutsideCells
269 forAll(outsidePts, outsidePtI)
272 label celli = queryMesh.
findCell(outsidePts[outsidePtI], -1,
false);
274 if (celli != -1 && cellType[celli] == MESH)
276 Info<<
"Marking cell " << celli <<
" containing outside point " 277 << outsidePts[outsidePtI] <<
" with type " << cellType[celli]
288 label facei = cFaces[i];
290 if (outsideFacesMap.insert(facei))
292 outsideFaces.
append(facei);
293 outsideFacesInfo.append(meshInfo);
304 outsideFacesInfo.shrink(),
314 forAll(allCellInfo, celli)
316 if (cellType[celli] == MESH)
320 if (allCellInfo[celli].
type() != MESH)
322 cellType[celli] = NONMESH;
333 int main(
int argc,
char *argv[])
357 fileName surfName(refineDict.lookup(
"surface"));
358 pointField outsidePts(refineDict.lookup(
"outsidePoints"));
359 bool useSurface(
readBool(refineDict.lookup(
"useSurface")));
360 bool selectCut(
readBool(refineDict.lookup(
"selectCut")));
361 bool selectInside(
readBool(refineDict.lookup(
"selectInside")));
362 bool selectOutside(
readBool(refineDict.lookup(
"selectOutside")));
363 scalar nearDist(
readScalar(refineDict.lookup(
"nearDistance")));
368 Info<<
"Cells to be used for meshing (0=false, 1=true):" <<
nl 369 <<
" cells cut by surface : " << selectCut <<
nl 370 <<
" cells inside of surface : " << selectInside <<
nl 371 <<
" cells outside of surface : " << selectOutside <<
nl 372 <<
" cells with points further than : " << nearDist <<
nl 377 Info<<
"Cells to be used for meshing (0=false, 1=true):" <<
nl 378 <<
" cells reachable from outsidePoints:" << selectOutside <<
nl 383 (void)edgeCalc.minLen(
Info);
389 forAll(outsidePts, outsideI)
391 const point& outsidePoint = outsidePts[outsideI];
397 <<
"outsidePoint " << outsidePoint
398 <<
" is not inside any cell" 426 surf().writeStats(
Info);
452 label nHanging, nRegionEdges, nRegionPoints, nOutside;
456 Info<<
"Removing cells which after subsetting would have all points" 457 <<
" on outside ..." <<
nl <<
endl;
467 Info<<
"Removing edges connecting cells unconnected by faces ..." 478 Info<<
"Removing points connecting cells unconnected by faces ..." 494 nOutside = selectOutsideCells
506 || nRegionPoints != 0
511 getType(cellType, MESH, selectedCells);
513 writeSet(selectedCells,
"cells selected for meshing");
Various (local, not parallel) searches on polyMesh; uses (demand driven) octree to search...
#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.
errorManipArg< error, int > exit(error &err, const int errNo=1)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
bool hit() const
Is there a hit.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
void size(const label)
Override size to be inconsistent with allocated storage.
Ostream & endl(Ostream &os)
Add newline and flush stream.
static void noParallel()
Remove the parallel options.
const indexedOctree< treeDataTriSurface > & tree() const
Demand driven construction of the octree.
This class describes the interaction of (usually) a face and a point. It carries the info of a succes...
label size() const
Return number of elements in table.
label findCell(const point &location, const label seedCelli=-1, const bool useTreeSearch=true) const
Find cell containing location.
Holds information regarding type of cell. Used in inside/outside determination in cellClassification...
const cellList & cells() const
virtual const pointField & points() const
Return raw points.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Helper class to search on triSurface.
const labelListList & pointCells() const
'Cuts' a mesh with a surface.
const List< Type > & allCellInfo() const
Get allCellInfo.
void append(const T &)
Append an element at the end of the list.
label fillRegionPoints(const label meshType, const label fillType, const label maxIter)
Find regionPoints and fill all neighbours. Iterate until nothing.
const fileName & local() const
bool readScalar(const char *buf, doubleScalar &s)
Read whole of buf as a scalar. Return true if succesful.
const globalMeshData & globalData() const
Return parallel info.
Helper class to calculate minimum edge length on mesh.
Non-pointer based hierarchical recursive searching.
fileName::Type type(const fileName &)
Return the file type: DIRECTORY or FILE.
A collection of cell labels.
virtual bool write() const
Write using setting from DB.
label fillRegionEdges(const label meshType, const label fillType, const label maxIter)
Find regionEdges and fill one neighbour. Iterate until nothing.
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...
Mesh consisting of general polyhedral cells.
Triangulated surface description with patch information.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
label fillHangingCells(const label meshType, const label fillType, const label maxIter)
Find hanging cells (cells with all points on outside) and set their.
const fileName & instance() const
label nTotalCells() const
Return total number of cells in decomposed mesh.
const word & name() const
Return name.
void shrink()
Shrink the allocated table to approx. twice number of elements.