26 #include "writeFuns.H" 29 #include <standards.h> 30 #include <sys/endian.h> 33 #if defined(LITTLE_ENDIAN) \ 34 || defined(_LITTLE_ENDIAN) \ 35 || defined(__LITTLE_ENDIAN) 36 #define LITTLEENDIAN 1 37 #elif defined(BIG_ENDIAN) || defined(_BIG_ENDIAN) || defined(__BIG_ENDIAN) 40 #error "Cannot find LITTLE_ENDIAN or BIG_ENDIAN symbol defined." 41 #error "Please add to compilation options" 46 void Foam::writeFuns::swapWord(int32_t& word32)
48 char* mem =
reinterpret_cast<char*
>(&word32);
60 void Foam::writeFuns::swapWords(
const label nWords, int32_t* words32)
62 for (
label i=0; i<nWords; i++)
73 List<floatScalar>& fField
79 swapWords(fField.size(),
reinterpret_cast<int32_t*
>(fField.begin()));
84 reinterpret_cast<char*>(fField.begin()),
85 fField.size()*
sizeof(float)
94 os << fField[i] <<
' ';
96 if (i > 0 && (i % 10) == 0)
110 DynamicList<floatScalar>& fField
113 List<floatScalar>& fld = fField.shrink();
114 write(os, binary, fld);
130 (
sizeof(
label)/4)*elems.size(),
131 reinterpret_cast<int32_t*
>(elems.begin())
136 reinterpret_cast<char*>(elems.begin()),
137 elems.size()*
sizeof(
label)
146 os << elems[i] <<
' ';
148 if (i > 0 && (i % 10) == 0)
162 DynamicList<label>& elems
166 write(os, binary, fld);
172 dest.append(
float(pt.x()));
173 dest.append(
float(pt.y()));
174 dest.append(
float(pt.z()));
182 dest.append(source[i]);
189 const List<scalar>& source,
190 DynamicList<floatScalar>& dest
195 dest.append(
float(source[i]));
203 const List<scalar>& source,
204 DynamicList<floatScalar>& dest
209 dest.append(
float(source[map[i]]));
216 const List<point>& source,
217 DynamicList<floatScalar>& dest
229 const List<point>& source,
230 DynamicList<floatScalar>& dest
235 insert(source[map[i]], dest);
#define forAll(list, i)
Loop across all elements in list.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Ostream & endl(Ostream &os)
Add newline and flush stream.
static void insert(const point &, DynamicList< floatScalar > &dest)
Append point to given DynamicList.
List< label > labelList
A List of labels.
static void write(std::ostream &, const bool, DynamicList< floatScalar > &)
Write floats ascii or binary.
vector point
Point is a vector.