OpenFOAM logo
Open Source CFD Toolkit

meshCutSurface.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     meshCutSurface
00027 
00028 Description
00029     Description of surface resulting from cuts through mesh. Region on
00030     labelledTris is the cell the triangle is resulting from.
00031 
00032 SourceFiles
00033     meshCutSurface.C
00034 
00035 \*---------------------------------------------------------------------------*/
00036 
00037 #ifndef meshCutSurface_H
00038 #define meshCutSurface_H
00039 
00040 #include "labelList.H"
00041 #include "HashTable.H"
00042 #include "pointField.H"
00043 #include "triSurface.H"
00044 #include "boolList.H"
00045 
00046 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00047 
00048 namespace Foam
00049 {
00050 
00051 // Class forward declarations
00052 class primitiveMesh;
00053 class cellAddressing;
00054 class faceDecompCuts;
00055 class cellDecompCuts;
00056 
00057 /*---------------------------------------------------------------------------*\
00058                            Class meshCutSurface Declaration
00059 \*---------------------------------------------------------------------------*/
00060 
00061 class meshCutSurface
00062 :
00063     public triSurface
00064 {
00065 
00066     // Static data members
00067 
00068         //- Symbolic names of tet vertices
00069         static label FP0;
00070         static label FC;
00071         static label FP1;
00072         static label CC;
00073 
00074         //- Symbolic names of tet edges
00075         static label FP0_FC;
00076         static label FP0_FP1;
00077         static label FP0_CC;
00078         static label FC_CC;
00079         static label FC_FP1;
00080         static label FP1_CC;
00081 
00082 
00083     // Private Static Functions
00084 
00085         //- Find key in hashtable. Returns value or -1 if not found
00086         template<class T, class Hash>
00087         static label find
00088         (
00089             const HashTable<label, T, Hash>& table,
00090             const T& key
00091         );
00092 
00093         //- Find edge in subset edgeLabels of edges.
00094         static label findEdge
00095         (
00096             const edgeList& edges,
00097             const labelList& edgeLabels,
00098             const edge& e
00099         );
00100 
00101         //- Find the other (i.e. not cutEdgeI) cut-edge on faceI of cell model
00102         static label findCutEdge
00103         (
00104             const cellAddressing& model,
00105             const labelList& tetEdgeCuts,
00106             const label faceI,
00107             const label cutEdgeI
00108         );
00109 
00110 
00111     // Private Member Functions
00112 
00113         //- Remove duplicate faces (resulting from 3 meshVerts cut - is seen
00114         //  from both sides)
00115         static triSurface removeDuplicates(const triSurface& surf);
00116 
00117 public:
00118         //- Generic tet cutting routine.
00119         //  Generate triangles given the cut vertices and edges of the tet.
00120         //  (Triangles can be incorrectly oriented)
00121         void cutTet
00122         (
00123             const cellAddressing& model,
00124             const labelList& tetVertCuts,
00125             const labelList& tetEdgeCuts,
00126             const label cellI,
00127             List<labelledTri>& tris,
00128             label& triI
00129         );
00130 
00131         //- Tet cutting when cuts are only through edges.
00132         void cutTetThroughEdges
00133         (
00134             const cellAddressing& model,
00135             const labelList& tetEdgeCuts,
00136             const label nEdgeCuts,
00137             const label cellI,
00138             List<labelledTri>& tris,
00139             label& triI
00140         );
00141 
00142         //- Tet cutting when cuts are through corner vertices (and possibly
00143         //  edges)
00144         void cutTetThroughVerts
00145         (
00146             const cellAddressing& model,
00147             const labelList& tetVertCuts,
00148             const label nVertCuts,
00149             const labelList& tetEdgeCuts,
00150             const label nEdgeCuts,
00151             const label cellI,
00152             List<labelledTri>& tris,
00153             label& triI
00154         );
00155 
00156     // Static functions
00157 
00158         //- Interpolate onto points given edge weights, cell centre values,
00159         //  face centre values and vertex values
00160         template <class T>
00161         static Field<T> interpolate
00162         (
00163             const faceDecompCuts& cuts,
00164             const Field<T>& vField,
00165             const Field<T>& fField,
00166             const Field<T>& pField
00167         );
00168 
00169         //- Interpolate onto points given edge weights, cell centre values,
00170         //  and vertex values
00171         template <class T>
00172         static Field<T> interpolate
00173         (
00174             const cellDecompCuts& cuts,
00175             const Field<T>& vField,
00176             const Field<T>& pField
00177         );
00178 
00179 
00180     // Constructors
00181 
00182         //- Construct from cuts on faceDecomp tet decomposition
00183         //  (introduces cellcentres and facecentres)
00184         meshCutSurface(const faceDecompCuts& cuts);
00185 
00186         //- Construct from cuts on cellDecomp tet decomposition
00187         //  (introduces cellcentres but not facecentres)
00188         meshCutSurface(const cellDecompCuts& cuts);
00189 };
00190 
00191 
00192 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00193 
00194 } // End namespace Foam
00195 
00196 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00197 
00198 #ifdef NoRepository
00199 #   include "meshCutSurfaceInterpolate.C"
00200 #endif
00201 
00202 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00203 
00204 #endif
00205 
00206 // ************************************************************************* //
For further information go to www.openfoam.org