fieldValue.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 | Copyright (C) 2011-2015 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 "fieldValue.H"
27 #include "fvMesh.H"
28 #include "Time.H"
30 
31 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
32 
33 namespace Foam
34 {
35  defineTypeNameAndDebug(fieldValue, 0);
36  defineRunTimeSelectionTable(fieldValue, dictionary);
37 }
38 
39 
40 // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
41 
43 {
44  if (active_)
45  {
46  dict_ = dict;
47 
48  log_ = dict.lookupOrDefault<Switch>("log", true);
49  dict.lookup("fields") >> fields_;
50  dict.lookup("valueOutput") >> valueOutput_;
51  }
52 }
53 
54 
56 {
57  if (active_)
58  {
60 
61  if (log_) Info<< type() << " " << name_ << " output:" << nl;
62  }
63 }
64 
65 
66 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
67 
69 (
70  const word& name,
71  const objectRegistry& obr,
72  const dictionary& dict,
73  const word& valueType,
74  const bool loadFromFiles
75 )
76 :
77  functionObjectFile(obr, name, valueType),
78  name_(name),
79  obr_(obr),
80  dict_(dict),
81  active_(true),
82  log_(true),
83  sourceName_(word::null),
84  fields_(dict.lookup("fields")),
85  valueOutput_(dict.lookup("valueOutput")),
86  resultDict_(fileName("name"), dictionary::null)
87 {
88  // Only active if obr is an fvMesh
89  if (isA<fvMesh>(obr_))
90  {
91  read(dict);
92  }
93  else
94  {
95  WarningIn
96  (
97  "fieldValue::fieldValue"
98  "("
99  "const word&, "
100  "const objectRegistry&, "
101  "const dictionary&, "
102  "const bool"
103  ")"
104  ) << "No fvMesh available, deactivating " << name << nl
105  << endl;
106  active_ = false;
107  }
108 }
109 
110 
111 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
112 
114 {}
115 
116 
117 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
118 
120 {
121  // Do nothing
122 }
123 
124 
126 {
127  // Do nothing
128 }
129 
130 
132 {
133  // Do nothing
134 }
135 
136 
138 {
139  // Do nothing
140 }
141 
142 
144 {
145  // Do nothing
146 }
147 
148 
149 // ************************************************************************* //
virtual void execute()
Execute.
Definition: fieldValue.C:119
virtual void timeSet()
Called when time was set at the end of the Time::operator++.
Definition: fieldValue.C:131
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:158
A class for handling words, derived from string.
Definition: word.H:59
A simple wrapper around bool so that it can be read as a word: true/false, on/off, yes/no, y/n, t/f, or none.
Definition: Switch.H:60
messageStream Info
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
virtual void write()
Write to screen/file.
Definition: fieldValue.C:55
Namespace for OpenFOAM.
virtual void updateMesh(const mapPolyMesh &)
Update mesh.
Definition: fieldValue.C:137
virtual void read(const dictionary &dict)
Read from dictionary.
Definition: fieldValue.C:42
static const dictionary null
Null dictionary.
Definition: dictionary.H:193
dictionary dict
static const char nl
Definition: Ostream.H:260
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
#define WarningIn(functionName)
Report a warning using Foam::Warning.
fieldValue(const word &name, const objectRegistry &obr, const dictionary &dict, const word &valueType, const bool loadFromFiles=false)
Construct from components.
Definition: fieldValue.C:69
Macros for easy insertion into run-time selection tables.
fileName::Type type(const fileName &)
Return the file type: DIRECTORY or FILE.
Definition: POSIX.C:589
virtual void write()
Write function.
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
Definition: dictionary.C:452
T lookupOrDefault(const word &, const T &, bool recursive=false, bool patternMatch=true) const
Find and return a T,.
Registry of regIOobjects.
A class for handling file names.
Definition: fileName.H:69
virtual void end()
Execute the at the final time-loop, currently does nothing.
Definition: fieldValue.C:125
defineRunTimeSelectionTable(reactionRateFlameArea, dictionary)
Base class for output file data handling.
bool read(const char *, int32_t &)
Definition: int32IO.C:87
virtual ~fieldValue()
Destructor.
Definition: fieldValue.C:113
static const word null
An empty word.
Definition: word.H:77
defineTypeNameAndDebug(combustionModel, 0)
virtual void movePoints(const polyMesh &)
Move points.
Definition: fieldValue.C:143