polyModifyPoint.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 | Copyright (C) 2011 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::polyModifyPoint
26 
27 Description
28  Class describing modification of a point.
29 
30 \*---------------------------------------------------------------------------*/
31 
32 #ifndef polyModifyPoint_H
33 #define polyModifyPoint_H
34 
35 #include "label.H"
36 #include "point.H"
37 #include "topoAction.H"
38 
39 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
40 
41 namespace Foam
42 {
43 
44 /*---------------------------------------------------------------------------*\
45  Class polyModifyPoint Declaration
46 \*---------------------------------------------------------------------------*/
47 
48 class polyModifyPoint
49 :
50  public topoAction
51 {
52  // Private data
53 
54  //- Point ID
55  label pointID_;
56 
57  //- New point location
58  point location_;
59 
60  //- Remove from current zone
61  bool removeFromZone_;
62 
63  //- New zone ID
64  label zoneID_;
65 
66  //- Does the point support a cell
67  bool inCell_;
68 
69 
70 public:
71 
72  // Static data members
73 
74  //- Runtime type information
75  TypeName("modifyPoint");
76 
77 
78  // Constructors
79 
80  //- Construct null. Used only for list construction
82  :
83  pointID_(-1),
84  location_(vector::zero),
85  removeFromZone_(false),
86  zoneID_(-1),
87  inCell_(false)
88  {}
89 
90  //- Construct from components
92  (
93  const label pointID,
94  const point& newP,
95  const bool removeFromZone,
96  const label newZoneID,
97  const bool inCell
98  )
99  :
100  pointID_(pointID),
101  location_(newP),
102  removeFromZone_(removeFromZone),
103  zoneID_(newZoneID),
104  inCell_(inCell)
105  {}
106 
107  //- Construct and return a clone
108  virtual autoPtr<topoAction> clone() const
109  {
110  return autoPtr<topoAction>(new polyModifyPoint(*this));
111  }
112 
113 
114  // Default Destructor
115 
116  // Member Functions
117 
118  //- Point ID
119  label pointID() const
120  {
121  return pointID_;
122  }
123 
124  //- New point location
125  const point& newPoint() const
126  {
127  return location_;
128  }
129 
130  //- Does the point belong to a zone?
131  bool isInZone() const
132  {
133  return zoneID_ >= 0;
134  }
135 
136  //- Should the point be removed from current zone
137  bool removeFromZone() const
138  {
139  return removeFromZone_;
140  }
141 
142  //- Point zone ID
143  label zoneID() const
144  {
145  return zoneID_;
146  }
147 
148  //- Does the point support a cell
149  bool inCell() const
150  {
151  return inCell_;
152  }
153 };
154 
155 
156 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
157 
158 } // End namespace Foam
159 
160 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
161 
162 #endif
163 
164 // ************************************************************************* //
A virtual base class for topological actions.
Definition: topoAction.H:48
virtual autoPtr< topoAction > clone() const
Construct and return a clone.
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
Class describing modification of a point.
label zoneID() const
Point zone ID.
Namespace for OpenFOAM.
label pointID() const
Point ID.
A class representing the concept of 0 used to avoid unnecessary manipulations for objects that are kn...
Definition: zero.H:47
const point & newPoint() const
New point location.
bool isInZone() const
Does the point belong to a zone?
bool removeFromZone() const
Should the point be removed from current zone.
bool inCell() const
Does the point support a cell.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:117
TypeName("modifyPoint")
Runtime type information.
polyModifyPoint()
Construct null. Used only for list construction.