distanceSurfaceTemplates.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 | Copyright (C) 2011-2016 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 
26 #include "distanceSurface.H"
27 #include "volFieldsFwd.H"
28 #include "pointFields.H"
29 #include "volPointInterpolation.H"
30 
31 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
32 
33 template<class Type>
35 Foam::distanceSurface::sampleField
36 (
38 ) const
39 {
40  if (cell_)
41  {
42  return tmp<Field<Type>>
43  (
44  new Field<Type>(vField, isoSurfCellPtr_().meshCells())
45  );
46  }
47  else
48  {
49  return tmp<Field<Type>>
50  (
51  new Field<Type>(vField, isoSurfPtr_().meshCells())
52  );
53  }
54 }
55 
56 
57 template<class Type>
59 Foam::distanceSurface::interpolateField
60 (
61  const interpolation<Type>& interpolator
62 ) const
63 {
64  const fvMesh& fvm = static_cast<const fvMesh&>(mesh());
65 
66  // Get fields to sample. Assume volPointInterpolation!
68  interpolator.psi();
69 
71  (
73  );
74 
75  // Sample.
76  if (cell_)
77  {
78  return isoSurfCellPtr_().interpolate
79  (
80  (
81  average_
82  ? pointAverage(pointFld())()
83  : volFld
84  ),
85  pointFld()
86  );
87  }
88  else
89  {
90  return isoSurfPtr_().interpolate
91  (
92  (
93  average_
94  ? pointAverage(pointFld())()
95  : volFld
96  ),
97  pointFld()
98  );
99  }
100 }
101 
102 
103 // ************************************************************************* //
Generic GeometricField class.
tmp< surfaceScalarField > interpolate(const RhoType &rho)
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
dynamicFvMesh & mesh
Pre-declare SubField and related Field type.
Definition: Field.H:57
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
Abstract base class for interpolation.
A class for managing temporary objects.
Definition: PtrList.H:54
const GeometricField< Type, fvPatchField, volMesh > & psi() const
Return the field to be interpolated.