Commit 57881f3e authored by Martin Heistermann's avatar Martin Heistermann
Browse files

wip

parent 9e66e062
Pipeline #18949 failed with stage
in 8 minutes and 31 seconds
......@@ -54,20 +54,22 @@ ReadCompatibility BinaryFileReader::compatibility()
static_assert(std::is_base_of_v<TopologyKernel, MeshT>);
read_header();
if (state_ == ReadState::Error) { // TODO: check for more generic error state!
error_msg_ = "Error reading header.";
return ReadCompatibility::InvalidFile;
}
if (file_header_.header_version > 0) {
if (file_header_.header_version != 1) {
error_msg_ = "Header version unsupported";
return ReadCompatibility::FileVersionUnsupported;
}
if (file_header_.file_version > 0) {
if (file_header_.file_version != 1) {
#ifndef NDEBUG
std::cerr << "OVM::IO: file version is too new, still trying to read." << std::endl;
#endif
}
// TODO: allow converting vertex dimension?
if (file_header_.vertex_dim != MeshT::Point::dim()) {
return ReadCompatibility::MeshVertexDimensionIncompatible;
}
// TODO: check geometry type (float, double)
if (std::is_base_of<TetrahedralMeshTopologyKernel, MeshT>::value) {
if (file_header_.topo_type != TopoType::Tetrahedral) {
return ReadCompatibility::MeshTopologyIncompatible;
......
......@@ -70,7 +70,7 @@ bool read(Decoder &decoder, FileHeader &_file_header)
}
_file_header.file_version = decoder.u8();
_file_header.header_version = decoder.u8();
if (_file_header.header_version != 0)
if (_file_header.header_version != 1)
return false;
_file_header.vertex_dim = decoder.u8();
read(decoder, _file_header.topo_type);
......
......@@ -30,7 +30,18 @@ ReadResult ovmb_read(std::istream &_istream,
{
static_assert(std::is_base_of_v<TopologyKernel, MeshT>);
auto reader = make_ovmb_reader(_istream, _options, _prop_codecs);
return reader->read_file(_mesh);
auto result = reader->read_file(_mesh);
#ifndef NDEBUG
if (result != ReadResult::Ok) {
std::cerr << "Error reading ovmb file: "
<< to_string(result)
<< " ("
<< reader->get_error_msg()
<< ")"
<< std::endl;
}
#endif
return result;
}
template<typename MeshT>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment