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 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  ijkMeshI.H
37 
38 \*---------------------------------------------------------------------------*/
39 
40 #ifndef ijkMesh_H
41 #define ijkMesh_H
42 
43 #include "ijkAddressing.H"
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 
50 /*---------------------------------------------------------------------------*\
51  Class ijkMesh Declaration
52 \*---------------------------------------------------------------------------*/
53 
54 class ijkMesh
55 :
56  public ijkAddressing
57 {
58 public:
59 
60  // Constructors
61 
62  //- Construct zero-sized
63  inline ijkMesh();
64 
65  //- Construct with addressing
66  inline explicit ijkMesh(const labelVector& ijk);
67 
68  //- Construct with addressing
69  inline ijkMesh(const label nx, const label ny, const label nz);
70 
71 
72  // Member Functions
73 
74  // Access
75 
76  //- The number of mesh points (nx+1)*(ny+1)*(nz+1) in the i-j-k mesh.
77  inline label nPoints() const;
78 
79  //- The number of mesh cells (nx*ny*nz) in the i-j-k mesh
80  // This is the same as the ijkAddressing::size()
81  inline label nCells() const;
82 
83  //- The total number of mesh faces in the i-j-k mesh
84  inline label nFaces() const;
85 
86  //- The number of internal faces in the i-j-k mesh
87  inline label nInternalFaces() const;
88 
89  //- The number of boundary faces in the i-j-k mesh
90  inline label nBoundaryFaces() const;
91 
92  //- The number of boundary faces on the box face
93  // Face: 0=x-min, 1=x-max, 2=y-min, 3=y-max, 4=z-min, 5=z-max
94  inline label nBoundaryFaces(const direction shapeFacei) const;
95 
96  //- The linear cell index for an i-j-k position - same as index()
97  inline label cellLabel
98  (
99  const label i,
100  const label j,
101  const label k
102  ) const;
103 
104  //- The linear cell index for an i-j-k position - same as index()
105  inline label cellLabel(const labelVector& ijk) const;
106 
107  //- The linear point index for an i-j-k position.
108  // Addressable in the range (ni+1, nj+1, nk+1).
109  inline label pointLabel
110  (
111  const label i,
112  const label j,
113  const label k
114  ) const;
115 
116  //- The linear point index for an i-j-k position.
117  // Addressable in the range (ni+1, nj+1, nk+1).
118  inline label pointLabel(const labelVector& ijk) const;
119 };
120 
121 
122 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
123 
124 } // End namespace Foam
125 
126 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
127 
128 #include "ijkMeshI.H"
129 
130 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
131 
132 #endif
133 
134 // ************************************************************************* //
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:53
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::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
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