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,
94  &sampledMeshedSurface::sample(sampler)
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 // ************************************************************************* //
Foam::sampledMeshedSurfaceNormal::sampledMeshedSurfaceNormal
sampledMeshedSurfaceNormal(const word &name, const polyMesh &mesh, const word &surfaceName, const samplingSource sampleSource)
Construct from components.
Definition: sampledMeshedSurfaceNormal.C:58
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::sampledMeshedSurfaceNormal::sample
virtual tmp< scalarField > sample(const interpolation< scalar > &sampler) const
Sample volume field onto surface faces.
Definition: sampledMeshedSurfaceNormal.H:154
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::Zero
static constexpr const zero Zero
Global zero (0)
Definition: zero.H:131
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
Foam::sampledSurface::interpolate
bool interpolate() const noexcept
Same as isPointData()
Definition: sampledSurface.H:598
faceNormals
surfaceVectorField faceNormals(mesh.Sf()/mesh.magSf())
Foam::Field< vector >
Foam::addNamedToRunTimeSelectionTable
addNamedToRunTimeSelectionTable(topoSetCellSource, badQualityToCell, word, badQuality)
Foam::interpolation
Abstract base class for interpolation.
Definition: mappedPatchFieldBase.H:96
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
addToRunTimeSelectionTable.H
Macros for easy insertion into run-time selection tables.
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::sampledMeshedSurface
A sampledSurface from a meshed surface. It samples on the points/faces of the meshed surface.
Definition: sampledMeshedSurface.H:188
sampledMeshedSurfaceNormal.H
Foam::New
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
Global function forwards to reuseTmpDimensionedField::New.
Definition: DimensionedFieldReuseFunctions.H:105
points
const pointField & points
Definition: gmvOutputHeader.H:1
Foam::name
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Definition: exprTraits.C:59
Foam::UIndirectList
A List with indirect addressing.
Definition: faMatrix.H:60
Foam::defineTypeNameAndDebug
defineTypeNameAndDebug(combustionModel, 0)
Foam::fac::interpolate
static tmp< GeometricField< Type, faePatchField, edgeMesh > > interpolate(const GeometricField< Type, faPatchField, areaMesh > &tvf, const edgeScalarField &faceFlux, Istream &schemeData)
Interpolate field onto faces using scheme given by Istream.
Foam::sampledMeshedSurface::samplingSource
samplingSource
Types of sampling regions.
Definition: sampledMeshedSurface.H:196