ijkMesh.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-2021 OpenCFD Ltd.
9 -------------------------------------------------------------------------------
10 License
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 Class
27  Foam::ijkMesh
28 
29 Description
30  A simple i-j-k (row-major order) to linear addressing for a
31  rectilinear mesh. Since the underlying mesh is rectilinear, some
32  mesh-related sizing information can be derived directly from the
33  addressing information.
34 
35 SourceFiles
36  ijkMesh.C
37  ijkMeshI.H
38 
39 \*---------------------------------------------------------------------------*/
40 
41 #ifndef ijkMesh_H
42 #define ijkMesh_H
43 
44 #include "ijkAddressing.H"
45 
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 
48 namespace Foam
49 {
50 
51 // Forward Declarations
52 class hexCell;
53 
54 /*---------------------------------------------------------------------------*\
55  Class ijkMesh Declaration
56 \*---------------------------------------------------------------------------*/
57 
58 class ijkMesh
59 :
60  public ijkAddressing
61 {
62 public:
63 
64  // Constructors
65 
66  //- Construct zero-sized
67  inline ijkMesh();
68 
69  //- Construct with addressing
70  inline explicit ijkMesh(const labelVector& ijk);
71 
72  //- Construct with addressing
73  inline ijkMesh(const label nx, const label ny, const label nz);
74 
75 
76  // Member Functions
77 
78  // Access
79 
80  //- The number of mesh points (nx+1)*(ny+1)*(nz+1) in the i-j-k mesh.
81  inline label nPoints() const;
82 
83  //- The number of mesh cells (nx*ny*nz) in the i-j-k mesh
84  // This is the same as the ijkAddressing::size()
85  inline label nCells() const;
86 
87  //- The total number of mesh faces in the i-j-k mesh
88  inline label nFaces() const;
89 
90  //- The number of internal faces in the i-j-k mesh
91  inline label nInternalFaces() const;
92 
93  //- The number of boundary faces in the i-j-k mesh
94  inline label nBoundaryFaces() const;
95 
96  //- The number of boundary faces on the box face
97  // Face: 0=x-min, 1=x-max, 2=y-min, 3=y-max, 4=z-min, 5=z-max
98  inline label nBoundaryFaces(const direction shapeFacei) const;
99 
100  //- The linear cell index for an i-j-k position - same as index()
101  inline label cellLabel
102  (
103  const label i,
104  const label j,
105  const label k
106  ) const;
107 
108  //- The linear cell index for an i-j-k position - same as index()
109  inline label cellLabel(const labelVector& ijk) const;
110 
111  //- The linear point index for an i-j-k position.
112  // Addressable in the range (ni+1, nj+1, nk+1).
113  inline label pointLabel
114  (
115  const label i,
116  const label j,
117  const label k
118  ) const;
119 
120  //- The linear point index for an i-j-k position.
121  // Addressable in the range (ni+1, nj+1, nk+1).
122  inline label pointLabel(const labelVector& ijk) const;
123 
124 
125  // Mesh Components
126 
127  //- The hex cell vertices for an i-j-k position
128  hexCell vertLabels(const label i, const label j, const label k) const;
129 
130  //- The hex cell vertices for an i-j-k position
131  hexCell vertLabels(const labelVector& ijk) const;
132 };
133 
134 
135 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
136 
137 } // End namespace Foam
138 
139 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
140 
141 #include "ijkMeshI.H"
142 
143 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
144 
145 #endif
146 
147 // ************************************************************************* //
Foam::ijkMesh::nFaces
label nFaces() const
The total number of mesh faces in the i-j-k mesh.
Definition: ijkMeshI.H:74
Foam::ijkMesh::cellLabel
label cellLabel(const label i, const label j, const label k) const
The linear cell index for an i-j-k position - same as index()
Definition: ijkMeshI.H:166
ijkAddressing.H
Foam::ijkMesh::pointLabel
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
Foam::ijkMesh
A simple i-j-k (row-major order) to linear addressing for a rectilinear mesh. Since the underlying me...
Definition: ijkMesh.H:57
Foam::ijkMesh::ijkMesh
ijkMesh()
Construct zero-sized.
Definition: ijkMeshI.H:30
Foam::ijkMesh::nBoundaryFaces
label nBoundaryFaces() const
The number of boundary faces in the i-j-k mesh.
Definition: ijkMeshI.H:110
Foam::ijkMesh::vertLabels
hexCell vertLabels(const label i, const label j, const label k) const
The hex cell vertices for an i-j-k position.
Definition: ijkMesh.C:33
Foam::ijkMesh::nInternalFaces
label nInternalFaces() const
The number of internal faces in the i-j-k mesh.
Definition: ijkMeshI.H:92
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::ijkMesh::nCells
label nCells() const
The number of mesh cells (nx*ny*nz) in the i-j-k mesh.
Definition: ijkMeshI.H:68
Foam::Vector< label >
Foam::ijkMesh::nPoints
label nPoints() const
The number of mesh points (nx+1)*(ny+1)*(nz+1) in the i-j-k mesh.
Definition: ijkMeshI.H:55
Foam::hexCell
A hexahedral cell primitive.
Definition: hexCell.H:60
k
label k
Boltzmann constant.
Definition: LISASMDCalcMethod2.H:41
ijkMeshI.H
Foam::direction
uint8_t direction
Definition: direction.H:52
Foam::ijkAddressing
A simple i-j-k (row-major order) to linear addressing.
Definition: ijkAddressing.H:51