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 | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2011-2016 OpenFOAM Foundation
9-------------------------------------------------------------------------------
10License
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
26Class
27 Foam::polyAddPoint
28
29Description
30 Class containing data for point addition.
31
32\*---------------------------------------------------------------------------*/
33
34#ifndef polyAddPoint_H
35#define polyAddPoint_H
36
37#include "label.H"
38#include "point.H"
39#include "topoAction.H"
40
41// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42
43namespace Foam
44{
45
46/*---------------------------------------------------------------------------*\
47 Class polyAddPoint Declaration
48\*---------------------------------------------------------------------------*/
50class polyAddPoint
51:
52 public topoAction
53{
54 // Private data
55
56 //- Point to add
57 point p_;
58
59 //- Master point
60 label masterPointID_;
61
62 //- Point zone ID
63 label zoneID_;
64
65 //- Does the point support a cell
66 bool inCell_;
67
68
69public:
70
71 // Static data members
72
73 //- Runtime type information
74 TypeName("addPoint");
75
76
77 // Constructors
78
79 //- Construct null. Used only for list construction
81 :
82 p_(Zero),
83 masterPointID_(-1),
84 zoneID_(-1),
85 inCell_(false)
86 {}
87
88 //- Construct from components
90 (
91 const point& p,
92 const label masterPointID,
93 const label zoneID,
94 const bool inCell
95 )
96 :
97 p_(p),
98 masterPointID_(masterPointID),
99 zoneID_(zoneID),
100 inCell_(inCell)
101 {
102 if (zoneID_ < 0 && !inCell)
103 {
105 << "This is not allowed.\n"
106 << "point: " << p
107 << " master: " << masterPointID_
108 << " zone: " << zoneID_
109 << abort(FatalError);
110 }
111
112 }
113
114 //- Construct and return a clone
115 virtual autoPtr<topoAction> clone() const
116 {
117 return autoPtr<topoAction>(new polyAddPoint(*this));
118 }
119
120
121 // Default Destructor
122
123
124 // Member Functions
125
126 //- Point location
127 const point& newPoint() const
128 {
129 return p_;
130 }
131
132 //- Master point label
133 label masterPointID() const
134 {
135 return masterPointID_;
136 }
137
138 //- Is the point appended with no master
139 bool appended() const
140 {
141 return masterPointID_ < 0;
142 }
143
144 //- Does the point belong to a zone?
145 bool isInZone() const
146 {
147 return zoneID_ >= 0;
148 }
149
150 //- Point zone ID
151 label zoneID() const
152 {
153 return zoneID_;
154 }
155
156 //- Does the point support a cell
157 bool inCell() const
158 {
159 return inCell_;
160 }
161};
162
163
164// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
165
166} // End namespace Foam
167
168// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
169
170#endif
171
172// ************************************************************************* //
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: autoPtr.H:66
Class containing data for point addition.
Definition: polyAddPoint.H:52
label zoneID() const
Point zone ID.
Definition: polyAddPoint.H:150
const point & newPoint() const
Point location.
Definition: polyAddPoint.H:126
bool inCell() const
Does the point support a cell.
Definition: polyAddPoint.H:156
label masterPointID() const
Master point label.
Definition: polyAddPoint.H:132
polyAddPoint()
Construct null. Used only for list construction.
Definition: polyAddPoint.H:79
polyAddPoint(const point &p, const label masterPointID, const label zoneID, const bool inCell)
Construct from components.
Definition: polyAddPoint.H:89
TypeName("addPoint")
Runtime type information.
virtual autoPtr< topoAction > clone() const
Construct and return a clone.
Definition: polyAddPoint.H:114
bool isInZone() const
Does the point belong to a zone?
Definition: polyAddPoint.H:144
bool appended() const
Is the point appended with no master.
Definition: polyAddPoint.H:138
A virtual base class for topological actions.
Definition: topoAction.H:52
volScalarField & p
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:453
Namespace for OpenFOAM.
errorManip< error > abort(error &err)
Definition: errorManip.H:144
static constexpr const zero Zero
Global zero (0)
Definition: zero.H:131
error FatalError
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73