Loading...
Searching...
No Matches
degenerateMatcher.C
Go to the documentation of this file.
1/*---------------------------------------------------------------------------*\
2 ========= |
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 \\ / O peration |
5 \\ / A nd | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2011-2016 OpenFOAM Foundation
9-------------------------------------------------------------------------------
10License
11 This file is part of OpenFOAM.
12
13 OpenFOAM is free software: you can redistribute it and/or modify it
14 under the terms of the GNU General Public License as published by
15 the Free Software Foundation, either version 3 of the License, or
16 (at your option) any later version.
17
18 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25
26\*---------------------------------------------------------------------------*/
27
28#include "degenerateMatcher.H"
29#include "primitiveMesh.H"
30#include "ListOps.H"
31
32// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
33
34Foam::hexMatcher Foam::degenerateMatcher::hex;
35Foam::wedgeMatcher Foam::degenerateMatcher::wedge;
36Foam::prismMatcher Foam::degenerateMatcher::prism;
37Foam::tetWedgeMatcher Foam::degenerateMatcher::tetWedge;
38Foam::pyrMatcher Foam::degenerateMatcher::pyr;
39Foam::tetMatcher Foam::degenerateMatcher::tet;
40
41
42// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
43
44Foam::cellShape Foam::degenerateMatcher::match
45(
46 const faceList& faces,
47 const labelList& owner,
48 const label celli,
49 const labelList& cellFaces
50)
51{
52 // Recognize in order of assumed occurrence.
53
54 if (hex.matchShape(false, faces, owner, celli, cellFaces))
55 {
56 return cellShape(hex.model(), hex.vertLabels());
57 }
58 if (tet.matchShape(false, faces, owner, celli, cellFaces))
59 {
60 return cellShape(tet.model(), tet.vertLabels());
61 }
62 if (prism.matchShape(false, faces, owner, celli, cellFaces))
63 {
64 return cellShape(prism.model(), prism.vertLabels());
65 }
66 if (pyr.matchShape(false, faces, owner, celli, cellFaces))
67 {
68 return cellShape(pyr.model(), pyr.vertLabels());
69 }
70 if (wedge.matchShape(false, faces, owner, celli, cellFaces))
71 {
72 return cellShape(wedge.model(), wedge.vertLabels());
73 }
74 if (tetWedge.matchShape(false, faces, owner, celli, cellFaces))
75 {
76 return cellShape(tetWedge.model(), tetWedge.vertLabels());
77 }
78
80}
81
82
83Foam::cellShape Foam::degenerateMatcher::match(const faceList& faces)
84{
85 // Do as if single cell mesh; all faces are referenced by a single cell
86
87 return match
88 (
89 faces,
90 labelList(faces.size(), Zero), // cell 0 is owner of all faces
91 0, // cell 0
92 identity(faces.size()) // cell 0 consists of all faces
93 );
94}
95
97Foam::cellShape Foam::degenerateMatcher::match(const cellShape& shape)
98{
99 return match(shape.collapsedFaces());
100}
101
102
103Foam::cellShape Foam::degenerateMatcher::match
104(
105 const primitiveMesh& mesh,
106 const label celli
107)
108{
109 return match
110 (
111 mesh.faces(),
112 mesh.faceOwner(),
113 celli,
114 mesh.cells()[celli]
115 );
116}
117
118
119// ************************************************************************* //
Various functions to operate on Lists.
void size(const label n)
Older name for setAddressableSize.
Definition UList.H:118
@ UNKNOWN
unknown
Definition cellModel.H:83
static const cellModel & ref(const modelType model)
Look up reference to cellModel by enumeration. Fatal on failure.
Definition cellModels.C:150
An analytical geometric cellShape.
Definition cellShape.H:71
faceList collapsedFaces() const
Collapsed faces of this cell.
Definition cellShapeI.H:260
static cellShape match(const primitiveMesh &mesh, const label celli)
Recognize shape given mesh and celli.
A cellMatcher for hex cells (cellModel::HEX).
Definition hexMatcher.H:53
Cell-face mesh analysis engine.
A cellMatcher for prism cells (cellModel::PRISM).
A cellMatcher for pyr cells (cellModel::PYR).
Definition pyrMatcher.H:53
A cellMatcher for tet cells (cellModel::TET).
Definition tetMatcher.H:53
A cellMatcher for tetWedge cells (cellModel::TETWEDGE).
A cellMatcher for wedge cells (cellModel::WEDGE).
dynamicFvMesh & mesh
List< label > labelList
A List of labels.
Definition List.H:62
List< face > faceList
List of faces.
Definition faceListFwd.H:41
labelList identity(const label len, label start=0)
Return an identity map of the given length with (map[i] == i), works like std::iota() but returning a...
static constexpr const zero Zero
Global zero (0).
Definition zero.H:127