- Timestamp:
- 05/16/11 15:42:41 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/modules/MeshPartitionx/MeshPartitionx.cpp
r6412 r8303 1 1 /*!\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. 3 3 */ 4 4 … … 9 9 #include "../../EnumDefinitions/EnumDefinitions.h" 10 10 11 int MeshPartitionx(int** pepart, int** pnpart, int numberofelements,int numberof grids,double* elements,12 int numberofelements2d,int numberof grids2d,double* elements2d,int numlayers,int elements_width, int dim,int num_procs){11 int 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){ 13 13 14 14 int noerr=1; … … 32 32 if(dim==2){ 33 33 epart=(int*)xmalloc(numberofelements*sizeof(int)); 34 npart=(int*)xmalloc(numberof grids*sizeof(int));34 npart=(int*)xmalloc(numberofnodes*sizeof(int)); 35 35 index=(int*)xmalloc(elements_width*numberofelements*sizeof(int)); 36 36 for (i=0;i<numberofelements;i++){ … … 42 42 /*Partition using Metis:*/ 43 43 if (num_procs>1){ 44 METIS_PartMeshNodal(&numberofelements,&numberof grids, index, &etype, &numflag, &num_procs, &edgecut, epart, npart);44 METIS_PartMeshNodal(&numberofelements,&numberofnodes, index, &etype, &numflag, &num_procs, &edgecut, epart, npart); 45 45 } 46 46 else if (num_procs==1){ 47 47 /*METIS does not know how to deal with one cpu only!*/ 48 48 for (i=0;i<numberofelements;i++) epart[i]=0; 49 for (i=0;i<numberof grids;i++) npart[i]=0;49 for (i=0;i<numberofnodes;i++) npart[i]=0; 50 50 } 51 51 else _error_("At least one processor is required"); … … 56 56 /*First build concatenated 2d mesh from 2d_coll and 2d_noncoll: */ 57 57 epart2d=(int*)xmalloc(numberofelements2d*sizeof(int)); 58 npart2d=(int*)xmalloc(numberof grids2d*sizeof(int));58 npart2d=(int*)xmalloc(numberofnodes2d*sizeof(int)); 59 59 index2d=(int*)xmalloc(3*numberofelements2d*sizeof(int)); 60 60 … … 67 67 /*Partition using Metis:*/ 68 68 if (num_procs>1){ 69 METIS_PartMeshNodal(&numberofelements2d,&numberof grids2d, index2d, &etype2d, &numflag, &num_procs, &edgecut, epart2d, npart2d);69 METIS_PartMeshNodal(&numberofelements2d,&numberofnodes2d, index2d, &etype2d, &numflag, &num_procs, &edgecut, epart2d, npart2d); 70 70 } 71 71 else if (num_procs==1){ 72 72 /*METIS does not know how to deal with one cpu only!*/ 73 73 for (i=0;i<numberofelements2d;i++) epart2d[i]=0; 74 for (i=0;i<numberof grids2d;i++) npart2d[i]=0;74 for (i=0;i<numberofnodes2d;i++) npart2d[i]=0; 75 75 } 76 76 else _error_("At least one processor is required"); … … 88 88 89 89 /*Extrude npart2d to npart, using numlayers: */ 90 npart=(int*)xmalloc(numberof grids*sizeof(int));90 npart=(int*)xmalloc(numberofnodes*sizeof(int)); 91 91 92 92 count=0; 93 93 for(i=0;i<(numlayers);i++){ 94 for(j=0;j<numberof grids2d;j++){94 for(j=0;j<numberofnodes2d;j++){ 95 95 npart[count]=npart2d[j]; 96 96 count++;
Note:
See TracChangeset
for help on using the changeset viewer.