FreeFOAM The Cross-Platform CFD Toolkit
metisDecomp.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::metisDecomp
26 
27 Description
28  Metis domain decomposition
29 
30 SourceFiles
31  metisDecomp.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef metisDecomp_H
36 #define metisDecomp_H
37 
39 
40 namespace Foam
41 {
42 
43 /*---------------------------------------------------------------------------*\
44  Class metisDecomp Declaration
45 \*---------------------------------------------------------------------------*/
46 
47 class metisDecomp
48 :
49  public decompositionMethod
50 {
51  // Private data
52 
53  const polyMesh& mesh_;
54 
55 
56  // Private Member Functions
57 
58  label decompose
59  (
60  const List<int>& adjncy,
61  const List<int>& xadj,
62  const scalarField& cellWeights,
63  List<int>& finalDecomp
64  );
65 
66  //- Disallow default bitwise copy construct and assignment
67  void operator=(const metisDecomp&);
68  metisDecomp(const metisDecomp&);
69 
70 
71 public:
72 
73  //- Runtime type information
74  TypeName("metis");
75 
76 
77  // Constructors
78 
79  //- Construct given the decomposition dictionary and mesh
80  metisDecomp
81  (
82  const dictionary& decompositionDict,
83  const polyMesh& mesh
84  );
85 
86 
87  // Destructor
88 
89  virtual ~metisDecomp()
90  {}
91 
92 
93  // Member Functions
94 
95  virtual bool parallelAware() const
96  {
97  // Metis does not know about proc boundaries
98  return false;
99  }
100 
101  //- Return for every coordinate the wanted processor number. Use the
102  // mesh connectivity (if needed)
103  // Weights get normalised so the minimum value is 1 before truncation
104  // to an integer so the weights should be multiples of the minimum
105  // value. The overall sum of weights might otherwise overflow.
106  virtual labelList decompose
107  (
108  const pointField& points,
109  const scalarField& pointWeights
110  );
111 
112  //- Return for every coordinate the wanted processor number. Gets
113  // passed agglomeration map (from fine to coarse cells) and coarse cell
114  // location. Can be overridden by decomposers that provide this
115  // functionality natively.
116  // See note on weights above.
117  virtual labelList decompose
118  (
119  const labelList& agglom,
120  const pointField& regionPoints,
121  const scalarField& regionWeights
122  );
123 
124  //- Same but with uniform weights
125  virtual labelList decompose
126  (
127  const labelList& agglom,
128  const pointField& regionPoints
129  )
130  {
131  return decompose
132  (
133  agglom,
134  regionPoints,
135  scalarField(regionPoints.size(), 1.0)
136  );
137  }
138 
139  //- Return for every coordinate the wanted processor number. Explicitly
140  // provided mesh connectivity.
141  // The connectivity is equal to mesh.cellCells() except for
142  // - in parallel the cell numbers are global cell numbers (starting
143  // from 0 at processor0 and then incrementing all through the
144  // processors)
145  // - the connections are across coupled patches
146  // See note on weights above.
147  virtual labelList decompose
148  (
149  const labelListList& globalCellCells,
150  const pointField& cc,
151  const scalarField& cWeights
152  );
153 
154 };
155 
156 
157 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
158 
159 } // End namespace Foam
160 
161 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
162 
163 #endif
164 
165 // ************************ vim: set sw=4 sts=4 et: ************************ //