Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Scotch.hpp
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 // File Scotch.hpp
4 //
5 // For more information, please see: http://www.nektar.info
6 //
7 // The MIT License
8 //
9 // Copyright (c) 2006 Division of Applied Mathematics, Brown University (USA),
10 // Department of Aeronautics, Imperial College London (UK), and Scientific
11 // Computing and Imaging Institute, University of Utah (USA).
12 //
13 // License for the specific language governing rights and limitations under
14 // Permission is hereby granted, free of charge, to any person obtaining a
15 // copy of this software and associated documentation files (the "Software"),
16 // to deal in the Software without restriction, including without limitation
17 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
18 // and/or sell copies of the Software, and to permit persons to whom the
19 // Software is furnished to do so, subject to the following conditions:
20 //
21 // The above copyright notice and this permission notice shall be included
22 // in all copies or substantial portions of the Software.
23 //
24 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
25 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
27 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
29 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
30 // DEALINGS IN THE SOFTWARE.
31 //
32 // Description: wrapper of functions around Scotch routines
33 //
34 ///////////////////////////////////////////////////////////////////////////////
35 
36 #ifndef NEKTAR_LIB_UTILITIES_BASICUTILS_SCOTCH_HPP
37 #define NEKTAR_LIB_UTILITIES_BASICUTILS_SCOTCH_HPP
38 
39 namespace Scotch
40 {
41  extern "C" {
42  // Scotch version of old metis call
43  void METIS_PartGraphVKway(int *nVerts, int *xadj, int *adjcy,
44  int *vertWgt, int *vertSize,
45  int *wgtFlag, int *numflag, int *nparts,
46  int *options, int *volume, int *part);
47 
48  }
49 
50  inline static void PartGraphVKway(
51  int& nVerts,
52  int& nVertConds,
57  int& nparts,
58  int& volume,
60  {
61  int wgtflag = 0;
62  int *vwgt = 0;
63  int *vsize = 0;
64  if (vertWgt.num_elements() > 0)
65  {
66  wgtflag += 1;
67  vwgt = &vertWgt[0];
68  }
69  if (vertSize.num_elements() > 0)
70  {
71  wgtflag += 2;
72  vsize = &vertSize[0];
73  }
74  int numflag = 0;
75  // number of balancing conditions (size of vertex multi-weight)
76  int options[5];
77  options[0] = 0;
78  //METIS_SetDefaultOptions(options);
79  METIS_PartGraphVKway(&nVerts, &xadj[0], &adjcy[0], vwgt, vsize,
80  &wgtflag, &numflag, &nparts, options, &volume,
81  &part[0]);
82  }
83 
84 }
85 
static void PartGraphVKway(int &nVerts, int &nVertConds, Nektar::Array< Nektar::OneD, int > &xadj, Nektar::Array< Nektar::OneD, int > &adjcy, Nektar::Array< Nektar::OneD, int > &vertWgt, Nektar::Array< Nektar::OneD, int > &vertSize, int &nparts, int &volume, Nektar::Array< Nektar::OneD, int > &part)
Definition: Scotch.hpp:50
void METIS_PartGraphVKway(int *nVerts, int *xadj, int *adjcy, int *vertWgt, int *vertSize, int *wgtFlag, int *numflag, int *nparts, int *options, int *volume, int *part)