source:
issm/oecreview/Archive/13977-14063/ISSM-14015-14016.diff@
28275
Last change on this file since 28275 was 14064, checked in by , 12 years ago | |
---|---|
File size: 4.4 KB |
-
../trunk-jpl/src/c/modules/NodeConnectivityx/NodeConnectivityx.h
6 6 #define _NODECONNECTIVITYX_H 7 7 8 8 /* local prototypes: */ 9 void NodeConnectivityx( double** pconnectivity, int* pwidth,double* elements, int nel, int nods);9 void NodeConnectivityx(int** pconnectivity,int* pwidth,int* elements,int nels, int nods); 10 10 11 11 #endif /* _NODECONNECTIVITYX_H */ -
../trunk-jpl/src/c/modules/NodeConnectivityx/NodeConnectivityx.cpp
17 17 #include "../../toolkits/toolkits.h" 18 18 #include "../../EnumDefinitions/EnumDefinitions.h" 19 19 20 void NodeConnectivityx( double** pconnectivity, int* pwidth, double* elements, int nel, int nods){20 void NodeConnectivityx(int** pconnectivity,int* pwidth,int* elements, int nels, int nods){ 21 21 22 22 int i,j,n; 23 23 const int maxels=25; … … 28 28 int index; 29 29 int num_elements; 30 30 int already_plugged=0; 31 doubleelement;31 int element; 32 32 33 /*output: */34 double* connectivity=NULL;35 36 33 /*Allocate connectivity: */ 37 connectivity=xNewZeroInit<double>(nods*width);34 int* connectivity=xNewZeroInit<int>(nods*width); 38 35 39 36 /*Go through all elements, and for each elements, plug into the connectivity, all the nodes. 40 37 * If nodes are already plugged into the connectivity, skip them.: */ 41 for(n=0;n<nel ;n++){38 for(n=0;n<nels;n++){ 42 39 43 element= (double)(n+1); //matlab indexing40 element=n+1; //matlab indexing 44 41 45 42 for(i=0;i<3;i++){ 46 43 47 node= (int)*(elements+n*3+i); //already matlab indexed, elements comes directly from the workspace.44 node=elements[n*3+i]; //already matlab indexed, elements comes directly from the workspace. 48 45 index=node-1; 49 46 50 num_elements= (int)*(connectivity+width*index+maxels); //retrieve number of elements already plugged into the connectivity of this node.47 num_elements=connectivity[width*index+maxels]; //retrieve number of elements already plugged into the connectivity of this node. 51 48 52 49 already_plugged=0; 53 50 for(j=0;j<num_elements;j++){ … … 59 56 if(already_plugged)break; 60 57 61 58 /*this elements is not yet plugged into the connectivity for this node, do it, and increase counter: */ 62 *(connectivity+width*index+num_elements)=element;63 *(connectivity+width*index+maxels)=(double)(num_elements+1);59 connectivity[width*index+num_elements]=element; 60 connectivity[width*index+maxels]=num_elements+1; 64 61 65 62 } 66 63 } … … 68 65 /*Last check: is the number of elements on last column of the connectivity superior to maxels? If so, then error out and 69 66 * warn the user to increase the connectivity width: */ 70 67 for(i=0;i<nods;i++){ 71 if (*(connectivity+width*i+maxels)>maxels)_error_("max connectivity width reached (" << *(connectivity+width*i+maxels) << ")! increase width of connectivity table"); 68 if (*(connectivity+width*i+maxels)>maxels) 69 _error_("max connectivity width reached (" << *(connectivity+width*i+maxels) << ")! increase width of connectivity table"); 72 70 } 73 71 74 72 /*Assign output pointers: */ -
../trunk-jpl/src/wrappers/NodeConnectivity/NodeConnectivity.cpp
12 12 WRAPPER(NodeConnectivity){ 13 13 14 14 /*inputs: */ 15 double* elements=NULL;16 int nel;17 int 15 int* elements=NULL; 16 int nels; 17 int nods; 18 18 19 19 /*outputs: */ 20 double* connectivity=NULL;21 int 20 int* connectivity=NULL; 21 int width; 22 22 23 23 /*Boot module: */ 24 24 MODULEBOOT(); … … 27 27 CHECKARGUMENTS(NLHS,NRHS,&NodeConnectivityUsage); 28 28 29 29 /*Input datasets: */ 30 FetchData(&elements,&nel ,NULL,ELEMENTS);30 FetchData(&elements,&nels,NULL,ELEMENTS); 31 31 FetchData(&nods,NUMNODES); 32 32 33 33 /*!Generate internal degree of freedom numbers: */ 34 NodeConnectivityx(&connectivity, &width,elements,nel,nods);34 NodeConnectivityx(&connectivity,&width,elements,nels,nods); 35 35 36 36 /*write output datasets: */ 37 37 WriteData(CONNECTIVITY,connectivity,nods,width);
Note:
See TracBrowser
for help on using the repository browser.