UniformDimensionedField.H
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-2017 OpenFOAM Foundation
9-------------------------------------------------------------------------------
10License
11 This file is part of OpenFOAM.
12
13 OpenFOAM is free software: you can redistribute it and/or modify it
14 under the terms of the GNU General Public License as published by
15 the Free Software Foundation, either version 3 of the License, or
16 (at your option) any later version.
17
18 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25
26Class
27 Foam::UniformDimensionedField
28
29Description
30 Dimensioned<Type> registered with the database as a registered IOobject
31 which has the functionality of a uniform field and allows values from the
32 top-level code to be passed to boundary conditions etc.
33
34 Is a 'global' field, same on all processors
35
36SourceFiles
37 UniformDimensionedField.C
38
39\*---------------------------------------------------------------------------*/
40
41#ifndef UniformDimensionedField_H
42#define UniformDimensionedField_H
43
44#include "regIOobject.H"
45#include "dimensionedType.H"
46
47// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48
49namespace Foam
50{
51
52/*---------------------------------------------------------------------------*\
53 Class UniformDimensionedField Declaration
54\*---------------------------------------------------------------------------*/
55
56template<class Type>
58:
59 public regIOobject,
60 public dimensioned<Type>
61{
62
63public:
64
65 //- Runtime type information
66 TypeName("UniformDimensionedField");
67
68
69 // Constructors
70
71 //- Construct from components. Either reads or uses supplied value.
72 // The name of the dimensioned<Type> defines the name of the
73 // field.
75 (
76 const IOobject& io,
77 const dimensioned<Type>& dt
78 );
79
80 //- Construct as copy
82
83 //- Construct from Istream
85
86
87 //- Destructor
89
90
91 // Member Functions
92
93 //- Name function provided to resolve the ambiguity between the
94 // name functions in regIOobject and dimensioned<Type>
95 virtual const word& name() const
96 {
98 }
99
100 //- ReadData function required for regIOobject read operation
101 virtual bool readData(Istream&);
102
103 //- WriteData function required for regIOobject write operation
104 bool writeData(Ostream&) const;
105
106 //- Is object global
107 virtual bool global() const
108 {
109 return true;
110 }
111
112 //- Return complete path + object name if the file exists
113 // either in the case/processor or case otherwise null
114 virtual fileName filePath() const
115 {
116 return globalFilePath(type());
117 }
118
119
120 // Member Operators
121
122 //- Assign name, dimensions and value.
124
125 //- Assign name, dimensions and value.
126 void operator=(const dimensioned<Type>& rhs);
128 Type operator[](const label) const
129 {
130 return this->value();
131 }
132};
133
134
135// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
136
137} // End namespace Foam
138
139// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
140
141#ifdef NoRepository
143#endif
144
145// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
146
147#endif
148
149// ************************************************************************* //
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:170
fileName globalFilePath(const word &typeName, const bool search=true) const
Helper for filePath that searches up if in parallel.
Definition: IOobject.C:593
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
Dimensioned<Type> registered with the database as a registered IOobject which has the functionality o...
virtual const word & name() const
Name function provided to resolve the ambiguity between the.
TypeName("UniformDimensionedField")
Runtime type information.
bool writeData(Ostream &) const
WriteData function required for regIOobject write operation.
virtual bool global() const
Is object global.
virtual ~UniformDimensionedField()
Destructor.
void operator=(const UniformDimensionedField< Type > &rhs)
Assign name, dimensions and value.
virtual fileName filePath() const
Return complete path + object name if the file exists.
virtual bool readData(Istream &)
ReadData function required for regIOobject read operation.
Generic dimensioned Type class.
const Type & value() const
Return const reference to value.
const word & name() const
Return const reference to name.
A class for handling file names.
Definition: fileName.H:76
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
Definition: regIOobject.H:76
A class for handling words, derived from Foam::string.
Definition: word.H:68
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, false)
Namespace for OpenFOAM.
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Definition: MSwindows.C:598
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73