surfaceOffsetLinearDistance.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  Copyright (C) 2019 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::surfaceOffsetLinearDistance
29 
30 Description
31 
32 SourceFiles
33  surfaceOffsetLinearDistance.C
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #ifndef surfaceOffsetLinearDistance_H
38 #define surfaceOffsetLinearDistance_H
39 
40 #include "cellSizeFunction.H"
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 namespace Foam
45 {
46 
47 /*---------------------------------------------------------------------------*\
48  Class surfaceOffsetLinearDistance Declaration
49 \*---------------------------------------------------------------------------*/
50 
52 :
53  public cellSizeFunction
54 {
55 
56 private:
57 
58  // Private data
59 
60  //- Cell size at distance_ from the surface
61  scalar distanceCellSize_;
62 
63  //- Offset distance from surface for constant size portion
64  scalar surfaceOffset_;
65 
66  //- Total distance from the surface to control over (distance +
67  // surfaceOffset)
68  scalar totalDistance_;
69 
70  //- totalDistance squared
71  scalar totalDistanceSqr_;
72 
73 
74  // Private Member Functions
75 
76  //- Calculate the cell size as a function of the given distance
77  scalar sizeFunction(const point& pt, scalar d, label index) const;
78 
79 
80 public:
81 
82  //- Runtime type information
83  TypeName("surfaceOffsetLinearDistance");
84 
85  // Constructors
86 
87  //- Construct from components
89  (
90  const dictionary& initialPointsDict,
92  const scalar& defaultCellSize,
93  const labelList regionIndices
94  );
95 
96 
97  //- Destructor
98  virtual ~surfaceOffsetLinearDistance() = default;
99 
100 
101  // Member Functions
102 
103  virtual bool sizeLocations
104  (
105  const pointIndexHit& hitPt,
106  const vector& n,
107  pointField& shapePts,
108  scalarField& shapeSizes
109  ) const;
110 
111  //- Modify scalar argument to the cell size specified by function.
112  // Return a boolean specifying if the function was used, i.e. false if
113  // the point was not in range of the surface for a spatially varying
114  // size.
115  virtual bool cellSize
116  (
117  const point& pt,
118  scalar& size
119  ) const;
120 };
121 
122 
123 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
124 
125 } // End namespace Foam
126 
127 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
128 
129 #endif
130 
131 // ************************************************************************* //
virtual bool sizeLocations(const pointIndexHit &hitPt, const vector &n, pointField &shapePts, scalarField &shapeSizes) const
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
Abstract base class for specifying target cell sizes.
This class describes the interaction of an object (often a face) and a point. It carries the info of ...
Definition: pointIndexHit.H:44
Base class of (analytical or triangulated) surface. Encapsulates all the search routines. WIP.
virtual ~surfaceOffsetLinearDistance()=default
Destructor.
surfaceOffsetLinearDistance(const dictionary &initialPointsDict, const searchableSurface &surface, const scalar &defaultCellSize, const labelList regionIndices)
Construct from components.
const wordList surface
Standard surface field types (scalar, vector, tensor, etc)
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
TypeName("surfaceOffsetLinearDistance")
Runtime type information.
label n
virtual bool cellSize(const point &pt, scalar &size) const
Modify scalar argument to the cell size specified by function.
Namespace for OpenFOAM.