OpenFOAM logo
Open Source CFD Toolkit

meshEdgeCuts.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-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     meshEdgeCuts
00027 
00028 Description
00029     Container for cuts of edges of mesh. Cuts either exactly through existing 
00030     vertices or through edges.
00031 
00032 SourceFiles
00033 
00034 \*---------------------------------------------------------------------------*/
00035 
00036 #ifndef meshEdgeCuts_H
00037 #define meshEdgeCuts_H
00038 
00039 #include "labelList.H"
00040 #include "labelHashSet.H"
00041 #include "scalarField.H"
00042 
00043 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00044 
00045 namespace Foam
00046 {
00047 
00048 // Class forward declarations
00049 class primitiveMesh;
00050 
00051 /*---------------------------------------------------------------------------*\
00052                            Class meshEdgeCuts Declaration
00053 \*---------------------------------------------------------------------------*/
00054 
00055 class meshEdgeCuts
00056 {
00057     // Private data
00058 
00059         const primitiveMesh& mesh_;
00060 
00061     // Private Member Functions
00062 
00063         //- Disallow default bitwise copy construct
00064         meshEdgeCuts(const meshEdgeCuts&);
00065 
00066         //- Disallow default bitwise assignment
00067         void operator=(const meshEdgeCuts&);
00068 
00069 
00070 protected:
00071 
00072         //- List of cells containing the cuts
00073         labelList cells_;
00074 
00075         //- Points exactly cut by cuts
00076         labelList meshVerts_;
00077 
00078         //- List of edge labels cut
00079         labelList meshEdges_;
00080 
00081         //- Positions on edges
00082         scalarField meshEdgeWeights_;
00083 
00084 
00085     // Protected Static Functions
00086 
00087         //- Mark element in a hashSet
00088         static void mark(const label elem, labelHashSet& markedElems);
00089 
00090         //- Mark list of elements in a hashSet
00091         static void mark(const labelList& elems, labelHashSet& markedElems);
00092 
00093         //- Return true and set weight if linear interpolation between
00094         //  val0 and val1 crosses isoVal. weight=1 if isoVal==val1
00095         static bool crosses
00096         (
00097             const scalar isoVal,
00098             const scalar val0,
00099             const scalar val1,
00100             scalar& weight
00101         );
00102 
00103 public:
00104 
00105     // Constructors
00106 
00107         //- Construct from components
00108         meshEdgeCuts
00109         (
00110             const primitiveMesh& mesh,
00111             const labelList& cells,
00112             const labelList& meshVerts,
00113             const labelList& meshEdges,
00114             const scalarField& meshEdgeWeights
00115         );
00116 
00117 
00118     // Member Functions
00119 
00120         const primitiveMesh& mesh() const
00121         {
00122             return mesh_;
00123         }
00124 
00125         const labelList& cells() const
00126         {
00127             return cells_;
00128         }
00129 
00130         const labelList& meshVerts() const
00131         {
00132             return meshVerts_;
00133         }
00134 
00135         const labelList& meshEdges() const
00136         {
00137             return meshEdges_;
00138         }
00139 
00140         const scalarField& meshEdgeWeights() const
00141         {
00142             return meshEdgeWeights_;
00143         }
00144 
00145         label size() const
00146         {
00147             return meshVerts_.size() + meshEdges_.size();
00148         }
00149 
00150 };
00151 
00152 
00153 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00154 
00155 } // End namespace Foam
00156 
00157 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00158 
00159 #endif
00160 
00161 // ************************************************************************* //
For further information go to www.openfoam.org