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-2024 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 {
36 }
37 }
38 
39 
40 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
41 
43 (
44  const objectRegistry& obr
45 )
46 :
48  <
52  >
53  (
54  IOobject
55  (
56  typeName,
57  obr.time().constant(),
58  obr,
59  IOobject::MUST_READ,
60  IOobject::NO_WRITE
61  ),
62  obr
63  ),
65 {
66  readHeaderOk(IOstream::ASCII, typeName);
67 }
68 
69 
70 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
71 
73 {
74  const dictionary coordinateSystemsDict(is);
75 
76  forAllConstIter(dictionary, coordinateSystemsDict, iter)
77  {
78  if (iter().isDict())
79  {
80  const word& name = iter().keyword();
81  const dictionary& dict = iter().dict();
82 
83  this->insert
84  (
85  name,
87  );
88  }
89  }
90 
91  return !is.bad();
92 }
93 
94 
96 {
97  return (os << *this).good();
98 }
99 
100 
101 // ************************************************************************* //
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
Definition: UList.H:477
MeshObject types:
Definition: MeshObjects.H:67
Templated abstract base-class for demand-driven mesh objects used to automate their allocation to the...
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:99
bool bad() const
Return true if stream is corrupted.
Definition: IOstream.H:348
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:57
Template dictionary class which manages the storage associated with it.
Definition: PtrDictionary.H:56
Base class for other coordinate system specifications.
static autoPtr< coordinateSystem > New(const objectRegistry &obr, const dictionary &dict)
Select constructed from dictionary and objectRegistry.
Provides a centralised coordinateSystem collection.
bool writeData(Ostream &) const
WriteData function required for regIOobject write operation.
coordinateSystems(const objectRegistry &obr)
Read construct from objectRegistry.
virtual bool readData(Istream &)
ReadData function required for regIOobject read operation.
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:162
Registry of regIOobjects.
bool readHeaderOk(const IOstream::streamFormat defaultFormat, const word &typeName)
Read header, check readOpt flags and read data if necessary.
A class for handling words, derived from string.
Definition: word.H:62
defineTypeNameAndDebug(cartesian, 0)
void insert(const scalar, DynamicList< floatScalar > &)
Append scalar to given DynamicList.
Namespace for OpenFOAM.
word name(const bool)
Return a word representation of a bool.
Definition: boolIO.C:39
dictionary dict