[14064] | 1 | Index: ../trunk-jpl/src/c/modules/NodeConnectivityx/NodeConnectivityx.h
|
---|
| 2 | ===================================================================
|
---|
| 3 | --- ../trunk-jpl/src/c/modules/NodeConnectivityx/NodeConnectivityx.h (revision 14015)
|
---|
| 4 | +++ ../trunk-jpl/src/c/modules/NodeConnectivityx/NodeConnectivityx.h (revision 14016)
|
---|
| 5 | @@ -6,6 +6,6 @@
|
---|
| 6 | #define _NODECONNECTIVITYX_H
|
---|
| 7 |
|
---|
| 8 | /* local prototypes: */
|
---|
| 9 | -void NodeConnectivityx( double** pconnectivity, int* pwidth,double* elements, int nel, int nods);
|
---|
| 10 | +void NodeConnectivityx(int** pconnectivity,int* pwidth,int* elements,int nels, int nods);
|
---|
| 11 |
|
---|
| 12 | #endif /* _NODECONNECTIVITYX_H */
|
---|
| 13 | Index: ../trunk-jpl/src/c/modules/NodeConnectivityx/NodeConnectivityx.cpp
|
---|
| 14 | ===================================================================
|
---|
| 15 | --- ../trunk-jpl/src/c/modules/NodeConnectivityx/NodeConnectivityx.cpp (revision 14015)
|
---|
| 16 | +++ ../trunk-jpl/src/c/modules/NodeConnectivityx/NodeConnectivityx.cpp (revision 14016)
|
---|
| 17 | @@ -17,7 +17,7 @@
|
---|
| 18 | #include "../../toolkits/toolkits.h"
|
---|
| 19 | #include "../../EnumDefinitions/EnumDefinitions.h"
|
---|
| 20 |
|
---|
| 21 | -void NodeConnectivityx( double** pconnectivity, int* pwidth, double* elements, int nel, int nods){
|
---|
| 22 | +void NodeConnectivityx(int** pconnectivity,int* pwidth,int* elements, int nels, int nods){
|
---|
| 23 |
|
---|
| 24 | int i,j,n;
|
---|
| 25 | const int maxels=25;
|
---|
| 26 | @@ -28,26 +28,23 @@
|
---|
| 27 | int index;
|
---|
| 28 | int num_elements;
|
---|
| 29 | int already_plugged=0;
|
---|
| 30 | - double element;
|
---|
| 31 | + int element;
|
---|
| 32 |
|
---|
| 33 | - /*output: */
|
---|
| 34 | - double* connectivity=NULL;
|
---|
| 35 | -
|
---|
| 36 | /*Allocate connectivity: */
|
---|
| 37 | - connectivity=xNewZeroInit<double>(nods*width);
|
---|
| 38 | + int* connectivity=xNewZeroInit<int>(nods*width);
|
---|
| 39 |
|
---|
| 40 | /*Go through all elements, and for each elements, plug into the connectivity, all the nodes.
|
---|
| 41 | * If nodes are already plugged into the connectivity, skip them.: */
|
---|
| 42 | - for(n=0;n<nel;n++){
|
---|
| 43 | + for(n=0;n<nels;n++){
|
---|
| 44 |
|
---|
| 45 | - element=(double)(n+1); //matlab indexing
|
---|
| 46 | + element=n+1; //matlab indexing
|
---|
| 47 |
|
---|
| 48 | for(i=0;i<3;i++){
|
---|
| 49 |
|
---|
| 50 | - node=(int)*(elements+n*3+i); //already matlab indexed, elements comes directly from the workspace.
|
---|
| 51 | + node=elements[n*3+i]; //already matlab indexed, elements comes directly from the workspace.
|
---|
| 52 | index=node-1;
|
---|
| 53 |
|
---|
| 54 | - num_elements=(int)*(connectivity+width*index+maxels); //retrieve number of elements already plugged into the connectivity of this node.
|
---|
| 55 | + num_elements=connectivity[width*index+maxels]; //retrieve number of elements already plugged into the connectivity of this node.
|
---|
| 56 |
|
---|
| 57 | already_plugged=0;
|
---|
| 58 | for(j=0;j<num_elements;j++){
|
---|
| 59 | @@ -59,8 +56,8 @@
|
---|
| 60 | if(already_plugged)break;
|
---|
| 61 |
|
---|
| 62 | /*this elements is not yet plugged into the connectivity for this node, do it, and increase counter: */
|
---|
| 63 | - *(connectivity+width*index+num_elements)=element;
|
---|
| 64 | - *(connectivity+width*index+maxels)=(double)(num_elements+1);
|
---|
| 65 | + connectivity[width*index+num_elements]=element;
|
---|
| 66 | + connectivity[width*index+maxels]=num_elements+1;
|
---|
| 67 |
|
---|
| 68 | }
|
---|
| 69 | }
|
---|
| 70 | @@ -68,7 +65,8 @@
|
---|
| 71 | /*Last check: is the number of elements on last column of the connectivity superior to maxels? If so, then error out and
|
---|
| 72 | * warn the user to increase the connectivity width: */
|
---|
| 73 | for(i=0;i<nods;i++){
|
---|
| 74 | - if (*(connectivity+width*i+maxels)>maxels)_error_("max connectivity width reached (" << *(connectivity+width*i+maxels) << ")! increase width of connectivity table");
|
---|
| 75 | + if (*(connectivity+width*i+maxels)>maxels)
|
---|
| 76 | + _error_("max connectivity width reached (" << *(connectivity+width*i+maxels) << ")! increase width of connectivity table");
|
---|
| 77 | }
|
---|
| 78 |
|
---|
| 79 | /*Assign output pointers: */
|
---|
| 80 | Index: ../trunk-jpl/src/wrappers/NodeConnectivity/NodeConnectivity.cpp
|
---|
| 81 | ===================================================================
|
---|
| 82 | --- ../trunk-jpl/src/wrappers/NodeConnectivity/NodeConnectivity.cpp (revision 14015)
|
---|
| 83 | +++ ../trunk-jpl/src/wrappers/NodeConnectivity/NodeConnectivity.cpp (revision 14016)
|
---|
| 84 | @@ -12,13 +12,13 @@
|
---|
| 85 | WRAPPER(NodeConnectivity){
|
---|
| 86 |
|
---|
| 87 | /*inputs: */
|
---|
| 88 | - double* elements=NULL;
|
---|
| 89 | - int nel;
|
---|
| 90 | - int nods;
|
---|
| 91 | + int* elements=NULL;
|
---|
| 92 | + int nels;
|
---|
| 93 | + int nods;
|
---|
| 94 |
|
---|
| 95 | /*outputs: */
|
---|
| 96 | - double* connectivity=NULL;
|
---|
| 97 | - int width;
|
---|
| 98 | + int* connectivity=NULL;
|
---|
| 99 | + int width;
|
---|
| 100 |
|
---|
| 101 | /*Boot module: */
|
---|
| 102 | MODULEBOOT();
|
---|
| 103 | @@ -27,11 +27,11 @@
|
---|
| 104 | CHECKARGUMENTS(NLHS,NRHS,&NodeConnectivityUsage);
|
---|
| 105 |
|
---|
| 106 | /*Input datasets: */
|
---|
| 107 | - FetchData(&elements,&nel,NULL,ELEMENTS);
|
---|
| 108 | + FetchData(&elements,&nels,NULL,ELEMENTS);
|
---|
| 109 | FetchData(&nods,NUMNODES);
|
---|
| 110 |
|
---|
| 111 | /*!Generate internal degree of freedom numbers: */
|
---|
| 112 | - NodeConnectivityx(&connectivity, &width,elements,nel, nods);
|
---|
| 113 | + NodeConnectivityx(&connectivity,&width,elements,nels,nods);
|
---|
| 114 |
|
---|
| 115 | /*write output datasets: */
|
---|
| 116 | WriteData(CONNECTIVITY,connectivity,nods,width);
|
---|