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