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-2015 OpenFOAM Foundation
6  \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
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  log_(true)
51 {
52  // Check if the available mesh is an fvMesh otherise deactivate
53  if (isA<fvMesh>(obr_))
54  {
55  read(dict);
56  }
57  else
58  {
59  active_ = false;
61  << "No fvMesh available, deactivating " << name_
62  << endl;
63  }
64 }
65 
66 
67 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
68 
70 {}
71 
72 
73 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
74 
76 {
77  if (active_)
78  {
79  log_.readIfPresent("log", dict);
80  dict.lookup("fields") >> fieldSet_;
81  }
82 }
83 
84 
86 {
87  if (active_)
88  {
89  if (log_) Info<< type() << " " << name_ << " output:" << nl;
90 
91  // Clear out any previously loaded fields
92  ssf_.clear();
93  svf_.clear();
94  sSpheretf_.clear();
95  sSymmtf_.clear();
96  stf_.clear();
97 
98  interpolateFields<scalar>(ssf_);
99  interpolateFields<vector>(svf_);
100  interpolateFields<sphericalTensor>(sSpheretf_);
101  interpolateFields<symmTensor>(sSymmtf_);
102  interpolateFields<tensor>(stf_);
103 
104  if (log_) Info<< endl;
105  }
106 }
107 
108 
110 {
111  // Do nothing
112 }
113 
114 
116 {
117  // Do nothing
118 }
119 
120 
122 {
123  if (active_)
124  {
125  if (log_) Info
126  << type() << " " << name_ << " output:" << nl
127  << " Writing interpolated surface fields to "
128  << obr_.time().timeName() << endl;
129 
130  forAll(ssf_, i)
131  {
132  ssf_[i].write();
133  }
134  forAll(svf_, i)
135  {
136  svf_[i].write();
137  }
138  forAll(sSpheretf_, i)
139  {
140  sSpheretf_[i].write();
141  }
142  forAll(sSymmtf_, i)
143  {
144  sSymmtf_[i].write();
145  }
146  forAll(stf_, i)
147  {
148  stf_[i].write();
149  }
150  }
151 }
152 
153 
154 // ************************************************************************* //
Foam::surfaceInterpolateFields::~surfaceInterpolateFields
virtual ~surfaceInterpolateFields()
Destructor.
Definition: surfaceInterpolateFields.C:69
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:406
Foam::read
bool read(const char *, int32_t &)
Definition: int32IO.C:87
Foam::dictionary::lookup
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
Definition: dictionary.C:449
Foam::surfaceInterpolateFields::execute
virtual void execute()
Execute, currently does nothing.
Definition: surfaceInterpolateFields.C:85
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
Foam::objectRegistry
Registry of regIOobjects.
Definition: objectRegistry.H:50
Foam::surfaceInterpolateFields::write
virtual void write()
Write.
Definition: surfaceInterpolateFields.C:121
Foam::nl
static const char nl
Definition: Ostream.H:260
Foam::Info
messageStream Info
Foam::surfaceInterpolateFields::timeSet
virtual void timeSet()
Called when time was set at the end of the Time::operator++.
Definition: surfaceInterpolateFields.C:115
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::surfaceInterpolateFields::read
virtual void read(const dictionary &)
Read the field min/max data.
Definition: surfaceInterpolateFields.C:75
Foam::surfaceInterpolateFields::surfaceInterpolateFields
surfaceInterpolateFields(const surfaceInterpolateFields &)
Disallow default bitwise copy construct.
surfaceInterpolateFields.H
Foam::type
fileName::Type type(const fileName &)
Return the file type: DIRECTORY or FILE.
Definition: POSIX.C:588
Foam::surfaceInterpolateFields::end
virtual void end()
Execute at the final time-loop, currently does nothing.
Definition: surfaceInterpolateFields.C:109
Foam::defineTypeNameAndDebug
defineTypeNameAndDebug(combustionModel, 0)
WarningInFunction
#define WarningInFunction
Report a warning using Foam::Warning.
Definition: messageStream.H:259
Foam::name
word name(const complex &)
Return a string representation of a complex.
Definition: complex.C:47