Changeset 24395
- Timestamp:
- 11/25/19 14:23:38 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/toolkits/metis/patches/METIS_PartMeshNodalPatch.cpp
r24393 r24395 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 void METIS_PartMeshNodalPatch(int* pnumberofelements,int* pnumberofnodes,int* index,int* petype,int* pnumflag,int* pnum_procs,int* pedgecut,int* epart,int* npart){ 10 10 11 11 #if _METIS_VERSION_ == 4 12 12 /*Our interface originates in the Metis 4.0 version, hence identical calls*/ 13 13 METIS_PartMeshNodal(pnumberofelements,pnumberofnodes, index, petype, pnumflag, pnum_procs, pedgecut, epart, npart); 14 14 15 #elif _METIS_VERSION_ == 5 15 16 /*This interface is heavily changed. More options, different ways of meshing, etc ...: */17 16 18 17 /*Create options*/ … … 21 20 22 21 options[METIS_OPTION_PTYPE] = METIS_PTYPE_KWAY; /* partitioning method */ 23 options[METIS_OPTION_OBJTYPE] = METIS_OBJTYPE_ VOL; /* type of objective */22 options[METIS_OPTION_OBJTYPE] = METIS_OBJTYPE_CUT; /* type of objective */ 24 23 options[METIS_OPTION_CTYPE] = METIS_CTYPE_SHEM; /* matching scheme to be used during coarsening.*/ 25 24 options[METIS_OPTION_IPTYPE] = METIS_IPTYPE_METISRB; /* algorithm used during initial partitioning*/ … … 33 32 options[METIS_OPTION_NCUTS] = 1; /* number of different partitionings that it will compute*/ 34 33 35 /*create eptr :*/34 /*create eptr*/ 36 35 idx_t k=0; 37 36 idx_t* eptr=xNew<idx_t>((*pnumberofelements+1)); … … 42 41 } 43 42 44 /*create tpwgts :*/43 /*create tpwgts (Weight per processor)*/ 45 44 real_t* tpwgts=xNew<real_t>(*pnum_procs); 46 for(int i=0;i<*pnum_procs;i++){ 47 tpwgts[i]=1.0/(*pnum_procs); 48 } 45 for(int i=0;i<*pnum_procs;i++) tpwgts[i]=1.0/(*pnum_procs); 46 47 /*create vwgt (Weight per node)*/ 48 idx_t* vwgts=xNew<idx_t>(*pnumberofnodes); 49 for(int i=0;i<*pnumberofnodes;i++) vwgts[i]=1; 49 50 50 51 /*Call METIS*/ 51 52 idx_t objval; 52 METIS_PartMeshNodal(pnumberofelements,pnumberofnodes, eptr, index,53 NULL, NULL, pnum_procs, tpwgts, options, &objval,epart, npart);53 int output = METIS_PartMeshNodal(pnumberofelements,pnumberofnodes,eptr,index,vwgts,NULL,pnum_procs,tpwgts,options,&objval,epart,npart); 54 if(output!=METIS_OK) _error_("Could not partition mesh"); 54 55 55 56 /*clean-up*/ 57 xDelete<idx_t>(vwgts); 56 58 xDelete<idx_t>(eptr); 57 59 xDelete<real_t>(tpwgts);
Note:
See TracChangeset
for help on using the changeset viewer.