scotchDecomp.H
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-2015 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 Class
25  Foam::scotchDecomp
26 
27 Description
28  Scotch domain decomposition.
29  When run in parallel will collect the whole graph on to the master,
30  decompose and send back. Run ptscotchDecomp for proper distributed
31  decomposition.
32 
33 SourceFiles
34  scotchDecomp.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef scotchDecomp_H
39 #define scotchDecomp_H
40 
41 #include "decompositionMethod.H"
42 
43 namespace Foam
44 {
45 
46 /*---------------------------------------------------------------------------*\
47  Class scotchDecomp Declaration
48 \*---------------------------------------------------------------------------*/
49 
50 class scotchDecomp
51 :
52  public decompositionMethod
53 {
54  // Private Member Functions
55 
56  //- Check and print error message
57  static void check(const int, const char*);
58 
60  (
61  const fileName& meshPath,
62  const List<label>& adjncy,
63  const List<label>& xadj,
64  const scalarField& cWeights,
65  List<label>& finalDecomp
66  );
67 
68  //- Decompose non-parallel
70  (
71  const fileName& meshPath,
72  const List<label>& adjncy,
73  const List<label>& xadj,
74  const scalarField& cWeights,
75  List<label>& finalDecomp
76  );
77 
78  //- Disallow default bitwise copy construct and assignment
79  void operator=(const scotchDecomp&);
80  scotchDecomp(const scotchDecomp&);
81 
82 
83 public:
84 
85  //- Runtime type information
86  TypeName("scotch");
87 
88 
89  // Constructors
90 
91  //- Construct given the decomposition dictionary and mesh
92  scotchDecomp(const dictionary& decompositionDict);
93 
94 
95  //- Destructor
96  virtual ~scotchDecomp()
97  {}
98 
99 
100  // Member Functions
101 
102  virtual bool parallelAware() const
103  {
104  // Knows about coupled boundaries
105  return true;
106  }
107 
108  //- Inherit decompose from decompositionMethod
110 
111  //- Return for every coordinate the wanted processor number. Use the
112  // mesh connectivity (if needed)
113  // Weights get normalised with minimum weight and truncated to
114  // convert into integer so e.g. 3.5 is seen as 3. The overall sum
115  // of weights might otherwise overflow.
116  virtual labelList decompose
117  (
118  const polyMesh& mesh,
119  const pointField& points,
120  const scalarField& pointWeights
121  );
122 
123  //- Return for every coordinate the wanted processor number. Gets
124  // passed agglomeration map (from fine to coarse cells) and coarse cell
125  // location. Can be overridden by decomposers that provide this
126  // functionality natively.
127  // See note on weights above.
128  virtual labelList decompose
129  (
130  const polyMesh& mesh,
131  const labelList& agglom,
132  const pointField& regionPoints,
133  const scalarField& regionWeights
134  );
135 
136  //- Return for every coordinate the wanted processor number. Explicitly
137  // provided mesh connectivity.
138  // The connectivity is equal to mesh.cellCells() except for
139  // - in parallel the cell numbers are global cell numbers (starting
140  // from 0 at processor0 and then incrementing all through the
141  // processors)
142  // - the connections are across coupled patches
143  // See note on weights above.
144  virtual labelList decompose
145  (
146  const labelListList& globalCellCells,
147  const pointField& cc,
148  const scalarField& cWeights
149  );
150 };
151 
152 
153 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
154 
155 } // End namespace Foam
156 
157 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
158 
159 #endif
160 
161 // ************************************************************************* //
Foam::fileName
A class for handling file names.
Definition: fileName.H:69
Foam::scotchDecomp::decompose
label decompose(const fileName &meshPath, const List< label > &adjncy, const List< label > &xadj, const scalarField &cWeights, List< label > &finalDecomp)
Definition: dummyScotchDecomp.C:61
decompositionMethod.H
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
Foam::scotchDecomp::check
static void check(const int, const char *)
Check and print error message.
Definition: dummyScotchDecomp.C:56
Foam::scotchDecomp
Scotch domain decomposition. When run in parallel will collect the whole graph on to the master,...
Definition: scotchDecomp.H:49
Foam::label
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
Foam::Field
Pre-declare SubField and related Field type.
Definition: Field.H:57
Foam::scotchDecomp::operator=
void operator=(const scotchDecomp &)
Disallow default bitwise copy construct and assignment.
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:18
Foam::decompositionMethod
Abstract base class for decomposition.
Definition: decompositionMethod.H:48
Foam::scotchDecomp::~scotchDecomp
virtual ~scotchDecomp()
Destructor.
Definition: scotchDecomp.H:95
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
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::scotchDecomp::decomposeOneProc
label decomposeOneProc(const fileName &meshPath, const List< label > &adjncy, const List< label > &xadj, const scalarField &cWeights, List< label > &finalDecomp)
Decompose non-parallel.
Definition: scotchDecomp.C:304
Foam::List< label >
Foam::scotchDecomp::parallelAware
virtual bool parallelAware() const
Is method parallel aware (i.e. does it synchronize domains across.
Definition: scotchDecomp.H:101
points
const pointField & points
Definition: gmvOutputHeader.H:1
Foam::scotchDecomp::scotchDecomp
scotchDecomp(const scotchDecomp &)
Foam::scotchDecomp::TypeName
TypeName("scotch")
Runtime type information.