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-------------------------------------------------------------------------------
11License
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
61template<>
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// ************************************************************************* //
A helper class for outputting values to Ostream.
Definition: InfoProxy.H:52
const T & t_
Definition: InfoProxy.H:55
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:64
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
Maps a geometry to a set of cell primitives.
Definition: cellModel.H:73
const word & name() const noexcept
Return model name.
Definition: cellModelI.H:31
label nEdges() const noexcept
Return number of edges.
Definition: cellModelI.H:49
const faceList & modelFaces() const noexcept
Return a raw list of model faces.
Definition: cellModelI.H:67
label index() const noexcept
Return index of model in the model list.
Definition: cellModelI.H:37
label nPoints() const noexcept
Return number of points.
Definition: cellModelI.H:43
label nFaces() const noexcept
Return number of faces.
Definition: cellModelI.H:55
const edgeList & modelEdges() const noexcept
Return a raw list of model edges.
Definition: cellModelI.H:61
A keyword and a list of tokens is a 'dictionaryEntry'.
virtual const dictionary & dict() const noexcept
Return dictionary (ie, this)
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
bool readEntry(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX, bool mandatory=true) const
const keyType & keyword() const noexcept
Return keyword.
Definition: entry.H:195
OBJstream os(runTime.globalPath()/outputName)
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:83
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:372
constexpr char tab
The tab '\t' character(0x09)
Definition: Ostream.H:52
dictionary dict