tetIndicesI.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 | 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 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
27 
28 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
29 
31 {
32  return celli_;
33 }
34 
35 
37 {
38  return facei_;
39 }
40 
41 
43 {
44  return faceBasePtI_;
45 }
46 
47 
49 {
50  return facePtAI_;
51 }
52 
53 
55 {
56  return facePtBI_;
57 }
58 
59 
61 {
62  return tetPtI_;
63 }
64 
65 
67 {
68  const pointField& pPts = mesh.points();
69  const faceList& pFaces = mesh.faces();
70  const vectorField& pC = mesh.cellCentres();
71 
72  const Foam::face& f = pFaces[facei_];
73 
74  return tetPointRef
75  (
76  pC[celli_],
77  pPts[f[faceBasePtI_]],
78  pPts[f[facePtAI_]],
79  pPts[f[facePtBI_]]
80  );
81 }
82 
83 
85 {
86  const pointField& oldPPts = mesh.oldPoints();
87  const faceList& pFaces = mesh.faces();
88 
89  // We need to reconstruct the old Cc from oldPoints (it isn't
90  // stored)
91  point oldC = mesh.cells()[celli_].centre
92  (
93  oldPPts,
94  pFaces
95  );
96 
97  const Foam::face& f = pFaces[facei_];
98 
99  return tetPointRef
100  (
101  oldC,
102  oldPPts[f[faceBasePtI_]],
103  oldPPts[f[facePtAI_]],
104  oldPPts[f[facePtBI_]]
105  );
106 }
107 
108 
110 {
111  const pointField& pPts = mesh.points();
112  const faceList& pFaces = mesh.faces();
113 
114  const Foam::face& f = pFaces[facei_];
115 
116  return triPointRef
117  (
118  pPts[f[faceBasePtI_]],
119  pPts[f[facePtAI_]],
120  pPts[f[facePtBI_]]
121  );
122 }
123 
124 
126 {
127  const faceList& pFaces = mesh.faces();
128 
129  const Foam::face& f = pFaces[facei_];
130 
131  return triFace
132  (
133  f[faceBasePtI_],
134  f[facePtAI_],
135  f[facePtBI_]
136  );
137 }
138 
139 
141 {
142  const pointField& oldPPts = mesh.oldPoints();
143  const faceList& pFaces = mesh.faces();
144 
145  const Foam::face& f = pFaces[facei_];
146 
147  return triPointRef
148  (
149  oldPPts[f[faceBasePtI_]],
150  oldPPts[f[facePtAI_]],
151  oldPPts[f[facePtBI_]]
152  );
153 }
154 
155 
157 {
158  return celli_;
159 }
160 
161 
163 {
164  return facei_;
165 }
166 
167 
169 {
170  return faceBasePtI_;
171 }
172 
173 
175 {
176  return facePtAI_;
177 }
178 
179 
181 {
182  return facePtBI_;
183 }
184 
185 
187 {
188  return tetPtI_;
189 }
190 
191 
192 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
193 
194 inline bool Foam::tetIndices::operator==(const Foam::tetIndices& rhs) const
195 {
196  return
197  (
198  cell() == rhs.cell()
199  && face() == rhs.face()
200  && faceBasePt() == rhs.faceBasePt()
201  && facePtA() == rhs.facePtA()
202  && facePtB() == rhs.facePtB()
203  && tetPt() == rhs.tetPt()
204  );
205 }
206 
207 
208 inline bool Foam::tetIndices::operator!=(const Foam::tetIndices& rhs) const
209 {
210  return !(*this == rhs);
211 }
212 
213 
214 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
215 
216 
217 // ************************************************************************* //
A tetrahedron primitive.
Definition: tetrahedron.H:62
A triangle primitive used to calculate face normals and swept volumes.
Definition: triangle.H:57
label cell() const
Return the cell.
Definition: tetIndicesI.H:30
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
label facePtA() const
Return face point A.
Definition: tetIndicesI.H:48
A face is a list of labels corresponding to mesh vertices.
Definition: face.H:75
triPointRef faceTri(const polyMesh &mesh) const
Return the geometry corresponding to the tri on the.
Definition: tetIndicesI.H:109
tetrahedron< point, const point & > tetPointRef
Definition: tetrahedron.H:78
bool operator!=(const tetIndices &) const
Definition: tetIndicesI.H:208
label tetPt() const
Return the characterising tetPtI.
Definition: tetIndicesI.H:60
const cellList & cells() const
bool operator==(const tetIndices &) const
Definition: tetIndicesI.H:194
virtual const pointField & points() const
Return raw points.
Definition: polyMesh.C:979
label faceBasePt() const
Return the face base point.
Definition: tetIndicesI.H:42
dynamicFvMesh & mesh
label facePtB() const
Return face point B.
Definition: tetIndicesI.H:54
virtual const pointField & oldPoints() const
Return old points for mesh motion.
Definition: polyMesh.C:1029
A triangular face using a FixedList of labels corresponding to mesh vertices.
Definition: triFace.H:68
face triFace(3)
Info<< "Finished reading KIVA file"<< endl;cellShapeList cellShapes(nPoints);labelList cellZoning(nPoints,-1);const cellModel &hex=*(cellModeller::lookup("hex"));labelList hexLabels(8);label activeCells=0;labelList pointMap(nPoints);forAll(pointMap, i){pointMap[i]=i;}for(label i=0;i< nPoints;i++){if(f[i] > 0.0){hexLabels[0]=i;hexLabels[1]=i1tab[i];hexLabels[2]=i3tab[i1tab[i]];hexLabels[3]=i3tab[i];hexLabels[4]=i8tab[i];hexLabels[5]=i1tab[i8tab[i]];hexLabels[6]=i3tab[i1tab[i8tab[i]]];hexLabels[7]=i3tab[i8tab[i]];cellShapes[activeCells]=cellShape(hex, hexLabels);edgeList edges=cellShapes[activeCells].edges();forAll(edges, ei){if(edges[ei].mag(points)< SMALL){label start=pointMap[edges[ei].start()];while(start!=pointMap[start]){start=pointMap[start];}label end=pointMap[edges[ei].end()];while(end!=pointMap[end]){end=pointMap[end];}label minLabel=min(start, end);pointMap[start]=pointMap[end]=minLabel;}}cellZoning[activeCells]=idreg[i];activeCells++;}}cellShapes.setSize(activeCells);cellZoning.setSize(activeCells);forAll(cellShapes, celli){cellShape &cs=cellShapes[celli];forAll(cs, i){cs[i]=pointMap[cs[i]];}cs.collapse();}label bcIDs[11]={-1, 0, 2, 4,-1, 5,-1, 6, 7, 8, 9};const label nBCs=12;const word *kivaPatchTypes[nBCs]={&wallPolyPatch::typeName,&wallPolyPatch::typeName,&wallPolyPatch::typeName,&wallPolyPatch::typeName,&symmetryPolyPatch::typeName,&wedgePolyPatch::typeName,&polyPatch::typeName,&polyPatch::typeName,&polyPatch::typeName,&polyPatch::typeName,&symmetryPolyPatch::typeName,&oldCyclicPolyPatch::typeName};enum patchTypeNames{PISTON, VALVE, LINER, CYLINDERHEAD, AXIS, WEDGE, INFLOW, OUTFLOW, PRESIN, PRESOUT, SYMMETRYPLANE, CYCLIC};const char *kivaPatchNames[nBCs]={"piston","valve","liner","cylinderHead","axis","wedge","inflow","outflow","presin","presout","symmetryPlane","cyclic"};List< SLList< face > > pFaces[nBCs]
Definition: readKivaGrid.H:235
triPointRef oldFaceTri(const polyMesh &mesh) const
Return the geometry corresponding to the tri on the.
Definition: tetIndicesI.H:140
triFace faceTriIs(const polyMesh &mesh) const
Return the point indices corresponding to the tri on the mesh.
Definition: tetIndicesI.H:125
const vectorField & cellCentres() const
Storage and named access for the indices of a tet which is part of the decomposition of a cell...
Definition: tetIndices.H:81
label face() const
Return the face.
Definition: tetIndicesI.H:36
labelList f(nPoints)
tetPointRef oldTet(const polyMesh &mesh) const
Return the geometry corresponding to this tet from the.
Definition: tetIndicesI.H:84
triangle< point, const point & > triPointRef
Definition: triPointRef.H:44
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
virtual const faceList & faces() const
Return raw faces.
Definition: polyMesh.C:1004
tetPointRef tet(const polyMesh &mesh) const
Return the geometry corresponding to this tet from the.
Definition: tetIndicesI.H:66