featureEdgeMesh.C
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-2019 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  defineTypeNameAndDebug(featureEdgeMesh, 0);
33 }
34 
35 
36 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
37 
39 :
40  regIOobject(io),
42 {
43  if
44  (
48  )
49  {
50  readStream(typeName) >> *this;
51  close();
52  }
53 
54  if (debug)
55  {
56  Pout<< "featureEdgeMesh::featureEdgeMesh :"
57  << " constructed from IOobject :"
58  << " points:" << points().size()
59  << " edges:" << edges().size()
60  << endl;
61  }
62 }
63 
64 
66 (
67  const IOobject& io,
68  const pointField& points,
69  const edgeList& edges
70 )
71 :
72  regIOobject(io),
73  edgeMesh(points, edges)
74 {}
75 
76 
77 // Copy constructor
79 (
80  const IOobject& io,
81  const featureEdgeMesh& em
82 )
83 :
84  regIOobject(io),
85  edgeMesh(em)
86 {}
87 
88 
89 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
90 
92 {
93  is >> *this;
94  return !is.bad();
95 }
96 
97 
99 {
100  os << *this;
101 
102  return os.good();
103 }
104 
105 
106 // ************************************************************************* //
bool bad() const
Return true if stream is corrupted.
Definition: IOstream.H:348
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
void size(const label)
Override size to be inconsistent with allocated storage.
Definition: ListI.H:164
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
bool headerOk()
Read and check header info.
Definition: regIOobject.C:443
bool good() const
Return true if next operation might succeed.
Definition: IOstream.H:330
regIOobject(const IOobject &, const bool isTime=false)
Construct from IOobject. Optional flag for if IOobject is the.
Definition: regIOobject.C:41
edgeMesh()
Construct null.
Definition: edgeMesh.C:123
virtual bool writeData(Ostream &) const
WriteData function required for regIOobject write operation.
void close()
Close Istream.
const edgeList & edges() const
Return edges.
Definition: edgeMeshI.H:68
Istream & readStream(const word &, const bool read=true)
Return Istream and check object type against that given.
virtual bool readData(Istream &)
ReadData function required for regIOobject read operation.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:54
const pointField & points() const
Return points.
Definition: edgeMeshI.H:62
defineTypeNameAndDebug(combustionModel, 0)
Points connected by edges.
Definition: edgeMesh.H:69
prefixOSstream Pout(cout, "Pout")
Definition: IOstreams.H:53
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
Definition: regIOobject.H:52
readOption readOpt() const
Definition: IOobject.H:365
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:98
featureEdgeMesh(const IOobject &)
Construct (read) given an IOobject.
Namespace for OpenFOAM.