OpenFOAM logo
Open Source CFD Toolkit

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