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 | Copyright (C) 2011-2014 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
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.
15 
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
19  for more details.
20 
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/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 #include "domainDecomposition.H"
27 #include "decompositionMethod.H"
28 #include "cpuTime.H"
29 #include "cellSet.H"
30 #include "regionSplit.H"
31 #include "Tuple2.H"
32 #include "faceSet.H"
33 #include "decompositionModel.H"
34 
35 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
36 
38 {
39  Info<< "\nCalculating distribution of cells" << endl;
40 
41  cpuTime decompositionTime;
42 
44  (
45  *this,
47  );
48 
49 
50  scalarField cellWeights;
51  if (method.found("weightField"))
52  {
53  word weightName = method.lookup("weightField");
54 
56  (
57  IOobject
58  (
59  weightName,
60  time().timeName(),
61  *this,
64  ),
65  *this
66  );
67  cellWeights = weights.internalField();
68  }
69 
70  cellToProc_ = method.decomposer().decompose(*this, cellWeights);
71 
72  Info<< "\nFinished decomposition in "
73  << decompositionTime.elapsedCpuTime()
74  << " s" << endl;
75 }
76 
77 
78 // ************************************************************************* //
Foam::cpuTime
Starts timing CPU usage and return elapsed time from start.
Definition: cpuTime.H:52
Foam::IOobject
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:91
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Tuple2.H
Foam::dictionary::lookup
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
Definition: dictionary.C:449
Foam::IOobject::MUST_READ
@ MUST_READ
Definition: IOobject.H:108
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
decompositionMethod.H
Foam::decompositionModel
MeshObject wrapper of decompositionMethod.
Definition: decompositionModel.H:53
Foam::IOobject::NO_WRITE
@ NO_WRITE
Definition: IOobject.H:118
Foam::dictionary::found
bool found(const word &, bool recursive=false, bool patternMatch=true) const
Search dictionary for given keyword.
Definition: dictionary.C:304
Foam::Field
Pre-declare SubField and related Field type.
Definition: Field.H:57
Foam::Info
messageStream Info
domainDecomposition.H
Foam::decompositionModel::decomposer
decompositionMethod & decomposer() const
Definition: decompositionModel.H:110
faceSet.H
regionSplit.H
Foam::GeometricField::internalField
InternalField & internalField()
Return internal field.
Definition: GeometricField.C:724
Foam::cpuTime::elapsedCpuTime
double elapsedCpuTime() const
Return CPU time (in seconds) from the start.
Definition: cpuTime.C:67
Foam::domainDecomposition::decompDictFile_
const fileName decompDictFile_
Optional non-standard file for decomposeParDict.
Definition: domainDecomposition.H:64
Foam::domainDecomposition::cellToProc_
labelList cellToProc_
Processor label for each cell.
Definition: domainDecomposition.H:73
cpuTime.H
Foam::domainDecomposition::distributeCells
void distributeCells()
Definition: domainDecompositionDistribute.C:37
Foam::decompositionModel::New
static const decompositionModel & New(const polyMesh &mesh, const fileName &decompDictFile="")
Read (optionallly from absolute path) & register on mesh.
Definition: decompositionModel.C:108
Foam::decompositionMethod::decompose
virtual labelList decompose(const pointField &points, const scalarField &pointWeights)
Return for every coordinate the wanted processor number.
Definition: decompositionMethod.H:126
Foam::surfaceInterpolation::weights
const surfaceScalarField & weights() const
Return reference to linear difference weighting factors.
Definition: surfaceInterpolation.C:77
timeName
word timeName
Definition: getTimeIndex.H:3
Foam::fvMesh::time
const Time & time() const
Return the top-level database.
Definition: fvMesh.H:243
decompositionModel.H
cellSet.H
Foam::GeometricField
Generic GeometricField class.
Definition: surfaceFieldsFwd.H:52