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-------------------------------------------------------------------------------
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
26Class
27 Foam::hexBlock
28
29Description
30 Hex block definition used in the cfx converter.
31
32SourceFiles
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
46namespace Foam
47{
48
49/*---------------------------------------------------------------------------*\
50 Class hexBlock Declaration
51\*---------------------------------------------------------------------------*/
53class 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
89public:
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 }
104 label yDim() const
105 {
106 return yDim_;
107 }
109 label zDim() const
110 {
111 return zDim_;
112 }
114 label nBlockPoints() const
115 {
116 return (xDim_ + 1)*(yDim_ + 1)*(zDim_ + 1);
117 }
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
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// ************************************************************************* //
scalar range
label k
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:64
Hex block definition used in the cfx converter.
Definition: hexBlock.H:53
label zDim() const
Definition: hexBlock.H:108
hexBlock(const label nx, const label ny, const label nz)
Construct from components.
faceList patchFaces(label direc, const labelList &range) const
Return block patch faces given direction and range limits.
label xDim() const
Number of points.
Definition: hexBlock.H:98
label nBlockPoints() const
Definition: hexBlock.H:113
labelListList blockCells() const
Return block cells.
void readPoints(Istream &)
Read block points.
label yDim() const
Definition: hexBlock.H:103
const pointField & points() const
Return block points.
Definition: hexBlock.H:124
label nBlockCells() const
Definition: hexBlock.H:118
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:453
Namespace for OpenFOAM.
errorManip< error > abort(error &err)
Definition: errorManip.H:144
error FatalError