ijkMeshI.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) 2019 OpenCFD Ltd.
9-------------------------------------------------------------------------------
10License
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\*---------------------------------------------------------------------------*/
27
28// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
29
31:
33{}
34
35
37:
38 ijkAddressing(ijk)
39{}
40
41
43(
44 const label nx,
45 const label ny,
46 const label nz
47)
48:
49 ijkAddressing(nx, ny, nz)
50{}
51
52
53// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
54
55inline Foam::label Foam::ijkMesh::nPoints() const
56{
58 {
59 return 0;
60 }
61
63
64 return ((n.x()+1) * (n.y()+1) * (n.z()+1));
65}
66
67
68inline Foam::label Foam::ijkMesh::nCells() const
69{
70 return ijkAddressing::size();
71}
72
73
74inline Foam::label Foam::ijkMesh::nFaces() const
75{
77 {
78 return 0;
79 }
80
82
83 return
84 (
85 ((n.x()+1) * n.y() * n.z())
86 + ((n.y()+1) * n.z() * n.x())
87 + ((n.z()+1) * n.x() * n.y())
88 );
89}
90
91
92inline Foam::label Foam::ijkMesh::nInternalFaces() const
93{
95 {
96 return 0;
97 }
98
100
101 return
102 (
103 ((n.x()-1) * n.y() * n.z())
104 + ((n.y()-1) * n.z() * n.x())
105 + ((n.z()-1) * n.x() * n.y())
106 );
107}
108
109
110inline Foam::label Foam::ijkMesh::nBoundaryFaces() const
111{
113 {
114 return 0;
115 }
116
118
119 return
120 (
121 (2 * n.y() * n.z())
122 + (2 * n.z() * n.x())
123 + (2 * n.x() * n.y())
124 );
125}
126
127
129(
130 const direction shapeFacei
131) const
132{
134 {
135 return 0;
136 }
137
139
140 switch (shapeFacei)
141 {
142 // Face 0,1 == x-min, x-max
143 case 0:
144 case 1:
145 return n.y()*n.z();
146 break;
147
148 // Face 2,3 == y-min, y-max
149 case 2:
150 case 3:
151 return n.z()*n.x();
152 break;
153
154 // Face 4,5 == z-min, z-max
155 case 4:
156 case 5:
157 return n.x()*n.y();
158 break;
159 }
160
161 return 0;
162}
163
164
165inline Foam::label Foam::ijkMesh::cellLabel
166(
167 const label i,
168 const label j,
169 const label k
170) const
171{
172 return ijkAddressing::index(i, j, k);
173}
174
175
176inline Foam::label Foam::ijkMesh::cellLabel(const labelVector& ijk) const
177{
178 return ijkAddressing::index(ijk);
179}
180
181
183(
184 const label i,
185 const label j,
186 const label k
187) const
188{
189 #ifdef FULLDEBUG
190 checkIndex(i, j, k, true);
191 #endif
192
193 const labelVector& n = sizes();
194
195 return (i + ((n.x()+1) * (j + (n.y()+1) * k)));
196}
197
198
199Foam::label Foam::ijkMesh::pointLabel(const labelVector& ijk) const
200{
201 #ifdef FULLDEBUG
202 checkIndex(ijk, true);
203 #endif
204
205 const labelVector& n = sizes();
206
207 return (ijk.x() + ((n.x()+1) * (ijk.y() + (n.y()+1) * ijk.z())));
208}
209
210
211// ************************************************************************* //
label k
label n
const Cmpt & z() const
Access to the vector z component.
Definition: VectorI.H:85
const Cmpt & y() const
Access to the vector y component.
Definition: VectorI.H:79
const Cmpt & x() const
Access to the vector x component.
Definition: VectorI.H:73
A simple i-j-k (row-major order) to linear addressing.
Definition: ijkAddressing.H:52
label size() const
Return the total i*j*k size.
const labelVector & sizes() const
The (i,j,k) addressing dimensions.
bool empty() const
Addressing is considered empty if any component is zero.
label nInternalFaces() const
The number of internal faces in the i-j-k mesh.
Definition: ijkMeshI.H:92
ijkMesh()
Construct zero-sized.
Definition: ijkMeshI.H:30
label nBoundaryFaces() const
The number of boundary faces in the i-j-k mesh.
Definition: ijkMeshI.H:110
label pointLabel(const label i, const label j, const label k) const
The linear point index for an i-j-k position.
Definition: ijkMeshI.H:183
label nCells() const
The number of mesh cells (nx*ny*nz) in the i-j-k mesh.
Definition: ijkMeshI.H:68
label nPoints() const
The number of mesh points (nx+1)*(ny+1)*(nz+1) in the i-j-k mesh.
Definition: ijkMeshI.H:55
label nFaces() const
The total number of mesh faces in the i-j-k mesh.
Definition: ijkMeshI.H:74
label cellLabel() const
Definition: splitCell.H:93
uint8_t direction
Definition: direction.H:56