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 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 MeshObject<fvMesh, MoveableMeshObject, cellCellStencilObject>,
58  public cellCellStencil
59 {
60  // Private Typedefs
61 
62  typedef MeshObject
63  <
64  fvMesh,
68 
69 
70  // Private Data
71 
72  autoPtr<cellCellStencil> stencilPtr_;
73 
74 
75 public:
76 
77  TypeName("cellCellStencilObject");
78 
79 
80  // Constructors
81 
82  //- Construct with mesh
83  explicit cellCellStencilObject
84  (
85  const fvMesh& mesh,
86  const bool update = true
87  )
88  :
90 
92  stencilPtr_
93  (
95  (
96  mesh,
97  mesh.schemesDict().subDict
98  (
99  "oversetInterpolation"
100  ),
101  update
102  )
103  )
104  {}
105 
106 
107  //- Destructor
108  virtual ~cellCellStencilObject() = default;
109 
110 
111  // Member Functions
112 
113  //- Callback for geometry motion
114  virtual bool movePoints()
115  {
116  return stencilPtr_().update();
117  }
118 
119  //- Update stencils. Return false if nothing changed.
120  virtual bool update()
121  {
122  return stencilPtr_().update();
123  }
124 
125  //- Return the cell type list
126  virtual const labelUList& cellTypes() const
127  {
128  return stencilPtr_().cellTypes();
129  }
130 
131  //- Indices of interpolated cells
132  virtual const labelUList& interpolationCells() const
133  {
134  return stencilPtr_().interpolationCells();
135  }
136 
137  //- Return a communication schedule
138  virtual const mapDistribute& cellInterpolationMap() const
139  {
140  return stencilPtr_().cellInterpolationMap();
141  }
142 
143  //- Per interpolated cell the neighbour cells (in terms of slots as
144  // constructed by above cellInterpolationMap) to interpolate
145  virtual const labelListList& cellStencil() const
146  {
147  return stencilPtr_().cellStencil();
148  }
149 
150  //- Weights for cellStencil
151  virtual const List<scalarList>& cellInterpolationWeights() const
152  {
153  return stencilPtr_().cellInterpolationWeights();
154  }
155 
156  //- Per interpolated cell the interpolation factor. (0 = use
157  // calculated, 1 = use interpolated)
158  virtual const scalarList& cellInterpolationWeight() const
159  {
160  return stencilPtr_().cellInterpolationWeight();
161  }
162 
163  //- Calculate weights for a single acceptor
164  virtual void stencilWeights
165  (
166  const point& sample,
167  const pointList& donorCcs,
168  scalarList& weights
169  ) const
170  {
171  stencilPtr_().stencilWeights(sample, donorCcs, weights);
172  }
173 
174  //- Return the names of any (stencil or mesh specific) fields that
175  // should not be interpolated
176  virtual const wordHashSet& nonInterpolatedFields() const
177  {
178  return stencilPtr_().nonInterpolatedFields();
179  }
180 };
181 
182 
183 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
185 } // End namespace Foam
186 
187 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
188 
189 #endif
190 
191 // ************************************************************************* //
virtual const scalarList & cellInterpolationWeight() const
Per interpolated cell the interpolation factor. (0 = use.
virtual const labelUList & interpolationCells() const
Indices of interpolated cells.
MoveableMeshObject(const word &objName, const objectRegistry &obr)
Construct from name and instance on registry.
Definition: MeshObject.H:326
virtual bool movePoints()
Callback for geometry motion.
TypeName("cellCellStencilObject")
static autoPtr< cellCellStencil > New(const fvMesh &, const dictionary &dict, const bool update=true)
New function which constructs and returns pointer to a.
MeshObject< fvMesh, MoveableMeshObject, cellCellStencilObject > Stencil
virtual const labelUList & cellTypes() const
Return the cell type list.
Calculation of interpolation stencils.
const fvMesh & 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.
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.