8template<
typename FileWriter>
22 auto *bufIn = (
char *) &val;
23 auto *bufOut = (
char *) &result;
25 for (
int i = 0; i <
sizeof(T); i++) {
26 bufOut[
sizeof(T) - i - 1] = bufIn[i];
36 auto bytes = sprintf(buf,
"%021lu", this->pointCount);
39 this->writer->write(buf, bytes);
47template<
typename FileWriter,
typename fp =
float>
requires IoWriter<FileWriter> and std::is_floating_point_v<fp>
51 this->writer->write(
"# vtk DataFile Version 3.0\n"
54 "DATASET POLYDATA\nPOINTS 000000000000000000000 ");
55 if (
typeid(fp) ==
typeid(
float)) {
56 this->writer->write(
" float\n");
58 assert(
typeid(fp) ==
typeid(
double))
59 this->writer->write(
"double\n");
65 void add(fp x, fp y, fp z) {
67 int bytes = sprintf(buf,
"%.8e %.8e %.8e\n", x, y, z);
68 this->
writer->write(buf, bytes);
74 auto bytes = sprintf(buf,
"POINT_DATA %021lu\n", this->
pointCount);
76 this->
writer->write(buf, bytes);
81 auto bytes = sprintf(buf,
"SCALARS %s %s 1\nLOOKUP_TABLE default\n", name,
typeid(fp) ==
typeid(
float) ?
" float" :
"double");
83 this->
writer->write(buf, bytes);
88 int bytes = sprintf(buf,
"%.8e\n", value);
90 this->
writer->write(buf, bytes);
99template<
typename FileWriter,
typename fp =
float>
requires IoWriter<FileWriter> and std::is_floating_point_v<fp>
103 this->writer->write(
"# vtk DataFile Version 3.0\n"
106 "DATASET POLYDATA\nPOINTS 000000000000000000000 ");
107 if (
typeid(fp) ==
typeid(
float)) {
108 this->writer->write(
" float\n");
110 assert(
typeid(fp) ==
typeid(
double))
111 this->writer->write(
"double\n");
117 void add(fp x, fp y, fp z) {
119 auto *buf = (fp*) this->
writer->buffer(3 *
sizeof(fp));
137 auto bytes = sprintf(buf,
"POINT_DATA %021lu\n", this->
pointCount);
139 this->
writer->write(buf, bytes);
144 auto bytes = sprintf(buf,
"SCALARS %s %s 1\nLOOKUP_TABLE default\n", name,
typeid(fp) ==
typeid(
float) ?
" float" :
"double");
146 this->
writer->write(buf, bytes);
VtkPointAsciiWriter(FileWriter *writer)
VtkPointAsciiWriter()=default
void addScalarPointDataHeader(const char *name)
void add(fp x, fp y, fp z)
void addPointDataHeader()
VtkPointBinaryWriter(FileWriter *writer)
void add(fp x, fp y, fp z)
void addPointDataHeader()
void addScalarPointDataHeader(const char *name)
VtkPointBinaryWriter()=default
VtkPointWriterBase(FileWriter *writer)
VtkPointWriterBase()=default
constexpr int particleCountPosition() const