OpenFOAM logo
Open Source CFD Toolkit

cellLooper.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     cellLooper
00027 
00028 Description
00029     Abstract base class. Concrete implementations know how to cut a cell
00030     (i.e. determine a loop around the circumference).
00031 
00032     Loop around the cell is given as the vertices to be cut and edges to
00033     be cut (and a weight between 0 and 1 giving where the cut is to be
00034     made). Main routine is 'cut' which gets called for every cell and
00035     gets the current cut situation and expects to return a loop on the
00036     cell circumference.
00037 
00038     Calling function needs to determine whether cellLooper is compatible with
00039     existing set of cuts.
00040 
00041     Also contains various utility functions which implementations might want to
00042     use.
00043 
00044 SourceFiles
00045     cellLooper.C
00046 
00047 \*---------------------------------------------------------------------------*/
00048 
00049 #ifndef cellLooper_H
00050 #define cellLooper_H
00051 
00052 #include "edgeVertex.H"
00053 #include "vector.H"
00054 #include "boolList.H"
00055 #include "scalarField.H"
00056 #include "DynamicList.H"
00057 
00058 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00059 
00060 namespace Foam
00061 {
00062 
00063 // Class forward declarations
00064 class polyMesh;
00065 class plane;
00066 
00067 /*---------------------------------------------------------------------------*\
00068                            Class cellLooper Declaration
00069 \*---------------------------------------------------------------------------*/
00070 
00071 class cellLooper
00072 :
00073     public edgeVertex
00074 {
00075     // Private data
00076 
00077 
00078 protected:
00079 
00080     // Protected Member Functions
00081 
00082         //- Get faces (on cell) connected to vertI which are not using edgeI
00083         labelList getVertFacesNonEdge
00084         (
00085             const label cellI,
00086             const label edgeI,
00087             const label vertI
00088         ) const;
00089 
00090         //- Get first edge connected to vertI and on faceI
00091         label getFirstVertEdge
00092         (
00093             const label faceI,
00094             const label vertI
00095         ) const;
00096 
00097         //- Get edges (on cell) connected to vertI which are not on faceI
00098         labelList getVertEdgesNonFace
00099         (
00100             const label cellI,
00101             const label faceI,
00102             const label vertI
00103         ) const;
00104 
00105         //- Return edge from cellEdges that is most perpendicular
00106         //  to refinement direction.
00107         label getMisAlignedEdge(const vector& refDir, const label cellI) const;
00108 
00109 private:
00110 
00111     // Private Member Functions
00112 
00113         //- Disallow default bitwise copy construct
00114         cellLooper(const cellLooper&);
00115 
00116         //- Disallow default bitwise assignment
00117         void operator=(const cellLooper&);
00118 
00119 
00120 public:
00121 
00122     //- Runtime type information
00123     TypeName("cellLooper");
00124 
00125 
00126     // Declare run-time constructor selection table
00127 
00128         // For the direct constructor
00129         declareRunTimeSelectionTable
00130         (
00131             autoPtr,
00132             cellLooper,
00133             word,
00134             (
00135                 const polyMesh& mesh
00136             ),
00137             (mesh)
00138         );
00139 
00140 
00141     // Constructors
00142 
00143         //- Construct from components
00144         cellLooper(const polyMesh& mesh);
00145 
00146         //- Clone
00147         autoPtr<cellLooper> clone() const
00148         {
00149             notImplemented("autoPtr<tcellLooper> clone() const");
00150             return autoPtr<cellLooper>(NULL);
00151         }
00152 
00153 
00154     // Selectors
00155 
00156         //- Return a reference to the selected cellLooper
00157         static autoPtr<cellLooper> New
00158         (
00159             const word& type,
00160             const polyMesh& mesh
00161         );
00162 
00163 
00164     // Destructor
00165 
00166         virtual ~cellLooper();
00167 
00168 
00169     // Member Functions
00170 
00171         //- Create cut along circumference of cellI. Gets current mesh cuts
00172         //  vertIsCut, edgeIsCut, edgeWeight).
00173         //  Cut along circumference is expressed as cellVertCut,
00174         //  cellEdgeToWeight. Returns true if succesfull. Still might not
00175         //  be compatible with existing cuts but this should be handled by
00176         //  caller). 
00177         virtual bool cut
00178         (
00179             const vector& refDir,
00180             const label cellI,
00181             const boolList& vertIsCut,
00182             const boolList& edgeIsCut,
00183             const scalarField& edgeWeight,
00184 
00185             labelList& loop,
00186             scalarField& loopWeights
00187         ) const = 0;
00188 
00189         //- Same but now also base point of cut provided (instead of always
00190         //  cell centre)
00191         virtual bool cut
00192         (
00193             const plane& cutPlane,
00194             const label cellI,
00195             const boolList& vertIsCut,
00196             const boolList& edgeIsCut,
00197             const scalarField& edgeWeight,
00198 
00199             labelList& loop,
00200             scalarField& loopWeights
00201         ) const = 0;
00202 
00203 };
00204 
00205 
00206 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00207 
00208 } // End namespace Foam
00209 
00210 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00211 
00212 #endif
00213 
00214 // ************************************************************************* //
For further information go to www.openfoam.org