OpenFOAM logo
The Open Source CFD Toolbox
  Programmer’s C++ Doxygen OpenCFD Solutions Contact OpenFOAM

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-2007 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 
00118 public:
00119 
00120         //- Generic tet cutting routine.
00121         //  Generate triangles given the cut vertices and edges of the tet.
00122         //  (Triangles can be incorrectly oriented)
00123         void cutTet
00124         (
00125             const cellAddressing& model,
00126             const labelList& tetVertCuts,
00127             const labelList& tetEdgeCuts,
00128             const label cellI,
00129             List<labelledTri>& tris,
00130             label& triI
00131         );
00132 
00133         //- Tet cutting when cuts are only through edges.
00134         void cutTetThroughEdges
00135         (
00136             const cellAddressing& model,
00137             const labelList& tetEdgeCuts,
00138             const label nEdgeCuts,
00139             const label cellI,
00140             List<labelledTri>& tris,
00141             label& triI
00142         );
00143 
00144         //- Tet cutting when cuts are through corner vertices (and possibly
00145         //  edges)
00146         void cutTetThroughVerts
00147         (
00148             const cellAddressing& model,
00149             const labelList& tetVertCuts,
00150             const label nVertCuts,
00151             const labelList& tetEdgeCuts,
00152             const label nEdgeCuts,
00153             const label cellI,
00154             List<labelledTri>& tris,
00155             label& triI
00156         );
00157 
00158 
00159     // Static functions
00160 
00161         //- Interpolate onto points given edge weights, cell centre values,
00162         //  face centre values and vertex values
00163         template <class T>
00164         static tmp<Field<T> > interpolate
00165         (
00166             const faceDecompCuts& cuts,
00167             const Field<T>& vField,
00168             const Field<T>& fField,
00169             const Field<T>& pField
00170         );
00171 
00172         //- Interpolate onto points given edge weights, cell centre values,
00173         //  and vertex values
00174         template <class T>
00175         static tmp<Field<T> > interpolate
00176         (
00177             const cellDecompCuts& cuts,
00178             const Field<T>& vField,
00179             const Field<T>& pField
00180         );
00181 
00182 
00183     // Constructors
00184 
00185         //- Construct from cuts on faceDecomp tet decomposition
00186         //  (introduces cellcentres and facecentres)
00187         meshCutSurface(const faceDecompCuts& cuts);
00188 
00189         //- Construct from cuts on cellDecomp tet decomposition
00190         //  (introduces cellcentres but not facecentres)
00191         meshCutSurface(const cellDecompCuts& cuts);
00192 };
00193 
00194 
00195 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00196 
00197 } // End namespace Foam
00198 
00199 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00200 
00201 #ifdef NoRepository
00202 #   include "meshCutSurfaceInterpolate.C"
00203 #endif
00204 
00205 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00206 
00207 #endif
00208 
00209 // ************************************************************************* //
Copyright © 2000-2007 OpenCFD Ltd