tetIndicesI.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-2018 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 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
27 
29 {
30  return celli_;
31 }
32 
33 
35 {
36  return celli_;
37 }
38 
39 
41 {
42  return facei_;
43 }
44 
45 
47 {
48  return facei_;
49 }
50 
51 
53 {
54  return tetPti_;
55 }
56 
57 
59 {
60  return tetPti_;
61 }
62 
63 
65 {
66  const Foam::face& f = mesh.faces()[face()];
67 
68  label faceBasePtI = mesh.tetBasePtIs()[face()];
69 
70  if (faceBasePtI < 0)
71  {
72  static label badFacei = -1;
73 
74  if (badFacei != face())
75  {
77  << "No base point for face " << face() << ", " << f
78  << ", produces a valid tet decomposition." << endl;
79 
80  badFacei = face();
81  }
82 
83  faceBasePtI = 0;
84  }
85 
86  label facePtI = (tetPt() + faceBasePtI) % f.size();
87  label faceOtherPtI = f.fcIndex(facePtI);
88 
89  if (mesh.faceOwner()[face()] != cell())
90  {
91  Swap(facePtI, faceOtherPtI);
92  }
93 
94  return triFace(f[faceBasePtI], f[facePtI], f[faceOtherPtI]);
95 }
96 
97 
99 {
100  const pointField& meshPoints = mesh.points();
101  const triFace tri = faceTriIs(mesh);
102 
103  return tetPointRef
104  (
105  mesh.cellCentres()[cell()],
106  meshPoints[tri[0]],
107  meshPoints[tri[1]],
108  meshPoints[tri[2]]
109  );
110 }
111 
112 
114 {
115  const pointField& meshPoints = mesh.points();
116  const triFace tri = faceTriIs(mesh);
117 
118  return triPointRef
119  (
120  meshPoints[tri[0]],
121  meshPoints[tri[1]],
122  meshPoints[tri[2]]
123  );
124 }
125 
126 
128 (
129  const polyMesh& mesh
130 ) const
131 {
132  const pointField& meshOldPoints = mesh.oldPoints();
133  const triFace tri = faceTriIs(mesh);
134 
135  return triPointRef
136  (
137  meshOldPoints[tri[0]],
138  meshOldPoints[tri[1]],
139  meshOldPoints[tri[2]]
140  );
141 }
142 
143 
144 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
145 
146 inline bool Foam::tetIndices::operator==(const Foam::tetIndices& rhs) const
147 {
148  return
149  cell() == rhs.cell()
150  && face() == rhs.face()
151  && tetPt() == rhs.tetPt();
152 }
153 
154 
155 inline bool Foam::tetIndices::operator!=(const Foam::tetIndices& rhs) const
156 {
157  return !(*this == rhs);
158 }
159 
160 
161 // ************************************************************************* //
A tetrahedron primitive.
Definition: tetrahedron.H:61
tetrahedron< point, const point & > tetPointRef
Definition: tetPointRef.H:44
label tetPt() const
Return the characterising tetPtI.
Definition: tetIndicesI.H:52
A triangle primitive used to calculate face areas and swept volumes.
Definition: triangle.H:57
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
A face is a list of labels corresponding to mesh vertices.
Definition: face.H:75
const labelIOList & tetBasePtIs() const
Return the tetBasePtIs.
Definition: polyMesh.C:848
triPointRef faceTri(const polyMesh &mesh) const
Return the geometry corresponding to the tri on the face for.
Definition: tetIndicesI.H:113
void size(const label)
Override size to be inconsistent with allocated storage.
Definition: ListI.H:164
label fcIndex(const label i) const
Return the forward circular index, i.e. the next index.
Definition: UListI.H:58
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
triFace faceTriIs(const polyMesh &mesh) const
Return the indices corresponding to the tri on the face for.
Definition: tetIndicesI.H:64
tetPointRef tet(const polyMesh &mesh) const
Return the geometry corresponding to this tet.
Definition: tetIndicesI.H:98
virtual const pointField & points() const
Return raw points.
Definition: polyMesh.C:1131
void Swap(T &a, T &b)
Definition: Swap.H:43
bool operator==(const tetIndices &) const
Definition: tetIndicesI.H:146
A triangular face using a FixedList of labels corresponding to mesh vertices.
Definition: triFace.H:68
label cell() const
Return the cell.
Definition: tetIndicesI.H:28
face triFace(3)
virtual const pointField & oldPoints() const
Return old points for mesh motion.
Definition: polyMesh.C:1181
virtual const labelList & faceOwner() const
Return face owner.
Definition: polyMesh.C:1169
Storage and named access for the indices of a tet which is part of the decomposition of a cell...
Definition: tetIndices.H:81
virtual const faceList & faces() const
Return raw faces.
Definition: polyMesh.C:1156
const vectorField & cellCentres() const
label face() const
Return the face.
Definition: tetIndicesI.H:40
labelList f(nPoints)
bool operator!=(const tetIndices &) const
Definition: tetIndicesI.H:155
#define WarningInFunction
Report a warning using Foam::Warning.
triangle< point, const point & > triPointRef
Definition: triPointRef.H:44
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
triPointRef oldFaceTri(const polyMesh &mesh) const
Return the geometry corresponding to the tri on the face for.
Definition: tetIndicesI.H:128