BUG: UListIO: byteSize overflowing on really big faceLists
[OpenFOAM-2.0.x.git] / applications / utilities / mesh / conversion / plot3dToFoam / hexBlock.H
blob3a91b036bbb79368879af18626dff51a5096d939
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
9     This file is part of OpenFOAM.
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.
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.
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/>.
24 Description
26 \*---------------------------------------------------------------------------*/
28 #ifndef hexBlock_H
29 #define hexBlock_H
31 #include "labelList.H"
32 #include "pointField.H"
33 #include "faceList.H"
35 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
37 namespace Foam
40 /*---------------------------------------------------------------------------*\
41                            Class hexBlock Declaration
42 \*---------------------------------------------------------------------------*/
44 class hexBlock
46     // Private data
48         //- Handedness of the block
49         enum handed
50         {
51             noPoints,
52             right,
53             left
54         };
56         //- Number of point in each direction
57         label xDim_;
58         label yDim_;
59         label zDim_;
61         //- Handedness of the block
62         handed blockHandedness_;
64         //- List of points
65         pointField points_;
68     // Private Member Functions
70         //- Disallow default bitwise copy construct
71         hexBlock(const hexBlock&);
73         //- Disallow default bitwise assignment
74         void operator=(const hexBlock&);
76         //- Vertex addressing inside the block
77         inline label vtxLabel(label i, label j, label k) const;
79         //- Calculate handedness of block
80         void setHandedness();
82 public:
84     // Constructors
86         //- Construct from components
87         hexBlock
88         (
89             const label nx,
90             const label ny,
91             const label nz
92         );
94     // Member Functions
96         //- Number of points
97         label xDim() const
98         {
99             return xDim_;
100         }
102         label yDim() const
103         {
104             return yDim_;
105         }
107         label zDim() const
108         {
109             return zDim_;
110         }
112         label nBlockPoints() const
113         {
114             return (xDim_ + 1)*(yDim_ + 1)*(zDim_ + 1);
115         }
117         label nBlockCells() const
118         {
119             return xDim_*yDim_*zDim_;
120         }
122         //- Return block points
123         const pointField& points() const
124         {
125             if (blockHandedness_ == noPoints)
126             {
127                 FatalErrorIn("hexBlock::points() const")
128                     << "points not read in yet"
129                     << abort(FatalError);
130             }
132             return points_;
133         }
135         //- Return block cells
136         labelListList blockCells() const;
138         //- Return block patch faces given direction and range limits
139         // From the cfx manual: direction
140         // 0 = solid (3-D patch),
141         // 1 = high i, 2 = high j, 3 = high k
142         // 4 = low i, 5 = low j, 6 = low k
143         faceList patchFaces(label direc, const labelList& range) const;
146         //- Read block points either with or without blanking after every block.
147         //  If twoDThickness > 0 reads (half) the points and extrudes the
148         //  points in z direction.
149         void readPoints
150         (
151             const bool readBlank,
152             const scalar twoDThicknes,
153             Istream&
154         );
158 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
160 } // End namespace Foam
162 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
164 #endif
166 // ************************************************************************* //