cellCellStencil.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) 2017-2019 OpenCFD Ltd.
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::cellCellStencil
28
29Description
30 Calculation of interpolation stencils.
31
32 Looks up zoneID labelIOList to give the zoning. Wrapped in
33 MeshObject as cellCellStencilObject. Kept separate so meshes can
34 implement more clever methods (e.g. solid body motion does not require
35 full recalculation)
36
37SourceFiles
38 cellCellStencil.C
39 cellCellStencilObject.C
40
41\*---------------------------------------------------------------------------*/
42
43#ifndef cellCellStencil_H
44#define cellCellStencil_H
45
46#include "scalarList.H"
47#include "mapDistribute.H"
48#include "pointList.H"
49#include "volFields.H"
50
51// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
52
53namespace Foam
54{
55
56class mapDistribute;
57
58/*---------------------------------------------------------------------------*\
59 Class cellCellStencil Declaration
60\*---------------------------------------------------------------------------*/
63{
64public:
66 enum patchCellType
67 {
68 OTHER = 0, // not on special patch
69 PATCH = 1, // next to (non-coupled) boundary
70 OVERSET = 2 // next to 'overset' boundary
71 };
73 enum cellType
74 {
75 CALCULATED = 0, // normal operation
76 INTERPOLATED = 1, // interpolated
77 HOLE = 2 // hole
78 };
79
80
81protected:
82
83 // Protected data
84
85 //- Mode type names
86 static const Enum<cellType> cellTypeNames_;
87
88 //- Reference to the mesh
89 const fvMesh& mesh_;
90
91 //- Set of fields that should not be interpolated
93
94
95 // Protected Member Functions
96
97 //- Count occurrences (in parallel)
98 static labelList count(const label size, const labelUList& lst);
99
100 //- Helper: create volScalarField for postprocessing.
101 template<class Type>
103 (
104 const fvMesh& mesh,
105 const word& name,
106 const UList<Type>&
107 );
108
109
110private:
111
112 // Private Member Functions
113
114 //- No copy construct
115 cellCellStencil(const cellCellStencil&) = delete;
116
117 //- No copy assignment
118 void operator=(const cellCellStencil&) = delete;
119
120
121public:
122
123 //- Runtime type information
124 TypeName("cellCellStencil");
125
126
127 // Declare run-time constructor selection tables
130 (
131 autoPtr,
133 mesh,
134 (
135 const fvMesh& mesh,
136 const dictionary& dict,
137 const bool update
138 ),
139 (mesh, dict, update)
140 );
141
142
143 // Constructors
144
145 //- Construct from fvMesh
146 cellCellStencil(const fvMesh&);
147
148 //- New function which constructs and returns pointer to a
149 // cellCellStencil
151 (
152 const fvMesh&,
153 const dictionary& dict,
154 const bool update = true
155 );
156
157
158 //- Destructor
159 virtual ~cellCellStencil();
160
161
162 // Member Functions
163
164 //- Update stencils. Return false if nothing changed.
165 virtual bool update() = 0;
166
167 //- Return the cell type list
168 virtual const labelUList& cellTypes() const = 0;
169
170 //- Indices of interpolated cells
171 virtual const labelUList& interpolationCells() const = 0;
172
173 //- Return a communication schedule
174 virtual const mapDistribute& cellInterpolationMap() const = 0;
175
176 //- Per interpolated cell the neighbour cells (in terms of slots as
177 // constructed by above cellInterpolationMap) to interpolate
178 virtual const labelListList& cellStencil() const = 0;
179
180 //- Weights for cellStencil
181 virtual const List<scalarList>& cellInterpolationWeights() const = 0;
182
183 //- Per interpolated cell the interpolation factor. (0 = use
184 // calculated, 1 = use interpolated)
185 virtual const scalarList& cellInterpolationWeight() const = 0;
186
187 //- Calculate weights for a single acceptor
188 virtual void stencilWeights
189 (
190 const point& sample,
191 const pointList& donorCcs,
192 scalarList& weights
193 ) const = 0;
194
195 //- Return the names of any (stencil or mesh specific) fields that
196 // should not be interpolated
197 virtual const wordHashSet& nonInterpolatedFields() const;
198
199 //- Return non-const non-interpolating fields
201
202 //- Helper: is stencil fully local
203 bool localStencil(const labelUList&) const;
204
205 //- Helper: get reference to registered zoneID. Loads volScalarField
206 // if not registered.
207 static const labelIOList& zoneID(const fvMesh&);
208
209 //- Helper: get reference to registered zoneID. Loads volScalarField
210 // if not registered.
211 const labelIOList& zoneID() const
212 {
213 return zoneID(mesh_);
214 }
215
216 //- Helper: create cell-cell addressing in global numbering
217 static void globalCellCells
218 (
219 const globalIndex& gi,
220 const polyMesh& mesh,
221 const boolList& isValidDonor,
222 const labelList& selectedCells,
223 labelListList& cellCells,
224 pointListList& cellCellCentres
225 );
226};
227
228
229// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
230
231} // End namespace Foam
232
233// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
234
235#ifdef NoRepository
237#endif
238
239// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
240
241#endif
242
243// ************************************************************************* //
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
Definition: Enum.H:61
Minimal example by using system/controlDict.functions:
Bookkeeping for patch definitions.
Definition: PDRpatchDef.H:54
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: autoPtr.H:66
Calculation of interpolation stencils.
virtual const labelUList & interpolationCells() const =0
Indices of interpolated cells.
virtual const scalarList & cellInterpolationWeight() const =0
Per interpolated cell the interpolation factor. (0 = use.
const fvMesh & mesh_
Reference to the mesh.
virtual const mapDistribute & cellInterpolationMap() const =0
Return a communication schedule.
bool localStencil(const labelUList &) const
Helper: is stencil fully local.
static labelList count(const label size, const labelUList &lst)
Count occurrences (in parallel)
const labelIOList & zoneID() const
Helper: get reference to registered zoneID. Loads volScalarField.
virtual bool update()=0
Update stencils. Return false if nothing changed.
virtual const labelUList & cellTypes() const =0
Return the cell type list.
static autoPtr< cellCellStencil > New(const fvMesh &, const dictionary &dict, const bool update=true)
New function which constructs and returns pointer to a.
virtual const wordHashSet & nonInterpolatedFields() const
Return the names of any (stencil or mesh specific) fields that.
virtual ~cellCellStencil()
Destructor.
virtual const List< scalarList > & cellInterpolationWeights() const =0
Weights for cellStencil.
static const Enum< cellType > cellTypeNames_
Mode type names.
static tmp< volScalarField > createField(const fvMesh &mesh, const word &name, const UList< Type > &)
Helper: create volScalarField for postprocessing.
wordHashSet nonInterpolatedFields_
Set of fields that should not be interpolated.
TypeName("cellCellStencil")
Runtime type information.
virtual void stencilWeights(const point &sample, const pointList &donorCcs, scalarList &weights) const =0
Calculate weights for a single acceptor.
declareRunTimeSelectionTable(autoPtr, cellCellStencil, mesh,(const fvMesh &mesh, const dictionary &dict, const bool update),(mesh, dict, update))
static void globalCellCells(const globalIndex &gi, const polyMesh &mesh, const boolList &isValidDonor, const labelList &selectedCells, labelListList &cellCells, pointListList &cellCellCentres)
Helper: create cell-cell addressing in global numbering.
virtual const labelListList & cellStencil() const =0
Per interpolated cell the neighbour cells (in terms of slots as.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:91
Calculates a unique integer (label so might not have enough room - 2G max) for processor + local inde...
Definition: globalIndex.H:68
Class containing processor-to-processor mapping information.
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:81
A class for managing temporary objects.
Definition: tmp.H:65
A class for handling words, derived from Foam::string.
Definition: word.H:68
dynamicFvMesh & mesh
Namespace for OpenFOAM.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Definition: exprTraits.C:59
#define declareRunTimeSelectionTable(ptrWrapper, baseType, argNames, argList, parList)
Declare a run-time selection (variables and adder classes)
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73