hexMatcher.H
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  Copyright (C) 2020 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::hexMatcher
29 
30 Description
31  A cellMatcher for hex cells (cellModel::HEX).
32 
33 See also
34  cellMatcher, cellModel
35 
36 SourceFiles
37  hexMatcher.C
38 
39 \*---------------------------------------------------------------------------*/
40 
41 #ifndef hexMatcher_H
42 #define hexMatcher_H
43 
44 #include "cellMatcher.H"
45 
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 
48 namespace Foam
49 {
50 
51 /*---------------------------------------------------------------------------*\
52  Class hexMatcher Declaration
53 \*---------------------------------------------------------------------------*/
54 
55 class hexMatcher
56 :
57  public cellMatcher
58 {
59  // Static Data Members
60 
61  // Constants for this shape
62  static constexpr label vertPerCell = 8;
63  static constexpr label facePerCell = 6;
64  static constexpr label maxVertPerFace = 4;
65 
66 
67  // Private Member Functions
68 
69  //- No copy construct
70  hexMatcher(const hexMatcher&) = delete;
71 
72  //- No copy assignment
73  hexMatcher& operator=(const hexMatcher&) = delete;
74 
75 
76 public:
77 
78  // Constructors
79 
80  //- Default construct
81  hexMatcher();
82 
83 
84  //- Destructor
85  ~hexMatcher() = default;
86 
87 
88  // Static Functions
89 
90  //- Test if given list of faces satisfies criteria for HEX.
91  //- (6 quad)
92  static bool test(const UList<face>& faces);
93 
94  //- Test if given cell satisfies criteria for HEX.
95  //- (6 quad)
96  static bool test(const primitiveMesh& mesh, const label celli);
97 
98 
99  // Member Functions
100 
101  virtual label nVertPerCell() const
102  {
103  return vertPerCell;
104  }
105 
106  virtual label nFacePerCell() const
107  {
108  return facePerCell;
109  }
110 
111  virtual label nMaxVertPerFace() const
112  {
113  return maxVertPerFace;
114  }
115 
116  virtual label faceHashValue() const;
117 
118  virtual bool faceSizeMatch(const faceList&, const labelList&) const;
119 
120  virtual bool matchShape
121  (
122  const bool checkOnly,
123  const faceList& faces,
124  const labelList& faceOwner,
125  const label celli,
126  const labelList& myFaces
127  );
128 
129  virtual bool isA(const faceList& faces)
130  {
131  return hexMatcher::test(faces);
132  }
133 
134  virtual bool isA(const primitiveMesh& mesh, const label celli)
135  {
136  return hexMatcher::test(mesh, celli);
137  }
138 
139  virtual bool matches
140  (
141  const primitiveMesh& mesh,
142  const label celli,
143  cellShape& shape
144  );
145 };
146 
147 
148 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
149 
150 } // End namespace Foam
151 
152 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
153 
154 #endif
155 
156 // ************************************************************************* //
Foam::hexMatcher::faceSizeMatch
virtual bool faceSizeMatch(const faceList &, const labelList &) const
Check whether number of face sizes match the shape.
Definition: hexMatcher.C:309
Foam::hexMatcher::nFacePerCell
virtual label nFacePerCell() const
Definition: hexMatcher.H:105
Foam::hexMatcher::nVertPerCell
virtual label nVertPerCell() const
Definition: hexMatcher.H:100
Foam::hexMatcher::test
static bool test(const UList< face > &faces)
Definition: hexMatcher.C:87
Foam::hexMatcher::isA
virtual bool isA(const faceList &faces)
Exact match given all the faces forming a cell. No checks.
Definition: hexMatcher.H:128
Foam::hexMatcher::matchShape
virtual bool matchShape(const bool checkOnly, const faceList &faces, const labelList &faceOwner, const label celli, const labelList &myFaces)
Low level shape recognition. Return true if matches.
Definition: hexMatcher.C:115
Foam::cellMatcher
Base class for cellshape matchers (hexMatch, prismMatch, etc.). These are classes which given a mesh ...
Definition: cellMatcher.H:99
Foam::hexMatcher
A cellMatcher for hex cells (cellModel::HEX).
Definition: hexMatcher.H:54
Foam::hexMatcher::nMaxVertPerFace
virtual label nMaxVertPerFace() const
Definition: hexMatcher.H:110
Foam::hexMatcher::~hexMatcher
~hexMatcher()=default
Destructor.
Foam::hexMatcher::matches
virtual bool matches(const primitiveMesh &mesh, const label celli, cellShape &shape)
Like isA but also constructs a cellShape (if shape matches)
Definition: hexMatcher.C:319
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam::cellShape
An analytical geometric cellShape.
Definition: cellShape.H:69
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::hexMatcher::faceHashValue
virtual label faceHashValue() const
Hash value of all face sizes of this shape. Can be used for.
Definition: hexMatcher.C:302
Foam::List< face >
cellMatcher.H
Foam::hexMatcher::isA
virtual bool isA(const primitiveMesh &mesh, const label celli)
Exact match. Uses faceSizeMatch.
Definition: hexMatcher.H:133
Foam::UList< face >
Foam::hexMatcher::hexMatcher
hexMatcher()
Default construct.
Definition: hexMatcher.C:100
Foam::primitiveMesh
Cell-face mesh analysis engine.
Definition: primitiveMesh.H:78