cellPointFace.H
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-2025 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 Class
25  Foam::interpolations::cellPointFace
26 
27 Description
28  Piecewise-linear interpolation method. Uses volPointInterpolation to create
29  values on the points and linear surfaceInterpolation to create values at
30  the face-centres. Then uses a face-centre tetrahedral decomposition to
31  linearly interpolate between the values at the points, at the face-centres
32  and at the cell-centres.
33 
34 SourceFiles
35  cellPointFace.C
36 
37 \*---------------------------------------------------------------------------*/
38 
39 #ifndef cellPointFace_H
40 #define cellPointFace_H
41 
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 namespace interpolations
49 {
50 
51 /*---------------------------------------------------------------------------*\
52  Class cellPointFace Declaration
53 \*---------------------------------------------------------------------------*/
54 
55 template<class Type>
56 class cellPointFace
57 :
58  public fieldInterpolation<Type, cellPointFace<Type>>,
59  public volPointInterpolation<Type>
60 {
61  // Private Data
62 
63  //- Linearly interpolated volfield
64  const SurfaceField<Type> psis_;
65 
66 
67  // Private Member Functions
68 
69  //- Find the tetrahedron in which the position is. While searching for
70  // the tet, store the tet closest to the position. This way, if
71  // position is not inside any tet, choose the closest one.
72  bool findTet
73  (
74  const vector& position,
75  const label nFace,
76  vector tetPoints[],
77  label tetLabelCandidate[],
78  label tetPointLabels[],
79  scalar phi[],
80  scalar phiCandidate[],
81  label& closestFace,
82  scalar& minDistance
83  ) const;
84 
85  //- Find the triangle in which the position is, when the position is
86  // known to be on the face
87  bool findTriangle
88  (
89  const vector& position,
90  const label nFace,
91  label tetPointLabels[],
92  scalar phi[]
93  ) const;
94 
95 
96 public:
97 
98  //- Runtime type information
99  TypeName("cellPointFace");
100 
101 
102  // Constructors
103 
104  //- Construct from components
106 
107  //- Copy construct
109 
110  //- Clone
111  virtual autoPtr<interpolation<Type>> clone() const
112  {
114  (
115  new cellPointFace<Type>(*this)
116  );
117  }
118 
119 
120  // Member Functions
121 
122  //- Inherit interpolate from interpolation
124 
125  //- Interpolate field to the given point in the given cell
126  Type interpolate
127  (
128  const vector& position,
129  const label celli,
130  const label facei = -1
131  ) const;
132 };
133 
134 
135 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
136 
137 } // End namespace interpolations
138 } // End namespace Foam
139 
140 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
141 
142 #ifdef NoRepository
143  #include "cellPointFace.C"
144 #endif
145 
146 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
147 
148 #endif
149 
150 // ************************************************************************* //
Generic GeometricField class.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
Abstract base class for interpolation.
Piecewise-linear interpolation method. Uses volPointInterpolation to create values on the points and ...
Definition: cellPointFace.H:59
virtual autoPtr< interpolation< Type > > clone() const
Clone.
TypeName("cellPointFace")
Runtime type information.
cellPointFace(const VolField< Type > &psi)
Construct from components.
Type interpolate(const vector &position, const label celli, const label facei=-1) const
Interpolate field to the given point in the given cell.
Base class for interpolations that require a vol-point interpolated field.
const volScalarField & psi
point position(const polyMesh &mesh, const barycentric &coordinates, const label celli, const label facei, const label faceTrii, const scalar stepFraction)
Return the position given the coordinates and tet topology.
Definition: trackingI.H:224
Namespace for OpenFOAM.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59