1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2008 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 the
13 Free Software Foundation; either version 2 of the License, or (at your
14 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, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26 Decomposition given a cell-to-processor association in a file
28 \*---------------------------------------------------------------------------*/
30 #include "manualDecomp.H"
31 #include "addToRunTimeSelectionTable.H"
33 #include "labelIOList.H"
35 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
39 defineTypeNameAndDebug(manualDecomp, 0);
41 addToRunTimeSelectionTable
48 addToRunTimeSelectionTable
57 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
59 Foam::manualDecomp::manualDecomp(const dictionary& decompositionDict)
61 decompositionMethod(decompositionDict)
63 notImplemented("manualDecomp(const dictionary&)");
67 Foam::manualDecomp::manualDecomp
69 const dictionary& decompositionDict,
73 decompositionMethod(decompositionDict),
77 decompositionDict.subDict(word(decompositionDict.lookup("method"))
78 + "Coeffs").lookup("dataFile")
83 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
85 Foam::labelList Foam::manualDecomp::decompose(const pointField& points)
87 const polyMesh& mesh = *meshPtr_;
89 labelIOList finalDecomp
102 // check if the final decomposition is OK
104 if (finalDecomp.size() != points.size())
106 FatalErrorIn("manualDecomp::decompose(const pointField&)")
107 << "Size of decomposition list does not correspond "
108 << "to the number of points. Size: "
109 << finalDecomp.size() << " Number of points: "
111 << ".\n" << "Manual decomposition data read from file "
112 << decompDataFile_ << "." << endl
116 if (min(finalDecomp) < 0 || max(finalDecomp) > nProcessors_ - 1)
118 FatalErrorIn("labelList manualDecomp::decompose(const pointField&)")
119 << "According to the decomposition, cells assigned to "
120 << "impossible processor numbers. Min processor = "
121 << min(finalDecomp) << " Max processor = " << max(finalDecomp)
122 << ".\n" << "Manual decomposition data read from file "
123 << decompDataFile_ << "." << endl
131 // ************************************************************************* //