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 "decompositionMethod.H"
30 #include "cpuTime.H"
31 #include "cellSet.H"
32 #include "regionSplit.H"
33 #include "Tuple2.H"
34 #include "faceSet.H"
35 #include "decompositionModel.H"
36 
37 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
38 
39 void Foam::domainDecomposition::distributeCells()
40 {
41  Info<< "\nCalculating distribution of cells" << endl;
42 
43  cpuTime decompositionTime;
44 
45  const decompositionModel& method = decompositionModel::New
46  (
47  *this,
48  decompDictFile_
49  );
50 
51  word weightName;
52  scalarField cellWeights;
53 
54  if (method.readIfPresent("weightField", weightName))
55  {
57  (
58  IOobject
59  (
60  weightName,
61  time().timeName(),
62  *this,
65  ),
66  *this
67  );
68  cellWeights = weights.primitiveField();
69  }
70 
71  cellToProc_ = method.decomposer().decompose(*this, cellWeights);
72 
73  Info<< "\nFinished decomposition in "
74  << decompositionTime.elapsedCpuTime()
75  << " s" << endl;
76 }
77 
78 
79 // ************************************************************************* //
Foam::IOobject::NO_WRITE
Definition: IOobject.H:130
Foam::scalarField
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Definition: primitiveFieldsFwd.H:52
Tuple2.H
Foam::GeometricField::primitiveField
const Internal::FieldType & primitiveField() const
Return a const-reference to the internal field.
Definition: GeometricFieldI.H:53
Foam::IOobject::IOobject
IOobject(const IOobject &)=default
Copy construct.
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:350
decompositionMethod.H
domainDecomposition.H
Foam::cpuTime
cpuTimeCxx cpuTime
Selection of preferred clock mechanism for the elapsed cpu time.
Definition: cpuTimeFwd.H:41
Foam::Info
messageStream Info
Information stream (uses stdout - output is on the master only)
faceSet.H
regionSplit.H
Foam::volScalarField
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:57
timeName
word timeName
Definition: getTimeIndex.H:3
Foam::decompositionModel::New
static const decompositionModel & New(const polyMesh &mesh, const fileName &decompDictFile="")
Read (optionally from absolute path) and register on mesh.
Definition: decompositionModel.C:116
Foam::surfaceInterpolation::weights
virtual const surfaceScalarField & weights() const
Return reference to linear difference weighting factors.
Definition: surfaceInterpolation.C:102
Foam::fvMesh::time
const Time & time() const
Return the top-level database.
Definition: fvMesh.H:275
decompositionModel.H
cellSet.H
Foam::IOobject::MUST_READ
Definition: IOobject.H:120