sampledPatchInternalField.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2026 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
28 
29 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
30 
31 namespace Foam
32 {
33 namespace sampledSurfaces
34 {
37 }
38 }
39 
40 
41 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
42 
44 (
45  const word& name,
46  const polyMesh& mesh,
47  const dictionary& dict
48 )
49 :
50  patch(name, mesh, dict),
51  mappers_(patchIndices().size())
52 {
53  // Negate the distance so that we sample cells inside the patch
54  dictionary mappersDict(dict);
55  if (dict.found("distance"))
56  {
57  mappersDict.set("distance", -mappersDict.lookup<scalar>("distance"));
58  }
59 
60  forAll(patchIndices(), i)
61  {
62  mappers_.set
63  (
64  i,
66  (
67  mesh.boundary()[patchIndices()[i]],
68  mappersDict
69  )
70  );
71  }
72 }
73 
74 
75 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
76 
78 {}
79 
80 
81 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
82 
83 #define IMPLEMENT_SAMPLE(Type, nullArg) \
84  Foam::tmp<Foam::Field<Foam::Type>> \
85  Foam::sampledSurfaces::patchInternalField::sample \
86  ( \
87  const VolField<Type>& vField \
88  ) const \
89  { \
90  return sampleField(vField); \
91  }
93 #undef IMPLEMENT_SAMPLE
94 
95 
96 #define IMPLEMENT_INTERPOLATE(Type, nullArg) \
97  Foam::tmp<Foam::Field<Foam::Type>> \
98  Foam::sampledSurfaces::patchInternalField::interpolate \
99  ( \
100  const interpolation<Type>& interpolator \
101  ) const \
102  { \
103  return interpolateField(interpolator); \
104  }
106 #undef IMPLEMENT_INTERPOLATE
107 
108 
110 {
111  os << "patchInternalField: " << name() << " :"
112  << " patches:" << patchNames()
113  << " faces:" << faces().size()
114  << " points:" << points().size();
115 }
116 
117 
118 // ************************************************************************* //
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:449
Macros for easy insertion into run-time selection tables.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
Definition: dictionary.C:669
Engine which provides mapping from cells to patch faces.
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:78
const polyBoundaryMesh & boundary() const
Return boundary mesh.
Definition: polyMesh.H:393
An abstract class for surfaces with sampling.
const polyMesh & mesh() const
Access to the underlying mesh.
Variation of sampledPatch that samples the internalField (at a given normal distance from the patch) ...
patchInternalField(const word &name, const polyMesh &mesh, const dictionary &dict)
Construct from dictionary.
virtual void print(Ostream &) const
Write.
A sampledSurface on patches. Non-triangulated by default.
Definition: sampledPatch.H:93
const labelList & patchIndices() const
Definition: sampledPatch.C:81
A class for handling words, derived from string.
Definition: word.H:63
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
const pointField & points
defineTypeNameAndDebug(cutPlane, 0)
addToRunTimeSelectionTable(sampledSurface, cutPlane, word)
Namespace for OpenFOAM.
FOR_ALL_FIELD_TYPES(makeDimensionedPointFieldFunctions)
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
wordList patchNames(nPatches)
#define IMPLEMENT_INTERPOLATE(Type, nullArg)
#define IMPLEMENT_SAMPLE(Type, nullArg)
dictionary dict