store netgen version, introduce "format_version" for future changes

This commit is contained in:
mhochsteger@cerbsim.com 2021-11-11 15:25:12 +01:00
parent 36f22a13ce
commit 8c9cdfbc34

View File

@ -1668,8 +1668,12 @@ namespace netgen
void OCCGeometry :: DoArchive(Archive& ar) void OCCGeometry :: DoArchive(Archive& ar)
{ {
int version = 0; constexpr int current_format_version = 0;
ar & version;
int format_version = current_format_version;
auto netgen_version = GetLibraryVersion("netgen");
ar & netgen_version & format_version;
if(ar.Output()) if(ar.Output())
{ {
std::stringstream ss; std::stringstream ss;
@ -1678,6 +1682,11 @@ namespace netgen
} }
else else
{ {
if(format_version>current_format_version)
throw Exception("Loading OCCGeometry from archive: unkown format version "
+ ToString(format_version)
+ ", written by netgen version "
+ ToString(netgen_version));
std::string str; std::string str;
ar & str; ar & str;
stringstream ss(str); stringstream ss(str);