cellPointWeight.H
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-2017 OpenFOAM Foundation
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 Class
27  Foam::cellPointWeight
28 
29 Description
30  Foam::cellPointWeight
31 
32 SourceFiles
33  cellPointWeight.C
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #ifndef Foam_cellPointWeight_H
38 #define Foam_cellPointWeight_H
39 
40 #include "vector.H"
41 #include "barycentric.H"
42 #include "triFace.H"
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 // Forward Declarations
50 class polyMesh;
51 
52 /*---------------------------------------------------------------------------*\
53  Class cellPointWeight Declaration
54 \*---------------------------------------------------------------------------*/
55 
56 class cellPointWeight
57 {
58 protected:
59 
60  // Protected Data
61 
62  //- Cell index
63  const label celli_;
64 
65  //- Weights applied to tet vertices.
66  // Equal to the barycentric coordinates of the interpolation position.
68 
69  //- Face vertex indices
71 
72 
73  // Protected Member Functions
74 
75  void findTetrahedron
76  (
77  const polyMesh& mesh,
78  const vector& position,
79  const label celli
80  );
81 
82  void findTriangle
83  (
84  const polyMesh& mesh,
85  const vector& position,
86  const label facei
87  );
88 
89 
90 public:
91 
92  //- Debug switch
93  static int debug;
94 
95  //- Tolerance used in calculating barycentric coordinates
96  // (applied to normalised values)
97  static scalar tol;
98 
99 
100  // Constructors
101 
102  //- Construct from components
104  (
105  const polyMesh& mesh,
106  const vector& position,
107  const label celli,
108  const label facei = -1
109  );
110 
111 
112  // Member Functions
113 
114  //- Cell index
115  label cell() const noexcept
116  {
117  return celli_;
118  }
119 
120  //- Interpolation weights
121  const barycentric& weights() const noexcept
122  {
123  return weights_;
124  }
125 
126  //- Interpolation addressing for points on face
127  const triFace& faceVertices() const noexcept
128  {
129  return faceVertices_;
130  }
131 };
132 
133 
134 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
135 
136 } // End namespace Foam
137 
138 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
139 
140 #endif
141 
142 // ************************************************************************* //
static scalar tol
Tolerance used in calculating barycentric coordinates.
triFace faceVertices_
Face vertex indices.
static int debug
Debug switch.
const label celli_
Cell index.
barycentric weights_
Weights applied to tet vertices.
cellPointWeight(const polyMesh &mesh, const vector &position, const label celli, const label facei=-1)
Construct from components.
dynamicFvMesh & mesh
A triangular face using a FixedList of labels corresponding to mesh vertices.
Definition: triFace.H:65
void findTetrahedron(const polyMesh &mesh, const vector &position, const label celli)
const direction noexcept
Definition: Scalar.H:258
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
const barycentric & weights() const noexcept
Interpolation weights.
void findTriangle(const polyMesh &mesh, const vector &position, const label facei)
const triFace & faceVertices() const noexcept
Interpolation addressing for points on face.
label cell() const noexcept
Cell index.
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
Foam::cellPointWeight.
Namespace for OpenFOAM.