OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

writeFuns.H

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software; you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by the
00013     Free Software Foundation; either version 2 of the License, or (at your
00014     option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM; if not, write to the Free Software Foundation,
00023     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00024 
00025 Class
00026     Foam::writeFunctions
00027 
00028 Description
00029     Various functions for collecting and writing binary data.
00030 
00031 SourceFiles
00032     writeFunctions.C
00033 
00034 \*---------------------------------------------------------------------------*/
00035 
00036 #ifndef writeFunctions_H
00037 #define writeFunctions_H
00038 
00039 #include "floatScalar.H"
00040 #include "DynamicList.H"
00041 #include "volFieldsFwd.H"
00042 #include "pointFieldsFwd.H"
00043 #include "vtkMesh.H"
00044 #include "volPointInterpolation.H"
00045 
00046 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00047 
00048 namespace Foam
00049 {
00050 
00051 /*---------------------------------------------------------------------------*\
00052                            Class writeFuns Declaration
00053 \*---------------------------------------------------------------------------*/
00054 
00055 class writeFuns
00056 {
00057     // Private member functions
00058 
00059         // Swap halves of word.
00060 
00061             static void swapWord(label& word32);
00062             static void swapWords(const label nWords, label* words32);
00063 
00064 
00065 public:
00066 
00067     // Write ascii or binary. If binary optionally in-place swaps argument
00068 
00069         static void write(std::ostream&, const bool, List<floatScalar>&);
00070         static void write(std::ostream&, const bool, DynamicList<floatScalar>&);
00071         static void write(std::ostream&, const bool, labelList&);
00072         static void write(std::ostream&, const bool, DynamicList<label>&);
00073 
00074 
00075     // Write header
00076 
00077         static void writeHeader(std::ostream&, const bool, const string&);
00078         static void writeCellDataHeader(std::ostream&, const label, const label);
00079         static void writePointDataHeader
00080         (
00081             std::ostream&,
00082             const label,
00083             const label
00084         );
00085 
00086 
00087     // Convert to VTK and store
00088 
00089         static void insert(const scalar&, DynamicList<floatScalar>&);
00090         static void insert(const point&, DynamicList<floatScalar>&);
00091         static void insert(const sphericalTensor&, DynamicList<floatScalar>&);
00092         static void insert(const symmTensor&, DynamicList<floatScalar>&);
00093         static void insert(const tensor&, DynamicList<floatScalar>&);
00094 
00095 
00096     //- Append elements to DynamicList
00097     static void insert(const labelList&, DynamicList<label>&);
00098     template<class Type>
00099     static void insert(const List<Type>&, DynamicList<floatScalar>&);
00100 
00101     //- Write volField with cell values (including decomposed cells)
00102     template<class Type>
00103     static void write
00104     (
00105         std::ostream&,
00106         const bool binary,
00107         const GeometricField<Type, fvPatchField, volMesh>&,
00108         const vtkMesh&
00109     );
00110 
00111     //- Write pointField on all mesh points. Interpolate to cell centre
00112     //  for decomposed cell centres.
00113     template<class Type>
00114     static void write
00115     (
00116         std::ostream&,
00117         const bool binary,
00118         const GeometricField<Type, pointPatchField, pointMesh>&,
00119         const vtkMesh&
00120     );
00121 
00122     //- Write interpolated field on points and original cell values on
00123     //  decomposed cell centres.
00124     template<class Type>
00125     static void write
00126     (
00127         std::ostream&,
00128         const bool binary,
00129         const GeometricField<Type, fvPatchField, volMesh>&,
00130         const GeometricField<Type, pointPatchField, pointMesh>&,
00131         const vtkMesh&
00132     );
00133 
00134     //- Write generic GeometricFields
00135     template<class Type, template<class> class PatchField, class GeoMesh>
00136     static void write
00137     (
00138         std::ostream&,
00139         const bool binary,
00140         const PtrList<GeometricField<Type, PatchField, GeoMesh> >&,
00141         const vtkMesh&
00142     );
00143 
00144     //- Interpolate and write volFields
00145     template<class Type>
00146     static void write
00147     (
00148         std::ostream&,
00149         const bool binary,
00150         const volPointInterpolation&,
00151         const PtrList<GeometricField<Type, fvPatchField, volMesh> >&,
00152         const vtkMesh&
00153     );
00154 };
00155 
00156 
00157 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00158 
00159 } // End namespace Foam
00160 
00161 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00162 
00163 #ifdef NoRepository
00164 #   include "writeFunsTemplates.C"
00165 #endif
00166 
00167 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00168 
00169 #endif
00170 
00171 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd