domainDecompositionDistribute.C
Go to the documentation of this file.
1/*---------------------------------------------------------------------------*\
2 ========= |
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 \\ / O peration |
5 \\ / A nd | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2011-2016 OpenFOAM Foundation
9-------------------------------------------------------------------------------
10License
11 This file is part of OpenFOAM.
12
13 OpenFOAM is free software: you can redistribute it and/or modify it
14 under the terms of the GNU General Public License as published by
15 the Free Software Foundation, either version 3 of the License, or
16 (at your option) any later version.
17
18 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25
26\*---------------------------------------------------------------------------*/
27
28#include "domainDecomposition.H"
29#include "cpuTime.H"
30#include "decompositionMethod.H"
31#include "decompositionModel.H"
32
33// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
34
35void Foam::domainDecomposition::distributeCells()
36{
37 Info<< "\nCalculating distribution of cells" << endl;
38
39 cpuTime decompositionTime;
40
41 const decompositionModel& method = decompositionModel::New
42 (
43 *this,
44 decompDictFile_
45 );
46
47 word weightName;
48 scalarField cellWeights;
49
50 if (method.readIfPresent("weightField", weightName))
51 {
53 (
54 IOobject
55 (
56 weightName,
57 time().timeName(),
58 *this,
61 ),
62 *this
63 );
64 cellWeights = weights.primitiveField();
65 }
66
67 cellToProc_ = method.decomposer().decompose(*this, cellWeights);
68
69 Info<< "\nFinished decomposition in "
70 << decompositionTime.elapsedCpuTime()
71 << " s" << endl;
72}
73
74
75// ************************************************************************* //
const Internal::FieldType & primitiveField() const
Return a const-reference to the internal field.
static autoPtr< Time > New()
Construct (dummy) Time - no functionObjects or libraries.
Definition: Time.C:717
const Time & time() const
Return the top-level database.
Definition: fvMesh.H:290
virtual const surfaceScalarField & weights() const
Return reference to linear difference weighting factors.
word timeName
Definition: getTimeIndex.H:3
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:82
messageStream Info
Information stream (stdout output on master, null elsewhere)
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:372
cpuTimeCxx cpuTime
Selection of preferred clock mechanism for the elapsed cpu time.
Definition: cpuTimeFwd.H:43