ENH: autoLayerDriver: better layering information message
[OpenFOAM-2.0.x.git] / src / OpenFOAM / meshes / meshShapes / cellMatcher / degenerateMatcher.C
blob0b10206c4364a024f8ec1cd239bcd8ef3fd5f8e9
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
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
13     the Free Software Foundation, either version 3 of the License, or
14     (at your 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, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
26 #include "degenerateMatcher.H"
27 #include "ListOps.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         identity(faces.size())         // cell 0 consists of all faces
90     );
94 Foam::cellShape Foam::degenerateMatcher::match(const cellShape& shape)
96     return match(shape.collapsedFaces());
100 Foam::cellShape Foam::degenerateMatcher::match
102     const primitiveMesh& mesh,
103     const label cellI
106     return match
107     (
108         mesh.faces(),
109         mesh.faceOwner(),
110         cellI,
111         mesh.cells()[cellI]
112     );
116 // ************************************************************************* //