sampledTriSurfaceMeshNormal.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-2018 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(sampledTriSurfaceMeshNormal, 0);
37  (
38  sampledSurface,
39  sampledTriSurfaceMeshNormal,
40  word
41  );
42 }
43 
44 
45 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
46 
48 (
49  const word& name,
50  const polyMesh& mesh,
51  const word& surfaceName,
52  const samplingSource sampleSource
53 )
54 :
55  sampledTriSurfaceMesh(name, mesh, surfaceName, sampleSource)
56 {}
57 
58 
60 (
61  const word& name,
62  const polyMesh& mesh,
63  const dictionary& dict
64 )
65 :
67 {}
68 
69 
71 (
72  const word& name,
73  const polyMesh& mesh,
74  const triSurface& surface,
75  const word& sampleSourceName
76 )
77 :
78  sampledTriSurfaceMesh(name, mesh, surface, sampleSourceName)
79 {}
80 
81 
82 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
83 
86 (
87  const interpolation<vector>& sampler
88 ) const
89 {
90  auto tvalues = tmp<Field<vector>>::New(size(), Zero);
91 
92  tvalues.ref().replace
93  (
94  0,
96  &sampledTriSurfaceMesh::sample(sampler)
97  );
98 
99  return tvalues;
100 }
101 
102 
105 (
106  const interpolation<vector>& interpolator
107 ) const
108 {
109  auto tvalues = tmp<Field<vector>>::New(points().size(), Zero);
110 
111  pointField allNormals(points().size(), Zero);
112  UIndirectList<vector>(allNormals, meshPoints()) = pointNormals();
113 
114  tvalues.ref().replace
115  (
116  0,
117  allNormals
119  );
120 
121  return tvalues;
122 }
123 
124 
125 // ************************************************************************* //
Foam::addToRunTimeSelectionTable
addToRunTimeSelectionTable(decompositionMethod, kahipDecomp, dictionary)
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:59
Foam::sampledTriSurfaceMeshNormal::sample
virtual tmp< scalarField > sample(const interpolation< scalar > &sampler) const
Sample volume field onto surface faces.
Definition: sampledTriSurfaceMeshNormal.H:157
Foam::Zero
static constexpr const zero Zero
Global zero.
Definition: zero.H:128
Foam::sampledTriSurfaceMesh::samplingSource
samplingSource
Types of communications.
Definition: sampledTriSurfaceMesh.H:148
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
Foam::sampledTriSurfaceMesh
A sampledSurface from a triSurfaceMesh. It samples on the points/triangles of the triSurface.
Definition: sampledTriSurfaceMesh.H:141
faceNormals
surfaceVectorField faceNormals(mesh.Sf()/mesh.magSf())
Foam::Field< vector >
Foam::triSurface
Triangulated surface description with patch information.
Definition: triSurface.H:70
Foam::name
word name(const complex &c)
Return string representation of complex.
Definition: complex.C:76
Foam::sampledTriSurfaceMeshNormal::sampledTriSurfaceMeshNormal
sampledTriSurfaceMeshNormal(const word &name, const polyMesh &mesh, const word &surfaceName, const samplingSource sampleSource)
Construct from components.
Definition: sampledTriSurfaceMeshNormal.C:48
Foam::interpolation
Abstract base class for interpolation.
Definition: mappedPatchFieldBase.H:95
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:121
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
addToRunTimeSelectionTable.H
Macros for easy insertion into run-time selection tables.
sampledTriSurfaceMeshNormal.H
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
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::UIndirectList
A List with indirect addressing.
Definition: fvMatrix.H:109
Foam::sampledSurface::interpolate
bool interpolate() const
Interpolation to nodes requested for surface.
Definition: sampledSurface.H:326
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.