OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

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