cellModelIO.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-2015 OpenFOAM Foundation
9  Copyright (C) 2018 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 "cellModel.H"
30 #include "dictionaryEntry.H"
31 
32 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
33 
35 {
36  const dictionaryEntry dictEntry(dictionary::null, is);
37  const dictionary& dict = dictEntry.dict();
38 
39  name_ = dictEntry.keyword();
40  dict.readEntry("index", index_);
41  dict.readEntry("numberOfPoints", nPoints_);
42  dict.readEntry("faces", faces_);
43  dict.readEntry("edges", edges_);
44 }
45 
46 
47 // * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
48 
49 Foam::Ostream& Foam::operator<<(Ostream& os, const cellModel& cm)
50 {
51  os << "name" << tab << cm.name() << tab
52  << "index" << tab << cm.index() << tab
53  << "numberOfPoints" << tab << cm.nPoints() << tab
54  << "faces" << tab << cm.modelFaces() << tab
55  << "edges" << tab << cm.modelEdges() << endl;
56 
57  return os;
58 }
59 
60 
61 template<>
62 Foam::Ostream& Foam::operator<<
63 (
64  Ostream& os,
65  const InfoProxy<cellModel>& iproxy
66 )
67 {
68  const auto& cm = *iproxy;
69 
70  os << "name = " << cm.name() << ", "
71  << "index = " << cm.index() << ", "
72  << "number of points = " << cm.nPoints() << ", "
73  << "number of faces = " << cm.nFaces() << ", "
74  << "number of edges = " << cm.nEdges() << endl;
75 
76  return os;
77 }
78 
79 
80 // ************************************************************************* //
dictionary dict
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
virtual const fileName & name() const override
Read/write access to the name of the stream.
Definition: OSstream.H:128
cellModel(Istream &is)
Construct from Istream.
Definition: cellModelIO.C:27
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
constexpr char tab
The tab &#39;\t&#39; character(0x09)
Definition: Ostream.H:49
A keyword and a list of tokens is a &#39;dictionaryEntry&#39;.
const keyType & keyword() const noexcept
Return keyword.
Definition: entry.H:231
static const dictionary null
An empty dictionary, which is also the parent for all dictionaries.
Definition: dictionary.H:474
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:56
OBJstream os(runTime.globalPath()/outputName)
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:77
virtual const dictionary & dict() const noexcept
Return dictionary (ie, this)