AveragingMethod.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-2017 OpenFOAM Foundation
9-------------------------------------------------------------------------------
10License
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
26Class
27 Foam::AveragingMethod
28
29Group
30 grpLagrangianIntermediateMPPICAveragingMethods
31
32Description
33 Base class for lagrangian averaging methods.
34
35SourceFiles
36 AveragingMethod.C
37 AveragingMethodI.H
38
39\*---------------------------------------------------------------------------*/
40
41#ifndef AveragingMethod_H
42#define AveragingMethod_H
43
44#include "IOdictionary.H"
45#include "autoPtr.H"
46#include "barycentric.H"
48
49// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50
51namespace Foam
52{
53
54/*---------------------------------------------------------------------------*\
55 Class AveragingMethod Declaration
56\*---------------------------------------------------------------------------*/
57
58template<class Type>
60:
61 public regIOobject,
62 public FieldField<Field, Type>
63{
64protected:
65
66 //- Protected typedefs
67
68 //- Gradient type
70
71
72 //- Protected data
73
74 //- Dictionary
75 const dictionary& dict_;
76
77 //- The mesh on which the averaging is to be done
78 const fvMesh& mesh_;
79
80
81 //- Protected member functions
82
83 //- Update the gradient calculation
84 virtual void updateGrad();
85
86
87public:
88
89 //- Runtime type information
90 TypeName("averagingMethod");
91
92 //- Declare runtime constructor selection table
94 (
95 autoPtr,
98 (
99 const IOobject& io,
100 const dictionary& dict,
101 const fvMesh& mesh
102 ),
103 (io, dict, mesh)
104 );
105
106
107 //- Constructors
108
109 //- Construct from components
111 (
112 const IOobject& io,
113 const dictionary& dict,
114 const fvMesh& mesh,
115 const labelList& size
116 );
117
118 //- Construct a copy
120
121 //- Construct and return a clone
122 virtual autoPtr<AveragingMethod<Type>> clone() const = 0;
123
124
125 //- Selector
127 (
128 const IOobject& io,
129 const dictionary& dict,
130 const fvMesh& mesh
131 );
132
133
134 //- Destructor
135 virtual ~AveragingMethod() = default;
136
137
138 //- Member Functions
139
140 //- Add point value to interpolation
141 virtual void add
142 (
144 const tetIndices& tetIs,
145 const Type& value
146 ) = 0;
147
148 //- Interpolate
149 virtual Type interpolate
150 (
152 const tetIndices& tetIs
153 ) const = 0;
154
155 //- Interpolate gradient
157 (
159 const tetIndices& tetIs
160 ) const = 0;
161
162 //- Calculate the average
163 virtual void average();
164 virtual void average(const AveragingMethod<scalar>& weight);
165
166 //- Dummy write
167 virtual bool writeData(Ostream&) const;
168
169 //- Write using setting from DB
170 virtual bool write(const bool valid = true) const;
171
172 //- Return an internal field of the average
173 virtual tmp<Field<Type>> primitiveField() const = 0;
174
175 //- Assign to another average
176 inline void operator=(const AveragingMethod<Type>& x);
177
178 //- Assign to value
179 inline void operator=(const Type& x);
180
181 //- Assign to tmp
183
184 //- Add-equal tmp
186
187 //- Multiply-equal tmp
189
190 //- Divide-equal tmp
192};
193
194
195// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
196
197} // End namespace Foam
198
199// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
200
201#include "AveragingMethodI.H"
202
203// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
204
205#ifdef NoRepository
206 #include "AveragingMethod.C"
207#endif
208
209// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
210
211#endif
212
213// ************************************************************************* //
Base class for lagrangian averaging methods.
const fvMesh & mesh_
The mesh on which the averaging is to be done.
virtual bool writeData(Ostream &) const
Dummy write.
virtual autoPtr< AveragingMethod< Type > > clone() const =0
Construct and return a clone.
virtual TypeGrad interpolateGrad(const barycentric &coordinates, const tetIndices &tetIs) const =0
Interpolate gradient.
void operator=(const AveragingMethod< Type > &x)
Assign to another average.
void operator*=(tmp< FieldField< Field, Type > > x)
Multiply-equal tmp.
virtual void add(const barycentric &coordinates, const tetIndices &tetIs, const Type &value)=0
Member Functions.
outerProduct< vector, Type >::type TypeGrad
Protected typedefs.
static autoPtr< AveragingMethod< Type > > New(const IOobject &io, const dictionary &dict, const fvMesh &mesh)
Selector.
virtual ~AveragingMethod()=default
Destructor.
const dictionary & dict_
Protected data.
void operator+=(tmp< FieldField< Field, Type > > x)
Add-equal tmp.
virtual void updateGrad()
Protected member functions.
void operator/=(tmp< FieldField< Field, scalar > > x)
Divide-equal tmp.
declareRunTimeSelectionTable(autoPtr, AveragingMethod, dictionary,(const IOobject &io, const dictionary &dict, const fvMesh &mesh),(io, dict, mesh))
Declare runtime constructor selection table.
virtual void average()
Calculate the average.
TypeName("averagingMethod")
Runtime type information.
virtual Type interpolate(const barycentric &coordinates, const tetIndices &tetIs) const =0
Interpolate.
virtual tmp< Field< Type > > primitiveField() const =0
Return an internal field of the average.
A field of fields is a PtrList of fields with reference counting.
Definition: FieldField.H:80
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:170
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
label size() const noexcept
The number of elements in the list.
Definition: UPtrListI.H:106
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: autoPtr.H:66
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:91
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
Definition: regIOobject.H:76
Storage and named access for the indices of a tet which is part of the decomposition of a cell.
Definition: tetIndices.H:84
A class for managing temporary objects.
Definition: tmp.H:65
type
Volume classification types.
Definition: volumeType.H:66
dynamicFvMesh & mesh
PtrList< coordinateSystem > coordinates(solidRegions.size())
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, false)
Namespace for OpenFOAM.
runTime write()
Macros to ease declaration of run-time selection tables.
#define declareRunTimeSelectionTable(ptrWrapper, baseType, argNames, argList, parList)
Declare a run-time selection (variables and adder classes)
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73