FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

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-2010 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
00013     the Free Software Foundation, either version 3 of the License, or
00014     (at your 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, see <http://www.gnu.org/licenses/>.
00023 
00024 Class
00025     Foam::writeFuns
00026 
00027 Description
00028     Various functions for collecting and writing binary data.
00029 
00030 SourceFiles
00031     writeFuns.C
00032 
00033 \*---------------------------------------------------------------------------*/
00034 
00035 #ifndef writeFuns_H
00036 #define writeFuns_H
00037 
00038 #include <OpenFOAM/floatScalar.H>
00039 #include <OpenFOAM/DynamicList.H>
00040 #include <finiteVolume/volFieldsFwd.H>
00041 #include <OpenFOAM/pointFieldsFwd.H>
00042 #include "vtkMesh.H"
00043 #include <finiteVolume/volPointInterpolation.H>
00044 
00045 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00046 
00047 namespace Foam
00048 {
00049 
00050 /*---------------------------------------------------------------------------*\
00051                            Class writeFuns Declaration
00052 \*---------------------------------------------------------------------------*/
00053 
00054 class writeFuns
00055 {
00056     // Private member functions
00057 
00058         // Swap halves of word.
00059 
00060             static void swapWord(label& word32);
00061             static void swapWords(const label nWords, label* words32);
00062 
00063 
00064 public:
00065 
00066     // Write ascii or binary. If binary optionally in-place swaps argument
00067 
00068         static void write(std::ostream&, const bool, List<floatScalar>&);
00069         static void write(std::ostream&, const bool, DynamicList<floatScalar>&);
00070         static void write(std::ostream&, const bool, labelList&);
00071         static void write(std::ostream&, const bool, DynamicList<label>&);
00072 
00073 
00074     // Write header
00075 
00076         static void writeHeader(std::ostream&, const bool, const string&);
00077         static void writeCellDataHeader(std::ostream&, const label, const label);
00078         static void writePointDataHeader
00079         (
00080             std::ostream&,
00081             const label,
00082             const label
00083         );
00084 
00085 
00086     // Convert to VTK and store
00087 
00088         static void insert(const scalar&, DynamicList<floatScalar>&);
00089         static void insert(const point&, DynamicList<floatScalar>&);
00090         static void insert(const sphericalTensor&, DynamicList<floatScalar>&);
00091         static void insert(const symmTensor&, DynamicList<floatScalar>&);
00092         static void insert(const tensor&, DynamicList<floatScalar>&);
00093 
00094 
00095     //- Append elements to DynamicList
00096     static void insert(const labelList&, DynamicList<label>&);
00097     template<class Type>
00098     static void insert(const List<Type>&, DynamicList<floatScalar>&);
00099 
00100     //- Write volField with cell values (including decomposed cells)
00101     template<class Type>
00102     static void write
00103     (
00104         std::ostream&,
00105         const bool binary,
00106         const GeometricField<Type, fvPatchField, volMesh>&,
00107         const vtkMesh&
00108     );
00109 
00110     //- Write pointField on all mesh points. Interpolate to cell centre
00111     //  for decomposed cell centres.
00112     template<class Type>
00113     static void write
00114     (
00115         std::ostream&,
00116         const bool binary,
00117         const GeometricField<Type, pointPatchField, pointMesh>&,
00118         const vtkMesh&
00119     );
00120 
00121     //- Write interpolated field on points and original cell values on
00122     //  decomposed cell centres.
00123     template<class Type>
00124     static void write
00125     (
00126         std::ostream&,
00127         const bool binary,
00128         const GeometricField<Type, fvPatchField, volMesh>&,
00129         const GeometricField<Type, pointPatchField, pointMesh>&,
00130         const vtkMesh&
00131     );
00132 
00133     //- Write generic GeometricFields
00134     template<class Type, template<class> class PatchField, class GeoMesh>
00135     static void write
00136     (
00137         std::ostream&,
00138         const bool binary,
00139         const PtrList<GeometricField<Type, PatchField, GeoMesh> >&,
00140         const vtkMesh&
00141     );
00142 
00143     //- Interpolate and write volFields
00144     template<class Type>
00145     static void write
00146     (
00147         std::ostream&,
00148         const bool binary,
00149         const volPointInterpolation&,
00150         const PtrList<GeometricField<Type, fvPatchField, volMesh> >&,
00151         const vtkMesh&
00152     );
00153 };
00154 
00155 
00156 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00157 
00158 } // End namespace Foam
00159 
00160 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00161 
00162 #ifdef NoRepository
00163 #   include "writeFunsTemplates.C"
00164 #endif
00165 
00166 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00167 
00168 #endif
00169 
00170 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines