Newer
Older
#pragma once
#include <cstddef>
#include <string>
Thomas Steinreiter
committed
#include <tuple>
struct HeaderInfo {
Size GlobalSize;
std::size_t HeaderLength;
};
static HeaderInfo ReadHeader(const std::string& path);
static void WriteHeader(const HeaderInfo& header, const std::string& path,
const MpiEnvironment& env);
Thomas Steinreiter
committed
static SizeCoord GetTileSizeCoord(Size globalSize, Size gridSize, std::size_t rank);
// helper class to share commonly used data for reading and writing
class Tile {
static constexpr std::size_t LF = 1; // linefeed chars
const std::string& _path;
const std::size_t _headerLength;
const Size _srcSize;
const Size _gridSize;
const std::size_t _rank;
Thomas Steinreiter
committed
const SizeCoord _tileSizeCoord;
Thomas Steinreiter
committed
const Coord _tileCoord;
const MpiSubarray _tileType;
const MpiSubarray _bufType;
const std::size_t _displ;
public:
Tile(const std::string& path, HeaderInfo header, Size gridSize,