7#include <kernel/geometry/voxel_map.hpp>
22 typedef std::int64_t
i64;
24 typedef std::uint64_t
u64;
36 _out_of_bounds_value(true),
42 _create_stage(
other._create_stage),
43 _bbox_min(
other._bbox_min),
44 _bbox_max(
other._bbox_max),
45 _num_points(
other._num_points),
46 _stride_line(
other._stride_line),
47 _stride_plane(
other._stride_plane),
48 _num_lines(
other._num_lines),
49 _num_planes(
other._num_planes),
50 _voxel_map(std::forward<std::vector<char>>(
other._voxel_map)),
51 _out_of_bounds_value(
other._out_of_bounds_value),
52 _coverage(
other._coverage)
64 _bbox_max =
other._bbox_max;
84 XASSERTM(x_min < x_max,
"invalid X dimensions for voxel map bounding box");
85 XASSERTM(y_min < y_max,
"invalid Y dimensions for voxel map bounding box");
91 XASSERTM(
_bbox_min[0u] + 1 < _bbox_max[0u],
"bounding box is too small in X dimension");
92 XASSERTM(
_bbox_min[1u] + 1 < _bbox_max[1u],
"bounding box is too small in Y dimension");
97 XASSERTM(x_min < x_max,
"invalid X dimensions for voxel map bounding box");
98 XASSERTM(y_min < y_max,
"invalid Y dimensions for voxel map bounding box");
99 XASSERTM(z_min < z_max,
"invalid Z dimensions for voxel map bounding box");
106 XASSERTM(
_bbox_min[0u] + 1 < _bbox_max[0u],
"bounding box is too small in X dimension");
107 XASSERTM(
_bbox_min[1u] + 1 < _bbox_max[1u],
"bounding box is too small in Y dimension");
108 XASSERTM(
_bbox_min[2u] + 1 < _bbox_max[2u],
"bounding box is too small in Z dimension");
132 XASSERTM(max_res > 1E-12,
"invalid resolution for voxel map");
141#ifdef FEAT_HAVE_FPARSER
145 XABORTM(
"FEAT is not build and lined against FPARSER third-party library!");
154#ifdef FEAT_HAVE_FPARSER
158 XABORTM(
"FEAT is not build and lined against FPARSER third-party library!");
167 XASSERTM(
_bbox_min[2u] < _bbox_max[2u],
"CGAL OFF voxel map creation is only available in 3D");
168 std::stringstream sstr;
175 XASSERTM(
_bbox_min[2u] < _bbox_max[2u],
"CGAL OFF voxel map creation is only available in 3D");
181 XABORTM(
"FEAT is not build and linked against CGAL third-party library!");
191 std::ofstream ofs(filename, std::ios_base::out | std::ios_base::binary);
192 if(!ofs.is_open() || !ofs.good())
195 return write(ofs, compress_block_size, compress_level);
200 std::size_t written = 0u;
204 memset(&header, 0,
sizeof(header));
206 header.header_size =
sizeof(header);
208 header.max_x = _bbox_max[0];
212 header.max_y = _bbox_max[1];
216 header.max_z = _bbox_max[2];
226 if(compress_block_size > 0u)
228 XASSERTM(compress_block_size < 1024u,
"maximum compression block size is 1024 MB");
231 header.planes_per_block = (compress_block_size*1024ull*1024ull) /
_stride_plane;
232 XASSERTM(header.planes_per_block > 0ull,
"compression block size is to small to hold a single plane!");
234 header.num_blocks = (
_num_planes + header.planes_per_block - 1u) / header.planes_per_block;
235 XASSERTM(header.num_blocks > 0ull,
"invalid number of compression blocks!");
240 os.write(
reinterpret_cast<char*
>(&header),
sizeof(header));
241 written +=
sizeof(header);
244 if(header.num_blocks == 0ull)
247 os.write(
reinterpret_cast<const char*
>(
_voxel_map.data()), std::streamsize(header.stride_volume));
248 return WriteResult(written + header.stride_volume);
253 XASSERTM(header.planes_per_block *
_stride_plane < 1073741824ull,
"voxel map plane compression block size is too big");
256 std::vector<std::vector<char>> compress_buffers(header.num_blocks);
259 std::vector<u64> compress_blocks(header.num_blocks, 0u);
268 FEAT_PRAGMA_OMP(parallel
for schedule(dynamic,1) reduction(+:failures))
269 for(
u64 iblock = 0; iblock < header.num_blocks; ++iblock)
272 u64 first_plane = iblock * header.planes_per_block;
276 u64 buffer_size =
u64(::compressBound(uLong(block_bytes)));
279 compress_buffers[iblock].resize(buffer_size);
282 uLongf dest_size = uLongf(buffer_size);
285 int rtn = ::compress2(
reinterpret_cast<Bytef*
>(compress_buffers[iblock].data()), &dest_size,
296 compress_blocks[iblock] =
u64(dest_size);
300 XASSERTM(failures == 0,
"ZLIB failed to compress at least one plane block!");
303 os.write(
reinterpret_cast<const char*
>(compress_blocks.data()), std::streamsize(compress_blocks.size() *
sizeof(
u64)));
304 written += compress_blocks.size() *
sizeof(
u64);
307 u64 compress_size = 0u;
308 for(std::size_t i(0); i < compress_buffers.size(); ++i)
310 os.write(
reinterpret_cast<const char*
>(compress_buffers[i].data()), std::streamsize(compress_blocks[i]));
311 written += compress_blocks[i];
312 compress_size += compress_blocks[i];
316 return WriteResult(written, compress_block_size,
u64(compress_level), compress_buffers.size(), compress_size);
319 (void)compress_block_size;
320 (void)compress_level;
329 return read(stream, filename);
336 memset(&header, 0,
sizeof(header));
339 if(!is.read(
reinterpret_cast<char*
>(&header),
sizeof(header)).good())
342 u64 bytes_read =
sizeof(header);
353 if((header.num_x > 0u) && (header.max_x <= header.min_x))
355 if((header.num_y > 0u) && (header.max_y <= header.min_y))
357 if((header.num_z > 0u) && (header.max_z <= header.min_z))
359 if((header.num_x == 0u) && (header.max_x != header.min_x))
361 if((header.num_y == 0u) && (header.max_y != header.min_y))
363 if((header.num_z == 0u) && (header.max_z != header.min_z))
365 if(header.stride_line*8u < header.num_x)
367 if((header.stride_line & 0xF) != 0)
369 if(header.stride_plane < header.num_y * header.stride_line)
371 if((header.stride_plane & 0xF) != 0)
373 if(header.stride_volume < header.num_z * header.stride_plane)
375 if((header.stride_volume & 0xF) != 0)
380 _bbox_max[0u] = header.max_x;
382 _bbox_max[1u] = header.max_y;
384 _bbox_max[2u] = header.max_z;
398 if(header.num_blocks == 0u)
401 if(!is.read(
_voxel_map.data(), std::streamsize(header.stride_volume)).good())
402 throw VoxelMapFileError(filename,
"Failed to read uncompressed voxel map buffer");
403 bytes_read +=
u64(is.gcount());
411 std::vector<u64> blocks(header.num_blocks);
412 if(!is.read(
reinterpret_cast<char*
>(blocks.data()), std::streamsize(header.num_blocks *
sizeof(
u64))).good())
413 throw VoxelMapFileError(filename,
"Failed to read voxel map compression blocks");
414 bytes_read +=
u64(is.gcount());
417 std::vector<std::size_t> buffer_offset(header.num_blocks + 1u);
418 buffer_offset[0u] = 0u;
419 for(std::size_t i(0); i < blocks.size(); ++i)
420 buffer_offset[i+1u] = buffer_offset[i] + blocks[i];
423 std::vector<char> compression_buffer(buffer_offset.back());
424 if(!is.read(compression_buffer.data(), std::streamsize(compression_buffer.size())).good())
426 bytes_read +=
u64(is.gcount());
432 FEAT_PRAGMA_OMP(parallel
for schedule(dynamic,1) reduction(+:failures))
433 for(
u64 iblock = 0; iblock < header.num_blocks; ++iblock)
435 u64 first_plane = iblock * header.planes_per_block;
437 u64 compress_size = blocks[iblock];
440 uLongf dest_size = uLongf(block_bytes);
442 reinterpret_cast<const Bytef*
>(&compression_buffer[buffer_offset[iblock]]), uLong(compress_size));
452 XASSERTM(failures == 0,
"ZLIB failed to decompress at least one plane block!");
453 return ReadResult(bytes_read, header.num_blocks, compression_buffer.size());
455 XABORTM(
"Cannot read compressed voxel map file, because FEAT was compiled without the ZLIB third-party library");
466 std::ofstream ofs(filename, std::ios_base::binary);
474 std::ofstream ofs(filename, std::ios_base::binary);
486 XASSERTM(depth <= 20000,
"render width is too big for BMP export!");
487 for(
i64 iplane(0); iplane <
i64(depth); ++iplane)
490 std::ofstream ofs(filename, std::ios_base::binary);
500 std::ofstream ofs(filename, std::ios_base::binary);
527 FEAT_PRAGMA_OMP(parallel
for reduction(+:count))
528 for(
u64 i = 0u; i < n; ++i)
530 for(
int k = 0; k < 8; ++k)
639 return (this->
_voxel_map[(xidx >> 3)] >> (xidx & 0x7)) & 0x1;
646 if((xidx|yidx) == ~
u64(0))
656 if((xidx|yidx|zidx) == ~
u64(0))
664 for(
u64 xidx(box_min[0]); xidx <= box_max[0]; ++xidx)
666 if((this->
_voxel_map[(xidx >> 3)] >> (xidx & 0x7)) & 0x1)
674 for(
u64 yidx(box_min[1]); yidx <= box_max[1]; ++yidx)
676 for(
u64 xidx(box_min[0]); xidx <= box_max[0]; ++xidx)
687 for(
u64 zidx(box_min[2]); zidx <= box_max[2]; ++zidx)
689 for(
u64 yidx(box_min[1]); yidx <= box_max[1]; ++yidx)
692 for(
u64 xidx(box_min[0]); xidx <= box_max[0]; ++xidx)
776 Real v0 = v01 + (v00 - v01) * s0;
777 Real v1 = v10 + (v11 - v10) * s1;
781 if(xidx1 == xidx0 + 1)
782 return Real(0.5) * (v0 + v1);
823 Real result =
Real(0.5) * (s0*v0 + s1*v1);
826 if(xidx1 == xidx0 + 2)
839 for(
i64 i = xidx0+2; i < xidx1-1; ++i)
843 return result / (
Real(xidx1 - xidx0 - 2) + s0 + s1);
869 Real v0 = v01 + (v00 - v01) * s0;
870 Real v1 = v10 + (v11 - v10) * s1;
874 if(yidx1 == yidx0 + 1)
875 return Real(0.5) * (v0 + v1);
880 Real result =
Real(0.5) * (s0*v0 + s1*v1);
883 if(yidx1 == yidx0 + 2)
886 result +=
Real(0.5) * (s0 + s1) *
_sample_box_1d(px0, px1, xidx0, xidx1, yidx0+1, zidx);
896 for(
i64 i = yidx0+2; i < yidx1-1; ++i)
900 return result / (
Real(yidx1 - yidx0 - 2) + s0 +s1);
903 Real VoxelMap::_sample_box_3d(
i64 px0,
i64 px1,
i64 py0,
i64 py1,
i64 pz0,
i64 pz1,
i64 xidx0,
i64 xidx1,
i64 yidx0,
i64 yidx1,
i64 zidx0,
i64 zidx1)
const
926 Real v0 = v01 + (v00 - v01) * s0;
927 Real v1 = v10 + (v11 - v10) * s1;
931 if(zidx1 == zidx0 + 1)
932 return Real(0.5) * (v0 + v1);
937 Real result =
Real(0.5) * (s0*v0 + s1*v1);
940 if(zidx1 == zidx0 + 2)
943 result +=
Real(0.5) * (s0 + s1) *
_sample_box_2d(px0, px1, py0, py1, xidx0, xidx1, yidx0, yidx1, zidx0+1);
948 result +=
Real(0.5) * (s0 +
Real(1)) *
_sample_box_2d(px0, px1, py0, py1, xidx0, xidx1, yidx0, yidx1, zidx0+1);
949 result +=
Real(0.5) * (s1 +
Real(1)) *
_sample_box_2d(px0, px1, py0, py1, xidx0, xidx1, yidx0, yidx1, zidx1-1);
953 for(
i64 i = zidx0+2; i < zidx1-1; ++i)
954 result +=
_sample_box_2d(px0, px1, py0, py1, xidx0, xidx1, yidx0, yidx1, i);
957 return result / (
Real(zidx1 - zidx0 - 2) + s0 +s1);
972 return _sample_box_2d(box_min[0], box_max[0], box_min[1], box_max[1],
985 return _sample_box_3d(box_min[0], box_max[0], box_min[1], box_max[1], box_min[2], box_max[2],
990 return _sample_box_2d(box_min[0], box_max[0], box_min[1], box_max[1],
1003 const u64 n =
u64(mask.size());
1005 for(u64 i(0); i < n; ++i)
1007 _voxel_map[off + (i >> 3)] |=
char(
char(mask[i] != 0) << char(i & 0x7));
1019 typedef std::uint16_t u16;
1020 typedef std::uint32_t u32;
1027 u32 stride = ((width + 31u) & ~31u) >> 3;
1032 os.write((
char*)&magic, 2u);
1034 u32 filesize = 62u + height * stride;
1035 os.write((
char*)&filesize, 4u);
1038 os.write((
char*)&zeros, 4u);
1040 u32 offbits = 54u + 2u*4u;
1041 os.write((
char*)&offbits, 4u);
1046 os.write((
char*)&bisize, 4u);
1048 os.write((
char*)&width, 4u);
1049 os.write((
char*)&height, 4u);
1052 os.write((
char*)&planes, 2u);
1055 os.write((
char*)&bitcount, 2u);
1057 os.write((
char*)&zeros, 4u);
1059 u32 size_image = height * stride;
1060 os.write((
char*)&size_image, 4u);
1062 u32 px_per_m = 3780;
1063 os.write((
char*)&px_per_m, 4u);
1064 os.write((
char*)&px_per_m, 4u);
1067 os.write((
char*)&clr_used, 4u);
1069 os.write((
char*)&zeros, 4u);
1072 u32 clr_black = 0u, clr_white = ~u32(0);
1073 os.write((
char*)&clr_black, 4u);
1074 os.write((
char*)&clr_white, 4u);
1076 std::vector<char> linebuffer(stride);
1077 char* oline = linebuffer.data();
1080 for(u32 i(0); i < height; ++i)
1083 for(u32 j(0); j < stride; ++j)
1084 for(
int k(0); k < 8; ++k)
1085 (oline[j] <<= 1) |= ((iline[j] >> k) & 1);
1086 os.write(oline, stride);
1094 XASSERTM(width <= 20000,
"render width is too big for BMP export!");
1095 XASSERTM(height <= 20000,
"render width is too big for BMP export!");
1096 XASSERTM(box_min_z < box_max_z,
"invalid depth for voxel map render!");
1098 XASSERTM(box_max_z <= _bbox_max[2],
"invalid depth for voxel map render!");
1100 typedef std::uint8_t u8;
1101 typedef std::uint16_t u16;
1102 typedef std::uint32_t u32;
1105 u32 width2 = u32(width);
1106 u32 height2 = u32(height);
1109 u32 stride = ((width2*8 + 31u) & ~31u) >> 3;
1114 os.write((
char*)&magic, 2u);
1116 u32 filesize = 54u + height2 * stride + 256u*4u;
1117 os.write((
char*)&filesize, 4u);
1120 os.write((
char*)&zeros, 4u);
1122 u32 offbits = 54u + 256u*4u;
1123 os.write((
char*)&offbits, 4u);
1128 os.write((
char*)&bisize, 4u);
1130 os.write((
char*)&width2, 4u);
1131 os.write((
char*)&height2, 4u);
1134 os.write((
char*)&planes, 2u);
1137 os.write((
char*)&bitcount, 2u);
1139 os.write((
char*)&zeros, 4u);
1141 u32 size_image = height2 * stride;
1142 os.write((
char*)&size_image, 4u);
1144 u32 px_per_m = 3780;
1145 os.write((
char*)&px_per_m, 4u);
1146 os.write((
char*)&px_per_m, 4u);
1148 u32 clr_used = 256u;
1149 os.write((
char*)&clr_used, 4u);
1151 os.write((
char*)&zeros, 4u);
1154 std::vector<u32> colors(256);
1155 for(u32 i = 0u; i < 256u; ++i)
1157 colors[i] = i | (i << 8) | (i << 16);
1159 os.write((
char*)colors.data(), 256u*4u);
1161 std::vector<u8> linebuffer(stride);
1162 u8* oline = linebuffer.data();
1165 std::array<i64, 3u> box_min, box_max;
1166 box_min[2u] = box_min_z;
1167 box_max[2u] = box_max_z;
1169 const i64 ih =
i64(height);
1170 const i64 jw =
i64(width);
1173 for(
i64 i(0); i < ih; ++i)
1177 for(
i64 j(0); j < jw; ++j)
1182 oline[j] = (w <= 0.0 ? 0 : (w >= 255.0 ? 255 : u8(w)));
1184 os.write((
char*)oline, stride);
#define ASSERT(expr)
Debug-Assertion macro definition.
#define XABORTM(msg)
Abortion macro definition with custom message.
#define ASSERTM(expr, msg)
Debug-Assertion macro definition with custom message.
#define XASSERT(expr)
Assertion macro definition.
#define XASSERTM(expr, msg)
Assertion macro definition with custom message.
static void read_common(std::stringstream &stream, const String &filename, const Dist::Comm &comm, int root_rank=0)
Reads a common text file for all ranks.
File-Not-Created exception.
Wrapper for the CGAL Library.
Voxel masker implementation for CGAL wrapper.
helper class for read function result
helper class for write function result
Error class for VoxelMap related file errors.
i64 _map_coord_idx_lower(i64 xyz, std::size_t sdim) const
Maps a unit coordinate to a X-/Y-/Z-index of the lower voxel in the voxel map.
bool _check_point_nearest(const std::array< i64, 1 > &p) const
Checks the nearest voxel map entry for a given 1D point.
static constexpr u64 header_size
size of voxel map header in bytes
Real _sample_box_1d(i64 px0, i64 px1, i64 xidx0, i64 xidx1, i64 yidx=i64(0), i64 zidx=i64(0)) const
Helper function for _sample_box: samples a 1D edge in X line.
Real _calc_sample_rate(i64 xyz, i64 idx, std::size_t sdim) const
Helper function for _sample_voxel_map_Xd: compute the sample rate in a given dimension.
std::vector< char > _voxel_map
the actual voxel map; its size may be larger than necessary due to padding
void export_to_bmp(const String &filename_prefix) const
Exports the voxel map to a sequence of monochrome BMP image files.
bool _check_point(i64 xidx, i64 yidx, i64 zidx) const
Helper function for _sample_point: checks a single voxel point value.
WriteResult write(const String &filename, const u64 compress_block_size=128u, const int compress_level=9) const
Writes the voxel map into a file that can later be read in.
void render_to_bmp(const String &filename_prefix, Index width, Index height, Index depth) const
Renders the voxel map to a sequence of gray-scale BMP image files.
void _export_plane_to_bmp(std::ostream &os, u64 plane) const
Exports a single plane of the voxel map to a monochrome BMP image file.
i64 _map_coord_idx_upper(i64 xyz, std::size_t sdim) const
Maps a unit coordinate to a X-/Y-/Z-index of the upper voxel in the voxel map.
Real _sample_point_1d_y(i64 py, i64 xidx, i64 yidx, i64 zidx=i64(0)) const
Helper function for _sample_point: samples a 1D edge in Y-parallel line.
Real _sample_box_2d(i64 px0, i64 px1, i64 py0, i64 py1, i64 xidx0, i64 xidx1, i64 yidx0, i64 yidx1, i64 zidx=i64(0)) const
Helper function for _sample_box: samples a 2D rectangle in XY plane.
std::array< u64, 3u > _num_points
number of points in each dimension
Real _sample_box_3d(i64 px0, i64 px1, i64 py0, i64 py1, i64 pz0, i64 pz1, i64 xidx0, i64 xidx1, i64 yidx0, i64 yidx1, i64 zidx0, i64 zidx1) const
Helper function for _sample_box: samples a 3D cuboid in XYZ volume.
void _compress_voxel_map_line(const std::vector< int > &mask, const u64 line)
Compresses a voxel map line into the voxel map.
u64 _compute_domain_coverage() const
Computes the domain coverage of the voxel map.
void export_plane_to_bmp(const String &filename, Real z_coord) const
Exports a single plane of the voxel map to a monochrome BMP image file.
void _compute_voxel_map(const Dist::Comm &comm, VoxelMasker< CoordType, dim_ > &masker, bool gather_to_all)
Computes the voxel map for the domain.
static constexpr u64 magic_number
voxel map magic number
Real get_bounding_box_volume() const
Returns the volume of the 1D/2D/3D voxel map bounding box.
u64 _num_planes
number of planes; 2D = 1; 3D = num_points[3]
std::uint64_t u64
unsigned 64-bit integer type
Real _sample_point_1d_z(i64 pz, i64 xidx, i64 yidx, i64 zidx) const
Helper function for _sample_point: samples a 1D edge in Z-parallel line.
Index get_num_voxels() const
Returns the total number of voxels in the voxel map.
void set_resolution(Real max_res)
Sets the resolution for the voxel map, i.e. the maximum voxel size in each dimension.
u64 _stride_line
stride of a single voxel line in X dimension
void compute_map_from_formula_3d(const Dist::Comm &comm, const String &formula, bool gather_to_all=true)
Creates the voxel map based on a 3D formula by utilizing MPI parallelization.
void set_num_points(Index num_x, Index num_y, Index num_z=0u)
Sets the number of points of the voxel map in each dimension.
virtual ~VoxelMap()
virtual destructor
void render_plane_to_bmp(const String &filename, Index width, Index height, Real z_min, Real z_max) const
Renders a plane range of voxel map to a single gray-scale BMP image file.
std::int64_t i64
signed 64-bit integer type
Real _sample_point_1d_x(i64 px, i64 xidx, i64 yidx=i64(0), i64 zidx=i64(0)) const
Helper function for _sample_point: samples a 1D edge in X-parallel line.
void compute_map_from_off_3d(const Dist::Comm &comm, const String &filename, bool invert, bool gather_to_all=true)
Creates the voxel map based on a 3D OFF model handled by CGAL by utilizing MPI parallelization.
u64 _stride_plane
stride of a single plane in XY dimensions
u64 _coverage
the coverage of the domain, relative to unit size
void set_bounding_box_2d(Real x_min, Real x_max, Real y_min, Real y_max)
Sets the bounding box for a 2D voxel map.
Real _sample_point_2d(i64 px, i64 py, i64 xidx, i64 yidx, i64 zidx=i64(0)) const
Helper function for _sample_point: samples a 2D square in XY-parallel plane.
static constexpr i64 unit_size
size of a real unit (meter) in our internal units (nanometers)
bool _out_of_bounds_value
the out-of-bounds-value for the voxel map
ReadResult read(const Dist::Comm &comm, const String &filename)
Reads a voxel map from a file.
std::array< i64, 3u > _bbox_min
bounding box dimensions of domain
bool _check_box(const std::array< u64, 1 > &box_min, const std::array< u64, 1 > &box_max) const
Checks whether a 1D box contains at least one active voxel.
void compute_map_from_formula_2d(const Dist::Comm &comm, const String &formula, bool gather_to_all=true)
Creates the voxel map based on a 2D formula by utilizing MPI parallelization.
Real _sample_point(const std::array< i64, 1 > &p) const
Samples the voxel map for a given 1D point by multi-linear interpolation.
int _create_stage
current creation stage
u64 _map_coord_idx_nearest(i64 xyz, std::size_t sdim) const
Maps a unit coordinate to a X-/Y-/Z-index of the closest voxel in the voxel map.
VoxelMap()
standard constructor
Real _sample_point_3d(i64 px, i64 py, i64 pz, i64 xidx, i64 yidx, i64 zidx) const
Helper function for _sample_point: samples a 3D cube in XYZ volume.
void set_bounding_box_3d(Real x_min, Real x_max, Real y_min, Real y_max, Real z_min, Real z_max)
Sets the bounding box for a 3D voxel map.
void _render_plane_to_bmp(std::ostream &os, Index width, Index height, i64 box_min_z, i64 box_max_z) const
Renders a plane range of voxel map to a single gray-scale BMP image file.
static u64 calc_line_stride(u64 num_x)
ensure that we're not compiling on some freak architecture...
Real _sample_box(const std::array< i64, 1 > &box_min, const std::array< i64, 1 > &box_max) const
Samples a 1D box of the voxel map.
u64 _num_lines
number of lines; 2D = num_points[2]; 3D: = num_points[2] * num_points[3]
String class implementation.
String pad_front(size_type len, char c=' ') const
Pads the front of the string up to a desired length.
std::uint64_t u64
unsigned 64-bit integer type
@ other
generic/other permutation strategy
std::int64_t i64
signed 64-bit integer type
T_ abs(T_ x)
Returns the absolute value.
T_ sqr(T_ x)
Returns the square of a value.
T_ min(T_ a, T_ b)
Returns the minimum of two values.
T_ cub(T_ x)
Returns the cube of a value.
T_ max(T_ a, T_ b)
Returns the maximum of two values.
double Real
Real data type.
String stringify(const T_ &item)
Converts an item into a String.
std::uint64_t Index
Index data type.