29 #include <standards.h> 30 #include <sys/endian.h> 34 #ifdef __DARWIN_BYTE_ORDER 35 #if __DARWIN_BYTE_ORDER==__DARWIN_BIG_ENDIAN 42 #if defined(LITTLE_ENDIAN) \ 43 || defined(_LITTLE_ENDIAN) \ 44 || defined(__LITTLE_ENDIAN) 45 #define LITTLEENDIAN 1 46 #elif defined(BIG_ENDIAN) || defined(_BIG_ENDIAN) || defined(__BIG_ENDIAN) 49 #error "Cannot find LITTLE_ENDIAN or BIG_ENDIAN symbol defined." 50 #error "Please add to compilation options" 57 char* mem =
reinterpret_cast<char*
>(&word32);
71 for (
label i = 0; i < nWords; i++)
82 List<floatScalar>& fField
88 swapWords(fField.size(),
reinterpret_cast<label*
>(fField.begin()));
92 reinterpret_cast<char*>(fField.begin()),
93 fField.size()*
sizeof(float)
104 if (i > 0 && (i % 10) == 0)
122 DynamicList<floatScalar>& fField
125 List<floatScalar>& fld = fField.shrink();
127 write(os, binary, fld);
145 reinterpret_cast<char*>(elems.begin()),
146 elems.size()*
sizeof(
label)
157 if (i > 0 && (i % 10) == 0)
175 DynamicList<label>& elems
180 write(os, binary, fld);
188 const std::string& title
191 os <<
"# vtk DataFile Version 2.0" << std::endl
212 os <<
"CELL_DATA " << nCells << std::endl
213 <<
"FIELD attributes " << nFields <<
std::endl;
224 os <<
"POINT_DATA " << nPoints << std::endl
225 <<
"FIELD attributes " << nFields <<
std::endl;
231 dest.append(
float(src));
238 DynamicList<floatScalar>& dest
243 dest.append(
float(src[cmpt]));
251 DynamicList<floatScalar>& dest
256 dest.append(
float(src[cmpt]));
264 DynamicList<floatScalar>& dest
267 dest.append(
float(src.xx()));
268 dest.append(
float(src.yy()));
269 dest.append(
float(src.zz()));
270 dest.append(
float(src.xy()));
271 dest.append(
float(src.yz()));
272 dest.append(
float(src.xz()));
279 DynamicList<floatScalar>& dest
284 dest.append(
float(src[cmpt]));
298 const List<scalar>& source,
299 DynamicList<floatScalar>& dest
304 dest.append(
float(source[map[i]]));
311 const List<point>& source,
312 DynamicList<floatScalar>& dest
325 const List<point>& source,
326 DynamicList<floatScalar>& dest
331 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.
void writeCellDataHeader(std::ostream &, const label nCells, const label nFields)
Vector< scalar > vector
A scalar version of the templated Vector.
void insert(const scalar, DynamicList< floatScalar > &)
Append scalar to given DynamicList.
static const direction nComponents
Number of components in this vector space.
void swapWords(const label nWords, label *words32)
Swap halves of word.
void writeHeader(std::ostream &, const bool isBinary, const std::string &title)
Write header.
SymmTensor< scalar > symmTensor
SymmTensor of scalars.
void write(std::ostream &os, const bool binary, List< floatScalar > &fField)
Write floats ascii or binary.
List< label > labelList
A List of labels.
void writePointDataHeader(std::ostream &, const label nPoints, const label nFields)
SphericalTensor< scalar > sphericalTensor
SphericalTensor of scalars.
Tensor< scalar > tensor
Tensor of scalars.
void swapWord(label &word32)
Swap halves of word.