All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
linearDistance.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) 2012-2019 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::linearDistance
26 
27 Description
28 
29 SourceFiles
30  linearDistance.C
31 
32 \*---------------------------------------------------------------------------*/
33 
34 #ifndef linearDistance_H
35 #define linearDistance_H
36 
37 #include "cellSizeFunction.H"
38 
39 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
40 
41 namespace Foam
42 {
43 
44 /*---------------------------------------------------------------------------*\
45  Class linearDistance Declaration
46 \*---------------------------------------------------------------------------*/
47 
48 class linearDistance
49 :
50  public cellSizeFunction
51 {
52 
53 private:
54 
55  // Private Data
56 
57  //- Cell size at distance_ from the surface
58  scalar distanceCellSize_;
59 
60  //- Distance from the surface to control over
61  scalar distance_;
62 
63  //- Distance squared
64  scalar distanceSqr_;
65 
66 
67  // Private Member Functions
68 
69  //- Calculate the cell size as a function of the given distance
70  scalar sizeFunction(const point& pt, scalar d, label index) const;
71 
72 
73 public:
74 
75  //- Runtime type information
76  TypeName("linearDistance");
77 
78  // Constructors
79 
80  //- Construct from components
82  (
83  const dictionary& initialPointsDict,
84  const searchableSurface& surface,
85  const scalar& defaultCellSize,
86  const labelList regionIndices
87  );
88 
89 
90  //- Destructor
91  virtual ~linearDistance()
92  {}
93 
94 
95  // Member Functions
96 
97 
98  virtual bool sizeLocations
99  (
100  const pointIndexHit& hitPt,
101  const vector& n,
102  pointField& shapePts,
103  scalarField& shapeSizes
104  ) const;
105 
106  //- Modify scalar argument to the cell size specified by function.
107  // Return a boolean specifying if the function was used, i.e. false if
108  // the point was not in range of the surface for a spatially varying
109  // size.
110  virtual bool cellSize
111  (
112  const point& pt,
113  scalar& size
114  ) const;
115 
116  //- Adapt local cell size. Return true if anything changed.
117  virtual bool setCellSize
118  (
119  const pointField& pts
120  );
121 };
122 
123 
124 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
125 
126 } // End namespace Foam
127 
128 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
129 
130 #endif
131 
132 // ************************************************************************* //
virtual bool setCellSize(const pointField &pts)
Adapt local cell size. Return true if anything changed.
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
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:158
Abstract base class for specifying target cell sizes.
This class describes the interaction of (usually) a face and a point. It carries the info of a succes...
Definition: PointIndexHit.H:53
Base class of (analytical or triangulated) surface. Encapsulates all the search routines. WIP.
virtual bool cellSize(const point &pt, scalar &size) const
Modify scalar argument to the cell size specified by function.
virtual bool sizeLocations(const pointIndexHit &hitPt, const vector &n, pointField &shapePts, scalarField &shapeSizes) const
label n
virtual ~linearDistance()
Destructor.
TypeName("linearDistance")
Runtime type information.
Namespace for OpenFOAM.
linearDistance(const dictionary &initialPointsDict, const searchableSurface &surface, const scalar &defaultCellSize, const labelList regionIndices)
Construct from components.