|
|
|
cuttingPlane.HGo 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-2007 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 cuttingPlane 00027 00028 Description 00029 Constructs plane through mesh. No attempt at resolving degenerate 00030 cases. 00031 00032 SourceFiles 00033 cuttingPlane.C 00034 00035 \*---------------------------------------------------------------------------*/ 00036 00037 #ifndef cuttingPlane_H 00038 #define cuttingPlane_H 00039 00040 #include "plane.H" 00041 #include "pointField.H" 00042 #include "faceList.H" 00043 00044 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00045 00046 namespace Foam 00047 { 00048 00049 class primitiveMesh; 00050 00051 /*---------------------------------------------------------------------------*\ 00052 Class cuttingPlane Declaration 00053 \*---------------------------------------------------------------------------*/ 00054 00055 class cuttingPlane 00056 : 00057 public plane 00058 { 00059 // Private data 00060 00061 //- List of cells cut by the plane 00062 labelList cutCells_; 00063 00064 //- Intersection points 00065 pointField cutPoints_; 00066 00067 //- Cut faces in terms of intersection points 00068 faceList cutFaces_; 00069 00070 00071 // Private Member Functions 00072 00073 //- Determine cut cells, possibly restricted to a list of cells 00074 void calcCutCells 00075 ( 00076 const primitiveMesh&, 00077 const scalarField& dotProducts, 00078 const labelList& cellIdLabels = labelList::null() 00079 ); 00080 00081 //- Determine intersection points (cutPoints_). 00082 labelList intersectEdges 00083 ( 00084 const primitiveMesh&, 00085 const scalarField& dotProducts 00086 ); 00087 00088 //- Walk around circumference of cell starting from startEdgeI crossing 00089 // only cut edges. Record cutPoint labels in faceVerts. 00090 static bool walkCell 00091 ( 00092 const primitiveMesh&, 00093 const labelList& edgePoint, 00094 const label cellI, 00095 const label startEdgeI, 00096 DynamicList<label>& faceVerts 00097 ); 00098 00099 //- Determine cuts for all cut cells. 00100 void walkCellCuts 00101 ( 00102 const primitiveMesh& mesh, 00103 const labelList& edgePoint 00104 ); 00105 00106 00107 protected: 00108 00109 // Constructors 00110 00111 //- Construct plane description without cutting 00112 cuttingPlane(const plane&); 00113 00114 00115 // Protected Member Functions 00116 00117 //- recut mesh with existing planeDesc 00118 void reCut(const primitiveMesh&); 00119 00120 //- recut mesh with existing planeDesc, restricted to a list of cells 00121 void reCut 00122 ( 00123 const primitiveMesh&, 00124 const labelList& cellIdLabels 00125 ); 00126 00127 00128 public: 00129 00130 // Constructors 00131 00132 //- Construct from components: Mesh reference and plane 00133 cuttingPlane(const primitiveMesh&, const plane&); 00134 00135 //- Construct from mesh reference and plane, 00136 // restricted to a list of cells 00137 cuttingPlane 00138 ( 00139 const primitiveMesh&, 00140 const plane&, 00141 const labelList& cellIdLabels 00142 ); 00143 00144 00145 // Member Functions 00146 00147 //- Return plane used 00148 const plane& planeDesc() const; 00149 00150 //- Return pointField of cutting points 00151 const pointField& points() const; 00152 00153 //- Return faceList of points in cells 00154 const faceList& faces() const; 00155 00156 //- Return labelList of cut cells 00157 const labelList& cells() const; 00158 00159 //- Return true or false to question: have any cells been cut? 00160 bool cut(); 00161 00162 //- Sample the cell field 00163 template<class Type> 00164 tmp<Field<Type> > sample(const Field<Type>&) const; 00165 00166 template<class Type> 00167 tmp<Field<Type> > sample(const tmp<Field<Type> >&) const; 00168 00169 00170 // Member Operators 00171 00172 void operator=(const cuttingPlane&); 00173 }; 00174 00175 00176 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00177 00178 } // End namespace Foam 00179 00180 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00181 00182 #ifdef NoRepository 00183 # include "cuttingPlaneSample.C" 00184 #endif 00185 00186 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00187 00188 #endif 00189 00190 // ************************************************************************* // |