FreeFOAM The Cross-Platform CFD Toolkit
decompositionMethod.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::decompositionMethod
26 
27 Description
28  Abstract base class for decomposition
29 
30 SourceFiles
31  decompositionMethod.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef decompositionMethod_H
36 #define decompositionMethod_H
37 
38 #include <OpenFOAM/polyMesh.H>
39 #include <OpenFOAM/pointField.H>
40 
41 namespace Foam
42 {
43 
44 /*---------------------------------------------------------------------------*\
45  Class decompositionMethod Declaration
46 \*---------------------------------------------------------------------------*/
47 
49 {
50 
51 protected:
52 
53  // Protected data
54 
56  label nProcessors_;
57 
58 
59  //- Helper: determine (non-parallel) cellCells from mesh agglomeration.
60  static void calcCellCells
61  (
62  const polyMesh& mesh,
63  const labelList& agglom,
64  const label nCoarse,
65  labelListList& cellCells
66  );
67 
68 private:
69 
70  // Private Member Functions
71 
72  //- Disallow default bitwise copy construct and assignment
74  void operator=(const decompositionMethod&);
75 
76 
77 public:
78 
79  //- Runtime type information
80  TypeName("decompositionMethod");
81 
82 
83  // Declare run-time constructor selection tables
84 
86  (
87  autoPtr,
89  dictionary,
90  (
91  const dictionary& decompositionDict
92  ),
93  (decompositionDict)
94  );
95 
97  (
98  autoPtr,
100  dictionaryMesh,
101  (
102  const dictionary& decompositionDict,
103  const polyMesh& mesh
104  ),
105  (decompositionDict, mesh)
106  );
107 
108 
109  // Selectors
110 
111  //- Return a reference to the selected decomposition method
113  (
114  const dictionary& decompositionDict
115  );
116 
117  //- Return a reference to the selected decomposition method
119  (
120  const dictionary& decompositionDict,
121  const polyMesh& mesh
122  );
123 
124 
125  // Constructors
126 
127  //- Construct given the decomposition dictionary
128  decompositionMethod(const dictionary& decompositionDict)
129  :
130  decompositionDict_(decompositionDict),
132  (
133  readLabel(decompositionDict.lookup("numberOfSubdomains"))
134  )
135  {}
136 
137 
138  // Destructor
139 
141  {}
142 
143 
144  // Member Functions
145 
146  //- Is method parallel aware (i.e. does it synchronize domains across
147  // proc boundaries)
148  virtual bool parallelAware() const = 0;
149 
150  //- Return for every coordinate the wanted processor number. Use the
151  // mesh connectivity (if needed)
152  virtual labelList decompose
153  (
154  const pointField& points,
155  const scalarField& pointWeights
156  ) = 0;
157 
158  //- Like decompose but with uniform weights on the points
159  virtual labelList decompose(const pointField&);
160 
161 
162  //- Return for every coordinate the wanted processor number. Gets
163  // passed agglomeration map (from fine to coarse cells) and coarse cell
164  // location. Can be overridden by decomposers that provide this
165  // functionality natively. Coarse cells are local to the processor
166  // (if in parallel). If you want to have coarse cells spanning
167  // processors use the globalCellCells instead.
168  virtual labelList decompose
169  (
170  const labelList& cellToRegion,
171  const pointField& regionPoints,
172  const scalarField& regionWeights
173  );
174 
175  //- Like decompose but with uniform weights on the regions
176  virtual labelList decompose
177  (
178  const labelList& cellToRegion,
179  const pointField& regionPoints
180  );
181 
182 
183  //- Return for every coordinate the wanted processor number. Explicitly
184  // provided connectivity - does not use mesh_.
185  // The connectivity is equal to mesh.cellCells() except for
186  // - in parallel the cell numbers are global cell numbers (starting
187  // from 0 at processor0 and then incrementing all through the
188  // processors)
189  // - the connections are across coupled patches
190  virtual labelList decompose
191  (
192  const labelListList& globalCellCells,
193  const pointField& cc,
194  const scalarField& cWeights
195  ) = 0;
196 
197  //- Like decompose but with uniform weights on the cells
198  virtual labelList decompose
199  (
200  const labelListList& globalCellCells,
201  const pointField& cc
202  );
203 
204 };
205 
206 
207 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
208 
209 } // End namespace Foam
210 
211 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
212 
213 #endif
214 
215 // ************************ vim: set sw=4 sts=4 et: ************************ //