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-2024 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  DemandDrivenMeshObject to store the solver performance residuals of all
29  the fields 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 "DemandDrivenMeshObject.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 :
56  <
57  polyMesh,
58  TopoChangeableMeshObject,
59  Residuals<Type>
60  >,
61  public HashTable<DynamicList<SolverPerformance<Type>>>
62 {
63  // Private Data
64 
65  //- Previously used time-index, used for reset between iterations
66  mutable label prevTimeIndex_;
67 
68 
69 protected:
70 
71  friend class DemandDrivenMeshObject
72  <
73  polyMesh,
75  Residuals<Type>
76  >;
77 
78  // Protected Constructors
79 
80  //- Construct for given mesh
81  explicit Residuals(const polyMesh& mesh);
82 
83 
84 public:
85 
86  //- Runtime type information
87  TypeName("residuals");
88 
89 
90  // Constructors
91 
92  //- Disallow default bitwise copy construction
93  Residuals(const Residuals<Type>&) = delete;
94 
95 
96  // Member Functions
97 
98  //- Return the list of field names of the particular type
99  // for which residuals are stored
100  static List<word> fieldNames(const polyMesh& mesh);
101 
102  //- Return true if residuals for the given field are stored
103  static bool found(const polyMesh& mesh, const word& fieldName);
104 
105  //- Return the list of solver performance residuals for the given field
107  (
108  const polyMesh& mesh,
109  const word& fieldName
110  );
111 
112  //- Append the given solver performance residuals
113  // in the corresponding list
114  static void append
115  (
116  const polyMesh& mesh,
118  );
119 
120  //- Update for mesh motion
121  virtual bool movePoints();
122 
123  //- Redistribute or update using the given distribution map
124  virtual void distribute(const polyDistributionMap& map);
125 
126  //- Update topology using the given map
127  virtual void topoChange(const polyTopoChangeMap& map);
128 
129  //- Update from another mesh using the given map
130  virtual void mapMesh(const polyMeshMap& map);
131 
132 
133  // Member Operators
134 
135  //- Disallow default bitwise assignment
136  void operator=(const Residuals<Type>&) = delete;
137 };
138 
139 
140 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
141 
142 } // End namespace Foam
143 
144 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
145 
146 #ifdef NoRepository
147  #include "Residuals.C"
148 #endif
149 
150 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
151 
152 #endif
153 
154 // ************************************************************************* //
Templated abstract base-class for demand-driven mesh objects used to automate their allocation to the...
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
Definition: DynamicList.H:78
An STL-conforming hash table.
Definition: HashTable.H:127
DemandDrivenMeshObject to store the solver performance residuals of all the fields of the type it is ...
Definition: Residuals.H:61
virtual bool movePoints()
Update for mesh motion.
Definition: Residuals.C:146
static bool found(const polyMesh &mesh, const word &fieldName)
Return true if residuals for the given field are stored.
Definition: Residuals.C:62
virtual void mapMesh(const polyMeshMap &map)
Update from another mesh using the given map.
Definition: Residuals.C:163
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:79
void operator=(const Residuals< Type > &)=delete
Disallow default bitwise assignment.
Residuals(const polyMesh &mesh)
Construct for given mesh.
Definition: Residuals.C:32
virtual void distribute(const polyDistributionMap &map)
Redistribute or update using the given distribution map.
Definition: Residuals.C:153
TypeName("residuals")
Runtime type information.
static List< word > fieldNames(const polyMesh &mesh)
Return the list of field names of the particular type.
Definition: Residuals.C:47
virtual void topoChange(const polyTopoChangeMap &map)
Update topology using the given map.
Definition: Residuals.C:158
static void append(const polyMesh &mesh, const SolverPerformance< Type > &)
Append the given solver performance residuals.
Definition: Residuals.C:98
SolverPerformance is the class returned by the LduMatrix solver containing performance statistics.
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
Class containing mesh-to-mesh mapping information.
Definition: polyMeshMap.H:51
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:80
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
A class for handling words, derived from string.
Definition: word.H:62
Namespace for OpenFOAM.
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