polyAddPoint.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::polyAddPoint
26 
27 Description
28  Class containing data for point addition.
29 
30 \*---------------------------------------------------------------------------*/
31 
32 #ifndef polyAddPoint_H
33 #define polyAddPoint_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 polyAddPoint Declaration
46 \*---------------------------------------------------------------------------*/
47 
48 class polyAddPoint
49 :
50  public topoAction
51 {
52  // Private data
53 
54  //- Point to add
55  point p_;
56 
57  //- Master point
58  label masterPointID_;
59 
60  //- Point zone ID
61  label zoneID_;
62 
63  //- Does the point support a cell
64  bool inCell_;
65 
66 
67 public:
68 
69  // Static data members
70 
71  //- Runtime type information
72  TypeName("addPoint");
73 
74 
75  // Constructors
76 
77  //- Construct null. Used only for list construction
78  polyAddPoint()
79  :
80  p_(vector::zero),
81  masterPointID_(-1),
82  zoneID_(-1),
83  inCell_(false)
84  {}
85 
86  //- Construct from components
88  (
89  const point& p,
90  const label masterPointID,
91  const label zoneID,
92  const bool inCell
93  )
94  :
95  p_(p),
96  masterPointID_(masterPointID),
97  zoneID_(zoneID),
98  inCell_(inCell)
99  {
100  if (zoneID_ < 0 && !inCell)
101  {
103  (
104  "polyAddPoint\n"
105  "(\n"
106  " const point& p,\n"
107  " const label masterPointID,\n"
108  " const label zoneID,\n"
109  " const bool inCell\n"
110  ")"
111  ) << "Point is not in a cell and not in a zone. "
112  << "This is not allowed.\n"
113  << "point: " << p
114  << " master: " << masterPointID_
115  << " zone: " << zoneID_
116  << abort(FatalError);
117  }
118 
119  }
120 
121  //- Construct and return a clone
122  virtual autoPtr<topoAction> clone() const
123  {
124  return autoPtr<topoAction>(new polyAddPoint(*this));
125  }
126 
127 
128  // Default Destructor
129 
130 
131  // Member Functions
132 
133  //- Point location
134  const point& newPoint() const
135  {
136  return p_;
137  }
138 
139  //- Master point label
140  label masterPointID() const
141  {
142  return masterPointID_;
143  }
144 
145  //- Is the point appended with no master
146  bool appended() const
147  {
148  return masterPointID_ < 0;
149  }
150 
151  //- Does the point belong to a zone?
152  bool isInZone() const
153  {
154  return zoneID_ >= 0;
155  }
156 
157  //- Point zone ID
158  label zoneID() const
159  {
160  return zoneID_;
161  }
162 
163  //- Does the point support a cell
164  bool inCell() const
165  {
166  return inCell_;
167  }
168 };
169 
170 
171 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
172 
173 } // End namespace Foam
174 
175 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
176 
177 #endif
178 
179 // ************************************************************************* //
polyAddPoint()
Construct null. Used only for list construction.
Definition: polyAddPoint.H:77
A virtual base class for topological actions.
Definition: topoAction.H:48
label masterPointID() const
Master point label.
Definition: polyAddPoint.H:139
virtual autoPtr< topoAction > clone() const
Construct and return a clone.
Definition: polyAddPoint.H:121
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
Namespace for OpenFOAM.
TypeName("addPoint")
Runtime type information.
bool isInZone() const
Does the point belong to a zone?
Definition: polyAddPoint.H:151
volScalarField & p
Definition: createFields.H:51
bool inCell() const
Does the point support a cell.
Definition: polyAddPoint.H:163
A class representing the concept of 0 used to avoid unnecessary manipulations for objects that are kn...
Definition: zero.H:47
errorManip< error > abort(error &err)
Definition: errorManip.H:131
label zoneID() const
Point zone ID.
Definition: polyAddPoint.H:157
const point & newPoint() const
Point location.
Definition: polyAddPoint.H:133
#define FatalErrorIn(functionName)
Report an error message using Foam::FatalError.
Definition: error.H:314
error FatalError
bool appended() const
Is the point appended with no master.
Definition: polyAddPoint.H:145
Class containing data for point addition.
Definition: polyAddPoint.H:47
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:117