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 | Copyright (C) 2011 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
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.
15 
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.
20 
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/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 #include "degenerateMatcher.H"
27 #include "ListOps.H"
28 
29 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
30 
37 
38 
40 (
41  const faceList& faces,
42  const labelList& owner,
43  const label cellI,
44  const labelList& cellFaces
45 )
46 {
47  // Recognize in order of assumed occurrence.
48 
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  }
77 }
78 
79 
81 {
82  // Do as if single cell mesh; all faces are referenced by a single cell
83 
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  );
91 }
92 
93 
95 {
96  return match(shape.collapsedFaces());
97 }
98 
99 
101 (
102  const primitiveMesh& mesh,
103  const label cellI
104 )
105 {
106  return match
107  (
108  mesh.faces(),
109  mesh.faceOwner(),
110  cellI,
111  mesh.cells()[cellI]
112  );
113 }
114 
115 
116 // ************************************************************************* //
Foam::prismMatcher
A cellMatcher for prism cells.
Definition: prismMatcher.H:51
Foam::labelList
List< label > labelList
A List of labels.
Definition: labelList.H:56
Foam::degenerateMatcher::tet
static tetMatcher tet
Definition: degenerateMatcher.H:68
Foam::tetWedgeMatcher
A cellMatcher for tetWedge cells.
Definition: tetWedgeMatcher.H:51
Foam::primitiveMesh::cells
const cellList & cells() const
Definition: primitiveMeshCells.C:136
Foam::tetMatcher
A cellMatcher for tet cells.
Definition: tetMatcher.H:51
Foam::pyrMatcher
A cellMatcher for pyr cells.
Definition: pyrMatcher.H:51
Foam::hexMatcher
A cellMatcher for hex cells.
Definition: hexMatcher.H:51
Foam::label
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
degenerateMatcher.H
Foam::degenerateMatcher::wedge
static wedgeMatcher wedge
Definition: degenerateMatcher.H:64
Foam::polyMesh::faceOwner
virtual const labelList & faceOwner() const
Return face owner.
Definition: polyMesh.C:1017
Foam::degenerateMatcher::hex
static hexMatcher hex
Matchers for all degenerate hex shapes.
Definition: degenerateMatcher.H:63
Foam::identity
labelList identity(const label len)
Create identity map (map[i] == i) of given length.
Definition: ListOps.C:104
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:18
Foam::cellShape
An analytical geometric cellShape.
Definition: cellShape.H:69
Foam::hex
IOstream & hex(IOstream &io)
Definition: IOstream.H:564
Foam::degenerateMatcher::tetWedge
static tetWedgeMatcher tetWedge
Definition: degenerateMatcher.H:66
Foam::polyMesh::faces
virtual const faceList & faces() const
Return raw faces.
Definition: polyMesh.C:1004
Foam::wedgeMatcher
A cellMatcher for wedge cells.
Definition: wedgeMatcher.H:51
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
Foam::cellShape::collapsedFaces
faceList collapsedFaces() const
Collapsed faces of this cell.
Definition: cellShapeI.H:168
Foam::degenerateMatcher::prism
static prismMatcher prism
Definition: degenerateMatcher.H:65
ListOps.H
Various functions to operate on Lists.
Foam::degenerateMatcher::match
static cellShape match(const faceList &faces, const labelList &faceOwner, const label cellI, const labelList &cellFaces)
Recognize basic shape.
Definition: degenerateMatcher.C:40
Foam::List::size
void size(const label)
Override size to be inconsistent with allocated storage.
Foam::degenerateMatcher::pyr
static pyrMatcher pyr
Definition: degenerateMatcher.H:67
lookup
stressControl lookup("compactNormalStress") >> compactNormalStress
Foam::primitiveMesh
Cell-face mesh analysis engine.
Definition: primitiveMesh.H:79