Changeset 24396


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

CHG: simplifying syntax to METIS

Location:
issm/trunk-jpl/src/c
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/c/modules/MeshPartitionx/MeshPartitionx.h

    r17692 r24396  
    1010/* local prototypes: */
    1111template <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){
     12int 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){
    1414
    1515        int noerr=1;
     
    2626        int  count=0;
    2727
    28         int  etype=1; //tria mesh see metis/Programs/Io.c
    29         int  etype2d=1; //tria mesh see metis/Programs/Io.c
    30         int  numflag=0;
    31         int  edgecut=1;
    3228
    3329        switch(meshelementtype){
     
    4642                        if (num_procs>1){
    4743#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);
    4945#else
    5046                                _error_("metis has not beed installed. Cannot run with more than 1 cpu");
     
    7571                        if (num_procs>1){
    7672#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);
    7874#else
    7975                                _error_("metis has not beed installed. Cannot run with more than 1 cpu");
  • issm/trunk-jpl/src/c/modules/ModelProcessorx/ElementsAndVerticesPartitioning.cpp

    r24059 r24396  
    6161
    6262        /*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);
    6464        xDelete<int>(elements2d);
    6565        xDelete<int>(npart);
  • issm/trunk-jpl/src/c/toolkits/metis/patches/METIS_PartMeshNodalPatch.cpp

    r24395 r24396  
    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){
     9/*METIS prototypes*/
     10extern "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
     20void METIS_PartMeshNodalPatch(int numberofelements,int numberofnodes,int* index,int* vweights,int num_procs,int* epart,int* npart){
    1021
    1122        #if _METIS_VERSION_ == 4
    1223        /*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);
    1428
    1529        #elif _METIS_VERSION_ == 5
     
    3448        /*create eptr*/
    3549        idx_t  k=0;
    36         idx_t* eptr=xNew<idx_t>((*pnumberofelements+1));
     50        idx_t* eptr=xNew<idx_t>(numberofelements+1);
    3751        eptr[0]=0;
    38         for(int i=0;i<*pnumberofelements;i++){
     52        for(int i=0;i<numberofelements;i++){
    3953                k+=3;
    4054                eptr[i+1]=k;
     
    4256
    4357        /*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);
    4660
    4761        /*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;
    5064
    5165        /*Call METIS*/
    5266        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);
    5468        if(output!=METIS_OK) _error_("Could not partition mesh");
    5569
  • issm/trunk-jpl/src/c/toolkits/metis/patches/metispatches.h

    r10087 r24396  
    1212#endif
    1313
    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 }
     14void METIS_PartMeshNodalPatch(int numberofelements,int numberofnodes,int* index,int* vweights,int num_procs,int* epart,int* npart);
    2715
    2816#endif
Note: See TracChangeset for help on using the changeset viewer.