62 nearestToPoint::typeName,
63 "\n Usage: nearestToPoint (pt0 .. ptn)\n\n"
64 " Select the nearest point for each of the points pt0 ..ptn\n\n"
70void Foam::nearestToPoint::combine(topoSet& set,
const bool add)
const
73 List<mappedPatchBase::nearInfo> nearest(points_.
size());
83 scalar minDistSqr =
magSqr(
pts[minPointi] - points_[pointi]);
85 for (label i = 1; i <
pts.size(); i++)
87 scalar distSqr =
magSqr(
pts[i] - points_[pointi]);
89 if (distSqr < minDistSqr)
97 nearest[pointi].first() =
pointIndexHit(
true, minPt, minPointi);
98 nearest[pointi].second() = Tuple2<scalar, label>
100 magSqr(minPt-points_[pointi]),
109 for (
const auto& near : nearest)
139 points_(std::move(
points))
177 Info<<
" Adding points nearest to " << points_ <<
endl;
186 Info<<
" Removing points nearest to " << points_ <<
endl;
Macros for easy insertion into run-time selection tables.
#define addNamedToRunTimeSelectionTable(baseType, thisType, argNames, lookupName)
Add to construction table with 'lookupName' as the key.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
static void listCombineReduce(UList< T > &values, CombineOp cop, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Forwards to Pstream::listReduce with an in-place cop.
void size(const label n)
Older name for setAddressableSize.
static int myProcNo(const label communicator=worldComm)
Rank of this process in the communicator (starting from masterNo()). Negative if the process is not a...
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
A topoSetPointSource to select points nearest to given points.
virtual void applyToSet(const topoSetSource::setAction action, topoSet &set) const
Apply specified action to the topoSet.
nearestToPoint(const polyMesh &mesh, const pointField &points)
Construct from components, copying points.
Mesh consisting of general polyhedral cells.
virtual const pointField & points() const
Return raw points.
The topoSetPointSource is a intermediate class for handling topoSet sources for selecting points.
topoSetPointSource(const polyMesh &mesh)
Construct from mesh.
Class with constructor to add usage string to table.
Base class of a source for a topoSet.
void addOrDelete(topoSet &set, const label id, const bool add) const
Add or delete id from set. Add when 'add' is true.
setAction
Enumeration defining various actions.
@ SUBTRACT
Subtract elements from current set.
@ ADD
Add elements to current set.
@ NEW
Create a new set and ADD elements to it.
bool verbose_
Output verbosity (default: true).
const polyMesh & mesh() const noexcept
Reference to the mesh.
const polyMesh & mesh_
Reference to the mesh.
static Istream & checkIs(Istream &is)
Check state of stream.
General set of labels of mesh quantity (points, cells, faces).
A class for handling words, derived from Foam::string.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
messageStream Info
Information stream (stdout output on master, null elsewhere).
Ostream & endl(Ostream &os)
Add newline and flush stream.
void add(DimensionedField< scalar, GeoMesh > &result, const dimensioned< scalar > &dt1, const DimensionedField< scalar, GeoMesh > &f2)
vector point
Point is a vector.
vectorField pointField
pointField is a vectorField.
PointIndexHit< point > pointIndexHit
A PointIndexHit with a 3D point.
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
dict add("bounds", meshBb)
#define forAll(list, i)
Loop across all elements in list.