cellCellStencilObject.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,2024 OpenCFD Ltd.
9 -------------------------------------------------------------------------------
10 License
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 
26 Class
27  Foam::cellCellStencilObject
28 
29 Description
30 
31 SourceFiles
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef Foam_cellCellStencilObject_H
36 #define Foam_cellCellStencilObject_H
37 
38 #include "cellCellStencil.H"
39 #include "MeshObject.H"
40 
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42 
43 namespace Foam
44 {
45 
46 // Typedefs
49 
50 
51 /*---------------------------------------------------------------------------*\
52  Class cellCellStencilObject Declaration
53 \*---------------------------------------------------------------------------*/
54 
56 :
57  public Stencil,
58  public cellCellStencil
59 {
60  // Private Data
61 
62  autoPtr<cellCellStencil> stencilPtr_;
63 
64 
65 public:
66 
67  TypeName("cellCellStencilObject");
68 
69 
70  // Constructors
71 
72  //- Construct with mesh
73  explicit cellCellStencilObject
74  (
75  const fvMesh& mesh,
76  const bool update = true
77  )
78  :
79  Stencil(mesh),
81  stencilPtr_
82  (
84  (
85  mesh,
86  mesh.schemesDict().subDict
87  (
88  "oversetInterpolation"
89  ),
90  update
91  )
92  )
93  {}
94 
95 
96  //- Destructor
97  virtual ~cellCellStencilObject() = default;
98 
99 
100  // Member Functions
101 
102  //- Callback for geometry motion
103  virtual bool movePoints();
104 
105  //- Update stencils. Return false if nothing changed.
106  virtual bool update()
107  {
108  return stencilPtr_().update();
109  }
110 
111  //- Return the cell type list
112  virtual const labelUList& cellTypes() const
113  {
114  return stencilPtr_().cellTypes();
115  }
116 
117  //- Indices of interpolated cells
118  virtual const labelUList& interpolationCells() const
119  {
120  return stencilPtr_().interpolationCells();
121  }
122 
123  //- Return a communication schedule
124  virtual const mapDistribute& cellInterpolationMap() const
125  {
126  return stencilPtr_().cellInterpolationMap();
127  }
128 
129  //- Per interpolated cell the neighbour cells (in terms of slots as
130  // constructed by above cellInterpolationMap) to interpolate
131  virtual const labelListList& cellStencil() const
132  {
133  return stencilPtr_().cellStencil();
134  }
135 
136  //- Weights for cellStencil
137  virtual const List<scalarList>& cellInterpolationWeights() const
138  {
139  return stencilPtr_().cellInterpolationWeights();
140  }
141 
142  //- Per interpolated cell the interpolation factor. (0 = use
143  // calculated, 1 = use interpolated)
144  virtual const scalarList& cellInterpolationWeight() const
145  {
146  return stencilPtr_().cellInterpolationWeight();
147  }
148 
149  //- Calculate weights for a single acceptor
150  virtual void stencilWeights
151  (
152  const point& sample,
153  const pointList& donorCcs,
154  scalarList& weights
155  ) const
156  {
157  stencilPtr_().stencilWeights(sample, donorCcs, weights);
158  }
159 
160  //- Return the names of any (stencil or mesh specific) fields that
161  // should not be interpolated
162  virtual const wordHashSet& nonInterpolatedFields() const
163  {
164  return stencilPtr_().nonInterpolatedFields();
165  }
166 };
167 
168 
169 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
171 } // End namespace Foam
172 
173 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
174 
175 #endif
176 
177 // ************************************************************************* //
virtual const scalarList & cellInterpolationWeight() const
Per interpolated cell the interpolation factor. (0 = use.
virtual const labelUList & interpolationCells() const
Indices of interpolated cells.
static const Type & New(const Mesh &mesh, Args &&... args)
Get existing or create MeshObject registered with typeName.
Definition: MeshObject.C:53
TypeName("cellCellStencilObject")
MeshObject< fvMesh, MoveableMeshObject, cellCellStencilObject > Stencil
virtual const labelUList & cellTypes() const
Return the cell type list.
Templated abstract base-class for optional mesh objects used to automate their allocation to the mesh...
Definition: MeshObject.H:152
Calculation of interpolation stencils.
const Mesh & mesh() const noexcept
Reference to the mesh.
Definition: MeshObject.H:255
virtual const labelListList & cellStencil() const
Per interpolated cell the neighbour cells (in terms of slots as.
virtual ~cellCellStencilObject()=default
Destructor.
virtual const List< scalarList > & cellInterpolationWeights() const
Weights for cellStencil.
cellCellStencilObject(const fvMesh &mesh, const bool update=true)
Construct with mesh.
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
virtual bool update()
Update stencils. Return false if nothing changed.
virtual void stencilWeights(const point &sample, const pointList &donorCcs, scalarList &weights) const
Calculate weights for a single acceptor.
Class containing processor-to-processor mapping information.
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
virtual const mapDistribute & cellInterpolationMap() const
Return a communication schedule.
virtual bool movePoints()
Callback for geometry motion.
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Definition: HashPtrTable.H:48
virtual const wordHashSet & nonInterpolatedFields() const
Return the names of any (stencil or mesh specific) fields that.
Namespace for OpenFOAM.