1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | cfMesh: A library for mesh generation
5 \\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
6 \\/ M anipulation | Copyright (C) Creative Fields, Ltd.
7 -------------------------------------------------------------------------------
9 This file is part of cfMesh.
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.
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
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/>.
27 \*---------------------------------------------------------------------------*/
30 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
37 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
40 inline pointFieldPMG::pointFieldPMG(const IOobject& io)
43 pointField(readStream(typeName)),
44 nElmts_(pointField::size())
49 inline pointFieldPMG::pointFieldPMG(const IOobject& io, const label s)
56 inline pointFieldPMG::pointFieldPMG(const IOobject& io, const pointField& pts)
63 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
66 inline pointFieldPMG::~pointFieldPMG()
69 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
71 inline label pointFieldPMG::size() const
76 inline void pointFieldPMG::setSize(const label nElmts)
78 if( nElmts >= pointField::size() )
80 Info << "Resizing points!" << endl;
81 pointField::setSize(label(1.5*nElmts)+1);
87 inline void pointFieldPMG::reserve(const label capacity)
89 if( capacity > size() )
90 this->setSize(capacity);
93 inline void pointFieldPMG::clear()
98 inline void pointFieldPMG::append(const point& p)
100 const label i = nElmts_;
102 this->operator[](i) = p;
105 inline point& pointFieldPMG::newElmt(const label pI)
108 return this->operator[](pI);
111 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
113 inline bool pointFieldPMG::writeData(Ostream& os) const
115 return (os << *this).good();
118 inline void pointFieldPMG::operator=(const pointField& pts)
122 this->operator[](pI) = pts[pI];
125 inline Ostream& operator<<(Ostream& os, const pointFieldPMG& pts)
127 SubList<point> p(pts, pts.nElmts_, 0);
133 inline Istream& operator>>(Istream& is, pointFieldPMG& pts)
135 pointField& points = static_cast<pointField&>(pts);
137 pts.nElmts_ = points.size();
142 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
144 } // End namespace Foam
146 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //