manifoldCellsMeshObject.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) 2022 OpenCFD Ltd.
9 -------------------------------------------------------------------------------
10 License
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 Class
27  Foam::manifoldCellsMeshObject
28 
29 Description
30  Provides cell-to-faces ('cells()') with duplicate faces removed.
31 
32  Useful for postprocessing.
33 
34 SourceFiles
35  manifoldCellsMeshObject.C
36 
37 \*---------------------------------------------------------------------------*/
38 
39 #ifndef Foam_manifoldCellsMeshObject_H
40 #define Foam_manifoldCellsMeshObject_H
41 
42 #include "MeshObject.H"
43 #include "polyMesh.H"
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 
50 /*---------------------------------------------------------------------------*\
51  Class manifoldCellsMeshObject Declaration
52 \*---------------------------------------------------------------------------*/
53 
55 :
56  public MeshObject<polyMesh, UpdateableMeshObject, manifoldCellsMeshObject>
57 {
58  // Private Typedefs
59 
60  typedef MeshObject
61  <
62  polyMesh,
66 
67 
68  // Private Data
69 
70  //- The adjusted cells list
71  mutable refPtr<cellList> cellsPtr_;
72 
73  //- The number of globally corrected cells (-1 for uninitialized)
74  mutable label nCorrected_;
75 
76 
77  // Private Member Functions
78 
79  //- Calculate cellList with all duplicate faces removed.
80  //- Is reference to input mesh if no duplicates
81  static refPtr<cellList> filter
82  (
83  const polyMesh& mesh,
84  label& nCellsCorrected
85  );
86 
87  //- No copy construct
89 
90  //- No copy assignment
91  void operator=(const manifoldCellsMeshObject&) = delete;
92 
93 
94 public:
95 
96  //- Declare name of the class, no debug
97  ClassNameNoDebug("manifoldCellsMeshObject");
98 
99 
100  // Constructors
101 
102  //- Construct from mesh
103  explicit manifoldCellsMeshObject(const polyMesh& mesh);
104 
105 
106  //- Destructor
107  virtual ~manifoldCellsMeshObject() = default;
108 
109 
110  // Member Functions
111 
112  //- Calculate cellList with all duplicate faces removed.
113  //- Is reference to input mesh if no duplicates
114  static refPtr<cellList> filter(const polyMesh& mesh);
115 
116  //- True if any manifold cells detected (globally)
117  //- Triggers demand-driven filtering if required.
118  bool manifold() const;
119 
120  //- Return the (optionally compacted) cell list
121  //- Triggers demand-driven filtering if required.
122  const cellList& cells() const;
123 
124  //- Mesh motion
125  virtual bool movePoints()
126  {
127  return false;
128  }
129 
130  //- Mesh changes
131  virtual void updateMesh(const mapPolyMesh&);
132 };
133 
134 
135 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
136 
137 } // End namespace Foam
138 
139 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
140 
141 #endif
142 
143 // ************************************************************************* //
virtual bool movePoints()
Mesh motion.
virtual ~manifoldCellsMeshObject()=default
Destructor.
A class for managing references or pointers (no reference counting)
Definition: HashPtrTable.H:49
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:158
Templated abstract base-class for optional mesh objects used to automate their allocation to the mesh...
Definition: MeshObject.H:152
Provides cell-to-faces (&#39;cells()&#39;) with duplicate faces removed.
const polyMesh & mesh() const noexcept
Reference to the mesh.
Definition: MeshObject.H:255
virtual void updateMesh(const mapPolyMesh &)
Mesh changes.
bool manifold() const
True if any manifold cells detected (globally) Triggers demand-driven filtering if required...
ClassNameNoDebug("manifoldCellsMeshObject")
Declare name of the class, no debug.
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:75
const cellList & cells() const
Return the (optionally compacted) cell list Triggers demand-driven filtering if required.
Namespace for OpenFOAM.
UpdateableMeshObject(const word &objName, const objectRegistry &obr)
Construct from name and instance on registry.
Definition: MeshObject.H:352