surfaceInterpolate.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-2016 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 "surfaceInterpolate.H"
27 #include "surfaceFields.H"
29 
30 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
31 
32 namespace Foam
33 {
34 namespace functionObjects
35 {
36  defineTypeNameAndDebug(surfaceInterpolate, 0);
37 
39  (
40  functionObject,
41  surfaceInterpolate,
42  dictionary
43  );
44 }
45 }
46 
47 
48 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
49 
50 Foam::functionObjects::surfaceInterpolate::surfaceInterpolate
51 (
52  const word& name,
53  const Time& runTime,
54  const dictionary& dict
55 )
56 :
57  fvMeshFunctionObject(name, runTime, dict),
58  fieldSet_()
59 {
60  read(dict);
61 }
62 
63 
64 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
65 
67 {}
68 
69 
70 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
71 
73 (
74  const dictionary& dict
75 )
76 {
77  dict.lookup("fields") >> fieldSet_;
78 
79  return true;
80 }
81 
82 
84 {
85  Info<< type() << " " << name() << " write:" << nl;
86 
87  // Clear out any previously loaded fields
88  ssf_.clear();
89  svf_.clear();
90  sSpheretf_.clear();
91  sSymmtf_.clear();
92  stf_.clear();
93 
94  interpolateFields<scalar>(ssf_);
95  interpolateFields<vector>(svf_);
96  interpolateFields<sphericalTensor>(sSpheretf_);
97  interpolateFields<symmTensor>(sSymmtf_);
98  interpolateFields<tensor>(stf_);
99 
100  Info<< endl;
101 
102  return true;
103 }
104 
105 
107 {
108  Info<< type() << " " << name() << " write:" << nl;
109 
110  Info<< " Writing interpolated surface fields to "
111  << obr_.time().timeName() << endl;
112 
113  forAll(ssf_, i)
114  {
115  ssf_[i].write();
116  }
117  forAll(svf_, i)
118  {
119  svf_[i].write();
120  }
121  forAll(sSpheretf_, i)
122  {
123  sSpheretf_[i].write();
124  }
125  forAll(sSymmtf_, i)
126  {
127  sSymmtf_[i].write();
128  }
129  forAll(stf_, i)
130  {
131  stf_[i].write();
132  }
133 
134  return true;
135 }
136 
137 
138 // ************************************************************************* //
Foam::surfaceFields.
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:428
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:253
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:68
Macros for easy insertion into run-time selection tables.
bool read(const char *, int32_t &)
Definition: int32IO.C:85
A class for handling words, derived from string.
Definition: word.H:59
virtual bool write()
Write the interpolated fields.
static const char nl
Definition: Ostream.H:262
word name(const complex &)
Return a string representation of a complex.
Definition: complex.C:47
fileName::Type type(const fileName &, const bool followLink=true)
Return the file type: DIRECTORY or FILE.
Definition: POSIX.C:485
messageStream Info
Specialization of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
defineTypeNameAndDebug(fvMeshFunctionObject, 0)
virtual bool read(const dictionary &)
Read the controls.
virtual bool execute()
Calculate the interpolated fields.
addToRunTimeSelectionTable(functionObject, add, dictionary)
Namespace for OpenFOAM.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
Definition: dictionary.C:576