Changeset 24395


Ignore:
Timestamp:
11/25/19 14:23:38 (5 years ago)
Author:
Mathieu Morlighem
Message:

CHG: fixing partitioning

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/c/toolkits/metis/patches/METIS_PartMeshNodalPatch.cpp

    r24393 r24395  
    77#include "../../../shared/shared.h"
    88
    9 void METIS_PartMeshNodalPatch(int* pnumberofelements,int* pnumberofnodes, int* index, int* petype, int* pnumflag, int* pnum_procs, int* pedgecut, int* epart, int* npart){
     9void METIS_PartMeshNodalPatch(int* pnumberofelements,int* pnumberofnodes,int* index,int* petype,int* pnumflag,int* pnum_procs,int* pedgecut,int* epart,int* npart){
    1010
    1111        #if _METIS_VERSION_ == 4
    1212        /*Our interface originates in the Metis 4.0 version, hence identical calls*/
    1313        METIS_PartMeshNodal(pnumberofelements,pnumberofnodes, index, petype, pnumflag, pnum_procs, pedgecut, epart, npart);
     14
    1415        #elif _METIS_VERSION_ == 5
    15 
    16         /*This interface is heavily changed. More options, different ways of meshing, etc ...: */
    1716
    1817        /*Create options*/
     
    2120
    2221        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 */
    2423        options[METIS_OPTION_CTYPE]   = METIS_CTYPE_SHEM;     /* matching scheme to be used during coarsening.*/
    2524        options[METIS_OPTION_IPTYPE]  = METIS_IPTYPE_METISRB; /* algorithm used during initial partitioning*/
     
    3332        options[METIS_OPTION_NCUTS]   = 1;                    /* number of different partitionings that it will compute*/
    3433
    35         /*create eptr: */
     34        /*create eptr*/
    3635        idx_t  k=0;
    3736        idx_t* eptr=xNew<idx_t>((*pnumberofelements+1));
     
    4241        }
    4342
    44         /*create tpwgts: */
     43        /*create tpwgts (Weight per processor)*/
    4544        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;
    4950
    5051        /*Call METIS*/
    5152        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");
    5455
    5556        /*clean-up*/
     57        xDelete<idx_t>(vwgts);
    5658        xDelete<idx_t>(eptr);
    5759        xDelete<real_t>(tpwgts);
Note: See TracChangeset for help on using the changeset viewer.