Loading...
Searching...
No Matches
processorColour.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 | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2022 M. Janssens
9-------------------------------------------------------------------------------
10License
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
26Class
27 Foam::processorColour
28
29Description
30 Colouring processors such that no neighbours have the same colour
31
32SourceFiles
33 processorColour.C
34
35\*---------------------------------------------------------------------------*/
36
37#ifndef Foam_processorColour_H
38#define Foam_processorColour_H
39
40#include "MeshObject.H"
41#include "lduMesh.H"
43#include "primitiveFields.H"
44
45// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46
47namespace Foam
48{
49
50class lduMatrix;
52/*---------------------------------------------------------------------------*\
53 Class processorColour Declaration
54\*---------------------------------------------------------------------------*/
55
56class processorColour
57:
58 public MeshObject<lduMesh, MoveableMeshObject, processorColour>,
59 public labelList
60{
61 // Private Typedefs
62
63 typedef MeshObject
64 <
65 lduMesh,
67 processorColour
68 > MeshObject_type;
69
70
71 // Private Member Functions
72
73 //- No copy construct
74 processorColour(const processorColour&) = delete;
75
76 //- No copy assignment
77 void operator=(const processorColour&) = delete;
78
79
80protected:
81
82 // Protected data
83
84 //- Max number of colours
85 label nColours_;
87
88 // Protected Member Fucntions
89
90 static void walkFront
91 (
92 const lduMesh& mesh,
95 );
96
97public:
98
99 //- Runtime type information
100 TypeName("processorColour");
101
102
103 // Constructors
104
105 //- Construct given mesh
106 explicit processorColour(const lduMesh& mesh);
107
108
109 // Selectors
110
111 //- Should use the MeshObject provided one but that needs a
112 // mesh.name() ...
113 static const processorColour& New(const lduMesh& mesh);
114
115
116 //- Destructor
117 virtual ~processorColour() = default;
118
119
120 // Member Functions
121
122 // Access
123
124 label nColours() const
125 {
126 return nColours_;
128
129 label myColour() const
130 {
132 }
133
135 //- Calculate processor colouring from processor connectivity. Sets
136 //- colour per processor such that no neighbouring processors have the
137 //- same colour. Returns number of colours used.
138 static label colour(const lduMesh& mesh, labelList& procColour);
140 //- Calculate (locally) per cell colour according to walking from
141 //- global patches. Returns number of colours used.
142 //- Note: asssumes all non-processor interfaces are global.
143 static label cellColour
144 (
145 const lduMesh& mesh,
147 labelList& patchToColour
148 );
149
150 virtual bool movePoints()
151 {
152 return true;
153 }
154};
155
156
157// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
158
159} // End namespace Foam
160
161// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
162
163#endif
165// ************************************************************************* //
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
Definition DynamicList.H:68
label & operator[](const label i)
static int myProcNo(const label communicator=worldComm)
Rank of this process in the communicator (starting from masterNo()). Negative if the process is not a...
Definition UPstream.H:1706
lduMatrix is a general matrix class in which the coefficients are stored as three arrays,...
Definition lduMatrix.H:81
Abstract base class for meshes which provide LDU addressing for the construction of lduMatrix and LDU...
Definition lduMesh.H:54
virtual ~processorColour()=default
Destructor.
static const processorColour & New(const lduMesh &mesh)
Should use the MeshObject provided one but that needs a.
virtual bool movePoints()
Update for mesh motion.
label nColours_
Max number of colours.
static void walkFront(const lduMesh &mesh, DynamicList< label > &front, labelList &cellColour)
static label cellColour(const lduMesh &mesh, labelList &cellColour, labelList &patchToColour)
Calculate (locally) per cell colour according to walking from global patches. Returns number of colou...
TypeName("processorColour")
Runtime type information.
static label colour(const lduMesh &mesh, labelList &procColour)
Calculate processor colouring from processor connectivity. Sets colour per processor such that no nei...
dynamicFvMesh & mesh
Namespace for OpenFOAM.
List< label > labelList
A List of labels.
Definition List.H:62
Specialisations of Field<T> for scalar, vector and tensor.
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68