UniformDimensionedField.H
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-2018 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 Class
25  Foam::UniformDimensionedField
26 
27 Description
28  Dimensioned<Type> registered with the database as a registered IOobject
29  which has the functionality of a uniform field and allows values from the
30  top-level code to be passed to boundary conditions etc.
31 
32 SourceFiles
33  UniformDimensionedField.C
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #ifndef UniformDimensionedField_H
38 #define UniformDimensionedField_H
39 
40 #include "regIOobject.H"
41 #include "dimensionedType.H"
42 
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 
45 namespace Foam
46 {
47 
48 /*---------------------------------------------------------------------------*\
49  Class UniformDimensionedField Declaration
50 \*---------------------------------------------------------------------------*/
51 
52 template<class Type>
54 :
55  public regIOobject,
56  public dimensioned<Type>
57 {
58 
59 public:
60 
61  //- Runtime type information
62  TypeName("UniformDimensionedField");
63 
64 
65  // Constructors
66 
67  //- Construct from components. Either reads or uses supplied value.
69 
70  //- Construct as copy
72 
73  //- Construct from Istream
75 
76 
77  //- Destructor
78  virtual ~UniformDimensionedField();
79 
80 
81  // Member Functions
82 
83  //- Name function provided to resolve the ambiguity between the
84  // name functions in regIOobject and dimensioned<Type>
85  virtual const word& name() const
86  {
87  return dimensioned<Type>::name();
88  }
89 
90  bool writeData(Ostream&) const;
91 
92  //- Is object global
93  virtual bool global() const
94  {
95  return true;
96  }
97 
98  //- Return complete path + object name if the file exists
99  // either in the case/processor or case otherwise null
100  virtual fileName filePath() const
101  {
102  return globalFilePath(type());
103  }
104 
105 
106  // Member Operators
107 
109  void operator=(const dimensioned<Type>&);
111  Type operator[](const label) const
112  {
113  return this->value();
114  }
115 };
116 
117 
118 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
119 
120 } // End namespace Foam
121 
122 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
123 
124 #ifdef NoRepository
125  #include "UniformDimensionedField.C"
126 #endif
127 
128 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
129 
130 #endif
131 
132 // ************************************************************************* //
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
A class for handling file names.
Definition: fileName.H:69
Generic dimensioned Type class.
bool writeData(Ostream &) const
Pure virtual writaData function.
void operator=(const UniformDimensionedField< Type > &)
virtual bool global() const
Is object global.
A class for handling words, derived from string.
Definition: word.H:59
const Type & value() const
Return const reference to value.
fileName globalFilePath(const word &typeName) const
Helper for filePath that searches up if in parallel.
Definition: IOobject.C:428
UniformDimensionedField(const IOobject &, const dimensioned< Type > &)
Construct from components. Either reads or uses supplied value.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
virtual fileName filePath() const
Return complete path + object name if the file exists.
const word & name() const
Return const reference to name.
fileName::Type type(const fileName &, const bool followLink=true)
Return the file type: DIRECTORY or FILE.
Definition: POSIX.C:481
Dimensioned<Type> registered with the database as a registered IOobject which has the functionality o...
TypeName("UniformDimensionedField")
Runtime type information.
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
Definition: regIOobject.H:65
virtual const word & name() const
Name function provided to resolve the ambiguity between the.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:92
Namespace for OpenFOAM.
virtual ~UniformDimensionedField()
Destructor.