primitiveMeshI.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2025 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 "primitiveMesh.H"
27 
28 // * * * * * * * * * * Protected Static Member Functions * * * * * * * * * * //
29 
30 template<class Class, class Type>
32 (
33  const Type& (Class::*method)() const,
34  const Type& (Class::*otherMethod)() const
35 )
36 {
37  return method == otherMethod;
38 }
39 
40 
41 template<class Class, class Type, class OtherType>
43 (
44  const Type& (Class::*method)() const,
45  const OtherType& (Class::*otherMethod)() const
46 )
47 {
48  return false;
49 }
50 
51 
52 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
53 
55 {
56  return nInternalPoints_;
57 }
58 
59 
61 {
62  return nPoints_;
63 }
64 
65 
67 {
68  // Force edge calculation
69  (void)nEdges();
70  return nInternal0Edges_;
71 }
72 
73 
75 {
76  // Force edge calculation
77  (void)nEdges();
78  return nInternal1Edges_;
79 }
80 
81 
83 {
84  // Force edge calculation
85  (void)nEdges();
86  return nInternalEdges_;
87 }
88 
89 
91 {
92  if (nEdges_ < 0)
93  {
94  nEdges_ = edges().size();
95  }
96 
97  return nEdges_;
98 }
99 
100 
102 {
103  return nInternalFaces_;
104 }
105 
106 
108 {
109  return nFaces_;
110 }
111 
112 
114 {
115  return nCells_;
116 }
117 
118 
119 inline bool Foam::primitiveMesh::isInternalFace(const label faceIndex) const
120 {
121  return faceIndex < nInternalFaces();
122 }
123 
124 
125 template<class Type>
127 (
128  const Type& (primitiveMesh::*method)() const
129 ) const
130 {
131  if (isMethod(method, &primitiveMesh::cellShapes)) return cellShapesPtr_;
132  if (isMethod(method, &primitiveMesh::edges)) return edgesPtr_;
133  if (isMethod(method, &primitiveMesh::cellCells)) return ccPtr_;
134  if (isMethod(method, &primitiveMesh::edgeCells)) return ecPtr_;
135  if (isMethod(method, &primitiveMesh::pointCells)) return pcPtr_;
136  if (isMethod(method, &primitiveMesh::cells)) return cfPtr_;
137  if (isMethod(method, &primitiveMesh::edgeFaces)) return efPtr_;
138  if (isMethod(method, &primitiveMesh::pointFaces)) return pfPtr_;
139  if (isMethod(method, &primitiveMesh::cellEdges)) return cePtr_;
140  if (isMethod(method, &primitiveMesh::faceEdges)) return fePtr_;
141  if (isMethod(method, &primitiveMesh::pointEdges)) return pePtr_;
142  if (isMethod(method, &primitiveMesh::pointPoints)) return ppPtr_;
143  if (isMethod(method, &primitiveMesh::cellPoints)) return cpPtr_;
144  if (isMethod(method, &primitiveMesh::cellCentres)) return cellCentresPtr_;
145  if (isMethod(method, &primitiveMesh::faceCentres)) return faceCentresPtr_;
146  if (isMethod(method, &primitiveMesh::cellVolumes)) return cellVolumesPtr_;
147  if (isMethod(method, &primitiveMesh::faceAreas)) return faceAreasPtr_;
148  if (isMethod(method, &primitiveMesh::magFaceAreas)) return magFaceAreasPtr_;
149 
150  return false;
151 }
152 
153 
154 // ************************************************************************* //
Cell-face mesh analysis engine.
Definition: primitiveMesh.H:75
label nInternal1Edges() const
Internal edges using 0 or 1 boundary point.
const labelListList & pointEdges() const
const edgeList & edges() const
Return mesh edges. Uses calcEdges.
label nInternalEdges() const
Internal edges using 0,1 or 2 boundary points.
const labelListList & cellEdges() const
const vectorField & faceCentres() const
label nInternalPoints() const
Points not on boundary.
const labelListList & pointCells() const
const scalarField & cellVolumes() const
label nInternalFaces() const
const vectorField & cellCentres() const
const cellShapeList & cellShapes() const
Return cell shapes.
const labelListList & cellCells() const
const labelListList & cellPoints() const
label nCells() const
static bool isMethod(const Type &(Class::*method)() const, const Type &(Class::*otherMethod)() const)
Test if the supplied methods are the same. Same type overload.
bool has(const Type &(primitiveMesh::*method)() const) const
Return whether the result of the given method has been allocated.
const scalarField & magFaceAreas() const
const labelListList & pointFaces() const
label nPoints() const
const labelListList & edgeFaces() const
const labelListList & pointPoints() const
const labelListList & faceEdges() const
const labelListList & edgeCells() const
const vectorField & faceAreas() const
bool isInternalFace(const label faceIndex) const
Return true if given face label is internal to the mesh.
const cellList & cells() const
label nEdges() const
label nInternal0Edges() const
Internal edges (i.e. not on boundary face) using.
label nFaces() const
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