surfaceDistance.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) 2019-2020 OpenCFD Ltd.
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::functionObjects::surfaceDistance
28
29Group
30 grpFieldFunctionObjects
31
32Description
33 Computes the distance to the nearest surface from a given geometry.
34
35 Operands:
36 \table
37 Operand | Type | Location
38 input | - | -
39 output file | - | -
40 output field | volScalarField | $FOAM_CASE/<time>/surfaceDistance
41 \endtable
42
43Usage
44 Minimal example by using \c system/controlDict.functions:
45 \verbatim
46 surfaceDistance1
47 {
48 // Mandatory entries (unmodifiable)
49 type surfaceDistance;
50 libs (fieldFunctionObjects);
51
52 // Mandatory entries (runtime modifiable)
53 geometry
54 {
55 motorBike.obj
56 {
57 type triSurfaceMesh;
58 name motorBike;
59 }
60 }
61
62 // Optional entries (runtime modifiable)
63 calculateCells true;
64
65 // Optional (inherited) entries
66 ...
67 }
68 \endverbatim
69
70 where the entries mean:
71 \table
72 Property | Description | Type | Req'd | Dflt
73 type | Type name: surfaceDistance | word | yes | -
74 libs | Library name: fieldFunctionObjects | word | yes | -
75 geometry | Surface details | dict | yes | -
76 calculateCells | Calculate distance from cell | bool | no | true
77 \endtable
78
79 The inherited entries are elaborated in:
80 - \link functionObject.H \endlink
81
82 Usage by the \c postProcess utility is not available.
83
84See also
85 - Foam::functionObject
86 - Foam::functionObjects::fvMeshFunctionObject
87 - ExtendedCodeGuide::functionObjects::field::surfaceDistance
88
89SourceFiles
90 surfaceDistance.C
91
92\*---------------------------------------------------------------------------*/
93
94#ifndef functionObjects_surfaceDistance_H
95#define functionObjects_surfaceDistance_H
96
98#include "searchableSurfaces.H"
99#include "volFields.H"
100
101// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
102
103namespace Foam
104{
105
106// Forward declaration of classes
107class objectRegistry;
108class dictionary;
109class mapPolyMesh;
110
111namespace functionObjects
112{
113
114/*---------------------------------------------------------------------------*\
115 Class surfaceDistance Declaration
116\*---------------------------------------------------------------------------*/
117
118class surfaceDistance
119:
120 public fvMeshFunctionObject
121{
122protected:
123
124 // Protected Data
125
126 //- Switch to calculate distance-to-cells
127 Switch doCells_;
128
129 //- Geometry
130 autoPtr<searchableSurfaces> geomPtr_;
131
132
133public:
134
135 //- Runtime type information
136 TypeName("surfaceDistance");
137
138
139 // Constructors
140
141 //- Construct for given objectRegistry and dictionary.
142 // Allow the possibility to load fields from files
144 (
145 const word& name,
146 const Time& runTime,
147 const dictionary& dict
148 );
149
150 //- No copy construct
151 surfaceDistance(const surfaceDistance&) = delete;
152
153 //- No copy assignment
154 void operator=(const surfaceDistance&) = delete;
155
156
157 //- Destructor
158 virtual ~surfaceDistance() = default;
159
160
161 // Member Functions
162
163 //- Read the controls
164 virtual bool read(const dictionary&);
165
166 //- Calculate the interpolated fields
167 virtual bool execute();
168
169 //- Write the interpolated fields
170 virtual bool write();
171};
173
174// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
176} // End namespace functionObjects
177} // End namespace Foam
178
179// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
180
181#endif
182
183// ************************************************************************* //
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
Definition: Switch.H:78
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:80
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: autoPtr.H:66
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
const word & name() const noexcept
Return the name of this functionObject.
Specialization of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
Computes the distance to the nearest surface from a given geometry.
autoPtr< searchableSurfaces > geomPtr_
Geometry.
TypeName("surfaceDistance")
Runtime type information.
surfaceDistance(const word &name, const Time &runTime, const dictionary &dict)
Construct for given objectRegistry and dictionary.
virtual ~surfaceDistance()=default
Destructor.
void operator=(const surfaceDistance &)=delete
No copy assignment.
surfaceDistance(const surfaceDistance &)=delete
No copy construct.
Switch doCells_
Switch to calculate distance-to-cells.
virtual bool execute()
Calculate the interpolated fields.
virtual bool write()
Write the interpolated fields.
virtual bool read(const dictionary &)
Read the controls.
A class for handling words, derived from Foam::string.
Definition: word.H:68
engineTime & runTime
Namespace for OpenFOAM.
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73