blockDescriptorI.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2018 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 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
27 
29 {
30  return vertices_;
31 }
32 
33 
35 {
36  return faces_;
37 }
38 
39 
41 {
42  return blockShape_;
43 }
44 
45 
47 {
48  return density_;
49 }
50 
51 
53 {
54  return zoneName_;
55 }
56 
57 
59 {
60  return
61  (
62  (density_.x() + 1)
63  * (density_.y() + 1)
64  * (density_.z() + 1)
65  );
66 }
67 
68 
70 {
71  return
72  (
73  density_.x()
74  * density_.y()
75  * density_.z()
76  );
77 }
78 
79 
82 {
83  return curvedFaces_;
84 }
85 
86 
88 {
89  return nCurvedFaces_;
90 }
91 
92 
94 {
95  return vertices_[blockShape_[i]];
96 }
97 
98 
100 (
101  const label i,
102  const label j,
103  const label k
104 ) const
105 {
106  return
107  (
108  i
109  + j*(density_.x() + 1)
110  + k*(density_.x() + 1)*(density_.y() + 1)
111  );
112 }
113 
114 
116 (
117  const label facei,
118  const label i,
119  const label j
120 ) const
121 {
122  if (facei == 0 || facei == 1)
123  {
124  return
125  (
126  i
127  + j*(density_.y() + 1)
128  );
129  }
130  else if (facei == 2 || facei == 3)
131  {
132  return
133  (
134  i
135  + j*(density_.x() + 1)
136  );
137  }
138  else
139  {
140  return
141  (
142  i
143  + j*(density_.x() + 1)
144  );
145  }
146 }
147 
148 
150 (
151  const label i, const label j, const label k
152 ) const
153 {
154  bool iEnd = (i == 0 || i == density_.x());
155  bool jEnd = (j == 0 || j == density_.y());
156  bool kEnd = (k == 0 || k == density_.z());
157 
158  return (iEnd && jEnd && kEnd);
159 }
160 
161 
162 inline bool Foam::blockDescriptor::edge
163 (
164  const label i, const label j, const label k
165 ) const
166 {
167  bool iEnd = (i == 0 || i == density_.x());
168  bool jEnd = (j == 0 || j == density_.y());
169  bool kEnd = (k == 0 || k == density_.z());
170 
171  return (iEnd && jEnd) || (iEnd && kEnd) || (jEnd && kEnd);
172 }
173 
174 
176 (
177  const label i, const label j, const label k
178 ) const
179 {
180  if (i == 0 && curvedFaces_[0] == -1) return true;
181  if (i == density_.x() && curvedFaces_[1] == -1) return true;
182  if (j == 0 && curvedFaces_[2] == -1) return true;
183  if (j == density_.y() && curvedFaces_[3] == -1) return true;
184  if (k == 0 && curvedFaces_[4] == -1) return true;
185  if (k == density_.z() && curvedFaces_[5] == -1) return true;
186 
187  bool iEnd = (i == 0 || i == density_.x());
188  bool jEnd = (j == 0 || j == density_.y());
189  bool kEnd = (k == 0 || k == density_.z());
190 
191  return (iEnd && jEnd) || (iEnd && kEnd) || (jEnd && kEnd);
192 }
193 
194 
195 // ************************************************************************* //
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
bool vertex(const label i, const label j, const label k) const
Return true if point i,j,k addresses a block vertex.
A 1D vector of objects of type <T> with a fixed size <Size>.
Definition: FixedList.H:54
const Vector< label > & density() const
Return the mesh density (number of cells) in the i,j,k directions.
label nCells() const
Return the number of cells.
An analytical geometric cellShape.
Definition: cellShape.H:69
const Cmpt & z() const
Definition: VectorI.H:87
const Cmpt & y() const
Definition: VectorI.H:81
const cellShape & blockShape() const
Return the block shape.
const point & blockPoint(const label i) const
Return block point for local label i.
label facePointLabel(const label facei, const label i, const label j) const
Face vertex label offset for a particular i,j,k position.
const FixedList< label, 6 > & curvedFaces() const
Curved-face labels for each block-face (-1 for flat faces)
A class for handling words, derived from string.
Definition: word.H:59
bool flatFaceOrEdge(const label i, const label j, const label k) const
Return true if point i,j,k addresses a block flat face or edge.
const Cmpt & x() const
Definition: VectorI.H:75
label nCurvedFaces() const
Number of curved faces in this block.
Templated 3D Vector derived from VectorSpace adding construction from 3 components, element access using x(), y() and z() member functions and the inner-product (dot-product) and cross product operators.
Definition: Vector.H:57
label nPoints() const
Return the number of points.
const pointField & vertices() const
Reference to point field defining the block mesh.
label pointLabel(const label i, const label j, const label k) const
Vertex label offset for a particular i,j,k position.
const word & zoneName() const
Return the (optional) zone name.
bool edge(const label i, const label j, const label k) const
Return true if point i,j,k addresses a block edge.
const blockFaceList & faces() const
Return reference to the list of curved faces.