Ignore:
Timestamp:
05/16/11 15:42:41 (14 years ago)
Author:
seroussi
Message:

changed from grid to node in c

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/c/modules/MeshPartitionx/MeshPartitionx.cpp

    r6412 r8303  
    11/*!\file:  MeshPartition.cpp
    2  * \brief partition elements and grids across a cluster of size numprocs.
     2 * \brief partition elements and nodes across a cluster of size numprocs.
    33 */
    44
     
    99#include "../../EnumDefinitions/EnumDefinitions.h"
    1010
    11 int MeshPartitionx(int** pepart, int** pnpart, int numberofelements,int numberofgrids,double* elements,
    12                 int numberofelements2d,int numberofgrids2d,double* elements2d,int numlayers,int elements_width, int dim,int num_procs){
     11int MeshPartitionx(int** pepart, int** pnpart, int numberofelements,int numberofnodes,double* elements,
     12                int numberofelements2d,int numberofnodes2d,double* elements2d,int numlayers,int elements_width, int dim,int num_procs){
    1313
    1414        int noerr=1;
     
    3232        if(dim==2){
    3333                epart=(int*)xmalloc(numberofelements*sizeof(int));
    34                 npart=(int*)xmalloc(numberofgrids*sizeof(int));
     34                npart=(int*)xmalloc(numberofnodes*sizeof(int));
    3535                index=(int*)xmalloc(elements_width*numberofelements*sizeof(int));
    3636                for (i=0;i<numberofelements;i++){
     
    4242                /*Partition using Metis:*/
    4343                if (num_procs>1){
    44                         METIS_PartMeshNodal(&numberofelements,&numberofgrids, index, &etype, &numflag, &num_procs, &edgecut, epart, npart);
     44                        METIS_PartMeshNodal(&numberofelements,&numberofnodes, index, &etype, &numflag, &num_procs, &edgecut, epart, npart);
    4545                }
    4646                else if (num_procs==1){
    4747                        /*METIS does not know how to deal with one cpu only!*/
    4848                        for (i=0;i<numberofelements;i++) epart[i]=0;
    49                         for (i=0;i<numberofgrids;i++)    npart[i]=0;
     49                        for (i=0;i<numberofnodes;i++)    npart[i]=0;
    5050                }
    5151                else _error_("At least one processor is required");
     
    5656                /*First build concatenated 2d mesh  from 2d_coll and 2d_noncoll: */
    5757                epart2d=(int*)xmalloc(numberofelements2d*sizeof(int));
    58                 npart2d=(int*)xmalloc(numberofgrids2d*sizeof(int));
     58                npart2d=(int*)xmalloc(numberofnodes2d*sizeof(int));
    5959                index2d=(int*)xmalloc(3*numberofelements2d*sizeof(int));
    6060
     
    6767                /*Partition using Metis:*/
    6868                if (num_procs>1){
    69                         METIS_PartMeshNodal(&numberofelements2d,&numberofgrids2d, index2d, &etype2d, &numflag, &num_procs, &edgecut, epart2d, npart2d);
     69                        METIS_PartMeshNodal(&numberofelements2d,&numberofnodes2d, index2d, &etype2d, &numflag, &num_procs, &edgecut, epart2d, npart2d);
    7070                }
    7171                else if (num_procs==1){
    7272                        /*METIS does not know how to deal with one cpu only!*/
    7373                        for (i=0;i<numberofelements2d;i++) epart2d[i]=0;
    74                         for (i=0;i<numberofgrids2d;i++)    npart2d[i]=0;
     74                        for (i=0;i<numberofnodes2d;i++)    npart2d[i]=0;
    7575                }
    7676                else _error_("At least one processor is required");
     
    8888
    8989                /*Extrude npart2d to npart, using numlayers: */
    90                 npart=(int*)xmalloc(numberofgrids*sizeof(int));
     90                npart=(int*)xmalloc(numberofnodes*sizeof(int));
    9191               
    9292                count=0;
    9393                for(i=0;i<(numlayers);i++){
    94                         for(j=0;j<numberofgrids2d;j++){
     94                        for(j=0;j<numberofnodes2d;j++){
    9595                                npart[count]=npart2d[j];
    9696                                count++;
Note: See TracChangeset for help on using the changeset viewer.