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" 70 void 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)
123 const polyMesh&
mesh,
177 Info<<
" Adding points nearest to " << points_ <<
endl;
186 Info<<
" Removing points nearest to " << points_ <<
endl;
List< ReturnType > get(const UPtrList< T > &list, const AccessOp &aop)
List of values generated by applying the access operation to each list item.
void size(const label n)
Older name for setAddressableSize.
The topoSetPointSource is a intermediate class for handling topoSet sources for selecting points...
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Create a new set and ADD elements to it.
nearestToPoint(const polyMesh &mesh, const pointField &points)
Construct from components, copying points.
Add elements to current set.
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.
PointIndexHit< point > pointIndexHit
A PointIndexHit with a 3D point.
static int myProcNo(const label communicator=worldComm)
Rank of this process in the communicator (starting from masterNo()). Can be negative if the process i...
void addOrDelete(topoSet &set, const label id, const bool add) const
Add or delete id from set. Add when 'add' is true.
Macros for easy insertion into run-time selection tables.
addNamedToRunTimeSelectionTable(topoSetCellSource, badQualityToCell, word, badQuality)
virtual const pointField & points() const
Return raw points.
#define forAll(list, i)
Loop across all elements in list.
AccessType combine(const UList< T > &lists, AccessOp aop=accessOp< T >())
Combines sub-lists into a single list.
vectorField pointField
pointField is a vectorField.
setAction
Enumeration defining various actions.
const polyMesh & mesh_
Reference to the mesh.
void add(FieldField< Field1, typename typeOfSum< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
defineTypeNameAndDebug(combustionModel, 0)
virtual void applyToSet(const topoSetSource::setAction action, topoSet &set) const
Apply specified action to the topoSet.
General set of labels of mesh quantity (points, cells, faces).
Subtract elements from current set.
vector point
Point is a vector.
Class with constructor to add usage string to table.
messageStream Info
Information stream (stdout output on master, null elsewhere)
Mesh consisting of general polyhedral cells.
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
addToRunTimeSelectionTable(functionObject, pointHistory, dictionary)
static void listCombineReduce(List< T > &values, const CombineOp &cop, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Combines List elements. After completion all processors have the same data.