hexBlock.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) 2011-2015 OpenFOAM Foundation
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::hexBlock
28 
29 Description
30  Hex block definition used in the cfx converter.
31 
32 SourceFiles
33  hexBlock.C
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #ifndef hexBlock_H
38 #define hexBlock_H
39 
40 #include "labelList.H"
41 #include "pointField.H"
42 #include "faceList.H"
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 /*---------------------------------------------------------------------------*\
50  Class hexBlock Declaration
51 \*---------------------------------------------------------------------------*/
52 
53 class hexBlock
54 {
55  // Private data
56 
57  //- Handedness of the block
58  enum handed
59  {
60  noPoints,
61  right,
62  left
63  };
64 
65  //- Number of point in each direction
66  label xDim_;
67  label yDim_;
68  label zDim_;
69 
70  //- Handedness of the block
71  handed blockHandedness_;
72 
73  //- List of points
74  pointField points_;
75 
76 
77  // Private Member Functions
78 
79  //- No copy construct
80  hexBlock(const hexBlock&) = delete;
81 
82  //- No copy assignment
83  void operator=(const hexBlock&) = delete;
84 
85  //- Vertex addressing inside the block
86  inline label vtxLabel(label i, label j, label k) const;
87 
88 
89 public:
90 
91  // Constructors
92 
93  //- Construct from components
94  hexBlock(const label nx, const label ny, const label nz);
95 
96  // Member Functions
97 
98  //- Number of points
99  label xDim() const
100  {
101  return xDim_;
102  }
103 
104  label yDim() const
105  {
106  return yDim_;
107  }
108 
109  label zDim() const
110  {
111  return zDim_;
112  }
113 
114  label nBlockPoints() const
115  {
116  return (xDim_ + 1)*(yDim_ + 1)*(zDim_ + 1);
117  }
118 
119  label nBlockCells() const
120  {
121  return xDim_*yDim_*zDim_;
122  }
123 
124  //- Return block points
125  const pointField& points() const
126  {
127  if (blockHandedness_ == noPoints)
128  {
130  << "points not read in yet"
131  << abort(FatalError);
132  }
133 
134  return points_;
135  }
136 
137  //- Return block cells
138  labelListList blockCells() const;
139 
140  //- Return block patch faces given direction and range limits
141  // From the cfx manual: direction
142  // 0 = solid (3-D patch),
143  // 1 = high i, 2 = high j, 3 = high k
144  // 4 = low i, 5 = low j, 6 = low k
145  faceList patchFaces(label direc, const labelList& range) const;
146 
147 
148  //- Read block points
149  void readPoints(Istream&);
150 };
151 
152 
153 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
154 
155 } // End namespace Foam
156 
157 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
158 
159 #endif
160 
161 // ************************************************************************* //
Foam::hexBlock::yDim
label yDim() const
Definition: hexBlock.H:103
Foam::hexBlock::blockCells
labelListList blockCells() const
Return block cells.
Foam::hexBlock::nBlockPoints
label nBlockPoints() const
Definition: hexBlock.H:113
faceList.H
Foam::hexBlock::patchFaces
faceList patchFaces(label direc, const labelList &range) const
Return block patch faces given direction and range limits.
Foam::hexBlock::points
const pointField & points() const
Return block points.
Definition: hexBlock.H:124
labelList.H
Foam::Field< vector >
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
Foam::hexBlock::zDim
label zDim() const
Definition: hexBlock.H:108
Foam::FatalError
error FatalError
Foam::hexBlock::xDim
label xDim() const
Number of points.
Definition: hexBlock.H:98
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::abort
errorManip< error > abort(error &err)
Definition: errorManip.H:144
pointField.H
FatalErrorInFunction
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:453
range
scalar range
Definition: LISASMDCalcMethod1.H:12
Foam::List< labelList >
k
label k
Boltzmann constant.
Definition: LISASMDCalcMethod2.H:41
Foam::hexBlock::nBlockCells
label nBlockCells() const
Definition: hexBlock.H:118
Foam::hexBlock::readPoints
void readPoints(Istream &)
Read block points.
Foam::hexBlock
Hex block definition used in the cfx converter.
Definition: hexBlock.H:52