45 surfaceToPoint::typeName,
46 "\n Usage: surfaceToPoint <surface> <near> <inside> <outside>\n\n" 47 " <surface> name of triSurface\n" 48 " <near> scalar; include points with coordinate <= near to surface\n" 49 " <inside> boolean; whether to include points on opposite side of" 51 " <outside> boolean; whether to include points on this side of" 58 void Foam::surfaceToPoint::combine(topoSet&
set,
const bool add)
const 62 triSurface surf(surfName_);
64 Info<<
" Read surface from " << surfName_
65 <<
" in = "<< timer.cpuTimeIncrement() <<
" s" << endl <<
endl;
68 triSurfaceSearch querySurf(surf);
70 if (includeInside_ || includeOutside_)
72 boolList pointInside(querySurf.calcInside(mesh_.points()));
74 forAll(pointInside, pointi)
76 bool isInside = pointInside[pointi];
78 if ((isInside && includeInside_) || (!isInside && includeOutside_))
80 addOrDelete(
set, pointi, add);
90 const vector span(nearDist_, nearDist_, nearDist_);
94 const point& pt = meshPoints[pointi];
98 if (inter.hit() && (
mag(inter.hitPoint() - pt) < nearDist_))
100 addOrDelete(
set, pointi, add);
107 void Foam::surfaceToPoint::checkSettings()
const 109 if (nearDist_ < 0 && !includeInside_ && !includeOutside_)
112 <<
"Illegal point selection specification." 113 <<
" Result would be either all or no points." << endl
114 <<
"Please set one of includeInside or includeOutside" 115 <<
" to true, set nearDistance to a value > 0" 127 const scalar nearDist,
128 const bool includeInside,
129 const bool includeOutside
135 includeInside_(includeInside),
136 includeOutside_(includeOutside)
150 nearDist_(dict.
lookup<scalar>(
"nearDistance")),
165 surfName_(checkIs(is)),
167 includeInside_(
readBool(checkIs(is))),
168 includeOutside_(
readBool(checkIs(is)))
190 Info<<
" Adding points in relation to surface " << surfName_
197 Info<<
" Removing points in relation to surface " << surfName_
#define forAll(list, i)
Loop across all elements in list.
string expand(const string &, const HashTable< string, word, string::hash > &mapping, const char sigil='$')
Expand occurrences of variables according to the mapping.
A class for handling file names.
errorManipArg< error, int > exit(error &err, const int errNo=1)
A list of keyword definitions, which are a keyword followed by any number of values (e...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Ostream & endl(Ostream &os)
Add newline and flush stream.
virtual ~surfaceToPoint()
Destructor.
PointIndexHit< point > pointIndexHit
Vector< scalar > vector
A scalar version of the templated Vector.
surfaceToPoint(const polyMesh &mesh, const fileName &surfName, const scalar nearDist, const bool includeInside, const bool includeOutside)
Construct from components.
AccessType combine(const List< T > &, AccessOp aop=accessOp< T >())
Combines sublists into one big list.
Macros for easy insertion into run-time selection tables.
Base class of a source for a topoSet.
List< bool > boolList
Bool container classes.
vectorField pointField
pointField is a vectorField.
setAction
Enumeration defining the valid actions.
bool readScalar(const char *buf, doubleScalar &s)
Read whole of buf as a scalar. Return true if successful.
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
virtual void applyToSet(const topoSetSource::setAction action, topoSet &) const
defineTypeNameAndDebug(combustionModel, 0)
General set of labels of mesh quantity (points, cells, faces).
vector point
Point is a vector.
Class with constructor to add usage string to table.
dimensioned< scalar > mag(const dimensioned< Type > &)
Mesh consisting of general polyhedral cells.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.