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

hexCellLooper.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::hexCellLooper
00026 
00027 Description
00028     Implementation of cellLooper.
00029 
00030     This one walks hexes in a topological way:
00031       - cross edge to other face
00032       - cross face by walking edge-point-edge across to reach the other side.
00033     (edges are always cut through the middle)
00034 
00035     For anything else (tet, prism, .. poly) it will use geomCellLooper
00036     (which does a purely geometric cut using a plane through cell centre)
00037 
00038 SourceFiles
00039     hexCellLooper.C
00040 
00041 \*---------------------------------------------------------------------------*/
00042 
00043 #ifndef hexCellLooper_H
00044 #define hexCellLooper_H
00045 
00046 #include "geomCellLooper.H"
00047 #include <OpenFOAM/typeInfo.H>
00048 
00049 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00050 
00051 namespace Foam
00052 {
00053 
00054 // Forward declaration of classes
00055 class cellModel;
00056 
00057 /*---------------------------------------------------------------------------*\
00058                            Class hexCellLooper Declaration
00059 \*---------------------------------------------------------------------------*/
00060 
00061 class hexCellLooper
00062 :
00063     public geomCellLooper
00064 {
00065 
00066 protected:
00067 
00068     // Protected data
00069 
00070         //- Reference to hex cell shape.
00071         const cellModel& hex_;
00072 
00073 private:
00074 
00075     // Private Member Functions
00076 
00077         //- walk across faces of hex. Update loop/loopWeights with edges cut.
00078         //  Return true if successful walk. (should be always!)
00079         bool walkHex
00080         (
00081             const label cellI,
00082             const label startFaceI,
00083             const label startEdgeI,
00084 
00085             labelList& loop,
00086             scalarField& loopWeights
00087         ) const;
00088 
00089         //- Convert loop into face and points
00090         void makeFace
00091         (
00092             const labelList& loop,
00093             const scalarField& loopWeights,
00094 
00095             labelList& faceVerts,
00096             pointField& facePoints
00097         ) const;
00098 
00099 
00100         //- Disallow default bitwise copy construct
00101         hexCellLooper(const hexCellLooper&);
00102 
00103         //- Disallow default bitwise assignment
00104         void operator=(const hexCellLooper&);
00105 
00106 
00107 public:
00108 
00109     //- Runtime type information
00110     TypeName("hexCellLooper");
00111 
00112 
00113     // Constructors
00114 
00115         //- Construct from components
00116         hexCellLooper(const polyMesh& mesh);
00117 
00118 
00119     // Destructor
00120 
00121         virtual ~hexCellLooper();
00122 
00123 
00124     // Member Functions
00125 
00126         //- Create cut along circumference of cellI. Gets current mesh cuts.
00127         //  Cut along circumference is expressed as loop of cuts plus weights
00128         //  for cuts along edges (only valid for edge cuts).
00129         //  Return true if successful cut.
00130         virtual bool cut
00131         (
00132             const vector& refDir,
00133             const label cellI,
00134             const boolList& vertIsCut,
00135             const boolList& edgeIsCut,
00136             const scalarField& edgeWeight,
00137 
00138             labelList& loop,
00139             scalarField& loopWeights
00140         ) const;
00141 
00142 
00143         //- Same but now also base point of cut provided (instead of always
00144         //  cell centre)
00145         virtual bool cut
00146         (
00147             const plane& cutPlane,
00148             const label cellI,
00149             const boolList& vertIsCut,
00150             const boolList& edgeIsCut,
00151             const scalarField& edgeWeight,
00152 
00153             labelList& loop,
00154             scalarField& loopWeights
00155         ) const;
00156 };
00157 
00158 
00159 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00160 
00161 } // End namespace Foam
00162 
00163 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00164 
00165 #endif
00166 
00167 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines