1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by
13 the Free Software Foundation, either version 3 of the License, or
14 (at your option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
28 Constructs plane through mesh.
30 No attempt at resolving degenerate cases. Since the cut faces are
31 usually quite ugly, they will always be triangulated.
34 When the cutting plane coincides with a mesh face, the cell edge on the
35 positive side of the plane is taken.
40 \*---------------------------------------------------------------------------*/
42 #ifndef cuttingPlane_H
43 #define cuttingPlane_H
46 #include "pointField.H"
48 #include "MeshedSurface.H"
50 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
57 /*---------------------------------------------------------------------------*\
58 Class cuttingPlane Declaration
59 \*---------------------------------------------------------------------------*/
64 public MeshedSurface<face>
66 //- Private typedefs for convenience
67 typedef MeshedSurface<face> MeshStorage;
71 //- List of cells cut by the plane
74 // Private Member Functions
76 //- Determine cut cells, possibly restricted to a list of cells
80 const scalarField& dotProducts,
81 const labelUList& cellIdLabels = labelUList::null()
84 //- Determine intersection points (cutPoints).
88 const scalarField& dotProducts,
89 List<label>& edgePoint
92 //- Walk circumference of cell, starting from startEdgeI crossing
93 // only cut edges. Record cutPoint labels in faceVerts.
97 const labelUList& edgePoint,
99 const label startEdgeI,
100 DynamicList<label>& faceVerts
103 //- Determine cuts for all cut cells.
106 const primitiveMesh& mesh,
107 const bool triangulate,
108 const labelUList& edgePoint
116 //- Construct plane description without cutting
117 cuttingPlane(const plane&);
119 // Protected Member Functions
121 //- recut mesh with existing planeDesc, restricted to a list of cells
124 const primitiveMesh&,
125 const bool triangulate,
126 const labelUList& cellIdLabels = labelUList::null()
129 //- remap action on triangulation or cleanup
130 virtual void remapFaces(const labelUList& faceMap);
136 //- Construct from plane and mesh reference,
137 // possibly restricted to a list of cells
141 const primitiveMesh&,
142 const bool triangulate,
143 const labelUList& cellIdLabels = labelUList::null()
149 //- Return plane used
150 const plane& planeDesc() const
152 return static_cast<const plane&>(*this);
155 //- Return List of cells cut by the plane
156 const labelList& cutCells() const
161 //- Return true or false to question: have any cells been cut?
164 return cutCells_.size();
167 //- Sample the cell field
169 tmp<Field<Type> > sample(const Field<Type>&) const;
172 tmp<Field<Type> > sample(const tmp<Field<Type> >&) const;
177 void operator=(const cuttingPlane&);
181 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
183 } // End namespace Foam
185 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
188 # include "cuttingPlaneTemplates.C"
191 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
195 // ************************************************************************* //