![]() |
|
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 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 00072 // Private Member Functions 00073 00074 //- Determine cut cells. 00075 void calcCutCells 00076 ( 00077 const primitiveMesh&, 00078 const scalarField& dotProducts 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 public: 00108 00109 // Constructors 00110 00111 //- Construct from components: Mesh reference and plane 00112 cuttingPlane(const primitiveMesh&, const plane&); 00113 00114 00115 // Member Functions 00116 00117 //- Return pointField of cutting points 00118 const pointField& points() const; 00119 00120 //- Return faceList of points in cells 00121 const faceList& faces() const; 00122 00123 //- Return labelList of cut cells 00124 const labelList& cells() const; 00125 00126 //- Return true or false to question: have any cells been cut? 00127 bool cut(); 00128 00129 //- Sample the cell field 00130 template<class Type> 00131 tmp<Field<Type> > sample(const Field<Type>&) const; 00132 00133 template<class Type> 00134 tmp<Field<Type> > sample(const tmp<Field<Type> >&) const; 00135 00136 00137 // Member Operators 00138 00139 void operator=(const cuttingPlane&); 00140 00141 }; 00142 00143 00144 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00145 00146 } // End namespace Foam 00147 00148 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00149 00150 #ifdef NoRepository 00151 # include "cuttingPlaneSample.C" 00152 #endif 00153 00154 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00155 00156 #endif 00157 00158 // ************************************************************************* //