Residuals.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2019-2020 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::Residuals
26 
27 Description
28  MeshObject to store the solver performance residuals of all the fields
29  of the type it is instantiated on.
30 
31 SourceFiles
32  Residuals.C
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef Residuals_H
37 #define Residuals_H
38 
39 #include "MeshObject.H"
40 #include "polyMesh.H"
41 #include "solverPerformance.H"
42 
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 
45 namespace Foam
46 {
47 
48 /*---------------------------------------------------------------------------*\
49  Class Residuals Declaration
50 \*---------------------------------------------------------------------------*/
51 
52 template<class Type>
53 class Residuals
54 :
55  public MeshObject<polyMesh, GeometricMeshObject, Residuals<Type>>,
56  public HashTable<DynamicList<SolverPerformance<Type>>>
57 {
58  // Private Data
59 
60  //- Previously used time-index, used for reset between iterations
61  mutable label prevTimeIndex_;
62 
63 
64 public:
65 
66  //- Runtime type information
67  TypeName("residuals");
68 
69 
70  // Constructors
71 
72  //- Construct for given mesh
73  Residuals(const polyMesh& mesh);
74 
75  //- Disallow default bitwise copy construction
76  Residuals(const Residuals<Type>&) = delete;
77 
78 
79  // Member Functions
80 
81  //- Return the list of field names of the particular type
82  // for which residuals are stored
83  static List<word> fieldNames(const polyMesh& mesh);
84 
85  //- Return true if residuals for the given field are stored
86  static bool found(const polyMesh& mesh, const word& fieldName);
87 
88  //- Return the list of solver performance residuals for the given field
90  (
91  const polyMesh& mesh,
92  const word& fieldName
93  );
94 
95  //- Append the given solver performance residuals
96  // in the corresponding list
97  static void append
98  (
99  const polyMesh& mesh,
101  );
102 
103 
104  // Member Operators
105 
106  //- Disallow default bitwise assignment
107  void operator=(const Residuals<Type>&) = delete;
108 };
109 
110 
111 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
112 
113 } // End namespace Foam
114 
115 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
116 
117 #ifdef NoRepository
118  #include "Residuals.C"
119 #endif
120 
121 
122 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
123 
124 #endif
125 
126 // ************************************************************************* //
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
static void append(const polyMesh &mesh, const SolverPerformance< Type > &)
Append the given solver performance residuals.
Definition: Residuals.C:78
static const DynamicList< SolverPerformance< Type > > & field(const polyMesh &mesh, const word &fieldName)
Return the list of solver performance residuals for the given field.
Definition: Residuals.C:64
void operator=(const Residuals< Type > &)=delete
Disallow default bitwise assignment.
static bool found(const polyMesh &mesh, const word &fieldName)
Return true if residuals for the given field are stored.
Definition: Residuals.C:52
Templated abstract base-class for optional mesh objects used to automate their allocation to the mesh...
Definition: MeshObject.H:85
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects...
Definition: DynamicList.H:56
A class for handling words, derived from string.
Definition: word.H:59
SolverPerformance is the class returned by the LduMatrix solver containing performance statistics...
An STL-conforming hash table.
Definition: HashTable.H:61
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
static List< word > fieldNames(const polyMesh &mesh)
Return the list of field names of the particular type.
Definition: Residuals.C:42
Residuals(const polyMesh &mesh)
Construct for given mesh.
Definition: Residuals.C:32
Namespace for OpenFOAM.
MeshObject to store the solver performance residuals of all the fields of the type it is instantiated...
Definition: Residuals.H:52
TypeName("residuals")
Runtime type information.