Added new fieldValues function object
[OpenFOAM-1.6.x.git] / src / postProcessing / functionObjects / field / fieldValues / fieldValue / fieldValue.H
blob1b96bb8e41c6171c50ab7b6ee60f093e6e98b9f7
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 2009-2009 OpenCFD Ltd.
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 the
13     Free Software Foundation; either version 2 of the License, or (at your
14     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, write to the Free Software Foundation,
23     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 Class
26     Foam::fieldValue
28 Description
29     Base class for field value -based function objects.
31 SourceFiles
32     fieldValue.C
34 \*---------------------------------------------------------------------------*/
36 #ifndef fieldValue_H
37 #define fieldValue_H
39 #include "Switch.H"
40 #include "pointFieldFwd.H"
41 #include "OFstream.H"
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 namespace Foam
48 // Forward declaration of classes
49 class dictionary;
50 class objectRegistry;
51 class fvMesh;
52 class mapPolyMesh;
54 /*---------------------------------------------------------------------------*\
55                        Class fieldValue Declaration
56 \*---------------------------------------------------------------------------*/
58 class fieldValue
61 protected:
63     // Protected data
65          //- Name of this fieldValue object
66         word name_;
68         //- Database this class is registered to
69         const objectRegistry& obr_;
71         //- Active flag
72         bool active_;
74         //- Switch to send output to Info as well as to file
75         Switch log_;
77         //- Name of source object
78         word sourceName_;
80         //- List of field names to operate on
81         wordList fields_;
83         //- Output field values flag
84         Switch valueOutput_;
86         //- Output file pointer
87         autoPtr<OFstream> outputFilePtr_;
90         // Functions to be over-ridden from IOoutputFilter class
92             //- Make the output file
93             virtual void makeFile();
95             //- Write the output file header
96             virtual void writeFileHeader() = 0;
98             //- Update mesh
99             virtual void updateMesh(const mapPolyMesh&);
101             //- Move points
102             virtual void movePoints(const Field<point>&);
105 public:
107     //- Run-time type information
108     TypeName("fieldValue");
111     //- Construct from components
112     fieldValue
113     (
114         const word& name,
115         const objectRegistry& obr,
116         const dictionary& dict,
117         const bool loadFromFiles = false
118     );
121     //- Destructor
122     virtual ~fieldValue();
125     // Public member functions
127         // Access
129             //- Return the name of the geometric source
130             inline const word& name() const;
132             //- Return the reference to the object registry
133             inline const objectRegistry& obr() const;
135             //- Return the active flag
136             inline bool active() const;
138             //- Return the switch to send output to Info as well as to file
139             inline const Switch& log() const;
141             //- Return the source name
142             inline const word& sourceName() const;
144             //- Return the list of field names
145             inline const wordList& fields() const;
147             //- Return the output field values flag
148             inline const Switch& valueOutput() const;
150             //- Helper function to return the reference to the mesh
151             inline const fvMesh& mesh() const;
154         // Function object functions
156             //- Read from dictionary
157             virtual void read(const dictionary& dict);
159             //- Write to screen/file
160             virtual void write();
162             //- Execute
163             virtual void execute();
165             //- Execute the at the final time-loop, currently does nothing
166             virtual void end();
170 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
172 } // End namespace Foam
174 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
176 #include "fieldValueI.H"
178 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
180 #endif
182 // ************************************************************************* //