patchDistMethod.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) 2015-2016 OpenFOAM Foundation
9  Copyright (C) 2017 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::patchDistMethod
29 
30 Description
31  Specialisation of patchDist for wall distance calculation
32 
33 SourceFiles
34  patchDistMethod.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef patchDistMethod_H
39 #define patchDistMethod_H
40 
41 #include "dictionary.H"
42 #include "HashSet.H"
43 #include "volFieldsFwd.H"
44 #include "mapPolyMesh.H"
47 #include "runTimeSelectionTables.H"
48 
49 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50 
51 namespace Foam
52 {
53 
54 class fvMesh;
55 
56 /*---------------------------------------------------------------------------*\
57  Class patchDistMethod Declaration
58 \*---------------------------------------------------------------------------*/
59 
60 class patchDistMethod
61 {
62 
63 protected:
64 
65  // Protected Member Data
66 
67  //- Reference to the mesh
68  const fvMesh& mesh_;
69 
70  //- Set of patch IDs
71  const labelHashSet patchIDs_;
72 
73 private:
74 
75  // Private Member Functions
76 
77  //- No copy construct
78  patchDistMethod(const patchDistMethod&) = delete;
79 
80  //- No copy assignment
81  void operator=(const patchDistMethod&) = delete;
82 
83 public:
84 
85  //- Runtime type information
86  TypeName("patchDistMethod");
87 
88 
89  // Declare runtime construction
90 
92  (
93  autoPtr,
95  dictionary,
96  (
97  const dictionary& dict,
98  const fvMesh& mesh,
99  const labelHashSet& patchIDs
100  ),
101  (dict, mesh, patchIDs)
102  );
103 
104 
105  // Constructors
106 
107  //- Construct from mesh and patch ID set
109  (
110  const fvMesh& mesh,
111  const labelHashSet& patchIDs
112  );
113 
114 
115  // Selectors
116 
118  (
119  const dictionary& dict,
120  const fvMesh& mesh,
121  const labelHashSet& patchIDs
122  );
123 
125  (
126  const dictionary& dict,
127  const fvMesh& mesh,
128  const labelHashSet& patchIDs,
129  const word& defaultPatchDistMethod
130  );
131 
132 
133  //- Destructor
134  virtual ~patchDistMethod();
135 
136 
137  // Static Functions
138 
139  //- Return the patch types for y and n
140  // These are fixedValue for the set provided otherwise zero-gradient
141  template<class Type>
142  static wordList patchTypes
143  (
144  const fvMesh& mesh,
145  const labelHashSet& patchIDs
146  );
147 
148 
149  // Member Functions
150 
151  //- Return the patchIDs
152  const labelHashSet& patchIDs() const
153  {
154  return patchIDs_;
155  }
156 
157  //- Update cached geometry when the mesh moves
158  virtual bool movePoints()
159  {
160  return true;
161  }
162 
163  //- Update cached topology and geometry when the mesh changes
164  virtual void updateMesh(const mapPolyMesh&)
165  {}
166 
167  //- Correct the given distance-to-patch field
168  virtual bool correct(volScalarField& y) = 0;
169 
170  //- Correct the given distance-to-patch and normal-to-patch fields
171  virtual bool correct(volScalarField& y, volVectorField& n) = 0;
172 };
173 
174 
175 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
176 
177 } // End namespace Foam
178 
179 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
180 
181 #ifdef NoRepository
182  #include "patchDistMethodTemplates.C"
183 #endif
184 
185 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
186 
187 #endif
188 
189 // ************************************************************************* //
volFieldsFwd.H
Foam::patchDistMethod::correct
virtual bool correct(volScalarField &y)=0
Correct the given distance-to-patch field.
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::patchDistMethod::updateMesh
virtual void updateMesh(const mapPolyMesh &)
Update cached topology and geometry when the mesh changes.
Definition: patchDistMethod.H:163
mapPolyMesh.H
Foam::patchDistMethod::~patchDistMethod
virtual ~patchDistMethod()
Destructor.
Definition: patchDistMethod.C:114
Foam::patchDistMethod::patchTypes
static wordList patchTypes(const fvMesh &mesh, const labelHashSet &patchIDs)
Return the patch types for y and n.
Foam::HashSet< label, Hash< label > >
Foam::patchDistMethod::New
static autoPtr< patchDistMethod > New(const dictionary &dict, const fvMesh &mesh, const labelHashSet &patchIDs)
Definition: patchDistMethod.C:56
n
label n
Definition: TABSMDCalcMethod2.H:31
patchDistMethodTemplates.C
Foam::patchDistMethod::movePoints
virtual bool movePoints()
Update cached geometry when the mesh moves.
Definition: patchDistMethod.H:157
HashSet.H
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
Foam::patchDistMethod
Specialisation of patchDist for wall distance calculation.
Definition: patchDistMethod.H:59
Foam::patchDistMethod::mesh_
const fvMesh & mesh_
Reference to the mesh.
Definition: patchDistMethod.H:67
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:83
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::patchDistMethod::declareRunTimeSelectionTable
declareRunTimeSelectionTable(autoPtr, patchDistMethod, dictionary,(const dictionary &dict, const fvMesh &mesh, const labelHashSet &patchIDs),(dict, mesh, patchIDs))
Foam::patchDistMethod::patchIDs_
const labelHashSet patchIDs_
Set of patch IDs.
Definition: patchDistMethod.H:70
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
runTimeSelectionTables.H
Macros to ease declaration of run-time selection tables.
Foam::List< word >
Foam::patchDistMethod::TypeName
TypeName("patchDistMethod")
Runtime type information.
fixedValueFvPatchFields.H
dictionary.H
Foam::mapPolyMesh
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:161
Foam::GeometricField< scalar, fvPatchField, volMesh >
Foam::patchDistMethod::patchIDs
const labelHashSet & patchIDs() const
Return the patchIDs.
Definition: patchDistMethod.H:151
zeroGradientFvPatchFields.H
y
scalar y
Definition: LISASMDCalcMethod1.H:14