Path: blob/devel/elmergrid/src/metis-5.1.0/libmetis/struct.h
3206 views
/*1* Copyright 1997, Regents of the University of Minnesota2*3* struct.h4*5* This file contains data structures for ILU routines.6*7* Started 9/26/958* George9*10* $Id: struct.h 13900 2013-03-24 15:27:07Z karypis $11*/1213#ifndef _LIBMETIS_STRUCT_H_14#define _LIBMETIS_STRUCT_H_15161718/*************************************************************************/19/*! This data structure stores cut-based k-way refinement info about an20adjacent subdomain for a given vertex. */21/*************************************************************************/22typedef struct cnbr_t {23idx_t pid; /*!< The partition ID */24idx_t ed; /*!< The sum of the weights of the adjacent edges25that are incident on pid */26} cnbr_t;272829/*************************************************************************/30/*! The following data structure stores holds information on degrees for k-way31partition */32/*************************************************************************/33typedef struct ckrinfo_t {34idx_t id; /*!< The internal degree of a vertex (sum of weights) */35idx_t ed; /*!< The total external degree of a vertex */36idx_t nnbrs; /*!< The number of neighboring subdomains */37idx_t inbr; /*!< The index in the cnbr_t array where the nnbrs list38of neighbors is stored */39} ckrinfo_t;404142/*************************************************************************/43/*! This data structure stores volume-based k-way refinement info about an44adjacent subdomain for a given vertex. */45/*************************************************************************/46typedef struct vnbr_t {47idx_t pid; /*!< The partition ID */48idx_t ned; /*!< The number of the adjacent edges49that are incident on pid */50idx_t gv; /*!< The gain in volume achieved by moving the51vertex to pid */52} vnbr_t;535455/*************************************************************************/56/*! The following data structure holds information on degrees for k-way57vol-based partition */58/*************************************************************************/59typedef struct vkrinfo_t {60idx_t nid; /*!< The internal degree of a vertex (count of edges) */61idx_t ned; /*!< The total external degree of a vertex (count of edges) */62idx_t gv; /*!< The volume gain of moving that vertex */63idx_t nnbrs; /*!< The number of neighboring subdomains */64idx_t inbr; /*!< The index in the vnbr_t array where the nnbrs list65of neighbors is stored */66} vkrinfo_t;676869/*************************************************************************/70/*! The following data structure holds information on degrees for k-way71partition */72/*************************************************************************/73typedef struct nrinfo_t {74idx_t edegrees[2];75} nrinfo_t;767778/*************************************************************************/79/*! This data structure holds a graph */80/*************************************************************************/81typedef struct graph_t {82idx_t nvtxs, nedges; /* The # of vertices and edges in the graph */83idx_t ncon; /* The # of constrains */84idx_t *xadj; /* Pointers to the locally stored vertices */85idx_t *vwgt; /* Vertex weights */86idx_t *vsize; /* Vertex sizes for min-volume formulation */87idx_t *adjncy; /* Array that stores the adjacency lists of nvtxs */88idx_t *adjwgt; /* Array that stores the weights of the adjacency lists */8990idx_t *tvwgt; /* The sum of the vertex weights in the graph */91real_t *invtvwgt; /* The inverse of the sum of the vertex weights in the graph */929394/* These are to keep track control if the corresponding fields correspond to95application or library memory */96int free_xadj, free_vwgt, free_vsize, free_adjncy, free_adjwgt;9798idx_t *label;99100idx_t *cmap;101102/* Partition parameters */103idx_t mincut, minvol;104idx_t *where, *pwgts;105idx_t nbnd;106idx_t *bndptr, *bndind;107108/* Bisection refinement parameters */109idx_t *id, *ed;110111/* K-way refinement parameters */112ckrinfo_t *ckrinfo; /*!< The per-vertex cut-based refinement info */113vkrinfo_t *vkrinfo; /*!< The per-vertex volume-based refinement info */114115/* Node refinement information */116nrinfo_t *nrinfo;117118struct graph_t *coarser, *finer;119} graph_t;120121122/*************************************************************************/123/*! This data structure holds a mesh */124/*************************************************************************/125typedef struct mesh_t {126idx_t ne, nn; /*!< The # of elements and nodes in the mesh */127idx_t ncon; /*!< The number of element balancing constraints (element weights) */128129idx_t *eptr, *eind; /*!< The CSR-structure storing the nodes in the elements */130idx_t *ewgt; /*!< The weights of the elements */131} mesh_t;132133134135/*************************************************************************/136/*! The following structure stores information used by Metis */137/*************************************************************************/138typedef struct ctrl_t {139moptype_et optype; /* Type of operation */140mobjtype_et objtype; /* Type of refinement objective */141mdbglvl_et dbglvl; /* Controls the debuging output of the program */142mctype_et ctype; /* The type of coarsening */143miptype_et iptype; /* The type of initial partitioning */144mrtype_et rtype; /* The type of refinement */145146idx_t CoarsenTo; /* The # of vertices in the coarsest graph */147idx_t nIparts; /* The number of initial partitions to compute */148idx_t no2hop; /* Indicates if 2-hop matching will be used */149idx_t minconn; /* Indicates if the subdomain connectivity will be minimized */150idx_t contig; /* Indicates if contigous partitions are required */151idx_t nseps; /* The number of separators to be found during multiple bisections */152idx_t ufactor; /* The user-supplied load imbalance factor */153idx_t compress; /* If the graph will be compressed prior to ordering */154idx_t ccorder; /* If connected components will be ordered separately */155idx_t seed; /* The seed for the random number generator */156idx_t ncuts; /* The number of different partitionings to compute */157idx_t niter; /* The number of iterations during each refinement */158idx_t numflag; /* The user-supplied numflag for the graph */159idx_t *maxvwgt; /* The maximum allowed weight for a vertex */160161idx_t ncon; /*!< The number of balancing constraints */162idx_t nparts; /*!< The number of partitions */163164real_t pfactor; /* .1*(user-supplied prunning factor) */165166real_t *ubfactors; /*!< The per-constraint ubfactors */167168real_t *tpwgts; /*!< The target partition weights */169real_t *pijbm; /*!< The nparts*ncon multiplies for the ith partition170and jth constraint for obtaining the balance */171172real_t cfactor; /*!< The achieved compression factor */173174/* Various Timers */175double TotalTmr, InitPartTmr, MatchTmr, ContractTmr, CoarsenTmr, UncoarsenTmr,176RefTmr, ProjectTmr, SplitTmr, Aux1Tmr, Aux2Tmr, Aux3Tmr;177178/* Workspace information */179gk_mcore_t *mcore; /*!< The persistent memory core for within function180mallocs/frees */181182/* These are for use by the k-way refinement routines */183size_t nbrpoolsize; /*!< The number of {c,v}nbr_t entries that have been allocated */184size_t nbrpoolcpos; /*!< The position of the first free entry in the array */185size_t nbrpoolreallocs; /*!< The number of times the pool was resized */186187cnbr_t *cnbrpool; /*!< The pool of cnbr_t entries to be used during refinement.188The size and current position of the pool is controlled189by nnbrs & cnbrs */190vnbr_t *vnbrpool; /*!< The pool of vnbr_t entries to be used during refinement.191The size and current position of the pool is controlled192by nnbrs & cnbrs */193194/* The subdomain graph, in sparse format */195idx_t *maxnads; /* The maximum allocated number of adjacent domains */196idx_t *nads; /* The number of adjacent domains */197idx_t **adids; /* The IDs of the adjacent domains */198idx_t **adwgts; /* The edge-weight to the adjacent domains */199idx_t *pvec1, *pvec2; /* Auxiliar nparts-size vectors for efficiency */200201} ctrl_t;202203204205#endif206207208