/*\file NodeConnectivity.c
 *\brief: build node connectivity from elements. 
 */

#include "./NodeConnectivity.h"

void NodeConnectivityUsage(void){/*{{{*/
	_pprintLine_("");
	_pprintLine_("   usage: connectivity = " << __FUNCT__ << "(elements, numnodes);");
	_pprintLine_("");
}/*}}}*/
WRAPPER(NodeConnectivity){

	/*inputs: */
	double* elements=NULL;
	int     nel;
	int     nods;

	/*outputs: */
	double* connectivity=NULL;
	int     width;

	/*Boot module: */
	MODULEBOOT();

	/*checks on arguments: */
	CHECKARGUMENTS(NLHS,NRHS,&NodeConnectivityUsage);
        
	/*Input datasets: */
	FetchData(&elements,&nel,NULL,ELEMENTS);
	FetchData(&nods,NUMNODES);

	/*!Generate internal degree of freedom numbers: */
	NodeConnectivityx(&connectivity, &width,elements,nel, nods);

	/*write output datasets: */
	WriteData(CONNECTIVITY,connectivity,nods,width);

	/*end module: */
	MODULEEND();
}
