OpenFOAM logo
Open Source CFD Toolkit

topoCellLooper.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     topoCellLooper
00027 
00028 Description
00029     Implementation of cellLooper. This one recognizes splitHexes and tries
00030     to make a cut such that if the neighbour was split (in a previous iteration)
00031     this one also gets split in the same direction so that the result
00032     will be a mesh without splitHexes.
00033 
00034     'splitHexes' are cells of which the 'featureEdges'
00035     (see cellFeatures class) form a hex. The remaining non-feature edges
00036     are assumed to result from splitting the neighbour and this class tries
00037     to start from one of these and cut through to an opposite edge.
00038 
00039     The current set of cuts (vertIsCut, edgeIsCut, edgeWeight) are not being
00040     used by this implementation.
00041 
00042     All non-splitHexes are done by the parent classes.
00043 
00044 
00045 SourceFiles
00046     topoCellLooper.C
00047 
00048 \*---------------------------------------------------------------------------*/
00049 
00050 #ifndef topoCellLooper_H
00051 #define topoCellLooper_H
00052 
00053 #include "hexCellLooper.H"
00054 #include "typeInfo.H"
00055 
00056 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00057 
00058 namespace Foam
00059 {
00060 
00061 // Class forward declarations
00062 class cellFeatures;
00063 
00064 /*---------------------------------------------------------------------------*\
00065                            Class topoCellLooper Declaration
00066 \*---------------------------------------------------------------------------*/
00067 
00068 class topoCellLooper
00069 :
00070     public hexCellLooper
00071 {
00072 
00073     // Private Member Functions
00074 
00075         //- In-memory truncate a list
00076         template <class T>
00077         static void subsetList
00078         (
00079             const label startI,
00080             const label freeI,
00081             DynamicList<T>& lst
00082         );
00083 
00084         //- walk across superface discarding non-feature points.
00085         void walkFace
00086         (
00087             const cellFeatures& features,
00088             const label faceI,
00089             const label startEdgeI,
00090             const label startVertI,
00091             const label nFeaturePts,
00092 
00093             label& edgeI,
00094             label& vertI
00095         ) const;
00096 
00097         //- Returns list of vertices on 'superEdge' i.e. list of edges connected
00098         // by non-feature points. First and last are feature points, ones
00099         // inbetween are not.
00100         labelList getSuperEdge
00101         (
00102             const cellFeatures& features,
00103             const label faceI,
00104             const label startEdgeI,
00105             const label startVertI
00106         ) const;
00107 
00108         // Return non-feature edge from cells' edges that is most
00109         // perpendicular to refinement direction. Used as starting edge.
00110         label getAlignedNonFeatureEdge
00111         (
00112             const vector& refDir,
00113             const label cellI,
00114             const cellFeatures& features
00115         ) const;
00116 
00117         //- Starts from edge and vertex on edge on face (or neighbouring face)
00118         // and steps either to existing vertex (vertI != -1) or to edge
00119         // (vertI == -1)
00120         // by walking point-edge and crossing nFeats featurePoints.
00121         void walkAcrossFace
00122         (
00123             const cellFeatures& features,
00124             const label faceI,
00125             const label startEdgeI,
00126             const label startVertI,
00127             const label nFeats,
00128 
00129             label& edgeI,
00130             label& vertI
00131         ) const;
00132 
00133         //- Walks splitcell circumference. Sets loop/loopweights to walk on
00134         //  outside of cell.
00135         void walkSplitHex
00136         (
00137             const label cellI,
00138             const cellFeatures& features,
00139             const label fromFaceI,
00140             const label fromEdgeI,
00141             const label fromVertI,
00142 
00143             DynamicList<label>& loop,
00144             DynamicList<scalar>& loopWeights
00145         ) const;
00146 
00147 
00148         //- Disallow default bitwise copy construct
00149         topoCellLooper(const topoCellLooper&);
00150 
00151         //- Disallow default bitwise assignment
00152         void operator=(const topoCellLooper&);
00153 
00154 
00155 public:
00156 
00157     //- Runtime type information
00158     TypeName("topoCellLooper");
00159 
00160     // Static data members
00161 
00162         //- cos of angle for feature recognition (of splitHexes)
00163         static const scalar featureCos;
00164 
00165 
00166     // Constructors
00167 
00168         //- Construct from components
00169         topoCellLooper(const polyMesh& mesh);
00170 
00171 
00172     // Destructor
00173 
00174         virtual ~topoCellLooper();
00175 
00176 
00177     // Member Functions
00178 
00179         //- Create cut along circumference of cellI. Gets current mesh cuts.
00180         //  Cut along circumference is expressed as loop of cuts plus weights
00181         //  for cuts along edges (only valid for edge cuts).
00182         //  Return true if successful cut.
00183         virtual bool cut
00184         (
00185             const vector& refDir,
00186             const label cellI,
00187             const boolList& vertIsCut,
00188             const boolList& edgeIsCut,
00189             const scalarField& edgeWeight,
00190 
00191             labelList& loop,
00192             scalarField& loopWeights
00193         ) const;
00194 
00195         //- Same but now also base point of cut provided (instead of always
00196         //  cell centre)
00197         virtual bool cut
00198         (
00199             const plane& cutPlane,
00200             const label cellI,
00201             const boolList& vertIsCut,
00202             const boolList& edgeIsCut,
00203             const scalarField& edgeWeight,
00204 
00205             labelList& loop,
00206             scalarField& loopWeights
00207         ) const;
00208 };
00209 
00210 
00211 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00212 
00213 } // End namespace Foam
00214 
00215 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00216 
00217 #endif
00218 
00219 // ************************************************************************* //
For further information go to www.openfoam.org