sampledDiscreteSurface.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) 2011-2016 OpenFOAM Foundation
9  Copyright (C) 2016-2018 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
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 
27 \*---------------------------------------------------------------------------*/
28 
29 #include "sampledDiscreteSurface.H"
30 #include "meshSearch.H"
31 #include "Tuple2.H"
32 #include "globalIndex.H"
33 #include "treeDataCell.H"
34 #include "treeDataFace.H"
35 #include "meshTools.H"
37 
38 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
39 
40 namespace Foam
41 {
42  defineTypeNameAndDebug(sampledDiscreteSurface, 0);
44  (
45  sampledSurface,
46  sampledDiscreteSurface,
47  word
48  );
49 }
50 
51 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
52 
54 (
55  const word& name,
56  const polyMesh& mesh,
57  const word& surfaceName,
58  const discreteSurface::samplingSource sampleSource
59 )
60 :
62  SurfaceSource(mesh, surfaceName, sampleSource)
63 {}
64 
65 
67 (
68  const word& name,
69  const polyMesh& mesh,
70  const dictionary& dict
71 )
72 :
75 {}
76 
77 
79 (
80  const word& name,
81  const polyMesh& mesh,
82  const triSurface& surface,
83  const word& sampleSourceName
84 )
85 :
87  SurfaceSource(name, mesh, surface, sampleSourceName)
88 {}
89 
90 
91 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
92 
94 {}
95 
96 
97 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
98 
100 {
101  return SurfaceSource::needsUpdate();
102 }
103 
104 
106 {
107  if (SurfaceSource::expire())
108  {
109  // merged information etc
111 
112  return true;
113  }
114 
115  return false;
116 }
117 
118 
120 {
121  return SurfaceSource::update();
122 }
123 
124 
126 {
127  return SurfaceSource::update(bb);
128 }
129 
130 
132 (
133  const objectRegistry& store,
134  const word& fieldName
135 ) const
136 {
137  return SurfaceSource::sampleAndStore(store, fieldName);
138 }
139 
140 
142 (
143  const interpolation<scalar>& sampler
144 ) const
145 {
146  return SurfaceSource::sampleOnFaces(sampler);
147 }
148 
149 
151 (
152  const interpolation<vector>& sampler
153 ) const
154 {
155  return SurfaceSource::sampleOnFaces(sampler);
156 }
157 
159 (
160  const interpolation<sphericalTensor>& sampler
161 ) const
162 {
163  return SurfaceSource::sampleOnFaces(sampler);
164 }
165 
166 
168 (
169  const interpolation<symmTensor>& sampler
170 ) const
171 {
172  return SurfaceSource::sampleOnFaces(sampler);
173 }
174 
175 
177 (
178  const interpolation<tensor>& sampler
179 ) const
180 {
181  return SurfaceSource::sampleOnFaces(sampler);
182 }
183 
184 
186 (
187  const interpolation<scalar>& interpolator
188 ) const
189 {
190  return SurfaceSource::sampleOnPoints(interpolator);
191 }
192 
193 
195 (
196  const interpolation<vector>& interpolator
197 ) const
198 {
199  return SurfaceSource::sampleOnPoints(interpolator);
200 }
201 
203 (
204  const interpolation<sphericalTensor>& interpolator
205 ) const
206 {
207  return SurfaceSource::sampleOnPoints(interpolator);
208 }
209 
210 
212 (
213  const interpolation<symmTensor>& interpolator
214 ) const
215 {
216  return SurfaceSource::sampleOnPoints(interpolator);
217 }
218 
219 
221 (
222  const interpolation<tensor>& interpolator
223 ) const
224 {
225  return SurfaceSource::sampleOnPoints(interpolator);
226 }
227 
228 
230 {
231  os << "sampledDiscreteSurface: " << name() << " :";
233 }
234 
235 
236 // ************************************************************************* //
Foam::addToRunTimeSelectionTable
addToRunTimeSelectionTable(decompositionMethod, kahipDecomp, dictionary)
Foam::sampledDiscreteSurface::~sampledDiscreteSurface
virtual ~sampledDiscreteSurface()
Destructor.
Definition: sampledDiscreteSurface.C:93
meshTools.H
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
update
mesh update()
Tuple2.H
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:59
globalIndex.H
Foam::treeBoundBox
Standard boundBox with extra functionality for use in octree.
Definition: treeBoundBox.H:87
Foam::sampledDiscreteSurface::print
virtual void print(Ostream &os) const
Write.
Definition: sampledDiscreteSurface.C:229
Foam::sampledDiscreteSurface::sampleAndStore
virtual bool sampleAndStore(const objectRegistry &store, const word &fieldName) const
Sample the volume field onto surface,.
Definition: sampledDiscreteSurface.C:132
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
Foam::sampledDiscreteSurface::sampledDiscreteSurface
sampledDiscreteSurface(const word &name, const polyMesh &mesh, const word &surfaceName, const discreteSurface::samplingSource sampleSource)
Construct from components.
Definition: sampledDiscreteSurface.C:54
treeDataFace.H
Foam::objectRegistry
Registry of regIOobjects.
Definition: objectRegistry.H:60
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::discreteSurface
The basis for sampling from triSurfaceMesh. It samples on the points/triangles of the triSurface.
Definition: discreteSurface.H:91
Foam::sampledSurface
An abstract class for surfaces with sampling.
Definition: sampledSurface.H:120
Foam::interpolation< scalar >
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.
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
treeDataCell.H
Foam::sampledDiscreteSurface::sample
virtual tmp< scalarField > sample(const interpolation< scalar > &sampler) const
Sample volume field onto surface faces.
Definition: sampledDiscreteSurface.C:142
Foam::sampledDiscreteSurface::expire
virtual bool expire()
Mark the surface as needing an update.
Definition: sampledDiscreteSurface.C:105
meshSearch.H
Foam::sampledDiscreteSurface::update
virtual bool update()
Update the surface as required.
Definition: sampledDiscreteSurface.C:119
Foam::BitOps::print
Ostream & print(Ostream &os, UIntType value, char off='0', char on='1')
Print 0/1 bits in the (unsigned) integral type.
Definition: BitOps.H:172
Foam::sampledSurface::clearGeom
virtual void clearGeom() const
Additional cleanup when clearing the geometry.
Definition: sampledSurface.C:55
Foam::sampledDiscreteSurface::needsUpdate
virtual bool needsUpdate() const
Does the surface need an update?
Definition: sampledDiscreteSurface.C:99
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
sampledDiscreteSurface.H
Foam::sampledSurface::interpolate
bool interpolate() const
Interpolation to nodes requested for surface.
Definition: sampledSurface.H:326
Foam::defineTypeNameAndDebug
defineTypeNameAndDebug(combustionModel, 0)
Foam::discreteSurface::samplingSource
samplingSource
Types of communications.
Definition: discreteSurface.H:97