Changeset 14016


Ignore:
Timestamp:
11/27/12 12:04:54 (12 years ago)
Author:
Mathieu Morlighem
Message:

NEW: NodeConnectivity uses integers

Location:
issm/trunk-jpl/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/c/modules/NodeConnectivityx/NodeConnectivityx.cpp

    r13622 r14016  
    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;
     
    2929        int     num_elements;
    3030        int     already_plugged=0;
    31         double  element;
    32 
    33         /*output: */
    34         double* connectivity=NULL;
     31        int element;
    3532
    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;
     
    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                }
     
    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
  • issm/trunk-jpl/src/c/modules/NodeConnectivityx/NodeConnectivityx.h

    r13623 r14016  
    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 */
  • issm/trunk-jpl/src/wrappers/NodeConnectivity/NodeConnectivity.cpp

    r13236 r14016  
    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: */
     
    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: */
Note: See TracChangeset for help on using the changeset viewer.