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