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 
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<<(Ostream& os, const InfoProxy<cellModel>& ip)
63 {
64  const cellModel& cm = ip.t_;
65 
66  os << "name = " << cm.name() << ", "
67  << "index = " << cm.index() << ", "
68  << "number of points = " << cm.nPoints() << ", "
69  << "number of faces = " << cm.nFaces() << ", "
70  << "number of edges = " << cm.nEdges() << endl;
71 
72  return os;
73 }
74 
75 
76 // ************************************************************************* //
Foam::cellModel::index
label index() const noexcept
Return index of model in the model list.
Definition: cellModelI.H:37
Foam::dictionaryEntry
A keyword and a list of tokens is a 'dictionaryEntry'.
Definition: dictionaryEntry.H:65
Foam::OFstream::name
virtual const fileName & name() const
Read/write access to the name of the stream.
Definition: OSstream.H:107
Foam::dictionaryEntry::dict
virtual const dictionary & dict() const noexcept
Return dictionary (ie, this)
Definition: dictionaryEntry.C:102
Foam::entry::keyword
const keyType & keyword() const noexcept
Return keyword.
Definition: entry.H:195
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:369
Foam::cellModel::cellModel
cellModel(Istream &is)
Construct from Istream.
Definition: cellModelIO.C:34
Foam::dictionary::null
static const dictionary null
An empty dictionary, which is also the parent for all dictionaries.
Definition: dictionary.H:392
Foam::operator<<
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:83
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::cellModel::modelEdges
const edgeList & modelEdges() const noexcept
Return a raw list of model edges.
Definition: cellModelI.H:61
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:123
os
OBJstream os(runTime.globalPath()/outputName)
dictionaryEntry.H
Foam::cellModel::name
const word & name() const noexcept
Return model name.
Definition: cellModelI.H:31
Foam::tab
constexpr char tab
Definition: Ostream.H:403
Foam::cellModel::nPoints
label nPoints() const noexcept
Return number of points.
Definition: cellModelI.H:43
Foam::cellModel::modelFaces
const faceList & modelFaces() const noexcept
Return a raw list of model faces.
Definition: cellModelI.H:67
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