Use of the Connect Module
In all mesh generation modules the generated mesh is output in a Connect object. This object contains the generated node coordinates and element connectivity, topology, material number, etc. All generated nodes and elements are appended to any nodes and elements already existing in the specified Connect object. The Connect module contains access functions to retrieve the generated node and element information. The following code fragment illustrates the basic process:
vis_Connect *connect;
Vint numnp, numel;
Vint shape, maxi,maxj,maxk;
Vint nix, ix[27];
Vdouble x[3];
/* print generated nodes and elements */
vis_ConnectNumber (connect,SYS_NODE,&numnp);
vis_ConnectNumber (connect,SYS_ELEM,&numel);
printf("numnp= %d, numel= %d\n",numnp,numel);
/* print node information */
printf("Node information\n");
for(i = 1; i <= numnp; i++) {
vis_ConnectCoordsdv (connect,1,&i,(Vdouble(*)[3])x);
printf("id= %d x= %f, y= %f, z= %f\n",i,x[0],x[1],x[2]);
}
/* print element information */
printf("Element information\n");
for(i = 1; i <= numel; i++) {
/* topology */
vis_ConnectTopology (connect,i,&shape,&maxi,&maxj,&maxk);
if(shape == VIS_SHAPEPOINT) printf("id= %d POINT ix=",i);
if(shape == VIS_SHAPELINE) printf("id= %d LINE ix=",i);
if(shape == VIS_SHAPETRI) printf("id= %d TRI ix=",i);
if(shape == VIS_SHAPEQUAD) printf("id= %d QUAD ix=",i);
if(shape == VIS_SHAPETET) printf("id= %d TET ix=",i);
if(shape == VIS_SHAPEPYR) printf("id= %d PYR ix=",i);
if(shape == VIS_SHAPEWED) printf("id= %d WED ix=",i);
if(shape == VIS_SHAPEHEX) printf("id= %d HEX ix=",i);
/* connectivity */
vis_ConnectElemNode (connect,i,&nix,ix);
for(j = 0; j < nix; j++) {
printf(" %d",ix[j]);
}
printf("\n");
}