source: issm/oecreview/Archive/13977-14063/ISSM-14015-14016.diff@ 28275

Last change on this file since 28275 was 14064, checked in by Mathieu Morlighem, 12 years ago

Added Archive/13977-14063

File size: 4.4 KB
  • ../trunk-jpl/src/c/modules/NodeConnectivityx/NodeConnectivityx.h

     
    66#define _NODECONNECTIVITYX_H
    77
    88/* local prototypes: */
    9 void    NodeConnectivityx( double** pconnectivity, int* pwidth,double* elements, int nel, int nods);
     9void    NodeConnectivityx(int** pconnectivity,int* pwidth,int* elements,int nels, int nods);
    1010
    1111#endif  /* _NODECONNECTIVITYX_H */
  • ../trunk-jpl/src/c/modules/NodeConnectivityx/NodeConnectivityx.cpp

     
    1717#include "../../toolkits/toolkits.h"
    1818#include "../../EnumDefinitions/EnumDefinitions.h"
    1919
    20 void    NodeConnectivityx( double** pconnectivity, int* pwidth, double* elements, int nel, int nods){
     20void    NodeConnectivityx(int** pconnectivity,int* pwidth,int* elements, int nels, int nods){
    2121
    2222        int i,j,n;
    2323        const int maxels=25;
     
    2828        int     index;
    2929        int     num_elements;
    3030        int     already_plugged=0;
    31         double element;
     31        int element;
    3232
    33         /*output: */
    34         double* connectivity=NULL;
    35 
    3633        /*Allocate connectivity: */
    37         connectivity=xNewZeroInit<double>(nods*width);
     34        int* connectivity=xNewZeroInit<int>(nods*width);
    3835
    3936        /*Go through all elements, and for each elements, plug into the connectivity, all the nodes.
    4037         * If nodes are already plugged into the connectivity, skip them.: */
    41         for(n=0;n<nel;n++){
     38        for(n=0;n<nels;n++){
    4239
    43                 element=(double)(n+1); //matlab indexing
     40                element=n+1; //matlab indexing
    4441
    4542                for(i=0;i<3;i++){
    4643
    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.
    4845                        index=node-1;
    4946
    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.
    5148
    5249                        already_plugged=0;
    5350                        for(j=0;j<num_elements;j++){
     
    5956                        if(already_plugged)break;
    6057
    6158                        /*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;
    6461
    6562                }
    6663        }
     
    6865        /*Last check: is the number of elements on last column of the connectivity superior to maxels? If so, then error out and
    6966         * warn the user to increase the connectivity width: */
    7067        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");
    7270        }
    7371
    7472        /*Assign output pointers: */
  • ../trunk-jpl/src/wrappers/NodeConnectivity/NodeConnectivity.cpp

     
    1212WRAPPER(NodeConnectivity){
    1313
    1414        /*inputs: */
    15         double* elements=NULL;
    16         int     nel;
    17         int     nods;
     15        int* elements=NULL;
     16        int  nels;
     17        int  nods;
    1818
    1919        /*outputs: */
    20         double* connectivity=NULL;
    21         int     width;
     20        int* connectivity=NULL;
     21        int  width;
    2222
    2323        /*Boot module: */
    2424        MODULEBOOT();
     
    2727        CHECKARGUMENTS(NLHS,NRHS,&NodeConnectivityUsage);
    2828       
    2929        /*Input datasets: */
    30         FetchData(&elements,&nel,NULL,ELEMENTS);
     30        FetchData(&elements,&nels,NULL,ELEMENTS);
    3131        FetchData(&nods,NUMNODES);
    3232
    3333        /*!Generate internal degree of freedom numbers: */
    34         NodeConnectivityx(&connectivity, &width,elements,nel, nods);
     34        NodeConnectivityx(&connectivity,&width,elements,nels,nods);
    3535
    3636        /*write output datasets: */
    3737        WriteData(CONNECTIVITY,connectivity,nods,width);
Note: See TracBrowser for help on using the repository browser.