1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
7 -------------------------------------------------------------------------------
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
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 "fieldValue.H"
30 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
34 defineTypeNameAndDebug(fieldValue, 0);
38 // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
40 void Foam::fieldValue::updateMesh(const mapPolyMesh&)
46 void Foam::fieldValue::movePoints(const Field<point>&)
52 void Foam::fieldValue::makeFile()
54 // Create the output file if not already created
55 if (outputFilePtr_.empty())
59 Info<< "Creating output file." << endl;
63 if (Pstream::master())
67 obr_.time().timeName(obr_.time().startTime().value());
69 if (Pstream::parRun())
71 // Put in undecomposed case (Note: gives problems for
72 // distributed data running)
74 obr_.time().path()/".."/name_/startTimeName;
78 outputDir = obr_.time().path()/name_/startTimeName;
81 // Create directory if does not exist
84 // Open new file at start up
85 outputFilePtr_.reset(new OFstream(outputDir/(type() + ".dat")));
87 // Add headers to output data
94 void Foam::fieldValue::read(const dictionary& dict)
98 log_ = dict.lookupOrDefault<Switch>("log", false);
99 dict.lookup("fields") >> fields_;
100 dict.lookup("valueOutput") >> valueOutput_;
105 void Foam::fieldValue::write()
111 Info<< type() << " " << name_ << " output:" << nl;
119 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
121 Foam::fieldValue::fieldValue
124 const objectRegistry& obr,
125 const dictionary& dict,
126 const bool loadFromFiles
133 sourceName_(dict.lookupOrDefault<word>("sourceName", "sampledSurface")),
134 fields_(dict.lookup("fields")),
135 valueOutput_(dict.lookup("valueOutput")),
138 // Only active if obr is an fvMesh
139 if (isA<fvMesh>(obr_))
147 "fieldValue::fieldValue"
150 "const objectRegistry&, "
151 "const dictionary&, "
154 ) << "No fvMesh available, deactivating."
161 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
163 Foam::fieldValue::~fieldValue()
167 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
169 void Foam::fieldValue::execute()
175 void Foam::fieldValue::end()
181 // ************************************************************************* //