Loading...
Searching...
No Matches
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
49Foam::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
61template<>
62Foam::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// ************************************************************************* //
A helper class for outputting values to Ostream.
Definition InfoProxy.H:49
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition Istream.H:60
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition Ostream.H:59
Maps a geometry to a set of cell primitives.
Definition cellModel.H:73
const word & name() const noexcept
Return model name.
Definition cellModelI.H:24
cellModel(Istream &is)
Construct from Istream.
Definition cellModelIO.C:27
const faceList & modelFaces() const noexcept
Return a raw list of model faces.
Definition cellModelI.H:60
label index() const noexcept
Return index of model in the model list.
Definition cellModelI.H:30
label nPoints() const noexcept
Return number of points.
Definition cellModelI.H:36
const edgeList & modelEdges() const noexcept
Return a raw list of model edges.
Definition cellModelI.H:54
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:133
static const dictionary null
An empty dictionary, which is also the parent for all dictionaries.
Definition dictionary.H:487
const keyType & keyword() const noexcept
Return keyword.
Definition entry.H:231
OBJstream os(runTime.globalPath()/outputName)
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces).
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition Ostream.H:519
constexpr char tab
The tab '\t' character(0x09).
Definition Ostream.H:49
dictionary dict