cellSizeFunction.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) 2012-2015 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::cellSizeFunction
28
29Description
30 Abstract base class for specifying target cell sizes
31
32SourceFiles
33 cellSizeFunction.C
34
35\*---------------------------------------------------------------------------*/
36
37#ifndef cellSizeFunction_H
38#define cellSizeFunction_H
39
40#include "point.H"
42#include "searchableSurface.H"
43#include "dictionary.H"
44#include "autoPtr.H"
47
48// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49
50namespace Foam
51{
52
53/*---------------------------------------------------------------------------*\
54 Class cellSizeFunction Declaration
55\*---------------------------------------------------------------------------*/
58:
59 public dictionary
60{
61
62public:
63
64 //- Surface side mode
65 enum sideMode
66 {
67 smInside, // Control inside the surface
68 smOutside, // Control outside the surface
69 rmBothsides // Control on both sides of a surface
70 };
71
72 //- Runtime type information
73 TypeName("cellSizeFunction");
74
75
76protected:
77
78 // Static data
79
80 //- Point closeness tolerance to a surface where the function "snaps" to
81 // including the surface
82 static scalar snapToSurfaceTol_;
83
84
85 // Protected data
86
87 //- Reference to the searchableSurface that cellSizeFunction
88 // relates to
90
91 //- Cell size at the surface
95
96 //- Method details dictionary
99 const scalar& defaultCellSize_;
100
101 //- Index of the region of the surface that this cell size function
102 // applies to
104
105 //- Mode of size specification, i.e. inside, outside or bothSides
108 label priority_;
109
110
111 // Protected Member Functions
112
113 //- No copy construct
114 cellSizeFunction(const cellSizeFunction&) = delete;
115
116 //- No copy assignment
117 void operator=(const cellSizeFunction&) = delete;
118
119
120public:
121
122 // Declare run-time constructor selection table
125 (
126 autoPtr,
129 (
130 const dictionary& cellSizeFunctionDict,
131 const searchableSurface& surface,
132 const scalar& defaultCellSize,
133 const labelList regionIndices
134 ),
135 (cellSizeFunctionDict, surface, defaultCellSize, regionIndices)
136 );
137
138
139 // Constructors
140
141 //- Construct from components
143 (
144 const word& type,
145 const dictionary& cellSizeFunctionDict,
146 const searchableSurface& surface,
147 const scalar& defaultCellSize,
148 const labelList regionIndices
149 );
150
151
152 // Selectors
153
154 //- Return a reference to the selected cellSizeFunction
156 (
157 const dictionary& cellSizeFunctionDict,
158 const searchableSurface& surface,
159 const scalar& defaultCellSize,
160 const labelList regionIndices
161 );
162
163
164 //- Destructor
165 virtual ~cellSizeFunction();
166
167
168 // Member Functions
169
170 //- Const access to the details dictionary
171 inline const dictionary& coeffsDict() const
172 {
173 return coeffsDict_;
174 }
176 virtual bool sizeLocations
177 (
178 const pointIndexHit& hitPt,
179 const vector& n,
180 pointField& shapePts,
181 scalarField& shapeSizes
182 ) const = 0;
183
184 //- Modify scalar argument to the cell size specified by function.
185 // Return a boolean specifying if the function was used, i.e. false if
186 // the point was not in range of the surface for a spatially varying
187 // size.
188 virtual bool cellSize
189 (
190 const point& pt,
191 scalar& size
192 ) const = 0;
193
195 virtual bool setCellSize
196 (
197 const pointField& pts
198 )
199 {
201 << "Not overloaded."
202 << endl;
203 return false;
204 }
206 label priority() const
207 {
208 return priority_;
209 }
210};
211
212
213// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
214
215} // End namespace Foam
216
217// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
218
219#endif
220
221// ************************************************************************* //
label n
This class describes the interaction of (usually) a face and a point. It carries the info of a succes...
Definition: PointIndexHit.H:66
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: autoPtr.H:66
Abstract base class for specifying target cell sizes.
sideMode
Surface side mode.
const scalar & defaultCellSize_
const labelList regionIndices_
Index of the region of the surface that this cell size function.
static scalar snapToSurfaceTol_
Point closeness tolerance to a surface where the function "snaps" to.
static autoPtr< cellSizeFunction > New(const dictionary &cellSizeFunctionDict, const searchableSurface &surface, const scalar &defaultCellSize, const labelList regionIndices)
Return a reference to the selected cellSizeFunction.
virtual ~cellSizeFunction()
Destructor.
const searchableSurface & surface_
Reference to the searchableSurface that cellSizeFunction.
declareRunTimeSelectionTable(autoPtr, cellSizeFunction, dictionary,(const dictionary &cellSizeFunctionDict, const searchableSurface &surface, const scalar &defaultCellSize, const labelList regionIndices),(cellSizeFunctionDict, surface, defaultCellSize, regionIndices))
const dictionary & coeffsDict() const
Const access to the details dictionary.
cellSizeFunction(const word &type, const dictionary &cellSizeFunctionDict, const searchableSurface &surface, const scalar &defaultCellSize, const labelList regionIndices)
Construct from components.
scalarField surfaceCellSize_
Cell size at the surface.
virtual bool cellSize(const point &pt, scalar &size) const =0
Modify scalar argument to the cell size specified by function.
virtual bool sizeLocations(const pointIndexHit &hitPt, const vector &n, pointField &shapePts, scalarField &shapeSizes) const =0
sideMode sideMode_
Mode of size specification, i.e. inside, outside or bothSides.
void operator=(const cellSizeFunction &)=delete
No copy assignment.
cellSizeFunction(const cellSizeFunction &)=delete
No copy construct.
virtual bool setCellSize(const pointField &pts)
autoPtr< surfaceCellSizeFunction > surfaceCellSizeFunction_
dictionary coeffsDict_
Method details dictionary.
TypeName("cellSizeFunction")
Runtime type information.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
Base class of (analytical or triangulated) surface. Encapsulates all the search routines....
A class for handling words, derived from Foam::string.
Definition: word.H:68
#define WarningInFunction
Report a warning using Foam::Warning.
Namespace for OpenFOAM.
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Definition: MSwindows.C:598
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:372
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)
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73