Changeset 24396
- Timestamp:
- 11/25/19 14:42:13 (5 years ago)
- Location:
- issm/trunk-jpl/src/c
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/modules/MeshPartitionx/MeshPartitionx.h
r17692 r24396 10 10 /* local prototypes: */ 11 11 template <class doubletype> 12 int MeshPartitionx(int** pepart, int** pnpart,int numberofelements,int numberofnodes,int* elements,13 int numberofelements2d,int numberofnodes2d,doubletype* elements2d,int numlayers,int elements_width, int meshelementtype,int num_procs){12 int MeshPartitionx(int** pepart,int** pnpart,int numberofelements,int numberofnodes,int* elements, 13 int numberofelements2d,int numberofnodes2d,doubletype* elements2d,int* vweights,int numlayers,int elements_width, int meshelementtype,int num_procs){ 14 14 15 15 int noerr=1; … … 26 26 int count=0; 27 27 28 int etype=1; //tria mesh see metis/Programs/Io.c29 int etype2d=1; //tria mesh see metis/Programs/Io.c30 int numflag=0;31 int edgecut=1;32 28 33 29 switch(meshelementtype){ … … 46 42 if (num_procs>1){ 47 43 #ifdef _HAVE_METIS_ 48 METIS_PartMeshNodalPatch( &numberofelements,&numberofnodes, index, &etype, &numflag, &num_procs, &edgecut,epart, npart);44 METIS_PartMeshNodalPatch(numberofelements,numberofnodes,index,vweights,num_procs,epart, npart); 49 45 #else 50 46 _error_("metis has not beed installed. Cannot run with more than 1 cpu"); … … 75 71 if (num_procs>1){ 76 72 #ifdef _HAVE_METIS_ 77 METIS_PartMeshNodalPatch( &numberofelements2d,&numberofnodes2d, index2d, &etype2d, &numflag, &num_procs, &edgecut, epart2d,npart2d);73 METIS_PartMeshNodalPatch(numberofelements2d,numberofnodes2d,index2d,vweights,num_procs,epart2d,npart2d); 78 74 #else 79 75 _error_("metis has not beed installed. Cannot run with more than 1 cpu"); -
issm/trunk-jpl/src/c/modules/ModelProcessorx/ElementsAndVerticesPartitioning.cpp
r24059 r24396 61 61 62 62 /*Partition and free resouces*/ 63 MeshPartitionx(&epart,&npart,iomodel->numberofelements,iomodel->numberofvertices,iomodel->elements,numberofelements2d,numberofvertices2d,elements2d, numlayers,elements_width,iomodel->meshelementtype,num_procs);63 MeshPartitionx(&epart,&npart,iomodel->numberofelements,iomodel->numberofvertices,iomodel->elements,numberofelements2d,numberofvertices2d,elements2d,NULL,numlayers,elements_width,iomodel->meshelementtype,num_procs); 64 64 xDelete<int>(elements2d); 65 65 xDelete<int>(npart); -
issm/trunk-jpl/src/c/toolkits/metis/patches/METIS_PartMeshNodalPatch.cpp
r24395 r24396 7 7 #include "../../../shared/shared.h" 8 8 9 void METIS_PartMeshNodalPatch(int* pnumberofelements,int* pnumberofnodes,int* index,int* petype,int* pnumflag,int* pnum_procs,int* pedgecut,int* epart,int* npart){ 9 /*METIS prototypes*/ 10 extern "C" { 11 #if _METIS_VERSION_ == 4 12 void METIS_PartMeshNodal(int *, int *, idxtype *, int *, int *, int *, int *, idxtype *, idxtype *); 13 #endif 14 #if _METIS_VERSION_ == 5 15 int METIS_PartMeshNodal(idx_t*, idx_t*, idx_t*, idx_t*, idx_t*, idx_t*, idx_t*, real_t*, idx_t*, idx_t*, idx_t*, idx_t*); 16 int METIS_SetDefaultOptions(idx_t *options); 17 #endif 18 } 19 20 void METIS_PartMeshNodalPatch(int numberofelements,int numberofnodes,int* index,int* vweights,int num_procs,int* epart,int* npart){ 10 21 11 22 #if _METIS_VERSION_ == 4 12 23 /*Our interface originates in the Metis 4.0 version, hence identical calls*/ 13 METIS_PartMeshNodal(pnumberofelements,pnumberofnodes, index, petype, pnumflag, pnum_procs, pedgecut, epart, npart); 24 int edgecut=1; 25 int etype =1; //tria mesh see metis/Programs/Io.c 26 int numflag=0; 27 METIS_PartMeshNodal(&numberofelements,&numberofnodes, index,&etype,&numflag,&num_procs,&edgecut, epart, npart); 14 28 15 29 #elif _METIS_VERSION_ == 5 … … 34 48 /*create eptr*/ 35 49 idx_t k=0; 36 idx_t* eptr=xNew<idx_t>( (*pnumberofelements+1));50 idx_t* eptr=xNew<idx_t>(numberofelements+1); 37 51 eptr[0]=0; 38 for(int i=0;i< *pnumberofelements;i++){52 for(int i=0;i<numberofelements;i++){ 39 53 k+=3; 40 54 eptr[i+1]=k; … … 42 56 43 57 /*create tpwgts (Weight per processor)*/ 44 real_t* tpwgts=xNew<real_t>( *pnum_procs);45 for(int i=0;i< *pnum_procs;i++) tpwgts[i]=1.0/(*pnum_procs);58 real_t* tpwgts=xNew<real_t>(num_procs); 59 for(int i=0;i<num_procs;i++) tpwgts[i]=1.0/(num_procs); 46 60 47 61 /*create vwgt (Weight per node)*/ 48 idx_t* vwgts=xNew<idx_t>( *pnumberofnodes);49 for(int i=0;i< *pnumberofnodes;i++) vwgts[i]=1;62 idx_t* vwgts=xNew<idx_t>(numberofnodes); 63 for(int i=0;i<numberofnodes;i++) vwgts[i]=1; 50 64 51 65 /*Call METIS*/ 52 66 idx_t objval; 53 int output = METIS_PartMeshNodal( pnumberofelements,pnumberofnodes,eptr,index,vwgts,NULL,pnum_procs,tpwgts,options,&objval,epart,npart);67 int output = METIS_PartMeshNodal(&numberofelements,&numberofnodes,eptr,index,vwgts,NULL,&num_procs,tpwgts,options,&objval,epart,npart); 54 68 if(output!=METIS_OK) _error_("Could not partition mesh"); 55 69 -
issm/trunk-jpl/src/c/toolkits/metis/patches/metispatches.h
r10087 r24396 12 12 #endif 13 13 14 void METIS_PartMeshNodalPatch(int *, int *, int *, int *, int *, int *, int *, int *, int *); //Common interface we are using in ISSM. 15 16 extern "C" { 17 18 #if _METIS_VERSION_ == 4 19 void METIS_PartMeshNodal(int *, int *, idxtype *, int *, int *, int *, int *, idxtype *, idxtype *); 20 #endif 21 #if _METIS_VERSION_ == 5 22 int METIS_PartMeshNodal(idx_t*, idx_t*, idx_t*, idx_t*, idx_t*, idx_t*, idx_t*, real_t*, idx_t*, idx_t*, idx_t*, idx_t*); 23 int METIS_SetDefaultOptions(idx_t *options); 24 #endif 25 26 } 14 void METIS_PartMeshNodalPatch(int numberofelements,int numberofnodes,int* index,int* vweights,int num_procs,int* epart,int* npart); 27 15 28 16 #endif
Note:
See TracChangeset
for help on using the changeset viewer.