gmsh-TingyuanDoc
0.1
An Open-Source Timing-driven Analytical Mixed-size FPGA Placer
|
Go to the documentation of this file.
6 #include "GmshConfig.h"
26 return "Plugin(NearestNeighbor) computes the distance from each "
27 "point in `View' to its nearest neighbor.\n\n"
28 "If `View' < 0, the plugin is run on the current view.\n\n"
29 "Plugin(NearestNeighbor) is executed in-place.";
52 Msg::Error(
"View[%d] contains no points", iView);
57 ANNpointArray zeronodes = annAllocPts(totpoints, 3);
63 if(numNodes != 1)
continue;
64 data1->
getNode(step, ent, ele, 0, zeronodes[k][0], zeronodes[k][1],
69 ANNkd_tree *kdtree =
new ANNkd_tree(zeronodes, totpoints, 3);
70 ANNidxArray index =
new ANNidx[2];
71 ANNdistArray dist =
new ANNdist[2];
78 if(numNodes != 1)
continue;
80 data1->
getNode(step, ent, ele, 0, xyz[0], xyz[1], xyz[2]);
81 kdtree->annkSearch(xyz, 2, index, dist);
82 data1->
setValue(step, ent, ele, 0, 0, sqrt(dist[1]));
87 annDeallocPts(zeronodes);
91 Msg::Error(
"Nearest neighbor computation requires ANN");
virtual bool skipElement(int step, int ent, int ele, bool checkVisibility=false, int samplingRate=1)
virtual void setValue(int step, int ent, int ele, int nod, int comp, double val)
virtual int getNode(int step, int ent, int ele, int nod, double &x, double &y, double &z)
static void Error(const char *fmt,...)
virtual int getNumPoints(int step=-1)
virtual int getNumEntities(int step=-1)
StringXNumber * getOption(int iopt)
void setChanged(bool val)
PViewData * getData(bool useAdaptiveIfAvailable=false)
virtual int getNumNodes(int step, int ent, int ele)
virtual void setName(const std::string &val)
GMSH_Plugin * GMSH_RegisterNearestNeighborPlugin()
virtual PView * getView(int index, PView *view)
virtual int getNumElements(int step=-1, int ent=-1)
virtual std::string getName()
StringXNumber NearestNeighborOptions_Number[]
std::string getHelp() const
virtual bool finalize(bool computeMinMax=true, const std::string &interpolationScheme="")