Loading...
Searching...
No Matches
probeModel.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) 2011-2017 OpenFOAM Foundation
9 Copyright (C) 2025 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
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
27Class
28 Foam::probeModel
29
30Description
31 Base class for sampling fields at specified internal and boundary locations.
32
33SourceFiles
34 probeModel.C
35
36\*---------------------------------------------------------------------------*/
37
38#ifndef Foam_probeModel_H
39#define Foam_probeModel_H
40
41#include "fvMesh.H"
42#include "pointField.H"
43
44// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45
46namespace Foam
47{
49/*---------------------------------------------------------------------------*\
50 Class probeModel Declaration
51\*---------------------------------------------------------------------------*/
52
54{
55protected:
56
57 template<class T>
58 struct isNotEqOp
59 {
60 void operator()(T& x, const T& y) const
61 {
62 const T unsetVal(-VGREAT*pTraits<T>::one);
63
64 if (x != unsetVal)
65 {
66 // Keep x.
67
68 // Note: should check for y != unsetVal but multiple sample
69 // cells already handled in read().
70 }
71 else
72 {
73 // x is not set. y might be.
74 x = y;
75 }
76 }
77 };
78
79
80 // Protected Data
81
82 //- Const reference to the mesh
83 const fvMesh& thisMesh_;
84
85 //- Fixed locations (default: true)
86 // Note: set to false for moving mesh calculations where locations
87 // should move with the mesh
89
90 //- Include probes that were not found (default: true)
92
93 //- Interpolation/sample scheme to obtain values at the points
94 // Note: only possible when fixedLocations_ is true
96
97
98 // Calculated
99
100 //- Probe locations
102
103 //- Cells to be probed (obtained from the locations)
105
106 //- Faces to be probed
109 //- Processor holding the cell or face (-1 if point not found
110 //- on any processor)
112
113 //- Patch IDs on which the new probes are located
115
116 //- Original probes location
119
120 // Protected Member Functions
121
122 //- Find cells and faces containing probes
123 virtual void findElements(const fvMesh& mesh) = 0;
125
126public:
127
128 //- Runtime type information
129 TypeName("probeModel");
130
131
132 // Generated Methods
133
134 //- No copy construct
135 probeModel(const probeModel&) = delete;
136
137 //- No copy assignment
138 void operator=(const probeModel&) = delete;
139
140
141 // Constructors
143 //- Construct from Time and dictionary
145 (
146 const fvMesh& mesh,
147 const dictionary& dict
148 );
149
151 //- Destructor
152 virtual ~probeModel() = default;
153
154
155 // Member Functions
156
157 // Access
159 //- Return true if no probe locations
160 bool empty() const { return probes_.empty(); }
161
162 //- Return number of probe locations
163 label size() const { return probes_.size(); }
164
165 //- Return true if fixed locations
166 bool fixedLocations() const { return fixedLocations_; }
167
168 //- Return true if include out of bounds probes
169 bool includeOutOfBounds() const { return includeOutOfBounds_; }
170
171 //- Return the interpolation scheme to obtain values at the points
172 // Note: only possible when fixedLocations_ is true
173 const word& samplePointScheme() const { return samplePointScheme_; }
174
175 //- Return const reference to the probe locations
176 const pointField& probeLocations() const { return probes_; }
177
178 //- Return reference to the probe locations
179 pointField& probeLocations() { return probes_; }
180
181 //- Return the location of probe i
182 const point& probe(const label i) const { return probes_[i]; }
183
184 //- Cells to be probed (obtained from the locations)
185 const labelList& elements() const { return cellIds_; }
186
187 //- Return const reference to the faces to be probed
188 const labelList& faces() const { return faceIds_; }
189
190 //- Return const reference to the processor list
191 const labelList& processors() const { return procIds_; }
192
193 //- Return const reference to the patch ID list
194 const labelList& patchIDList() const noexcept { return patchIds_; }
195
196 //- Return const reference to the original probe locations
197 const pointField& oldPoints() const noexcept { return oldPoints_; }
198
199
200 // I-O
202 //- Read the settings dictionary
203 virtual bool read(const dictionary&);
204
205 //- Update for changes of mesh
206 virtual void updateMesh(const mapPolyMesh&);
207
208 //- Update for changes of mesh
209 virtual void movePoints(const polyMesh&);
210};
211
212
213// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
214
215} // End namespace Foam
216
217// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
219#endif
220
221// ************************************************************************* //
scalar y
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
Mesh data needed to do the Finite Volume discretisation.
Definition fvMesh.H:85
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
A traits class, which is primarily used for primitives and vector-space.
Definition pTraits.H:64
Mesh consisting of general polyhedral cells.
Definition polyMesh.H:79
word samplePointScheme_
Interpolation/sample scheme to obtain values at the points.
Definition probeModel.H:100
bool includeOutOfBounds_
Include probes that were not found (default: true).
Definition probeModel.H:93
virtual ~probeModel()=default
Destructor.
labelList cellIds_
Cells to be probed (obtained from the locations).
Definition probeModel.H:113
const pointField & oldPoints() const noexcept
Return const reference to the original probe locations.
Definition probeModel.H:253
void operator=(const probeModel &)=delete
No copy assignment.
labelList patchIds_
Patch IDs on which the new probes are located.
Definition probeModel.H:129
pointField & probeLocations()
Return reference to the probe locations.
Definition probeModel.H:223
bool includeOutOfBounds() const
Return true if include out of bounds probes.
Definition probeModel.H:206
labelList faceIds_
Faces to be probed.
Definition probeModel.H:118
pointField oldPoints_
Original probes location.
Definition probeModel.H:134
pointField probes_
Probe locations.
Definition probeModel.H:108
labelList procIds_
Processor holding the cell or face (-1 if point not found on any processor).
Definition probeModel.H:124
virtual void findElements(const fvMesh &mesh)=0
Find cells and faces containing probes.
bool empty() const
Return true if no probe locations.
Definition probeModel.H:191
const labelList & faces() const
Return const reference to the faces to be probed.
Definition probeModel.H:238
const fvMesh & thisMesh_
Const reference to the mesh.
Definition probeModel.H:80
const word & samplePointScheme() const
Return the interpolation scheme to obtain values at the points.
Definition probeModel.H:213
bool fixedLocations_
Fixed locations (default: true).
Definition probeModel.H:88
const labelList & elements() const
Cells to be probed (obtained from the locations).
Definition probeModel.H:233
label size() const
Return number of probe locations.
Definition probeModel.H:196
virtual void movePoints(const polyMesh &)
Update for changes of mesh.
Definition probeModel.C:171
TypeName("probeModel")
Runtime type information.
const point & probe(const label i) const
Return the location of probe i.
Definition probeModel.H:228
const labelList & patchIDList() const noexcept
Return const reference to the patch ID list.
Definition probeModel.H:248
bool fixedLocations() const
Return true if fixed locations.
Definition probeModel.H:201
virtual void updateMesh(const mapPolyMesh &)
Update for changes of mesh.
Definition probeModel.C:80
const labelList & processors() const
Return const reference to the processor list.
Definition probeModel.H:243
const pointField & probeLocations() const
Return const reference to the probe locations.
Definition probeModel.H:218
virtual bool read(const dictionary &)
Read the settings dictionary.
Definition probeModel.C:50
probeModel(const probeModel &)=delete
No copy construct.
A class for handling words, derived from Foam::string.
Definition word.H:66
dynamicFvMesh & mesh
Namespace for OpenFOAM.
List< label > labelList
A List of labels.
Definition List.H:62
vector point
Point is a vector.
Definition point.H:37
const direction noexcept
Definition scalarImpl.H:265
vectorField pointField
pointField is a vectorField.
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
dictionary dict
void operator()(T &x, const T &y) const
Definition probeModel.H:55
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68