OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

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-2009 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 \*---------------------------------------------------------------------------*/
00026 
00027 #include "degenerateMatcher.H"
00028 
00029 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
00030 
00031 Foam::hexMatcher Foam::degenerateMatcher::hex;
00032 Foam::wedgeMatcher Foam::degenerateMatcher::wedge;
00033 Foam::prismMatcher Foam::degenerateMatcher::prism;
00034 Foam::tetWedgeMatcher Foam::degenerateMatcher::tetWedge;
00035 Foam::pyrMatcher Foam::degenerateMatcher::pyr;
00036 Foam::tetMatcher Foam::degenerateMatcher::tet;
00037 
00038 
00039 Foam::cellShape Foam::degenerateMatcher::match
00040 (
00041     const faceList& faces,
00042     const labelList& owner,
00043     const label cellI,
00044     const labelList& cellFaces
00045 )
00046 {
00047     // Recognize in order of assumed occurrence.
00048 
00049     if (hex.matchShape(false, faces, owner, cellI, cellFaces))
00050     {
00051         return cellShape(hex.model(), hex.vertLabels());
00052     }
00053     else if (tet.matchShape(false, faces, owner, cellI, cellFaces))
00054     {
00055         return cellShape(tet.model(), tet.vertLabels());
00056     }
00057     else if (prism.matchShape(false, faces, owner, cellI, cellFaces))
00058     {
00059         return cellShape(prism.model(), prism.vertLabels());
00060     }
00061     else if (pyr.matchShape(false, faces, owner, cellI, cellFaces))
00062     {
00063         return cellShape(pyr.model(), pyr.vertLabels());
00064     }
00065     else if (wedge.matchShape(false, faces, owner, cellI, cellFaces))
00066     {
00067         return cellShape(wedge.model(), wedge.vertLabels());
00068     }
00069     else if (tetWedge.matchShape(false, faces, owner, cellI, cellFaces))
00070     {
00071         return cellShape(tetWedge.model(), tetWedge.vertLabels());
00072     }
00073     else
00074     {
00075         return cellShape(*(cellModeller::lookup(0)), labelList(0));
00076     }
00077 }
00078 
00079 
00080 Foam::cellShape Foam::degenerateMatcher::match(const faceList& faces)
00081 {
00082     // Do as if single cell mesh; all faces are referenced by a single cell
00083 
00084     return match
00085     (
00086         faces, 
00087         labelList(faces.size(), 0),     // Cell 0 is owner of all faces
00088         0,                              // cell 0
00089         labelList(cellMatcher::makeIdentity(faces.size()))  // cell 0 consists
00090                                                             // of all faces
00091     );
00092 }
00093 
00094 
00095 Foam::cellShape Foam::degenerateMatcher::match(const cellShape& shape)
00096 {
00097     return match(shape.collapsedFaces());
00098 }
00099 
00100 
00101 Foam::cellShape Foam::degenerateMatcher::match
00102 (
00103     const primitiveMesh& mesh,
00104     const label cellI
00105 )
00106 {
00107     return match
00108     (
00109         mesh.faces(), 
00110         mesh.faceOwner(),
00111         cellI,
00112         mesh.cells()[cellI]
00113     );
00114 }
00115 
00116 
00117 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd