initial commit for version 1.5.x patch release
[OpenFOAM-1.5.x.git] / src / OpenFOAM / meshes / meshShapes / cellMatcher / degenerateMatcher.C
blobe42aa491ca6a899ba132881eb07afe4e37a60c08
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2008 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
9     This file is part of OpenFOAM.
11     OpenFOAM is free software; you can redistribute it and/or modify it
12     under the terms of the GNU General Public License as published by the
13     Free Software Foundation; either version 2 of the License, or (at your
14     option) any later version.
16     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
19     for more details.
21     You should have received a copy of the GNU General Public License
22     along with OpenFOAM; if not, write to the Free Software Foundation,
23     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 \*---------------------------------------------------------------------------*/
27 #include "degenerateMatcher.H"
29 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
31 Foam::hexMatcher Foam::degenerateMatcher::hex;
32 Foam::wedgeMatcher Foam::degenerateMatcher::wedge;
33 Foam::prismMatcher Foam::degenerateMatcher::prism;
34 Foam::tetWedgeMatcher Foam::degenerateMatcher::tetWedge;
35 Foam::pyrMatcher Foam::degenerateMatcher::pyr;
36 Foam::tetMatcher Foam::degenerateMatcher::tet;
39 Foam::cellShape Foam::degenerateMatcher::match
41     const faceList& faces,
42     const labelList& owner,
43     const label cellI,
44     const labelList& cellFaces
47     // Recognize in order of assumed occurrence.
49     if (hex.matchShape(false, faces, owner, cellI, cellFaces))
50     {
51         return cellShape(hex.model(), hex.vertLabels());
52     }
53     else if (tet.matchShape(false, faces, owner, cellI, cellFaces))
54     {
55         return cellShape(tet.model(), tet.vertLabels());
56     }
57     else if (prism.matchShape(false, faces, owner, cellI, cellFaces))
58     {
59         return cellShape(prism.model(), prism.vertLabels());
60     }
61     else if (pyr.matchShape(false, faces, owner, cellI, cellFaces))
62     {
63         return cellShape(pyr.model(), pyr.vertLabels());
64     }
65     else if (wedge.matchShape(false, faces, owner, cellI, cellFaces))
66     {
67         return cellShape(wedge.model(), wedge.vertLabels());
68     }
69     else if (tetWedge.matchShape(false, faces, owner, cellI, cellFaces))
70     {
71         return cellShape(tetWedge.model(), tetWedge.vertLabels());
72     }
73     else
74     {
75         return cellShape(*(cellModeller::lookup(0)), labelList(0));
76     }
80 Foam::cellShape Foam::degenerateMatcher::match(const faceList& faces)
82     // Do as if single cell mesh; all faces are referenced by a single cell
84     return match
85     (
86         faces, 
87         labelList(faces.size(), 0),     // Cell 0 is owner of all faces
88         0,                              // cell 0
89         labelList(cellMatcher::makeIdentity(faces.size()))  // cell 0 consists
90                                                             // of all faces
91     );
95 Foam::cellShape Foam::degenerateMatcher::match(const cellShape& shape)
97     return match(shape.collapsedFaces());
101 Foam::cellShape Foam::degenerateMatcher::match
103     const primitiveMesh& mesh,
104     const label cellI
107     return match
108     (
109         mesh.faces(), 
110         mesh.faceOwner(),
111         cellI,
112         mesh.cells()[cellI]
113     );
117 // ************************************************************************* //