1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
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.
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
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/>.
25 Foam::decompositionMethod
28 Abstract base class for decomposition
33 \*---------------------------------------------------------------------------*/
35 #ifndef decompositionMethod_H
36 #define decompositionMethod_H
39 #include "pointField.H"
40 #include "CompactListList.H"
45 /*---------------------------------------------------------------------------*\
46 Class decompositionMethod Declaration
47 \*---------------------------------------------------------------------------*/
49 class decompositionMethod
56 const dictionary& decompositionDict_;
60 //- Helper: determine (global) cellCells from mesh agglomeration.
61 static void calcCellCells
64 const labelList& agglom,
66 CompactListList<label>& cellCells
69 //- Calculate the minimum face between two neighbouring cells
70 // (usually there is only one)
71 static label masterFace(const polyMesh&, const label, const label);
75 // Private Member Functions
77 //- Disallow default bitwise copy construct and assignment
78 decompositionMethod(const decompositionMethod&);
79 void operator=(const decompositionMethod&);
84 //- Runtime type information
85 TypeName("decompositionMethod");
88 // Declare run-time constructor selection tables
90 declareRunTimeSelectionTable
96 const dictionary& decompositionDict
104 //- Return a reference to the selected decomposition method
105 static autoPtr<decompositionMethod> New
107 const dictionary& decompositionDict
113 //- Construct given the decomposition dictionary
114 decompositionMethod(const dictionary& decompositionDict)
116 decompositionDict_(decompositionDict),
119 readLabel(decompositionDict.lookup("numberOfSubdomains"))
125 virtual ~decompositionMethod()
131 label nDomains() const
136 //- Is method parallel aware (i.e. does it synchronize domains across
138 virtual bool parallelAware() const = 0;
141 // No topology (implemented by geometric decomposers)
143 //- Return for every coordinate the wanted processor number.
144 virtual labelList decompose
146 const pointField& points,
147 const scalarField& pointWeights
152 "decompositionMethod:decompose(const pointField&"
153 ", const scalarField&)"
158 //- Like decompose but with uniform weights on the points
159 virtual labelList decompose(const pointField&)
163 "decompositionMethod:decompose(const pointField&)"
169 // Topology provided by mesh
171 //- Return for every coordinate the wanted processor number. Use the
172 // mesh connectivity (if needed)
173 virtual labelList decompose
175 const polyMesh& mesh,
176 const pointField& points,
177 const scalarField& pointWeights
180 //- Like decompose but with uniform weights on the points
181 virtual labelList decompose(const polyMesh&, const pointField&);
184 //- Return for every coordinate the wanted processor number. Gets
185 // passed agglomeration map (from fine to coarse cells) and coarse
187 // location. Can be overridden by decomposers that provide this
188 // functionality natively. Coarse cells are local to the processor
189 // (if in parallel). If you want to have coarse cells spanning
190 // processors use the globalCellCells instead.
191 virtual labelList decompose
193 const polyMesh& mesh,
194 const labelList& cellToRegion,
195 const pointField& regionPoints,
196 const scalarField& regionWeights
199 //- Like decompose but with uniform weights on the regions
200 virtual labelList decompose
202 const polyMesh& mesh,
203 const labelList& cellToRegion,
204 const pointField& regionPoints
208 // Topology provided explicitly addressing
210 //- Return for every coordinate the wanted processor number.
211 // The connectivity is equal to mesh.cellCells() except for
212 // - in parallel the cell numbers are global cell numbers
214 // from 0 at processor0 and then incrementing all through the
216 // - the connections are across coupled patches
217 virtual labelList decompose
219 const labelListList& globalCellCells,
220 const pointField& cc,
221 const scalarField& cWeights
224 //- Like decompose but with uniform weights on the cells
225 virtual labelList decompose
227 const labelListList& globalCellCells,
234 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
236 } // End namespace Foam
238 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
242 // ************************************************************************* //