featureEdgeMesh.C
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 \*---------------------------------------------------------------------------*/
25 
26 #include "featureEdgeMesh.H"
27 
28 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
29 
30 namespace Foam
31 {
32 
33 defineTypeNameAndDebug(featureEdgeMesh, 0);
34 
35 }
36 
37 
38 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
39 
41 :
42  regIOobject(io),
44 {
45  if
46  (
50  )
51  {
52  readStream(typeName) >> *this;
53  close();
54  }
55 
56  if (debug)
57  {
58  Pout<< "featureEdgeMesh::featureEdgeMesh :"
59  << " constructed from IOobject :"
60  << " points:" << points().size()
61  << " edges:" << edges().size()
62  << endl;
63  }
64 }
65 
66 
67 //- Construct from components
69 (
70  const IOobject& io,
71  const pointField& points,
72  const edgeList& edges
73 )
74 :
75  regIOobject(io),
76  edgeMesh(points, edges)
77 {}
78 
79 
80 // Construct as copy
82 (
83  const IOobject& io,
84  const featureEdgeMesh& em
85 )
86 :
87  regIOobject(io),
88  edgeMesh(em)
89 {}
90 
91 
92 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
93 
95 {
96  is >> *this;
97  return !is.bad();
98 }
99 
100 
102 {
103  os << *this;
104 
105  return os.good();
106 }
107 
108 
109 // ************************************************************************* //
Foam::IOobject
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:91
Foam::featureEdgeMesh::featureEdgeMesh
featureEdgeMesh(const IOobject &)
Construct (read) given an IOobject.
Definition: featureEdgeMesh.C:40
Foam::featureEdgeMesh::writeData
virtual bool writeData(Ostream &) const
WriteData function required for regIOobject write operation.
Definition: featureEdgeMesh.C:101
Foam::IOobject::MUST_READ
@ MUST_READ
Definition: IOobject.H:108
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
Foam::IOobject::headerOk
bool headerOk()
Read and check header info.
Definition: IOobject.C:439
Foam::IOobject::MUST_READ_IF_MODIFIED
@ MUST_READ_IF_MODIFIED
Definition: IOobject.H:109
Foam::Field
Pre-declare SubField and related Field type.
Definition: Field.H:57
Foam::IOobject::readOpt
readOption readOpt() const
Definition: IOobject.H:317
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:57
Foam::featureEdgeMesh::readData
virtual bool readData(Istream &)
ReadData function required for regIOobject read operation.
Definition: featureEdgeMesh.C:94
Foam::edgeMesh::points
const pointField & points() const
Return points.
Definition: edgeMeshI.H:39
Foam::edgeMesh::edges
const edgeList & edges() const
Return edges.
Definition: edgeMeshI.H:45
Foam::IOstream::bad
bool bad() const
Return true if stream is corrupted.
Definition: IOstream.H:351
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::regIOobject
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
Definition: regIOobject.H:60
Foam::regIOobject::readStream
Istream & readStream()
Return Istream.
Definition: regIOobjectRead.C:34
Foam::Pout
prefixOSstream Pout(cout, "Pout")
Definition: IOstreams.H:53
Foam::regIOobject::close
void close()
Close Istream.
Definition: regIOobjectRead.C:148
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
points
const pointField & points
Definition: gmvOutputHeader.H:1
Foam::List::size
void size(const label)
Override size to be inconsistent with allocated storage.
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:53
featureEdgeMesh.H
Foam::IOstream::good
bool good() const
Return true if next operation might succeed.
Definition: IOstream.H:333
Foam::IOobject::READ_IF_PRESENT
@ READ_IF_PRESENT
Definition: IOobject.H:110
Foam::featureEdgeMesh
edgeMesh + IO.
Definition: featureEdgeMesh.H:52
Foam::defineTypeNameAndDebug
defineTypeNameAndDebug(combustionModel, 0)
Foam::edgeMesh
Points connected by edges.
Definition: edgeMesh.H:69