XC Open source finite element analysis program
Metis.h
1 //----------------------------------------------------------------------------
2 // XC program; finite element analysis code
3 // for structural analysis and design.
4 //
5 // Copyright (C) Luis Claudio Pérez Tato
6 //
7 // This program derives from OpenSees <http://opensees.berkeley.edu>
8 // developed by the «Pacific earthquake engineering research center».
9 //
10 // Except for the restrictions that may arise from the copyright
11 // of the original program (see copyright_opensees.txt)
12 // XC is free software: you can redistribute it and/or modify
13 // it under the terms of the GNU General Public License as published by
14 // the Free Software Foundation, either version 3 of the License, or
15 // (at your option) any later version.
16 //
17 // This software is distributed in the hope that it will be useful, but
18 // WITHOUT ANY WARRANTY; without even the implied warranty of
19 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 // GNU General Public License for more details.
21 //
22 //
23 // You should have received a copy of the GNU General Public License
24 // along with this program.
25 // If not, see <http://www.gnu.org/licenses/>.
26 //----------------------------------------------------------------------------
27 /* ****************************************************************** **
28 ** OpenSees - Open System for Earthquake Engineering Simulation **
29 ** Pacific Earthquake Engineering Research Center **
30 ** **
31 ** **
32 ** (C) Copyright 1999, The Regents of the University of California **
33 ** All Rights Reserved. **
34 ** **
35 ** Commercial use of this program without express permission of the **
36 ** University of California, Berkeley, is strictly prohibited. See **
37 ** file 'COPYRIGHT' in main directory for information on usage and **
38 ** redistribution, and for a DISCLAIMER OF ALL WARRANTIES. **
39 ** **
40 ** Developed by: **
41 ** Frank McKenna (fmckenna@ce.berkeley.edu) **
42 ** Gregory L. Fenves (fenves@ce.berkeley.edu) **
43 ** Filip C. Filippou (filippou@ce.berkeley.edu) **
44 ** **
45 ** ****************************************************************** */
46 
47 // $Revision: 1.2 $
48 // $Date: 2006/01/12 23:37:19 $
49 // $Source: /usr/local/cvs/OpenSees/SRC/graph/partitioner/Metis.h,v $
50 
51 
52 // Written: fmk
53 //
54 // Description: This file contains the class definition for Metis.
55 // Metis is a type of GraphPartitioner which uses 'METIS - Unstructured
56 // Graph Partitioning And Sparse Matrix Ordering System', developed by
57 // G. Karypis and V. Kumar at the University of Minnesota. The metis
58 // files are found in metis-2.0 which were downloaded.
59 // This class provides the C++ interface for metis which will allow
60 // it to fit seamlessly into our system.
61 //
62 // What: "@(#) Metis.h, revA"
63 
64 #ifndef Metis_h
65 #define Metis_h
66 
67 #include "solution/graph/partitioner/GraphPartitioner.h"
68 #include "solution/graph/numberer/GraphNumberer.h"
69 
70 namespace XC {
72 //
77 class Metis : public GraphPartitioner, public GraphNumberer
78  {
79  private:
80  bool checkOptions(void);
81 
82  int myPtype ; // package type:
83  // pmetis = 1
84  // kmetis = 2
85 
86  int myMtype; // type of matching scheme:
87  // random = 1
88  // heavy edge = 2
89  // light edge = 3
90  // heavy clique = 4
91  // modified heavy edge = 5
92  // sorted random = 11
93  // sorted heavy edge =21
94  // sorted modified heavy edge = 51
95 
96  int myCoarsenTo; // the number of vertices the graph is coarsened down to
97  // if pmetis default is 100
98  // if kmetis default is 2000
99 
100  int myRtype; // type of refinement policy:
101  // greedy = 1
102  // kernighan-lin = 2
103  // combo greedy and K-L = 3
104  // boundary greedy = 11
105  // boundary K-L = 12
106  // combo of boundary greedy and boundary K-L = 13,
107  // no-refinement = 20
108 
109  int myIPtype; // type of bisection algo:
110  // graph growing partition = 1,
111  // greedy graph growing partition = 2,
112  // spectral bisection = 3,
113  // graph growing followed by K-L = 4
114 
115  bool defaultOptions;
116 
117  int numPartitions; // needed if to be used as a numberer
118  ID theRefResult;
119 
120  Metis(int numParts =1);
121  Metis(int Ptype,
122  int Mtype,
123  int coarsenTo,
124  int Rtype,
125  int IPtype,
126  int numParts =1);
127  public:
128  bool setOptions(int Ptype,
129  int Mtype,
130  int coarsenTo,
131  int Rtype,
132  int IPtype);
133  bool setDefaultOptions(void);
134 
135  int partitionHexMesh(int* elmnts, int* epart, int* npart, int ne, int nn, int nparts, bool whichToUse);
136  int partition(Graph &theGraph, int numPart);
137  int partitionGraph(int *nvtxs, int *xadj, int *adjncy, int *vwgt,
138  int *adjwgt, int *wgtflag, int *numflag, int *nparts,
139  int *options, int *edgecut, int *part, bool whichToUse);
140 
141  // the follwing methods are if the object is to be used as a numberer
142  const ID &number(Graph &theGraph, int lastVertex = -1);
143  const ID &number(Graph &theGraph, const ID &lastVertices);
144 
145  int sendSelf(CommParameters &);
146  int recvSelf(const CommParameters &);
147  };
148 } // end of XC namespace
149 
150 #endif
151 
int partition(Graph &theGraph, int numPart)
Method to partition the graph. It first creates the arrays needed by the metis lib and then invokes a...
Definition: MetisNumberer.cpp:221
================================================================================
Definition: ContinuaReprComponent.h:34