1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2009-2009 OpenCFD Ltd.
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 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
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
26 Foam::fieldValues::faceSource
29 Face source variant of field value function object. Values of user-
30 specified fields reported for collections of faces.
32 cellObj1 // Name also used to identify output folder
35 functionObjectLibs ("libfieldValueFunctionObjects.so");
37 outputControl outputTime;
38 log true; // log to screen?
39 valueOutput true; // Write values at run-time output times?
40 source faceZone; // Type of face source: faceZone, patch
51 where operation is one of:
61 \*---------------------------------------------------------------------------*/
66 #include "NamedEnum.H"
67 #include "fieldValue.H"
68 #include "labelList.H"
69 #include "surfaceFieldsFwd.H"
70 #include "volFieldsFwd.H"
72 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
79 /*---------------------------------------------------------------------------*\
80 Class faceSource Declaration
81 \*---------------------------------------------------------------------------*/
92 //- Source type enumeration
100 static const NamedEnum<sourceType, 2> sourceTypeNames_;
103 //- Operation type enumeration
113 //- Operation type names
114 static const NamedEnum<operationType, 5> operationTypeNames_;
119 // Private member functions
121 //- Set faces to evaluate based on a face zone
122 void setFaceZoneFaces();
124 //- Set faces to evaluate based on a patch
125 void setPatchFaces();
135 //- Operation to apply to values
136 operationType operation_;
138 //- Local list of face IDs
141 //- Local list of patch ID per face
142 labelList facePatchId_;
144 //- List of +1/-1 representing face flip map
147 //- Weight field name - only used for opWeightedAverage mode
148 word weightFieldName_;
151 // Protected member functions
153 //- Initialise, e.g. face addressing
154 void initialise(const dictionary& dict);
156 //- Insert field values into values list
160 const word& fieldName,
164 //- Apply the 'operation' to the values
166 Type processValues(const List<Type>& values) const;
168 //- Output file header information
169 virtual void writeFileHeader();
174 //- Run-time type information
175 TypeName("faceSource");
178 //- Construct from components
182 const objectRegistry& obr,
183 const dictionary& dict,
184 const bool loadFromFiles = false
189 virtual ~faceSource();
192 // Public member functions
196 //- Return the source type
197 inline const sourceType& source() const;
199 //- Return the local list of face IDs
200 inline const labelList& faceId() const;
202 //- Return the local list of patch ID per face
203 inline const labelList& facePatch() const;
205 //- Return the list of +1/-1 representing face flip map
206 inline const labelList& flipMap() const;
209 // Function object functions
211 //- Read from dictionary
212 virtual void read(const dictionary&);
214 //- Calculate and write
215 virtual void write();
217 //- Templated helper function to output field values
219 bool writeValues(const word& fieldName);
221 //- Filter a surface field according to faceIds
223 tmp<Field<Type> > filterField
225 const GeometricField<Type, fvsPatchField, surfaceMesh>& field
228 //- Filter a volume field according to faceIds
230 tmp<Field<Type> > filterField
232 const GeometricField<Type, fvPatchField, volMesh>& field
237 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
239 } // End namespace fieldValues
240 } // End namespace Foam
242 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
244 #include "faceSourceI.H"
246 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
249 #include "faceSourceTemplates.C"
252 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
256 // ************************************************************************* //