/*! \file  ContourToNodesx.c
 */

#include "./ContourToNodesx.h"

int ContourToNodesx( Vec* pflags,double* x, double* y, int nods, Contour** contours,int numcontours,int edgevalue){

	int i;
	int m,n;

	/*Contour:*/
	Contour* contouri=NULL;
	int      numnodes;
	double*  xc=NULL;
	double*  yc=NULL;
	double   value;

	/*output: */
	Vec flags=NULL;

	flags=NewVec(nods);

	/*Loop through all contours: */
	for (i=0;i<numcontours;i++){
		contouri=*(contours+i);
		numnodes=contouri->nods;
		xc=contouri->x;
		yc=contouri->y;
		IsInPoly(flags,xc,yc,numnodes,x,y,0,nods,edgevalue);
	}

	/*Assemble vector: */
	VecAssemblyBegin(flags);
	VecAssemblyEnd(flags);

	/*Assign output pointers: */
	*pflags=flags;
	
	return 1;
}
