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 -------------------------------------------------------------------------------
10 License
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 
35 void 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 // ************************************************************************* //
Foam::IOobject::NO_WRITE
@ NO_WRITE
Definition: IOobject.H:191
Foam::scalarField
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Definition: primitiveFieldsFwd.H:46
Foam::cpuTime
cpuTimePosix cpuTime
Selection of preferred clock mechanism for the elapsed cpu time.
Definition: cpuTimeFwd.H:36
Foam::GeometricField::primitiveField
const Internal::FieldType & primitiveField() const
Definition: GeometricFieldI.H:46
Foam::IOobject::IOobject
IOobject(const IOobject &)=default
Foam::endl
Ostream & endl(Ostream &os)
Definition: Ostream.H:381
decompositionMethod.H
domainDecomposition.H
Foam::decompositionModel::New
static const decompositionModel & New(const polyMesh &mesh, const fileName &decompDictFile="", const dictionary *fallback=nullptr)
Definition: decompositionModel.C:76
Foam::Info
messageStream Info
Foam::volScalarField
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:53
timeName
word timeName
Definition: getTimeIndex.H:3
cpuTime.H
Foam::surfaceInterpolation::weights
virtual const surfaceScalarField & weights() const
Definition: surfaceInterpolation.C:96
Foam::fvMesh::time
const Time & time() const
Definition: fvMesh.H:276
decompositionModel.H
Foam::IOobject::MUST_READ
@ MUST_READ
Definition: IOobject.H:181