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 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 // ************************************************************************* //
Foam::polyMesh::points
virtual const pointField & points() const
Return raw points.
Definition: polyMesh.C:979
Foam::tetIndices::tet
tetPointRef tet(const polyMesh &mesh) const
Return the geometry corresponding to this tet from the.
Definition: tetIndicesI.H:66
Foam::tetIndices::operator==
bool operator==(const tetIndices &) const
Definition: tetIndicesI.H:194
Foam::primitiveMesh::cells
const cellList & cells() const
Definition: primitiveMeshCells.C:136
Foam::tetIndices::oldFaceTri
triPointRef oldFaceTri(const polyMesh &mesh) const
Return the geometry corresponding to the tri on the.
Definition: tetIndicesI.H:140
Foam::tetIndices::cellI_
label cellI_
Cell that this is a decomposed tet of.
Definition: tetIndices.H:78
Foam::tetIndices::faceTriIs
triFace faceTriIs(const polyMesh &mesh) const
Return the point indices corresponding to the tri on the mesh.
Definition: tetIndicesI.H:125
Foam::tetIndices::tetPt
label tetPt() const
Return the characterising tetPtI.
Definition: tetIndicesI.H:60
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
pFaces
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
Foam::triangle
A triangle primitive used to calculate face normals and swept volumes.
Definition: triangle.H:59
Foam::tetIndices::facePtB
label facePtB() const
Return face point B.
Definition: tetIndicesI.H:54
Foam::tetIndices::oldTet
tetPointRef oldTet(const polyMesh &mesh) const
Return the geometry corresponding to this tet from the.
Definition: tetIndicesI.H:84
Foam::label
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
Foam::Field
Pre-declare SubField and related Field type.
Definition: Field.H:57
Foam::tetIndices::faceTri
triPointRef faceTri(const polyMesh &mesh) const
Return the geometry corresponding to the tri on the.
Definition: tetIndicesI.H:109
Foam::tetIndices::face
label face() const
Return the face.
Definition: tetIndicesI.H:36
Foam::polyMesh::oldPoints
virtual const pointField & oldPoints() const
Return old points for mesh motion.
Definition: polyMesh.C:1029
Foam::tetIndices::faceBasePt
label faceBasePt() const
Return the face base point.
Definition: tetIndicesI.H:42
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:18
Foam::tetPointRef
tetrahedron< point, const point & > tetPointRef
Definition: tetrahedron.H:78
Foam::tetIndices::cell
label cell() const
Return the cell.
Definition: tetIndicesI.H:30
Foam::tetIndices
Storage and named access for the indices of a tet which is part of the decomposition of a cell.
Definition: tetIndices.H:73
Foam::primitiveMesh::cellCentres
const vectorField & cellCentres() const
Definition: primitiveMeshCellCentresAndVols.C:211
Foam::polyMesh::faces
virtual const faceList & faces() const
Return raw faces.
Definition: polyMesh.C:1004
Foam::triFace
A triangular face using a FixedList of labels corresponding to mesh vertices.
Definition: triFace.H:68
f
labelList f(nPoints)
Foam::Vector< scalar >
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
Foam::tetIndices::facePtA
label facePtA() const
Return face point A.
Definition: tetIndicesI.H:48
Foam::face
A face is a list of labels corresponding to mesh vertices.
Definition: face.H:75
Foam::tetIndices::operator!=
bool operator!=(const tetIndices &) const
Definition: tetIndicesI.H:208
triFace
face triFace(3)
Foam::cell
A cell is defined as a list of faces with extra functionality.
Definition: cell.H:56
Foam::triPointRef
triangle< point, const point & > triPointRef
Definition: triangle.H:75
Foam::tetrahedron
A tetrahedron primitive.
Definition: tetrahedron.H:62