73static const label MESH = cellClassification::INSIDE;
74static const label NONMESH = cellClassification::OUTSIDE;
79 Info<<
"Writing " << msg <<
" (" <<
cells.size() <<
") to cellSet "
105 const bool selectCut,
106 const bool selectInside,
107 const bool selectOutside,
108 const scalar nearDist,
125 getType(cellType, cellClassification::INSIDE, inside);
126 writeSet(inside,
"inside cells");
129 getType(cellType, cellClassification::OUTSIDE, outside);
130 writeSet(outside,
"outside cells");
133 getType(cellType, cellClassification::CUT, cutCells);
134 writeSet(cutCells,
"cells cut by surface");
147 if (cType == cellClassification::CUT)
158 else if (cType == cellClassification::INSIDE)
169 else if (cType == cellClassification::OUTSIDE)
183 <<
"Multiple mesh regions in original mesh" <<
endl
184 <<
"Please use splitMeshRegions to separate these"
192 Info<<
"Removing cells with points closer than " << nearDist
193 <<
" to the surface ..." <<
nl <<
endl;
202 const point& pt = pts[pointi];
212 if (cellType[pCells[i]] != NONMESH)
243 Info<<
"Removed " << nRemoved <<
" cells since too close to surface"
252label selectOutsideCells
274 forAll(outsidePts, outsidePtI)
277 label celli = queryMesh.
findCell(outsidePts[outsidePtI], -1,
false);
279 if (celli != -1 && cellType[celli] == MESH)
281 Info<<
"Marking cell " << celli <<
" containing outside point "
282 << outsidePts[outsidePtI] <<
" with type " <<
cellType[celli]
293 label facei = cFaces[i];
295 if (outsideFacesMap.insert(facei))
297 outsideFaces.
append(facei);
298 outsideFacesInfo.append(meshInfo);
308 outsideFaces.shrink(),
309 outsideFacesInfo.shrink(),
310 mesh.globalData().nTotalCells()+1
319 forAll(allCellInfo, celli)
321 if (cellType[celli] == MESH)
325 if (allCellInfo[celli].
type() != MESH)
338int main(
int argc,
char *argv[])
342 "Select cells in relation to surface"
345 argList::noParallel();
362 IOobject::MUST_READ_IF_MODIFIED,
368 pointField outsidePts(refineDict.lookup(
"outsidePoints"));
369 const bool useSurface(refineDict.get<
bool>(
"useSurface"));
370 const bool selectCut(refineDict.get<
bool>(
"selectCut"));
371 const bool selectInside(refineDict.get<
bool>(
"selectInside"));
372 const bool selectOutside(refineDict.get<
bool>(
"selectOutside"));
373 const scalar nearDist(refineDict.get<scalar>(
"nearDistance"));
378 Info<<
"Cells to be used for meshing (0=false, 1=true):" <<
nl
379 <<
" cells cut by surface : " << selectCut <<
nl
380 <<
" cells inside of surface : " << selectInside <<
nl
381 <<
" cells outside of surface : " << selectOutside <<
nl
382 <<
" cells with points further than : " << nearDist <<
nl
387 Info<<
"Cells to be used for meshing (0=false, 1=true):" <<
nl
388 <<
" cells reachable from outsidePoints:" << selectOutside <<
nl
393 (void)edgeCalc.minLen(Info);
399 forAll(outsidePts, outsideI)
401 const point& outsidePoint = outsidePts[outsideI];
403 label celli = queryMesh.
findCell(outsidePoint, -1,
false);
407 <<
"outsidePoint " << outsidePoint
408 <<
" is not inside any cell"
421 cellClassification::MESH
431 surf.writeStats(Info);
456 label nHanging, nRegionEdges, nRegionPoints, nOutside;
460 Info<<
"Removing cells which after subsetting would have all points"
461 <<
" on outside ..." <<
nl <<
endl;
463 nHanging =
cellType.fillHangingCells
471 Info<<
"Removing edges connecting cells unconnected by faces ..."
474 nRegionEdges =
cellType.fillRegionEdges
482 Info<<
"Removing points connecting cells unconnected by faces ..."
485 nRegionPoints =
cellType.fillRegionPoints
498 nOutside = selectOutsideCells
510 || nRegionPoints != 0
515 getType(cellType, MESH, selectedCells);
517 writeSet(selectedCells,
"cells selected for meshing");
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Defines the attributes of an object for which implicit objectRegistry management is supported,...
void append(const T &val)
Append an element at the end of the list.
This class describes the interaction of (usually) a face and a point. It carries the info of a succes...
bool hit() const noexcept
Is there a hit?
void size(const label n)
Older name for setAddressableSize.
'Cuts' a mesh with a surface.
Holds information regarding type of cell. Used in inside/outside determination in cellClassification.
A collection of cell labels.
Helper class to calculate minimum edge length on mesh.
A class for handling file names.
Non-pointer based hierarchical recursive searching.
Various (local, not parallel) searches on polyMesh; uses (demand driven) octree to search.
label findCell(const point &location, const label seedCelli=-1, const bool useTreeSearch=true) const
Find cell containing location.
Mesh consisting of general polyhedral cells.
Helper class to search on triSurface.
const indexedOctree< treeDataTriSurface > & tree() const
Demand driven construction of the octree.
Triangulated surface description with patch information.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
void set(List< bool > &bools, const labelUList &locations)
Set the listed locations (assign 'true').
cellType
Equivalent to enumeration in "vtkCellType.h" (should be uint8_t)
dimensionedSymmTensor sqr(const dimensionedVector &dv)
messageStream Info
Information stream (stdout output on master, null elsewhere)
Ostream & endl(Ostream &os)
Add newline and flush stream.
T returnReduce(const T &value, const BinaryOp &bop, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Reduce (copy) and return value.
errorManipArg< error, int > exit(error &err, const int errNo=1)
constexpr char nl
The newline '\n' character (0x0a)
#define forAll(list, i)
Loop across all elements in list.