Go to the documentation of this file.
29 #include "triSurface.H"
48 surfaceToCell::typeName,
49 "\n Usage: surfaceToCell"
50 "<surface> <outsidePoints> <cut> <inside> <outside> <near> <curvature>\n\n"
51 " <surface> name of triSurface\n"
52 " <outsidePoints> list of points that define outside\n"
53 " <cut> boolean whether to include cells cut by surface\n"
54 " <inside> ,, ,, inside surface\n"
55 " <outside> ,, ,, outside surface\n"
56 " <near> scalar; include cells with centre <= near to surface\n"
57 " <curvature> scalar; include cells close to strong curvature"
59 " (curvature defined as difference in surface normal at nearest"
60 " point on surface for each vertex of cell)\n\n"
77 if (iter != cache.end())
90 cache.insert(pointI, triI);
103 const label cellTriI,
118 const face&
f = faces[cFaces[cFaceI]];
134 if (pointTriI != -1 && pointTriI != cellTriI)
136 scalar cosAngle = normals[pointTriI] & normals[cellTriI];
161 Info<<
" Marked inside/outside using surface orientation in = "
198 <<
"outsidePoint " << outsidePoint
199 <<
" is not inside any cell"
215 Info<<
" Marked inside/outside using surface intersection in = "
221 label cType = cellType[cellI];
259 Info<<
" Selecting cells with cellCentre closer than "
266 const point&
c = ctrs[cellI];
276 Info<<
" Determined nearest surface point in = "
284 Info<<
" Selecting cells with cellCentre closer than "
285 <<
nearDist_ <<
" to surface and curvature factor"
293 const point&
c = ctrs[cellI];
316 Info<<
" Determined nearest surface point in = "
330 (includeCut_ && includeInside_ && includeOutside_)
331 || (!includeCut_ && !includeInside_ && !includeOutside_)
336 <<
"Illegal include cell specification."
337 <<
" Result would be either all or no cells." <<
endl
338 <<
"Please set one of includeCut, includeInside, includeOutside"
339 <<
" to true, set nearDistance to a value > 0"
340 <<
" or set curvature to a value -1 .. 1."
344 if (useSurfaceOrientation_ && includeCut_)
347 <<
"Illegal include cell specification."
348 <<
" You cannot specify both 'useSurfaceOrientation'"
349 <<
" and 'includeCut'"
350 <<
" since 'includeCut' specifies a topological split"
363 const bool includeCut,
364 const bool includeInside,
365 const bool includeOutside,
366 const bool useSurfaceOrientation,
367 const scalar nearDist,
368 const scalar curvature
373 outsidePoints_(outsidePoints),
374 includeCut_(includeCut),
375 includeInside_(includeInside),
376 includeOutside_(includeOutside),
377 useSurfaceOrientation_(useSurfaceOrientation),
379 curvature_(curvature),
395 const bool includeCut,
396 const bool includeInside,
397 const bool includeOutside,
398 const bool useSurfaceOrientation,
399 const scalar nearDist,
400 const scalar curvature
405 outsidePoints_(outsidePoints),
406 includeCut_(includeCut),
407 includeInside_(includeInside),
408 includeOutside_(includeOutside),
409 useSurfaceOrientation_(useSurfaceOrientation),
411 curvature_(curvature),
413 querySurfPtr_(&querySurf),
432 useSurfaceOrientation_
453 surfName_(checkIs(is)),
454 outsidePoints_(checkIs(is)),
456 includeInside_(
readBool(checkIs(is))),
457 includeOutside_(
readBool(checkIs(is))),
458 useSurfaceOrientation_(
false),
491 Info<<
" Adding cells in relation to surface " << surfName_
498 Info<<
" Removing cells in relation to surface " << surfName_
Starts timing CPU usage and return elapsed time from start.
void checkSettings() const
Check values at construction time.
label index() const
Return index.
Various (local, not parallel) searches on polyMesh; uses (demand driven) octree to search.
A class for handling file names.
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
const scalar nearDist_
If > 0 : include cells with distance from cellCentre to surface.
#define forAll(list, i)
Loop across all elements in list.
pointIndexHit nearest(const point &, const vector &span) const
Calculate nearest point on surface for single searchPoint. Returns.
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
Template functions to aid in the implementation of demand driven data.
AccessType combine(const List< T > &, AccessOp aop=accessOp< T >())
Combines sublists into one big list.
static label getNearest(const triSurfaceSearch &querySurf, const label pointI, const point &pt, const vector &searchSpan, Map< label > &cache)
Find index of nearest triangle to point. Returns triangle or -1 if.
Class with constructor to add usage string to table.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
bool hit() const
Is there a hit.
T lookupOrDefault(const word &, const T &, bool recursive=false, bool patternMatch=true) const
Find and return a T,.
void combine(topoSet &set, const bool add) const
Depending on surface add to or delete from cellSet.
Ostream & endl(Ostream &os)
Add newline and flush stream.
setAction
Enumeration defining the valid actions.
const bool includeCut_
Include cut cells.
dimensioned< scalar > mag(const dimensioned< Type > &)
Helper class to search on triSurface.
Mesh consisting of general polyhedral cells.
bool differingPointNormals(const triSurfaceSearch &querySurf, const vector &span, const label cellI, const label cellTriI, Map< label > &pointToNearest) const
Return true if surface normal of nearest points to vertices on.
void deleteDemandDrivenData(DataPtr &dataPtr)
const scalar curvature_
If > -1 : include cells with normals at nearest surface points.
This class describes the interaction of (usually) a face and a point. It carries the info of a succes...
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.
Triangulated surface description with patch information.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
const Point & hitPoint() const
Return hit point.
General set of labels of mesh quantity (points, cells, faces).
const bool includeInside_
Include inside cells.
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)
Macros for easy insertion into run-time selection tables.
static addToUsageTable usage_
Add usage string.
Base class of a source for a topoSet.
'Cuts' a mesh with a surface.
const bool useSurfaceOrientation_
Determine inside/outside purely using geometric test.
errorManipArg< error, int > exit(error &err, const int errNo=1)
const vectorField & cellCentres() const
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
bool readScalar(const char *buf, doubleScalar &s)
Read whole of buf as a scalar. Return true if succesful.
const Field< PointType > & faceNormals() const
Return face normals for patch.
const bool includeOutside_
Include outside cells.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
label findCell(const point &location, const label seedCellI=-1, const bool useTreeSearch=true) const
Find cell containing location.
surfaceToCell(const polyMesh &mesh, const fileName &surfName, const pointField &outsidePoints, const bool includeCut, const bool includeInside, const bool includeOutside, const bool useSurfaceOrientation, const scalar nearDist, const scalar curvature)
Construct from components.
string & expand(const bool allowEmpty=false)
Expand initial tildes and all occurences of environment variables.
Implements a timeout mechanism via sigalarm.
const triSurface & surface() const
Return reference to the surface.
const dimensionedScalar c
Speed of light in a vacuum.
A face is a list of labels corresponding to mesh vertices.
const pointField outsidePoints_
Points which are outside.
const triSurfaceSearch & querySurf() const
defineTypeNameAndDebug(combustionModel, 0)
void addOrDelete(topoSet &set, const label cellI, const bool) const
Add (if bool) cellI to set or delete cellI from set.
virtual ~surfaceToCell()
Destructor.
virtual void applyToSet(const topoSetSource::setAction action, topoSet &) const