coordinateSystems.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2021 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 "coordinateSystems.H"
27 #include "Time.H"
28 
29 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
30 
31 namespace Foam
32 {
33 namespace coordinateSystems
34 {
35  defineTypeNameAndDebug(coordinateSystems, 0);
36 }
37 }
38 
39 
40 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
41 
43 (
44  const objectRegistry& obr
45 )
46 :
48  (
49  obr,
50  IOobject
51  (
52  typeName,
53  obr.time().constant(),
54  obr,
57  )
58  ),
60 {
61  readHeaderOk(IOstream::ASCII, typeName);
62 }
63 
64 
65 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
66 
68 {
69  const dictionary coordinateSystemsDict(is);
70 
71  forAllConstIter(dictionary, coordinateSystemsDict, iter)
72  {
73  if (iter().isDict())
74  {
75  const word& name = iter().keyword();
76  const dictionary& dict = iter().dict();
77 
78  this->insert
79  (
80  name,
81  coordinateSystem::New(name, dict).ptr()
82  );
83  }
84  }
85 
86  return !is.bad();
87 }
88 
89 
91 {
92  return (os << *this).good();
93 }
94 
95 
96 // ************************************************************************* //
bool writeData(Ostream &) const
WriteData function required for regIOobject write operation.
defineTypeNameAndDebug(cartesian, 0)
dictionary dict
bool bad() const
Return true if stream is corrupted.
Definition: IOstream.H:348
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
Definition: UList.H:477
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
void insert(const scalar, DynamicList< floatScalar > &)
Append scalar to given DynamicList.
virtual bool readData(Istream &)
ReadData function required for regIOobject read operation.
A class for handling words, derived from string.
Definition: word.H:59
const word & constant() const
Return constant name.
Definition: TimePaths.H:123
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:54
word name(const complex &)
Return a string representation of a complex.
Definition: complex.C:47
coordinateSystems(const objectRegistry &obr)
Read construct from objectRegistry.
static autoPtr< coordinateSystem > New(const objectRegistry &obr, const dictionary &dict)
Select constructed from dictionary and objectRegistry.
const Time & time() const
Return time.
Definition: IOobject.C:318
Registry of regIOobjects.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:98
Namespace for OpenFOAM.