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