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 | Copyright (C) 2011-2015 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 "cellModel.H"
27 #include "dictionaryEntry.H"
28 
29 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
30 
32 {
34  name_ = entry.keyword();
35  entry.lookup("index") >> index_;
36  entry.lookup("numberOfPoints") >> nPoints_;
37  entry.lookup("faces") >> faces_;
38  entry.lookup("edges") >> edges_;
39 }
40 
41 
43 {
44  os << "name" << tab << c.name_ << tab
45  << "index" << tab << c.index_ << tab
46  << "numberOfPoints" << tab << c.nPoints_ << tab
47  << "faces" << tab << c.faces_ << tab
48  << "edges" << tab << c.edges_ << endl;
49 
50  return os;
51 }
52 
53 
54 template<>
55 Foam::Ostream& Foam::operator<<(Ostream& os, const InfoProxy<cellModel>& ip)
56 {
57  const cellModel& cm = ip.t_;
58 
59  os << "name = " << cm.name() << ", "
60  << "index = " << cm.index() << ", "
61  << "number of points = " << cm.nPoints() << ", "
62  << "number of faces = " << cm.nFaces() << ", "
63  << "number of edges = " << cm.nEdges()
64  << endl;
65 
66  return os;
67 }
68 
69 
70 // ************************************************************************* //
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
const word & name() const
Return model name.
Definition: cellModelI.H:38
Ostream & operator<<(Ostream &, const edgeMesh &)
Definition: edgeMeshIO.C:133
const keyType & keyword() const
Return keyword.
Definition: entry.H:120
static const dictionary null
Null dictionary.
Definition: dictionary.H:193
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
Maps a geometry to a set of cell primitives, which enables geometric cell data to be calculated witho...
Definition: cellModel.H:64
A keyword and a list of tokens is a &#39;dictionaryEntry&#39;.
A keyword and a list of tokens is an &#39;entry&#39;.
Definition: entry.H:65
label nFaces() const
Return number of faces.
Definition: cellModelI.H:62
static const char tab
Definition: Ostream.H:259
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
Definition: dictionary.C:452
label nPoints() const
Return number of points.
Definition: cellModelI.H:50
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
const dimensionedScalar c
Speed of light in a vacuum.
label nEdges() const
Return number of edges.
Definition: cellModelI.H:56
label index() const
Return index of model in the model list.
Definition: cellModelI.H:44
cellModel(Istream &)
Construct from Istream.
Definition: cellModelIO.C:31