OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

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