Index: /issm/trunk/src/mex/Makefile.am
===================================================================
--- /issm/trunk/src/mex/Makefile.am	(revision 7640)
+++ /issm/trunk/src/mex/Makefile.am	(revision 7641)
@@ -50,4 +50,5 @@
 				OutputResults\
 				PenaltyConstraints\
+				PointCloudFindNeighbors\
 				PropagateFlagsFromConnectivity\
 				ProcessParams\
@@ -240,4 +241,7 @@
 			  PenaltyConstraints/PenaltyConstraints.h
 
+PointCloudFindNeighbors_SOURCES = PointCloudFindNeighbors/PointCloudFindNeighbors.cpp\
+			  PointCloudFindNeighbors/PointCloudFindNeighbors.h
+
 ProcessParams_SOURCES = ProcessParams/ProcessParams.cpp\
 			  ProcessParams/ProcessParams.h
Index: /issm/trunk/src/mex/PointCloudFindNeighbors/PointCloudFindNeighbors.cpp
===================================================================
--- /issm/trunk/src/mex/PointCloudFindNeighbors/PointCloudFindNeighbors.cpp	(revision 7641)
+++ /issm/trunk/src/mex/PointCloudFindNeighbors/PointCloudFindNeighbors.cpp	(revision 7641)
@@ -0,0 +1,54 @@
+/*! \file  PointCloudFindNeighbors
+    \brief: flag points that are too near one another, within an array of point coordinates
+*/
+	
+#include "./PointCloudFindNeighbors.h"
+
+void mexFunction( int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[]) {
+
+	int i,j;
+
+	/* required input: */
+	double* x=NULL;
+	double* y=NULL;
+	int     nods;
+	double  mindistance;
+	double  multithread;
+
+	/* output: */
+	Vec  flags=NULL;
+
+	/*Boot module: */
+	MODULEBOOT();
+
+	/*checks on arguments on the matlab side: */
+	CheckNumMatlabArguments(nlhs,NLHS,nrhs,NRHS,__FUNCT__,&PointCloudFindNeighborsUsage);
+
+	
+	/*Fetch inputs: */
+	FetchData(&x,&nods,NULL,XHANDLE);
+	FetchData(&y,NULL,NULL,YHANDLE);
+	FetchData(&mindistance,MINDISTANCE);
+	FetchData(&multithread,MULTITHREAD);
+
+	/*Run core routine: */
+	PointCloudFindNeighborsx(&flags,x,y,nods,mindistance,multithread);
+
+	/* output: */
+	WriteData(FLAGS,flags);
+
+	/*end module: */
+	MODULEEND();
+
+}
+
+void PointCloudFindNeighborsUsage(void){
+	printf("   usage:\n");
+	printf("   [flags]=PointCloudFindNeighbors(x,y,mindistance,multithread);\n\n");
+	printf("   where:\n");
+	printf("      x,y: list of points.\n");
+	printf("      mindistance: minimum distance that should exist between points in the cloud.\n");
+	printf("      multithread: run multithreaded or not. with multithreads, flags can get 1 and 2 values in duplicatges.\n");
+	printf("      flags: array of flags (flag==1 means point is within mindistance of another point)\n");
+	printf("\n");
+}
Index: /issm/trunk/src/mex/PointCloudFindNeighbors/PointCloudFindNeighbors.h
===================================================================
--- /issm/trunk/src/mex/PointCloudFindNeighbors/PointCloudFindNeighbors.h	(revision 7641)
+++ /issm/trunk/src/mex/PointCloudFindNeighbors/PointCloudFindNeighbors.h	(revision 7641)
@@ -0,0 +1,42 @@
+
+/*
+	PointCloudFindNeighbors.h
+*/
+
+
+#ifndef _POINTCLOUDFINDNEIGHBORS_H
+#define _POINTCLOUDFINDNEIGHBORS_H
+
+/* local prototypes: */
+void PointCloudFindNeighborsUsage(void);
+
+#include "../../c/modules/modules.h"
+#include "../../c/Container/Container.h"
+#include "../../c/shared/shared.h"
+
+#undef __FUNCT__
+#define __FUNCT__ "PointCloudFindNeighbors"
+
+
+#ifndef ALL
+#define ALL 0
+#endif
+
+/* input macros: */
+#define XHANDLE prhs[0]
+#define YHANDLE prhs[1]
+#define MINDISTANCE prhs[2]
+#define MULTITHREAD prhs[3]
+
+/* serial output macros: */
+#define FLAGS (mxArray**)&plhs[0]
+
+/* serial arg counts: */
+#undef NLHS
+#define NLHS 1
+#undef NRHS
+#define NRHS 4
+
+
+#endif  /* _POINTCLOUDFINDNEIGHBORS_H */
+
