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