ptscotchDecomp.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::ptscotchDecomp
26 
27 Description
28  PTScotch domain decomposition
29 
30 SourceFiles
31  ptscotchDecomp.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef ptscotchDecomp_H
36 #define ptscotchDecomp_H
37 
38 #include "decompositionMethod.H"
39 
40 namespace Foam
41 {
42 
43 /*---------------------------------------------------------------------------*\
44  Class ptscotchDecomp Declaration
45 \*---------------------------------------------------------------------------*/
46 
47 class ptscotchDecomp
48 :
49  public decompositionMethod
50 {
51  // Private Member Functions
52 
53  //- Insert list in front of list.
54  template<class Type>
55  static void prepend(const UList<Type>&, List<Type>&);
56  //- Insert list at end of list.
57  template<class Type>
58  static void append(const UList<Type>&, List<Type>&);
59 
60  //- Check and print error message
61  static void check(const int, const char*);
62 
63  //- Decompose. Handles size 0 arrays
65  (
66  const fileName& meshPath,
67  const List<label>& adjncy,
68  const List<label>& xadj,
69  const scalarField& cWeights,
70  List<label>& finalDecomp
71  ) const;
72 
73  //- Low level decompose
75  (
76  const fileName& meshPath,
77  const label adjncySize,
78  const label adjncy[],
79  const label xadjSize,
80  const label xadj[],
81  const scalarField& cWeights,
82  List<label>& finalDecomp
83  ) const;
84 
85  //- Disallow default bitwise copy construct and assignment
86  void operator=(const ptscotchDecomp&);
88 
89 
90 public:
91 
92  //- Runtime type information
93  TypeName("ptscotch");
94 
95 
96  // Constructors
97 
98  //- Construct given the decomposition dictionary and mesh
99  ptscotchDecomp(const dictionary& decompositionDict);
100 
101 
102  //- Destructor
103  virtual ~ptscotchDecomp()
104  {}
105 
106 
107  // Member Functions
108 
109  virtual bool parallelAware() const
110  {
111  // ptscotch does not know about proc boundaries
112  return true;
113  }
114 
115  //- Inherit decompose from decompositionMethod
117 
118  //- Return for every coordinate the wanted processor number. Use the
119  // mesh connectivity (if needed). See note on weights in scotchDecomp.H
120  virtual labelList decompose
121  (
122  const polyMesh& mesh,
123  const pointField& points,
124  const scalarField& pointWeights
125  );
126 
127  //- Return for every coordinate the wanted processor number. Gets
128  // passed agglomeration map (from fine to coarse cells) and coarse cell
129  // location. Can be overridden by decomposers that provide this
130  // functionality natively. See note on weights in scotchDecomp.H
131  virtual labelList decompose
132  (
133  const polyMesh& mesh,
134  const labelList& agglom,
135  const pointField& regionPoints,
136  const scalarField& regionWeights
137  );
138 
139  //- Return for every coordinate the wanted processor number. Explicitly
140  // provided mesh connectivity.
141  // The connectivity is equal to mesh.cellCells() except for
142  // - in parallel the cell numbers are global cell numbers (starting
143  // from 0 at processor0 and then incrementing all through the
144  // processors)
145  // - the connections are across coupled patches
146  // See note on weights in scotchDecomp.H
147  virtual labelList decompose
148  (
149  const labelListList& globalCellCells,
150  const pointField& cc,
151  const scalarField& cWeights
152  );
153 
154 };
155 
156 
157 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
158 
159 } // End namespace Foam
160 
161 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
162 
163 #ifdef NoRepository
164 # include "ptscotchDecompTemplates.C"
165 #endif
166 
167 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
168 
169 #endif
170 
171 // ************************************************************************* //
Foam::fileName
A class for handling file names.
Definition: fileName.H:69
Foam::ptscotchDecomp::~ptscotchDecomp
virtual ~ptscotchDecomp()
Destructor.
Definition: ptscotchDecomp.H:102
decompositionMethod.H
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
Foam::ptscotchDecomp::prepend
static void prepend(const UList< Type > &, List< Type > &)
Insert list in front of list.
Definition: ptscotchDecompTemplates.C:33
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
ptscotchDecompTemplates.C
Foam::ptscotchDecomp::ptscotchDecomp
ptscotchDecomp(const ptscotchDecomp &)
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
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::ptscotchDecomp::parallelAware
virtual bool parallelAware() const
Is method parallel aware (i.e. does it synchronize domains across.
Definition: ptscotchDecomp.H:108
Foam::ptscotchDecomp::decompose
label decompose(const fileName &meshPath, const List< label > &adjncy, const List< label > &xadj, const scalarField &cWeights, List< label > &finalDecomp) const
Decompose. Handles size 0 arrays.
Definition: dummyPtscotchDecomp.C:62
Foam::ptscotchDecomp::check
static void check(const int, const char *)
Check and print error message.
Definition: dummyPtscotchDecomp.C:57
Foam::ptscotchDecomp::operator=
void operator=(const ptscotchDecomp &)
Disallow default bitwise copy construct and assignment.
Foam::List< Type >
Foam::UList< Type >
points
const pointField & points
Definition: gmvOutputHeader.H:1
Foam::ptscotchDecomp
PTScotch domain decomposition.
Definition: ptscotchDecomp.H:46
Foam::ptscotchDecomp::TypeName
TypeName("ptscotch")
Runtime type information.
Foam::ptscotchDecomp::append
static void append(const UList< Type > &, List< Type > &)
Insert list at end of list.
Definition: ptscotchDecompTemplates.C:58