sampledMeshedSurfaceNormal.C
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) 2017-2020 OpenCFD Ltd.
9 -------------------------------------------------------------------------------
10 License
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 
26 \*---------------------------------------------------------------------------*/
27 
30 
31 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
32 
33 namespace Foam
34 {
35  defineTypeNameAndDebug(sampledMeshedSurfaceNormal, 0);
36  // Use shorter name only
38  (
39  sampledSurface,
40  sampledMeshedSurfaceNormal,
41  word,
42  meshedSurfaceNormal
43  );
44  // Compatibility name (1912)
46  (
47  sampledSurface,
48  sampledMeshedSurfaceNormal,
49  word,
50  sampledTriSurfaceMeshNormal
51  );
52 }
53 
54 
55 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
56 
58 (
59  const word& name,
60  const polyMesh& mesh,
61  const word& surfaceName,
62  const samplingSource sampleSource
63 )
64 :
65  sampledMeshedSurface(name, mesh, surfaceName, sampleSource)
66 {}
67 
68 
70 (
71  const word& name,
72  const polyMesh& mesh,
73  const dictionary& dict
74 )
75 :
77 {}
78 
79 
80 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
81 
84 (
85  const interpolation<vector>& sampler
86 ) const
87 {
88  auto tvalues = tmp<Field<vector>>::New(size(), Zero);
89 
90  tvalues.ref().replace
91  (
92  0,
95  );
96 
97  return tvalues;
98 }
99 
100 
103 (
104  const interpolation<vector>& interpolator
105 ) const
106 {
107  auto tvalues = tmp<Field<vector>>::New(points().size(), Zero);
108 
109  pointField allNormals(points().size(), Zero);
110  UIndirectList<vector>(allNormals, meshPoints()) = pointNormals();
111 
112  tvalues.ref().replace
113  (
114  0,
115  allNormals
116  &sampledMeshedSurface::interpolate(interpolator)
117  );
118 
119  return tvalues;
120 }
121 
122 
123 // ************************************************************************* //
dictionary dict
bool interpolate() const noexcept
Same as isPointData()
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tf1, const word &name, const dimensionSet &dimensions, const bool initCopy=false)
Global function forwards to reuseTmpDimensionedField::New.
sampledMeshedSurfaceNormal(const word &name, const polyMesh &mesh, const word &surfaceName, const samplingSource sampleSource)
Construct from components.
Macros for easy insertion into run-time selection tables.
virtual tmp< scalarField > sample(const interpolation< scalar > &sampler) const
Sample volume field onto surface faces.
addNamedToRunTimeSelectionTable(topoSetCellSource, badQualityToCell, word, badQuality)
virtual tmp< scalarField > sample(const interpolation< scalar > &sampler) const
Sample volume field onto surface faces.
const Field< point_type > & faceNormals() const
Return face unit normals for patch.
dynamicFvMesh & mesh
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Definition: exprTraits.C:127
const pointField & points
A class for handling words, derived from Foam::string.
Definition: word.H:63
defineTypeNameAndDebug(combustionModel, 0)
A sampledSurface from a meshed surface. It samples on the points/faces of the meshed surface...
A List with indirect addressing. Like IndirectList but does not store addressing. ...
Definition: faMatrix.H:56
Abstract base class for volume field interpolation.
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
A class for managing temporary objects.
Definition: HashPtrTable.H:50
Namespace for OpenFOAM.
static constexpr const zero Zero
Global zero (0)
Definition: zero.H:127