polyAddCell.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-2020 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 Class
25  Foam::polyAddCell
26 
27 Description
28  Class containing data for cell addition.
29 
30 \*---------------------------------------------------------------------------*/
31 
32 #ifndef polyAddCell_H
33 #define polyAddCell_H
34 
35 #include "label.H"
36 #include "topoAction.H"
37 
38 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
39 
40 namespace Foam
41 {
42 
43 /*---------------------------------------------------------------------------*\
44  Class polyAddCell Declaration
45 \*---------------------------------------------------------------------------*/
46 
47 class polyAddCell
48 :
49  public topoAction
50 {
51  // Private Data
52 
53  //- Master point ID for cells blown up from points
54  label masterPointID_;
55 
56  //- Master edge ID for cells blown up from edges
57  label masterEdgeID_;
58 
59  //- Master face ID for cells blown up from faces
60  label masterFaceID_;
61 
62  //- Master cell ID for cells blown up from cells
63  label masterCellID_;
64 
65  //- Cell zone ID
66  label zoneID_;
67 
68 
69 public:
70 
71  // Static Data Members
72 
73  //- Runtime type information
74  TypeName("addCell");
75 
76 
77  // Constructors
78 
79  //- Construct null. Used for constructing lists
80  polyAddCell()
81  :
82  masterPointID_(-1),
83  masterEdgeID_(-1),
84  masterFaceID_(-1),
85  masterCellID_(-1),
86  zoneID_(-1)
87  {}
88 
89  //- Construct from components
91  (
92  const label masterPointID,
93  const label masterEdgeID,
94  const label masterFaceID,
95  const label masterCellID,
96  const label zoneID
97  )
98  :
99  masterPointID_(masterPointID),
100  masterEdgeID_(masterEdgeID),
101  masterFaceID_(masterFaceID),
102  masterCellID_(masterCellID),
103  zoneID_(zoneID)
104  {}
105 
106  //- Construct and return a clone
107  virtual autoPtr<topoAction> clone() const
108  {
109  return autoPtr<topoAction>(new polyAddCell(*this));
110  }
111 
112 
113  // Default Destructor
114 
115 
116  // Member Functions
117 
118  //- Is the cell mastered by a point
119  bool isPointMaster() const
120  {
121  return masterPointID_ >= 0;
122  }
123 
124  //- Is the cell mastered by an edge
125  bool isEdgeMaster() const
126  {
127  return masterEdgeID_ >= 0;
128  }
129 
130  //- Is the cell mastered by another face
131  bool isFaceMaster() const
132  {
133  return masterFaceID_ >= 0;
134  }
135 
136  //- Is the cell mastered by another cell
137  bool isCellMaster() const
138  {
139  return masterCellID_ >= 0;
140  }
141 
142  //- Is the cell appended with no master
143  bool appended() const
144  {
145  return
146  !isPointMaster() && !isEdgeMaster()
147  && !isFaceMaster() && !isCellMaster();
148  }
149 
150  //- Return master point ID
151  label masterPointID() const
152  {
153  return masterPointID_;
154  }
155 
156  //- Return master edge ID
157  label masterEdgeID() const
158  {
159  return masterEdgeID_;
160  }
161 
162  //- Return master face ID
163  label masterFaceID() const
164  {
165  return masterFaceID_;
166  }
167 
168  //- Return master cell ID
169  label masterCellID() const
170  {
171  return masterCellID_;
172  }
173 
174  //- Does the cell belong to a zone?
175  bool isInZone() const
176  {
177  return zoneID_ >= 0;
178  }
179 
180  //- Cell zone ID
181  label zoneID() const
182  {
183  return zoneID_;
184  }
185 
186 };
187 
188 
189 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
190 
191 } // End namespace Foam
192 
193 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
194 
195 #endif
196 
197 // ************************************************************************* //
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
virtual autoPtr< topoAction > clone() const
Construct and return a clone.
Definition: polyAddCell.H:106
label masterCellID() const
Return master cell ID.
Definition: polyAddCell.H:168
label masterEdgeID() const
Return master edge ID.
Definition: polyAddCell.H:156
bool isPointMaster() const
Is the cell mastered by a point.
Definition: polyAddCell.H:118
bool isFaceMaster() const
Is the cell mastered by another face.
Definition: polyAddCell.H:130
bool isCellMaster() const
Is the cell mastered by another cell.
Definition: polyAddCell.H:136
Class containing data for cell addition.
Definition: polyAddCell.H:46
label masterPointID() const
Return master point ID.
Definition: polyAddCell.H:150
A virtual base class for topological actions.
Definition: topoAction.H:48
TypeName("addCell")
Runtime type information.
label zoneID() const
Cell zone ID.
Definition: polyAddCell.H:180
label masterFaceID() const
Return master face ID.
Definition: polyAddCell.H:162
polyAddCell()
Construct null. Used for constructing lists.
Definition: polyAddCell.H:79
bool appended() const
Is the cell appended with no master.
Definition: polyAddCell.H:142
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
bool isEdgeMaster() const
Is the cell mastered by an edge.
Definition: polyAddCell.H:124
bool isInZone() const
Does the cell belong to a zone?
Definition: polyAddCell.H:174
Namespace for OpenFOAM.