FreeFOAM The Cross-Platform CFD Toolkit
writeFuns.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
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
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
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.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::writeFuns
26 
27 Description
28  Various functions for collecting and writing binary data.
29 
30 SourceFiles
31  writeFuns.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef writeFuns_H
36 #define writeFuns_H
37 
38 #include <OpenFOAM/labelList.H>
39 #include <OpenFOAM/floatScalar.H>
40 #include <OpenFOAM/OFstream.H>
41 #include <OpenFOAM/DynamicList.H>
42 #include <OpenFOAM/point.H>
43 
44 using namespace Foam;
45 
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 
48 namespace Foam
49 {
50 
51 
52 /*---------------------------------------------------------------------------*\
53  Class writeFuns Declaration
54 \*---------------------------------------------------------------------------*/
55 
56 class writeFuns
57 {
58  //- Swap halves of word.
59  static void swapWord(label& word32);
60  static void swapWords(const label nWords, label* words32);
61 
62 public:
63 
64  //- Write ascii or binary. If binary optionally in-place swaps argument
65  static void write(std::ostream&, const bool, DynamicList<floatScalar>&);
66  static void write(std::ostream&, const bool, DynamicList<label>&);
67 
68  //- Write ascii or binary. If binary optionally in-place swaps argument
69  static void write(std::ostream&, const bool, List<floatScalar>&);
70  static void write(std::ostream&, const bool, labelList&);
71 
72  //- Append point to DynamicList
73  static void insert(const point&, DynamicList<floatScalar>& dest);
74 
75  //- Append elements of labelList to DynamicList
76  static void insert(const labelList&, DynamicList<label>&);
77  //- Append elements of scalarList to DynamicList
78  static void insert(const List<scalar>&, DynamicList<floatScalar>&);
79 
80  //- Append elements of scalarList to DynamicList using map
81  static void insert
82  (
83  const labelList& map,
84  const List<scalar>& source,
86  );
87 
88  //- Append points to DynamicList of floats
89  static void insert(const List<point>& source, DynamicList<floatScalar>&);
90  //- As above but using map
91  static void insert
92  (
93  const labelList& map,
94  const List<point>& source,
96  );
97 
98 };
99 
100 
101 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
102 
103 } // End namespace Foam
104 
105 
106 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
107 
108 #endif
109 
110 // ************************ vim: set sw=4 sts=4 et: ************************ //