Changeset 14016
- Timestamp:
- 11/27/12 12:04:54 (12 years ago)
- Location:
- issm/trunk-jpl/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/modules/NodeConnectivityx/NodeConnectivityx.cpp
r13622 r14016 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; … … 29 29 int num_elements; 30 30 int already_plugged=0; 31 double element; 32 33 /*output: */ 34 double* connectivity=NULL; 31 int element; 35 32 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; … … 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 } … … 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 -
issm/trunk-jpl/src/c/modules/NodeConnectivityx/NodeConnectivityx.h
r13623 r14016 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 */ -
issm/trunk-jpl/src/wrappers/NodeConnectivity/NodeConnectivity.cpp
r13236 r14016 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: */ … … 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: */
Note:
See TracChangeset
for help on using the changeset viewer.