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/labelList.H> 00039 #include <OpenFOAM/floatScalar.H> 00040 #include <OpenFOAM/OFstream.H> 00041 #include <OpenFOAM/DynamicList.H> 00042 #include <OpenFOAM/point.H> 00043 00044 using namespace Foam; 00045 00046 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00047 00048 namespace Foam 00049 { 00050 00051 00052 /*---------------------------------------------------------------------------*\ 00053 Class writeFuns Declaration 00054 \*---------------------------------------------------------------------------*/ 00055 00056 class writeFuns 00057 { 00058 //- Swap halves of word. 00059 static void swapWord(label& word32); 00060 static void swapWords(const label nWords, label* words32); 00061 00062 public: 00063 00064 //- Write ascii or binary. If binary optionally in-place swaps argument 00065 static void write(std::ostream&, const bool, DynamicList<floatScalar>&); 00066 static void write(std::ostream&, const bool, DynamicList<label>&); 00067 00068 //- Write ascii or binary. If binary optionally in-place swaps argument 00069 static void write(std::ostream&, const bool, List<floatScalar>&); 00070 static void write(std::ostream&, const bool, labelList&); 00071 00072 //- Append point to DynamicList 00073 static void insert(const point&, DynamicList<floatScalar>& dest); 00074 00075 //- Append elements of labelList to DynamicList 00076 static void insert(const labelList&, DynamicList<label>&); 00077 //- Append elements of scalarList to DynamicList 00078 static void insert(const List<scalar>&, DynamicList<floatScalar>&); 00079 00080 //- Append elements of scalarList to DynamicList using map 00081 static void insert 00082 ( 00083 const labelList& map, 00084 const List<scalar>& source, 00085 DynamicList<floatScalar>& 00086 ); 00087 00088 //- Append points to DynamicList of floats 00089 static void insert(const List<point>& source, DynamicList<floatScalar>&); 00090 //- As above but using map 00091 static void insert 00092 ( 00093 const labelList& map, 00094 const List<point>& source, 00095 DynamicList<floatScalar>& 00096 ); 00097 00098 }; 00099 00100 00101 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00102 00103 } // End namespace Foam 00104 00105 00106 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00107 00108 #endif 00109 00110 // ************************ vim: set sw=4 sts=4 et: ************************ //