polyAddPoint.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::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_(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  << "This is not allowed.\n"
104  << "point: " << p
105  << " master: " << masterPointID_
106  << " zone: " << zoneID_
107  << abort(FatalError);
108  }
109 
110  }
111 
112  //- Construct and return a clone
113  virtual autoPtr<topoAction> clone() const
114  {
115  return autoPtr<topoAction>(new polyAddPoint(*this));
116  }
117 
118 
119  // Default Destructor
120 
121 
122  // Member Functions
123 
124  //- Point location
125  const point& newPoint() const
126  {
127  return p_;
128  }
129 
130  //- Master point label
131  label masterPointID() const
132  {
133  return masterPointID_;
134  }
135 
136  //- Is the point appended with no master
137  bool appended() const
138  {
139  return masterPointID_ < 0;
140  }
141 
142  //- Does the point belong to a zone?
143  bool isInZone() const
144  {
145  return zoneID_ >= 0;
146  }
147 
148  //- Point zone ID
149  label zoneID() const
150  {
151  return zoneID_;
152  }
153 
154  //- Does the point support a cell
155  bool inCell() const
156  {
157  return inCell_;
158  }
159 };
160 
161 
162 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
163 
164 } // End namespace Foam
165 
166 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
167 
168 #endif
169 
170 // ************************************************************************* //
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
error FatalError
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:323
label zoneID() const
Point zone ID.
Definition: polyAddPoint.H:148
bool isInZone() const
Does the point belong to a zone?
Definition: polyAddPoint.H:142
Class containing data for point addition.
Definition: polyAddPoint.H:47
virtual autoPtr< topoAction > clone() const
Construct and return a clone.
Definition: polyAddPoint.H:112
const point & newPoint() const
Point location.
Definition: polyAddPoint.H:124
TypeName("addPoint")
Runtime type information.
bool inCell() const
Does the point support a cell.
Definition: polyAddPoint.H:154
static const zero Zero
Definition: zero.H:97
errorManip< error > abort(error &err)
Definition: errorManip.H:131
A virtual base class for topological actions.
Definition: topoAction.H:48
bool appended() const
Is the point appended with no master.
Definition: polyAddPoint.H:136
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
volScalarField & p
polyAddPoint()
Construct null. Used only for list construction.
Definition: polyAddPoint.H:77
Namespace for OpenFOAM.
label masterPointID() const
Master point label.
Definition: polyAddPoint.H:130