surfaceInterpolateFields.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-2014 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 
27 
28 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
29 
30 namespace Foam
31 {
32  defineTypeNameAndDebug(surfaceInterpolateFields, 0);
33 }
34 
35 
36 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
37 
39 (
40  const word& name,
41  const objectRegistry& obr,
42  const dictionary& dict,
43  const bool loadFromFiles
44 )
45 :
46  name_(name),
47  obr_(obr),
48  active_(true),
49  fieldSet_()
50 {
51  // Check if the available mesh is an fvMesh otherise deactivate
52  if (isA<fvMesh>(obr_))
53  {
54  read(dict);
55  }
56  else
57  {
58  active_ = false;
59  WarningIn
60  (
61  "surfaceInterpolateFields::surfaceInterpolateFields"
62  "("
63  "const word&, "
64  "const objectRegistry&, "
65  "const dictionary&, "
66  "const bool"
67  ")"
68  ) << "No fvMesh available, deactivating " << name_
69  << endl;
70  }
71 }
72 
73 
74 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
75 
77 {}
78 
79 
80 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
81 
83 {
84  if (active_)
85  {
86  dict.lookup("fields") >> fieldSet_;
87  }
88 }
89 
90 
92 {
93  if (active_)
94  {
95  Info<< type() << " " << name_ << " output:" << nl;
96 
97  // Clear out any previously loaded fields
98  ssf_.clear();
99  svf_.clear();
100  sSpheretf_.clear();
101  sSymmtf_.clear();
102  stf_.clear();
103 
104  interpolateFields<scalar>(ssf_);
105  interpolateFields<vector>(svf_);
106  interpolateFields<sphericalTensor>(sSpheretf_);
107  interpolateFields<symmTensor>(sSymmtf_);
108  interpolateFields<tensor>(stf_);
109 
110  Info<< endl;
111  }
112 }
113 
114 
116 {
117  if (active_)
118  {
119  execute();
120  }
121 }
122 
123 
125 {
126  // Do nothing
127 }
128 
129 
131 {
132  if (active_)
133  {
134  Info<< type() << " " << name_ << " output:" << nl;
135 
136  Info<< " Writing interpolated surface fields to "
137  << obr_.time().timeName() << endl;
138 
139  forAll(ssf_, i)
140  {
141  ssf_[i].write();
142  }
143  forAll(svf_, i)
144  {
145  svf_[i].write();
146  }
147  forAll(sSpheretf_, i)
148  {
149  sSpheretf_[i].write();
150  }
151  forAll(sSymmtf_, i)
152  {
153  sSymmtf_[i].write();
154  }
155  forAll(stf_, i)
156  {
157  stf_[i].write();
158  }
159  }
160 }
161 
162 
163 // ************************************************************************* //
virtual ~surfaceInterpolateFields()
Destructor.
virtual void end()
Execute at the final time-loop, currently does nothing.
A class for handling words, derived from string.
Definition: word.H:59
messageStream Info
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
Namespace for OpenFOAM.
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.
virtual void read(const dictionary &)
Read the field min/max data.
#define forAll(list, i)
Definition: UList.H:421
virtual void timeSet()
Called when time was set at the end of the Time::operator++.
fileName::Type type(const fileName &)
Return the file type: DIRECTORY or FILE.
Definition: POSIX.C:589
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
Definition: dictionary.C:452
Registry of regIOobjects.
bool read(const char *, int32_t &)
Definition: int32IO.C:87
virtual void execute()
Execute, currently does nothing.
surfaceInterpolateFields(const surfaceInterpolateFields &)
Disallow default bitwise copy construct.
defineTypeNameAndDebug(combustionModel, 0)