12 logger.
write(
"Cannot obtain file info from '", path.
native(),
"'");
18 table.
setCell(0, row,
"File name:");
21 table.
setCell(0, row,
"File version:");
22 table.
setCell(1, row, std::to_string(
int(info->version)));
24 table.
setCell(0, row,
"Particle count:");
25 table.
setCell(1, row, std::to_string(info->particleCnt));
27 table.
setCell(0, row,
"Material count:");
28 table.
setCell(1, row, std::to_string(info->materialCnt));
30 table.
setCell(0, row,
"Quantity count:");
31 table.
setCell(1, row, std::to_string(info->quantityCnt));
33 table.
setCell(0, row,
"Run time:");
34 table.
setCell(1, row, std::to_string(info->runTime));
36 table.
setCell(0, row,
"Time step:");
37 table.
setCell(1, row, std::to_string(info->timeStep));
39 table.
setCell(0, row,
"Wallclock time:");
42 table.
setCell(0, row,
"Run type:");
44 table.
setCell(1, row, EnumMap::toString<RunTypeEnum>(info->runType.
value()));
46 table.
setCell(1, row,
"unknown");
49 table.
setCell(0, row,
"Build date:");
50 if (info->buildDate) {
53 table.
setCell(1, row,
"unknown");
64 logger.
write(
"Cannot obtain file info from '", path.
native(),
"'");
70 table.
setCell(0, row,
"File name:");
73 table.
setCell(0, row,
"File version:");
74 table.
setCell(1, row, std::to_string(
int(info->version)));
76 table.
setCell(0, row,
"Particle count:");
77 table.
setCell(1, row, std::to_string(info->particleCnt));
79 table.
setCell(0, row,
"Run time:");
80 table.
setCell(1, row, std::to_string(info->runTime));
82 table.
setCell(0, row,
"Run type:");
83 table.
setCell(1, row, EnumMap::toString<RunTypeEnum>(info->runType));
88 int main(
int argc,
char* argv[]) {
90 if (argc != 2 || argv[1] == std::string(
"--help")) {
91 logger.
write(
"Usage: opensph-info file");
102 logger.
write(
"Unknown file format.");
uint32_t Size
Integral type used to index arrays (by default).
int main(int argc, char *argv[])
int printBinaryFileInfo(ILogger &logger, const Path &path)
int printCompressedFileInfo(ILogger &logger, const Path &path)
String getFormattedTime(const String &format)
Utility functions.
Helper container allowing to store strings in cells and print them into table.
Wrapper of type that either contains a value of given type, or an error message.
Type & value()
Returns the reference to expected value.
Interface providing generic (text, human readable) output of the program.
void write(TArgs &&... args)
Creates and logs a message by concatenating arguments.
Wrapper of type value of which may or may not be present.
INLINE Type valueOr(const TOther &other) const
Returns the stored value if the object has been initialized, otherwise returns provided parameter.
Object representing a path on a filesystem.
std::string native() const
Returns the native version of the path.
Path fileName() const
Returns the filename of the path.
std::string toString() const
Creates the text representation of the table.
void setCell(const Size colIdx, const Size rowIdx, std::string text)
Sets the text in given cell.
Optional< IoEnum > getIoEnum(const std::string &ext)
Returns the file type from file extension.