pointFieldPMG.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | cfMesh: A library for mesh generation
4  \\ / O peration |
5  \\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
6  \\/ M anipulation | Copyright (C) Creative Fields, Ltd.
7 -------------------------------------------------------------------------------
8 License
9  This file is part of cfMesh.
10 
11  cfMesh 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 3 of the License, or (at your
14  option) any later version.
15 
16  cfMesh 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 cfMesh. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  pointFieldPMG
26 
27 Description
28  This is a container with additional size to prevent re-allocation
29  every time it is resized
30 
31 SourceFiles
32 
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef pointFieldPMG_H
37 #define pointFieldPMG_H
38 
39 #include "regIOobject.H"
40 #include "pointField.H"
41 #include "Istream.H"
42 #include "Ostream.H"
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50 
51 class pointFieldPMG
52 : public regIOobject,
53  public pointField
54 {
55  // Private data
56  //- number of used elements
57  label nElmts_;
58 
59  // Disallow bitwise assignment
60  void operator=(const pointFieldPMG&);
61 
63 
64  // Disallow transfer from pointField
65  void transfer(pointField&);
66 
67 public:
68 
69  // Declare type name
70  TypeName("vectorField");
71 
72  // Constructors
73  //- construct from IOobject
74  inline pointFieldPMG(const IOobject&);
75 
76  //- construct from IOobject and size
77  inline pointFieldPMG(const IOobject&, const label);
78 
79  //- construct from IOobject and pointField
80  inline pointFieldPMG(const IOobject&, const pointField&);
81 
82  // Destructor
83  inline ~pointFieldPMG();
84 
85  // Member functions
86  //- return the number of used elements
87  inline label size() const;
88 
89  //- set the number of used elements
90  inline void setSize(const label nElmts);
91 
92  //- reserve the memory for the specified number of elements
93  //- the request is ignored if the specified value is smaller than
94  //- the current number of elements
95  //- does not change the size
96  inline void reserve(const label capacity);
97 
98  //- set the size to zero
99  inline void clear();
100 
101  //- add a point at the end of the list
102  inline void append(const point&);
103 
104  //- return an element with bound checking
105  inline point& newElmt(const label);
106 
107  //- read/write the list onto disk
108  inline bool writeData(Ostream&) const;
109 
110  // Member operators
111  inline void operator=(const pointField&);
112 
113  friend inline Ostream& operator<<(Ostream&, const pointFieldPMG&);
114 
115  friend inline Istream& operator>>(Istream&, pointFieldPMG&);
116 };
117 
118 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
119 
120 } // End namespace Foam
121 
122 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
123 
124 #include "pointFieldPMGI.H"
125 
126 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
127 
128 #endif
129 
130 // ************************************************************************* //
regIOobject.H
Foam::pointFieldPMG::operator<<
friend Ostream & operator<<(Ostream &, const pointFieldPMG &)
Definition: pointFieldPMGI.H:125
Foam::IOobject
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:91
Foam::pointFieldPMG::writeData
bool writeData(Ostream &) const
read/write the list onto disk
Definition: pointFieldPMGI.H:113
Foam::pointFieldPMG::newElmt
point & newElmt(const label)
return an element with bound checking
Definition: pointFieldPMGI.H:105
Foam::pointFieldPMG::TypeName
TypeName("vectorField")
Foam::pointFieldPMG::clear
void clear()
set the size to zero
Definition: pointFieldPMGI.H:93
Foam::pointFieldPMG::reserve
void reserve(const label capacity)
Definition: pointFieldPMGI.H:87
Foam::pointFieldPMG::pointFieldPMG
pointFieldPMG(const pointFieldPMG &)
Foam::label
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
Foam::Field
Pre-declare SubField and related Field type.
Definition: Field.H:57
Foam::pointFieldPMG::operator>>
friend Istream & operator>>(Istream &, pointFieldPMG &)
Definition: pointFieldPMGI.H:133
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:57
Istream.H
Foam::pointFieldPMG::size
label size() const
return the number of used elements
Definition: pointFieldPMGI.H:71
Foam::pointFieldPMG::setSize
void setSize(const label nElmts)
set the number of used elements
Definition: pointFieldPMGI.H:76
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::pointFieldPMG::append
void append(const point &)
add a point at the end of the list
Definition: pointFieldPMGI.H:98
pointField.H
Ostream.H
Foam::pointFieldPMG::operator=
void operator=(const pointFieldPMG &)
Foam::regIOobject
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
Definition: regIOobject.H:60
pointFieldPMGI.H
Foam::pointFieldPMG::nElmts_
label nElmts_
number of used elements
Definition: pointFieldPMG.H:56
Foam::Vector< scalar >
Foam::pointFieldPMG::transfer
void transfer(pointField &)
Foam::pointFieldPMG::~pointFieldPMG
~pointFieldPMG()
Definition: pointFieldPMGI.H:66
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:53
Foam::pointFieldPMG
Definition: pointFieldPMG.H:50