ENH: autoLayerDriver: better layering information message
[OpenFOAM-2.0.x.git] / src / postProcessing / functionObjects / field / surfaceInterpolateFields / surfaceInterpolateFields.C
bloba99b895ad38c5480b3c284b5db7b22393642332c
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
9     This file is part of OpenFOAM.
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.
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.
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/>.
24 \*---------------------------------------------------------------------------*/
26 #include "surfaceInterpolateFields.H"
28 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
30 namespace Foam
32     defineTypeNameAndDebug(surfaceInterpolateFields, 0);
36 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
38 Foam::surfaceInterpolateFields::surfaceInterpolateFields
40     const word& name,
41     const objectRegistry& obr,
42     const dictionary& dict,
43     const bool loadFromFiles
46     name_(name),
47     obr_(obr),
48     active_(true),
49     fieldSet_()
51     // Check if the available mesh is an fvMesh otherise deactivate
52     if (!isA<fvMesh>(obr_))
53     {
54         active_ = false;
55         WarningIn
56         (
57             "surfaceInterpolateFields::surfaceInterpolateFields"
58             "("
59                 "const word&, "
60                 "const objectRegistry&, "
61                 "const dictionary&, "
62                 "const bool"
63             ")"
64         )   << "No fvMesh available, deactivating."
65             << endl;
66     }
68     read(dict);
72 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
74 Foam::surfaceInterpolateFields::~surfaceInterpolateFields()
78 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
80 void Foam::surfaceInterpolateFields::read(const dictionary& dict)
82     if (active_)
83     {
84         dict.lookup("fields") >> fieldSet_;
85     }
89 void Foam::surfaceInterpolateFields::execute()
91     if (active_)
92     {
93         // Clear out any previously loaded fields 
94         ssf_.clear();
95         svf_.clear();
96         sSpheretf_.clear();
97         sSymmtf_.clear();
98         stf_.clear();
100         interpolateFields<scalar>(ssf_);
101         interpolateFields<vector>(svf_);
102         interpolateFields<sphericalTensor>(sSpheretf_);
103         interpolateFields<symmTensor>(sSymmtf_);
104         interpolateFields<tensor>(stf_);
105     }
109 void Foam::surfaceInterpolateFields::end()
111     // Do nothing
115 void Foam::surfaceInterpolateFields::write()
117     if (active_)
118     {
119         Info<< "Writing interpolated surface fields to "
120             << obr_.time().timeName() << endl;
122         forAll(ssf_, i)
123         {
124             ssf_[i].write();
125         }
126         forAll(svf_, i)
127         {
128             svf_[i].write();
129         }
130         forAll(sSpheretf_, i)
131         {
132             sSpheretf_[i].write();
133         }
134         forAll(sSymmtf_, i)
135         {
136             sSymmtf_[i].write();
137         }
138         forAll(stf_, i)
139         {
140             stf_[i].write();
141         }
142     }
146 // ************************************************************************* //