FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

hexBlock.H

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2010 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software: you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by
00013     the Free Software Foundation, either version 3 of the License, or
00014     (at your option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
00023 
00024 Class
00025     Foam::hexBlock
00026 
00027 Description
00028     Hex block definition used in the cfx converter.
00029 
00030 SourceFiles
00031     hexBlock.C
00032 
00033 \*---------------------------------------------------------------------------*/
00034 
00035 #ifndef hexBlock_H
00036 #define hexBlock_H
00037 
00038 #include <OpenFOAM/labelList.H>
00039 #include <OpenFOAM/pointField.H>
00040 #include <OpenFOAM/faceList.H>
00041 
00042 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00043 
00044 namespace Foam
00045 {
00046 
00047 /*---------------------------------------------------------------------------*\
00048                            Class hexBlock Declaration
00049 \*---------------------------------------------------------------------------*/
00050 
00051 class hexBlock
00052 {
00053     // Private data
00054 
00055         //- Handedness of the block
00056         enum handed
00057         {
00058             noPoints,
00059             right,
00060             left
00061         };
00062 
00063         //- Number of point in each direction
00064         label xDim_;
00065         label yDim_;
00066         label zDim_;
00067 
00068         //- Handedness of the block
00069         handed blockHandedness_;
00070 
00071         //- List of points
00072         pointField points_;
00073 
00074 
00075     // Private Member Functions
00076 
00077         //- Disallow default bitwise copy construct
00078         hexBlock(const hexBlock&);
00079 
00080         //- Disallow default bitwise assignment
00081         void operator=(const hexBlock&);
00082 
00083         //- Vertex addressing inside the block
00084         inline label vtxLabel(label i, label j, label k) const;
00085 
00086 
00087 public:
00088 
00089     // Constructors
00090 
00091         //- Construct from components
00092         hexBlock(const label nx, const label ny, const label nz);
00093 
00094     // Member Functions
00095 
00096         //- Number of points
00097         label xDim() const
00098         {
00099             return xDim_;
00100         }
00101 
00102         label yDim() const
00103         {
00104             return yDim_;
00105         }
00106 
00107         label zDim() const
00108         {
00109             return zDim_;
00110         }
00111 
00112         label nBlockPoints() const
00113         {
00114             return (xDim_ + 1)*(yDim_ + 1)*(zDim_ + 1);
00115         }
00116 
00117         label nBlockCells() const
00118         {
00119             return xDim_*yDim_*zDim_;
00120         }
00121 
00122         //- Return block points
00123         const pointField& points() const
00124         {
00125             if (blockHandedness_ == noPoints)
00126             {
00127                 FatalErrorIn("hexBlock::points() const")
00128                     << "points not read in yet"
00129                     << abort(FatalError);
00130             }
00131 
00132             return points_;
00133         }
00134 
00135         //- Return block cells
00136         labelListList blockCells() const;
00137 
00138         //- Return block patch faces given direction and range limits
00139         // From the cfx manual: direction
00140         // 0 = solid (3-D patch),
00141         // 1 = high i, 2 = high j, 3 = high k
00142         // 4 = low i, 5 = low j, 6 = low k
00143         faceList patchFaces(label direc, const labelList& range) const;
00144 
00145 
00146         //- Read block points
00147         void readPoints(Istream&);
00148 };
00149 
00150 
00151 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00152 
00153 } // End namespace Foam
00154 
00155 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00156 
00157 #endif
00158 
00159 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines