FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

degenerateMatcher.C

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-2010 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
00013     the Free Software Foundation, either version 3 of the License, or
00014     (at your 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, see <http://www.gnu.org/licenses/>.
00023 
00024 \*---------------------------------------------------------------------------*/
00025 
00026 #include <OpenFOAM/degenerateMatcher.H>
00027 
00028 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
00029 
00030 Foam::hexMatcher Foam::degenerateMatcher::hex;
00031 Foam::wedgeMatcher Foam::degenerateMatcher::wedge;
00032 Foam::prismMatcher Foam::degenerateMatcher::prism;
00033 Foam::tetWedgeMatcher Foam::degenerateMatcher::tetWedge;
00034 Foam::pyrMatcher Foam::degenerateMatcher::pyr;
00035 Foam::tetMatcher Foam::degenerateMatcher::tet;
00036 
00037 
00038 Foam::cellShape Foam::degenerateMatcher::match
00039 (
00040     const faceList& faces,
00041     const labelList& owner,
00042     const label cellI,
00043     const labelList& cellFaces
00044 )
00045 {
00046     // Recognize in order of assumed occurrence.
00047 
00048     if (hex.matchShape(false, faces, owner, cellI, cellFaces))
00049     {
00050         return cellShape(hex.model(), hex.vertLabels());
00051     }
00052     else if (tet.matchShape(false, faces, owner, cellI, cellFaces))
00053     {
00054         return cellShape(tet.model(), tet.vertLabels());
00055     }
00056     else if (prism.matchShape(false, faces, owner, cellI, cellFaces))
00057     {
00058         return cellShape(prism.model(), prism.vertLabels());
00059     }
00060     else if (pyr.matchShape(false, faces, owner, cellI, cellFaces))
00061     {
00062         return cellShape(pyr.model(), pyr.vertLabels());
00063     }
00064     else if (wedge.matchShape(false, faces, owner, cellI, cellFaces))
00065     {
00066         return cellShape(wedge.model(), wedge.vertLabels());
00067     }
00068     else if (tetWedge.matchShape(false, faces, owner, cellI, cellFaces))
00069     {
00070         return cellShape(tetWedge.model(), tetWedge.vertLabels());
00071     }
00072     else
00073     {
00074         return cellShape(*(cellModeller::lookup(0)), labelList(0));
00075     }
00076 }
00077 
00078 
00079 Foam::cellShape Foam::degenerateMatcher::match(const faceList& faces)
00080 {
00081     // Do as if single cell mesh; all faces are referenced by a single cell
00082 
00083     return match
00084     (
00085         faces, 
00086         labelList(faces.size(), 0),     // Cell 0 is owner of all faces
00087         0,                              // cell 0
00088         labelList(cellMatcher::makeIdentity(faces.size()))  // cell 0 consists
00089                                                             // of all faces
00090     );
00091 }
00092 
00093 
00094 Foam::cellShape Foam::degenerateMatcher::match(const cellShape& shape)
00095 {
00096     return match(shape.collapsedFaces());
00097 }
00098 
00099 
00100 Foam::cellShape Foam::degenerateMatcher::match
00101 (
00102     const primitiveMesh& mesh,
00103     const label cellI
00104 )
00105 {
00106     return match
00107     (
00108         mesh.faces(), 
00109         mesh.faceOwner(),
00110         cellI,
00111         mesh.cells()[cellI]
00112     );
00113 }
00114 
00115 
00116 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines