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 -------------------------------------------------------------------------------
10 License
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 
26 Class
27  Foam::cellSizeFunction
28 
29 Description
30  Abstract base class for specifying target cell sizes
31 
32 SourceFiles
33  cellSizeFunction.C
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #ifndef cellSizeFunction_H
38 #define cellSizeFunction_H
39 
40 #include "point.H"
41 #include "conformalVoronoiMesh.H"
42 #include "searchableSurface.H"
43 #include "dictionary.H"
44 #include "autoPtr.H"
45 #include "runTimeSelectionTables.H"
47 
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 
50 namespace Foam
51 {
52 
53 /*---------------------------------------------------------------------------*\
54  Class cellSizeFunction Declaration
55 \*---------------------------------------------------------------------------*/
56 
57 class cellSizeFunction
58 :
59  public dictionary
60 {
61 
62 public:
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 
76 protected:
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
93 
95 
96  //- Method details dictionary
98 
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
107 
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 
120 public:
121 
122  // Declare run-time constructor selection table
123 
125  (
126  autoPtr,
128  dictionary,
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  }
175 
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 
194 
195  virtual bool setCellSize
196  (
197  const pointField& pts
198  )
199  {
201  << "Not overloaded."
202  << endl;
203  return false;
204  }
205 
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 // ************************************************************************* //
Foam::cellSizeFunction::regionIndices_
const labelList regionIndices_
Index of the region of the surface that this cell size function.
Definition: cellSizeFunction.H:102
Foam::cellSizeFunction::surface_
const searchableSurface & surface_
Reference to the searchableSurface that cellSizeFunction.
Definition: cellSizeFunction.H:88
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::cellSizeFunction::priority
label priority() const
Definition: cellSizeFunction.H:205
searchableSurface.H
Foam::cellSizeFunction::operator=
void operator=(const cellSizeFunction &)=delete
No copy assignment.
point.H
Foam::cellSizeFunction::declareRunTimeSelectionTable
declareRunTimeSelectionTable(autoPtr, cellSizeFunction, dictionary,(const dictionary &cellSizeFunctionDict, const searchableSurface &surface, const scalar &defaultCellSize, const labelList regionIndices),(cellSizeFunctionDict, surface, defaultCellSize, regionIndices))
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:369
Foam::cellSizeFunction
Abstract base class for specifying target cell sizes.
Definition: cellSizeFunction.H:56
Foam::cellSizeFunction::cellSize
virtual bool cellSize(const point &pt, scalar &size) const =0
Modify scalar argument to the cell size specified by function.
Foam::cellSizeFunction::sideMode_
sideMode sideMode_
Mode of size specification, i.e. inside, outside or bothSides.
Definition: cellSizeFunction.H:105
Foam::cellSizeFunction::coeffsDict
const dictionary & coeffsDict() const
Const access to the details dictionary.
Definition: cellSizeFunction.H:170
Foam::cellSizeFunction::sizeLocations
virtual bool sizeLocations(const pointIndexHit &hitPt, const vector &n, pointField &shapePts, scalarField &shapeSizes) const =0
Foam::cellSizeFunction::smOutside
Definition: cellSizeFunction.H:67
Foam::cellSizeFunction::cellSizeFunction
cellSizeFunction(const cellSizeFunction &)=delete
No copy construct.
n
label n
Definition: TABSMDCalcMethod2.H:31
Foam::PointIndexHit
This class describes the interaction of (usually) a face and a point. It carries the info of a succes...
Definition: PointIndexHit.H:52
Foam::Field< scalar >
Foam::searchableSurface
Base class of (analytical or triangulated) surface. Encapsulates all the search routines....
Definition: searchableSurface.H:69
surfaceCellSizeFunction.H
Foam::cellSizeFunction::setCellSize
virtual bool setCellSize(const pointField &pts)
Definition: cellSizeFunction.H:195
Foam::cellSizeFunction::snapToSurfaceTol_
static scalar snapToSurfaceTol_
Point closeness tolerance to a surface where the function "snaps" to.
Definition: cellSizeFunction.H:81
Foam::cellSizeFunction::rmBothsides
Definition: cellSizeFunction.H:68
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam::cellSizeFunction::smInside
Definition: cellSizeFunction.H:66
Foam::cellSizeFunction::~cellSizeFunction
virtual ~cellSizeFunction()
Destructor.
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::cellSizeFunction::coeffsDict_
dictionary coeffsDict_
Method details dictionary.
Definition: cellSizeFunction.H:96
Foam::cellSizeFunction::New
static autoPtr< cellSizeFunction > New(const dictionary &cellSizeFunctionDict, const searchableSurface &surface, const scalar &defaultCellSize, const labelList regionIndices)
Return a reference to the selected cellSizeFunction.
Foam::cellSizeFunction::TypeName
TypeName("cellSizeFunction")
Runtime type information.
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::cellSizeFunction::surfaceCellSize_
scalarField surfaceCellSize_
Cell size at the surface.
Definition: cellSizeFunction.H:91
Foam::Vector< scalar >
Foam::List< label >
Foam::type
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Definition: MSwindows.C:590
Foam::cellSizeFunction::priority_
label priority_
Definition: cellSizeFunction.H:107
dictionary.H
Foam::cellSizeFunction::defaultCellSize_
const scalar & defaultCellSize_
Definition: cellSizeFunction.H:98
WarningInFunction
#define WarningInFunction
Report a warning using Foam::Warning.
Definition: messageStream.H:328
Foam::cellSizeFunction::sideMode
sideMode
Surface side mode.
Definition: cellSizeFunction.H:64
conformalVoronoiMesh.H
Foam::cellSizeFunction::surfaceCellSizeFunction_
autoPtr< surfaceCellSizeFunction > surfaceCellSizeFunction_
Definition: cellSizeFunction.H:93
autoPtr.H