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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2017 OpenFOAM Foundation
9  Copyright (C) 2022 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 \*---------------------------------------------------------------------------*/
28 
29 #include "featureEdgeMesh.H"
30 
31 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
32 
33 namespace Foam
34 {
36 }
37 
38 
39 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
40 
42 :
43  regIOobject(io),
44  edgeMesh()
45 {
46  if (isReadRequired() || (isReadOptional() && headerOk()))
47  {
48  readStream(typeName) >> *this;
49  close();
50  }
51 
52  if (debug)
53  {
54  Pout<< "featureEdgeMesh::featureEdgeMesh :"
55  << " constructed from IOobject :"
56  << " points:" << points().size()
57  << " edges:" << edges().size()
58  << endl;
59  }
60 }
61 
62 
64 (
65  const IOobject& io,
66  const pointField& points,
67  const edgeList& edges
68 )
69 :
70  regIOobject(io),
71  edgeMesh(points, edges)
72 {}
73 
74 
76 (
77  const IOobject& io,
78  const edgeMesh& em
79 )
80 :
82  edgeMesh(em)
83 {}
84 
85 
86 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
87 
89 {
90  is >> *this;
91  return !is.bad();
92 }
93 
94 
96 {
97  os << *this;
98 
99  return os.good();
100 }
101 
102 
103 // ************************************************************************* //
void size(const label n)
Older name for setAddressableSize.
Definition: UList.H:116
bool bad() const noexcept
True if stream is corrupted.
Definition: IOstream.H:305
const pointField & points() const noexcept
Return points.
Definition: edgeMeshI.H:92
List< edge > edgeList
List of edge.
Definition: edgeList.H:32
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:531
bool headerOk()
Read and check header info. Does not check the headerClassName.
Definition: regIOobject.C:505
bool isReadOptional() const noexcept
True if (LAZY_READ) bits are set [same as READ_IF_PRESENT].
virtual bool writeData(Ostream &) const
WriteData function required for regIOobject write operation.
vectorField pointField
pointField is a vectorField.
Definition: pointFieldFwd.H:38
const pointField & points
void close()
Close Istream.
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:56
int debug
Static debugging option.
OBJstream os(runTime.globalPath()/outputName)
defineTypeNameAndDebug(combustionModel, 0)
Mesh data needed to do the Finite Area discretisation.
Definition: edgeFaMesh.H:47
bool isReadRequired() const noexcept
True if (MUST_READ | READ_MODIFIED) bits are set.
bool good() const noexcept
True if next operation might succeed.
Definition: IOstream.H:281
const edgeList & edges() const noexcept
Return edges.
Definition: edgeMeshI.H:98
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
Definition: regIOobject.H:66
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, IOobject::NO_REGISTER)
Defines the attributes of an object for which implicit objectRegistry management is supported...
Definition: IOobject.H:172
featureEdgeMesh(const IOobject &)
Construct (read) given an IOobject.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
Namespace for OpenFOAM.