LeastSquaresVectors.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) 2013-2016 OpenFOAM Foundation
9  Copyright (C) 2021 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::fv::LeastSquaresVectors
29 
30 Description
31  Least-squares gradient scheme vectors
32 
33 See also
34  Foam::fv::LeastSquaresGrad
35 
36 SourceFiles
37  LeastSquaresVectors.C
38 
39 \*---------------------------------------------------------------------------*/
40 
41 #ifndef LeastSquaresVectors_H
42 #define LeastSquaresVectors_H
43 
45 #include "MeshObject.H"
46 
47 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 
49 namespace Foam
50 {
51 
52 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
53 
54 namespace fv
55 {
56 
57 /*---------------------------------------------------------------------------*\
58  Class LeastSquaresVectors Declaration
59 \*---------------------------------------------------------------------------*/
60 
61 template<class Stencil>
63 :
64  public MeshObject<fvMesh, MoveableMeshObject, LeastSquaresVectors<Stencil>>
65 {
66  // Private Typedefs
67 
68  typedef MeshObject
69  <
70  fvMesh,
74 
75 
76  // Private Data
77 
78  //- Least-squares gradient vectors
79  List<List<vector>> vectors_;
80 
81 
82  // Private Member Functions
83 
84  //- Calculate Least-squares gradient vectors
85  void calcLeastSquaresVectors();
86 
87 
88 public:
89 
90  // Declare name of the class and its debug switch
91  TypeName("LeastSquaresVectors");
92 
93 
94  // Constructors
95 
96  //- Construct given an fvMesh and the minimum determinant criterion
97  explicit LeastSquaresVectors(const fvMesh& mesh);
98 
99 
100  //- Destructor
101  virtual ~LeastSquaresVectors();
102 
103 
104  // Member Functions
105 
106  //- Return const reference to the stencil
108  {
109  return Stencil::New(this->mesh_);
110  }
111 
112  //- Return const reference to the least square vectors
113  const List<List<vector>>& vectors() const
114  {
115  return vectors_;
116  }
117 
118  //- Update the least square vectors when the mesh moves
119  virtual bool movePoints();
120 };
121 
122 
123 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
124 
125 } // End namespace fv
126 
127 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
128 
129 } // End namespace Foam
130 
131 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
132 
133 #ifdef NoRepository
134  #include "LeastSquaresVectors.C"
135 #endif
136 
137 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
138 
139 #endif
140 
141 // ************************************************************************* //
const extendedCentredCellToCellStencil & stencil() const
Return const reference to the stencil.
virtual bool movePoints()
Update the least square vectors when the mesh moves.
MoveableMeshObject(const word &objName, const objectRegistry &obr)
Construct from name and instance on registry.
Definition: MeshObject.H:326
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: BitOps.H:56
static const cellCellStencilObject & New(const fvMesh &mesh, Args &&... args)
Get existing or create MeshObject registered with typeName.
Definition: MeshObject.C:53
virtual ~LeastSquaresVectors()
Destructor.
const List< List< vector > > & vectors() const
Return const reference to the least square vectors.
Templated abstract base-class for optional mesh objects used to automate their allocation to the mesh...
Definition: MeshObject.H:152
const fvMesh & mesh() const noexcept
Reference to the mesh.
Definition: MeshObject.H:255
labelList fv(nPoints)
TypeName("LeastSquaresVectors")
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
LeastSquaresVectors(const fvMesh &mesh)
Construct given an fvMesh and the minimum determinant criterion.
Least-squares gradient scheme vectors.
Namespace for OpenFOAM.