1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
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
71 // Private Member Functions
73 //- Disallow default bitwise copy construct and assignment
74 decompositionMethod(const decompositionMethod&);
75 void operator=(const decompositionMethod&);
80 //- Runtime type information
81 TypeName("decompositionMethod");
84 // Declare run-time constructor selection tables
86 declareRunTimeSelectionTable
92 const dictionary& decompositionDict
100 //- Return a reference to the selected decomposition method
101 static autoPtr<decompositionMethod> New
103 const dictionary& decompositionDict
109 //- Construct given the decomposition dictionary
110 decompositionMethod(const dictionary& decompositionDict)
112 decompositionDict_(decompositionDict),
115 readLabel(decompositionDict.lookup("numberOfSubdomains"))
121 virtual ~decompositionMethod()
127 label nDomains() const
132 //- Is method parallel aware (i.e. does it synchronize domains across
134 virtual bool parallelAware() const = 0;
137 // No topology (implemented by geometric decomposers)
139 //- Return for every coordinate the wanted processor number.
140 virtual labelList decompose
142 const pointField& points,
143 const scalarField& pointWeights
148 "decompositionMethod:decompose(const pointField&"
149 ", const scalarField&)"
154 //- Like decompose but with uniform weights on the points
155 virtual labelList decompose(const pointField&)
159 "decompositionMethod:decompose(const pointField&)"
165 // Topology provided by mesh
167 //- Return for every coordinate the wanted processor number. Use the
168 // mesh connectivity (if needed)
169 virtual labelList decompose
171 const polyMesh& mesh,
172 const pointField& points,
173 const scalarField& pointWeights
176 //- Like decompose but with uniform weights on the points
177 virtual labelList decompose(const polyMesh&, const pointField&);
180 //- Return for every coordinate the wanted processor number. Gets
181 // passed agglomeration map (from fine to coarse cells) and coarse
183 // location. Can be overridden by decomposers that provide this
184 // functionality natively. Coarse cells are local to the processor
185 // (if in parallel). If you want to have coarse cells spanning
186 // processors use the globalCellCells instead.
187 virtual labelList decompose
189 const polyMesh& mesh,
190 const labelList& cellToRegion,
191 const pointField& regionPoints,
192 const scalarField& regionWeights
195 //- Like decompose but with uniform weights on the regions
196 virtual labelList decompose
198 const polyMesh& mesh,
199 const labelList& cellToRegion,
200 const pointField& regionPoints
204 // Topology provided explicitly addressing
206 //- Return for every coordinate the wanted processor number.
207 // The connectivity is equal to mesh.cellCells() except for
208 // - in parallel the cell numbers are global cell numbers
210 // from 0 at processor0 and then incrementing all through the
212 // - the connections are across coupled patches
213 virtual labelList decompose
215 const labelListList& globalCellCells,
216 const pointField& cc,
217 const scalarField& cWeights
220 //- Like decompose but with uniform weights on the cells
221 virtual labelList decompose
223 const labelListList& globalCellCells,
230 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
232 } // End namespace Foam
234 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
238 // ************************************************************************* //