initial commit for version 1.5.x patch release
[OpenFOAM-1.5.x.git] / src / finiteVolume / fvMesh / fvMeshCutSurface / edgeCuts / meshEdgeCuts.H
blobdab50b77e7d60385863fe6651418378a32c242bc
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2008 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
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 the
13     Free Software Foundation; either version 2 of the License, or (at your
14     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
19     for more details.
21     You should have received a copy of the GNU General Public License
22     along with OpenFOAM; if not, write to the Free Software Foundation,
23     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 Class
26     Foam::meshEdgeCuts
28 Description
29     Container for cuts of edges of mesh. Cuts either exactly through existing 
30     vertices or through edges.
32 SourceFiles
34 \*---------------------------------------------------------------------------*/
36 #ifndef meshEdgeCuts_H
37 #define meshEdgeCuts_H
39 #include "labelList.H"
40 #include "labelHashSet.H"
41 #include "scalarField.H"
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 namespace Foam
48 // Forward declaration of classes
49 class primitiveMesh;
51 /*---------------------------------------------------------------------------*\
52                            Class meshEdgeCuts Declaration
53 \*---------------------------------------------------------------------------*/
55 class meshEdgeCuts
57     // Private data
59         const primitiveMesh& mesh_;
61     // Private Member Functions
63         //- Disallow default bitwise copy construct
64         meshEdgeCuts(const meshEdgeCuts&);
66         //- Disallow default bitwise assignment
67         void operator=(const meshEdgeCuts&);
70 protected:
72         //- List of cells containing the cuts
73         labelList cells_;
75         //- Points exactly cut by cuts
76         labelList meshVerts_;
78         //- List of edge labels cut
79         labelList meshEdges_;
81         //- Positions on edges
82         scalarField meshEdgeWeights_;
85     // Protected Static Functions
87         //- Mark element in a hashSet
88         static void mark(const label elem, labelHashSet& markedElems);
90         //- Mark list of elements in a hashSet
91         static void mark(const labelList& elems, labelHashSet& markedElems);
93         //- Return true and set weight if linear interpolation between
94         //  val0 and val1 crosses isoVal. weight=1 if isoVal==val1
95         static bool crosses
96         (
97             const scalar isoVal,
98             const scalar val0,
99             const scalar val1,
100             scalar& weight
101         );
103 public:
105     // Constructors
107         //- Construct from components
108         meshEdgeCuts
109         (
110             const primitiveMesh& mesh,
111             const labelList& cells,
112             const labelList& meshVerts,
113             const labelList& meshEdges,
114             const scalarField& meshEdgeWeights
115         );
118     // Member Functions
120         const primitiveMesh& mesh() const
121         {
122             return mesh_;
123         }
125         const labelList& cells() const
126         {
127             return cells_;
128         }
130         const labelList& meshVerts() const
131         {
132             return meshVerts_;
133         }
135         const labelList& meshEdges() const
136         {
137             return meshEdges_;
138         }
140         const scalarField& meshEdgeWeights() const
141         {
142             return meshEdgeWeights_;
143         }
145         label size() const
146         {
147             return meshVerts_.size() + meshEdges_.size();
148         }
153 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
155 } // End namespace Foam
157 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
159 #endif
161 // ************************************************************************* //