Merge /u/wyldckat/foam-extend32/ branch master into master
[foam-extend-3.2.git] / src / postProcessing / functionObjects / field / readFields / readFields.C
blob6a3c330b9db59d2f664835060e6a21387a1d01a8
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | foam-extend: Open Source CFD
4    \\    /   O peration     | Version:     3.2
5     \\  /    A nd           | Web:         http://www.foam-extend.org
6      \\/     M anipulation  | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
8 License
9     This file is part of foam-extend.
11     foam-extend is free software: you can redistribute it and/or modify it
12     under the terms of the GNU General Public License as published by the
13     Free Software Foundation, either version 3 of the License, or (at your
14     option) any later version.
16     foam-extend is distributed in the hope that it will be useful, but
17     WITHOUT ANY WARRANTY; without even the implied warranty of
18     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19     General Public License for more details.
21     You should have received a copy of the GNU General Public License
22     along with foam-extend.  If not, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
26 #include "readFields.H"
27 #include "dictionary.H"
29 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
31 namespace Foam
33     defineTypeNameAndDebug(readFields, 0);
37 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
39 Foam::readFields::readFields
41     const word& name,
42     const objectRegistry& obr,
43     const dictionary& dict,
44     const bool loadFromFiles
47     name_(name),
48     obr_(obr),
49     active_(true),
50     fieldSet_()
52     // Check if the available mesh is an fvMesh otherise deactivate
53     if (!isA<fvMesh>(obr_))
54     {
55         active_ = false;
56         WarningIn
57         (
58             "readFields::readFields"
59             "("
60                 "const word&, "
61                 "const objectRegistry&, "
62                 "const dictionary&, "
63                 "const bool"
64             ")"
65         )   << "No fvMesh available, deactivating."
66             << endl;
67     }
69     read(dict);
73 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
75 Foam::readFields::~readFields()
79 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
81 void Foam::readFields::read(const dictionary& dict)
83     if (active_)
84     {
85         dict.lookup("fields") >> fieldSet_;
86     }
90 void Foam::readFields::execute()
92     //Info<< type() << " " << name_ << ":" << nl;
94     // Clear out any previously loaded fields
95     vsf_.clear();
96     vvf_.clear();
97     vSpheretf_.clear();
98     vSymmtf_.clear();
99     vtf_.clear();
101     ssf_.clear();
102     svf_.clear();
103     sSpheretf_.clear();
104     sSymmtf_.clear();
105     stf_.clear();
107     forAll(fieldSet_, fieldI)
108     {
109         // If necessary load field
110         loadField<scalar>(fieldSet_[fieldI], vsf_, ssf_);
111         loadField<vector>(fieldSet_[fieldI], vvf_, svf_);
112         loadField<sphericalTensor>(fieldSet_[fieldI], vSpheretf_, sSpheretf_);
113         loadField<symmTensor>(fieldSet_[fieldI], vSymmtf_, sSymmtf_);
114         loadField<tensor>(fieldSet_[fieldI], vtf_, stf_);
115     }
119 void Foam::readFields::end()
121     // Do nothing
125 void Foam::readFields::write()
127     // Do nothing
131 // ************************************************************************* //