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 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 \*---------------------------------------------------------------------------*/
27 
28 #include "cellModel.H"
29 #include "dictionaryEntry.H"
30 
31 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
32 
34 {
35  const dictionaryEntry dictEntry(dictionary::null, is);
36  const dictionary& dict = dictEntry.dict();
37 
38  name_ = dictEntry.keyword();
39  dict.readEntry("index", index_);
40  dict.readEntry("numberOfPoints", nPoints_);
41  dict.readEntry("faces", faces_);
42  dict.readEntry("edges", edges_);
43 }
44 
45 
46 // * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
47 
49 {
50  os << "name" << tab << cm.name() << tab
51  << "index" << tab << cm.index() << tab
52  << "numberOfPoints" << tab << cm.nPoints() << tab
53  << "faces" << tab << cm.modelFaces() << tab
54  << "edges" << tab << cm.modelEdges() << endl;
55 
56  return os;
57 }
58 
59 
60 template<>
61 Foam::Ostream& Foam::operator<<(Ostream& os, const InfoProxy<cellModel>& ip)
62 {
63  const cellModel& cm = ip.t_;
64 
65  os << "name = " << cm.name() << ", "
66  << "index = " << cm.index() << ", "
67  << "number of points = " << cm.nPoints() << ", "
68  << "number of faces = " << cm.nFaces() << ", "
69  << "number of edges = " << cm.nEdges() << endl;
70 
71  return os;
72 }
73 
74 
75 // ************************************************************************* //
Foam::dictionaryEntry
A keyword and a list of tokens is a 'dictionaryEntry'.
Definition: dictionaryEntry.H:65
Foam::entry::keyword
const keyType & keyword() const
Return keyword.
Definition: entry.H:187
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:337
Foam::cellModel::cellModel
cellModel(Istream &is)
Construct from Istream.
Definition: cellModelIO.C:33
Foam::dictionary::null
static const dictionary null
An empty dictionary, which is also the parent for all dictionaries.
Definition: dictionary.H:385
cellModel.H
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
Foam::IOstream::name
virtual const fileName & name() const
Return the name of the stream.
Definition: IOstream.C:39
Foam::cellModel::modelFaces
const faceList & modelFaces() const
Return a raw list of model faces.
Definition: cellModelI.H:66
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
Foam::cellModel::name
const word & name() const
Return model name.
Definition: cellModelI.H:30
dictionaryEntry.H
Foam::cellModel::modelEdges
const edgeList & modelEdges() const
Return a raw list of model edges.
Definition: cellModelI.H:60
Foam::tab
constexpr char tab
Definition: Ostream.H:371
Foam::dictionaryEntry::dict
virtual const dictionary & dict() const
Return dictionary.
Definition: dictionaryEntry.C:102
Foam::cellModel
Maps a geometry to a set of cell primitives.
Definition: cellModel.H:72
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::cellModel::index
label index() const
Return index of model in the model list.
Definition: cellModelI.H:36
Foam::operator<<
Ostream & operator<<(Ostream &, const boundaryPatch &)
Definition: boundaryPatch.C:102
Foam::cellModel::nPoints
label nPoints() const
Return number of points.
Definition: cellModelI.H:42