initial commit for version 1.5.x patch release
[OpenFOAM-1.5.x.git] / src / dynamicMesh / polyTopoChange / polyTopoChange / addObject / polyAddCell.H
blob9e1cbe9737b2b970e52d83e4b644387e2f248011
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2008 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
9     This file is part of OpenFOAM.
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 the
13     Free Software Foundation; either version 2 of the License, or (at your
14     option) any later version.
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.
21     You should have received a copy of the GNU General Public License
22     along with OpenFOAM; if not, write to the Free Software Foundation,
23     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 Class
26     Foam::polyAddCell
28 Description
29     Class containing data for cell addition.
31 \*---------------------------------------------------------------------------*/
33 #ifndef polyAddCell_H
34 #define polyAddCell_H
36 #include "label.H"
37 #include "topoAction.H"
39 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
41 namespace Foam
44 /*---------------------------------------------------------------------------*\
45                            Class polyAddCell Declaration
46 \*---------------------------------------------------------------------------*/
48 class polyAddCell
50     public topoAction
52     // Private data
54         //- Master point ID for cells blown up from points
55         label masterPointID_;
57         //- Master edge ID for cells blown up from edges
58         label masterEdgeID_;
60         //- Master face ID for cells blown up from faces
61         label masterFaceID_;
63         //- Master cell ID for cells blown up from cells
64         label masterCellID_;
66         //- Cell zone ID
67         label zoneID_;
70 public:
72     // Static data members
74         //- Runtime type information
75         TypeName("addCell");
78     // Constructors
80         //- Construct null.  Used for constructing lists
81         polyAddCell()
82         :
83             masterPointID_(-1),
84             masterEdgeID_(-1),
85             masterFaceID_(-1),
86             masterCellID_(-1),
87             zoneID_(-1)
88         {}
90         //- Construct from components
91         polyAddCell
92         (
93             const label masterPointID,
94             const label masterEdgeID,
95             const label masterFaceID,
96             const label masterCellID,
97             const label zoneID
98         )
99         :
100             masterPointID_(masterPointID),
101             masterEdgeID_(masterEdgeID),
102             masterFaceID_(masterFaceID),
103             masterCellID_(masterCellID),
104             zoneID_(zoneID)
105         {}
107         //- Construct and return a clone
108         virtual autoPtr<topoAction> clone() const
109         {
110             return autoPtr<topoAction>(new polyAddCell(*this));
111         }
114     // Default Destructor
117     // Member Functions
119         //- Is the cell mastered by a point
120         bool isPointMaster() const
121         {
122             return masterPointID_ >= 0;
123         }
125         //- Is the cell mastered by an edge
126         bool isEdgeMaster() const
127         {
128             return masterEdgeID_ >= 0;
129         }
131         //- Is the cell mastered by another face
132         bool isFaceMaster() const
133         {
134             return masterFaceID_ >= 0;
135         }
137         //- Is the cell mastered by another cell
138         bool isCellMaster() const
139         {
140             return masterCellID_ >= 0;
141         }
143         //- Is the cell appended with no master
144         bool appended() const
145         {
146             return
147                 !isPointMaster() && !isEdgeMaster()
148              && !isFaceMaster() && !isCellMaster();
149         }
151         //- Return master point ID
152         label masterPointID() const
153         {
154             return masterPointID_;
155         }
157         //- Return master edge ID
158         label masterEdgeID() const
159         {
160             return masterEdgeID_;
161         }
163         //- Return master face ID
164         label masterFaceID() const
165         {
166             return masterFaceID_;
167         }
169         //- Return master cell ID
170         label masterCellID() const
171         {
172             return masterCellID_;
173         }
175         //- Does the cell belong to a zone?
176         bool isInZone() const
177         {
178             return zoneID_ >= 0;
179         }
181         //- Cell zone ID
182         label zoneID() const
183         {
184             return zoneID_;
185         }
190 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
192 } // End namespace Foam
194 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
196 #endif
198 // ************************************************************************* //