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  faceBasePtI = 0;
73  if (nWarnings < maxNWarnings)
74  {
76  << "No base point for face " << face() << ", " << f
77  << ", produces a valid tet decomposition." << endl;
78  ++ nWarnings;
79  }
80  if (nWarnings == maxNWarnings)
81  {
82  Warning
83  << "Suppressing any further warnings." << endl;
84  ++ nWarnings;
85  }
86  }
87 
88  label facePtI = (tetPt() + faceBasePtI) % f.size();
89  label faceOtherPtI = f.fcIndex(facePtI);
90 
91  if (mesh.faceOwner()[face()] != cell())
92  {
93  Swap(facePtI, faceOtherPtI);
94  }
95 
96  return triFace(f[faceBasePtI], f[facePtI], f[faceOtherPtI]);
97 }
98 
99 
101 {
102  const pointField& meshPoints = mesh.points();
103  const triFace tri = faceTriIs(mesh);
104 
105  return tetPointRef
106  (
107  mesh.cellCentres()[cell()],
108  meshPoints[tri[0]],
109  meshPoints[tri[1]],
110  meshPoints[tri[2]]
111  );
112 }
113 
114 
116 {
117  const pointField& meshPoints = mesh.points();
118  const triFace tri = faceTriIs(mesh);
119 
120  return triPointRef
121  (
122  meshPoints[tri[0]],
123  meshPoints[tri[1]],
124  meshPoints[tri[2]]
125  );
126 }
127 
128 
130 (
131  const polyMesh& mesh
132 ) const
133 {
134  const pointField& meshOldPoints = mesh.oldPoints();
135  const triFace tri = faceTriIs(mesh);
136 
137  return triPointRef
138  (
139  meshOldPoints[tri[0]],
140  meshOldPoints[tri[1]],
141  meshOldPoints[tri[2]]
142  );
143 }
144 
145 
146 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
147 
148 inline bool Foam::tetIndices::operator==(const Foam::tetIndices& rhs) const
149 {
150  return
151  cell() == rhs.cell()
152  && face() == rhs.face()
153  && tetPt() == rhs.tetPt();
154 }
155 
156 
157 inline bool Foam::tetIndices::operator!=(const Foam::tetIndices& rhs) const
158 {
159  return !(*this == rhs);
160 }
161 
162 
163 // ************************************************************************* //
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:841
triPointRef faceTri(const polyMesh &mesh) const
Return the geometry corresponding to the tri on the face for.
Definition: tetIndicesI.H:115
void size(const label)
Override size to be inconsistent with allocated storage.
Definition: ListI.H:163
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:256
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:100
virtual const pointField & points() const
Return raw points.
Definition: polyMesh.C:1003
void Swap(T &a, T &b)
Definition: Swap.H:43
bool operator==(const tetIndices &) const
Definition: tetIndicesI.H:148
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:1053
virtual const labelList & faceOwner() const
Return face owner.
Definition: polyMesh.C:1041
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:1028
const vectorField & cellCentres() const
label face() const
Return the face.
Definition: tetIndicesI.H:40
labelList f(nPoints)
messageStream Warning
bool operator!=(const tetIndices &) const
Definition: tetIndicesI.H:157
#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:130