49int main(
int argc,
char *argv[])
53 "Find nearest face and vertex."
54 " Uses a zero origin unless otherwise specified"
67 args.getOrDefault<scalar>(
"x", 0),
68 args.getOrDefault<scalar>(
"y", 0),
69 args.getOrDefault<scalar>(
"z", 0)
71 Info<<
"Looking for nearest face/vertex to " << samplePt <<
endl;
81 const pointField& localPoints = surf1.localPoints();
84 scalar minDist = GREAT;
86 forAll(localPoints, pointi)
88 const scalar dist =
mag(localPoints[pointi] - samplePt);
96 Info<<
"Nearest vertex:" <<
nl
97 <<
" index : " << minIndex <<
" (in localPoints)" <<
nl
98 <<
" index : " << surf1.meshPoints()[minIndex]
99 <<
" (in points)" <<
nl
100 <<
" coordinates: " << localPoints[minIndex] <<
nl
116 const scalar dist =
mag(centre - samplePt);
124 const face&
f = surf1[minIndex];
126 Info<<
"Face with nearest centre:" <<
nl
127 <<
" index : " << minIndex <<
nl
128 <<
" centre : " <<
f.centre(
points) <<
nl
129 <<
" face : " <<
f <<
nl
130 <<
" vertex coords:" <<
endl;
137 const List<surfZone>& surfZones = surf1.surfZones();
141 if (minIndex >= surfZones[zonei].start())
const Vector< Cmpt > & centre(const Foam::UList< Vector< Cmpt > > &) const noexcept
Return this (for point which is a typedef to Vector<scalar>).
Extract command arguments and options from the supplied argc and argv parameters.
static void addArgument(const string &argName, const string &usage="")
Append a (mandatory) argument to validArgs.
static void noParallel()
Remove the parallel options.
static void addOption(const word &optName, const string ¶m="", const string &usage="", bool advanced=false)
Add an option to validOptions with usage information.
static void addNote(const string ¬e)
Add extra notes for the usage information.
A face is a list of labels corresponding to mesh vertices.
A class for handling file names.
A surface zone on a MeshedSurface.
messageStream Info
Information stream (stdout output on master, null elsewhere).
Ostream & endl(Ostream &os)
Add newline and flush stream.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
MeshedSurface< face > meshedSurface
vector point
Point is a vector.
vectorField pointField
pointField is a vectorField.
constexpr char nl
The newline '\n' character (0x0a).
Foam::argList args(argc, argv)
#define forAll(list, i)
Loop across all elements in list.