Commit a94fa39b authored by Mike Kremer's avatar Mike Kremer

Added compatibility mode for files in old file format without header.

git-svn-id: http://www.openvolumemesh.org/svnrepo/OpenVolumeMesh/trunk@88 66977474-1d4b-4f09-8fe9-267525286df2
parent 2a34c296
...@@ -84,6 +84,8 @@ bool FileManager::readFile(const std::string& _filename, MeshT& _mesh, ...@@ -84,6 +84,8 @@ bool FileManager::readFile(const std::string& _filename, MeshT& _mesh,
* Header * Header
*/ */
bool header_found = true;
// Get first line // Get first line
getCleanLine(iff, line); getCleanLine(iff, line);
sstr.str(line); sstr.str(line);
...@@ -92,9 +94,10 @@ bool FileManager::readFile(const std::string& _filename, MeshT& _mesh, ...@@ -92,9 +94,10 @@ bool FileManager::readFile(const std::string& _filename, MeshT& _mesh,
sstr >> s_tmp; sstr >> s_tmp;
std::transform(s_tmp.begin(), s_tmp.end(), s_tmp.begin(), ::toupper); std::transform(s_tmp.begin(), s_tmp.end(), s_tmp.begin(), ::toupper);
if(s_tmp != "OVM") { if(s_tmp != "OVM") {
iff.close(); //iff.close();
std::cerr << "The specified file is not in OpenVolumeMesh format!" << std::endl; header_found = false;
return false; std::cerr << "The specified might not be in OpenVolumeMesh format!" << std::endl;
//return false;
} }
// Get ASCII/BINARY string // Get ASCII/BINARY string
...@@ -109,9 +112,14 @@ bool FileManager::readFile(const std::string& _filename, MeshT& _mesh, ...@@ -109,9 +112,14 @@ bool FileManager::readFile(const std::string& _filename, MeshT& _mesh,
/* /*
* Vertices * Vertices
*/ */
getCleanLine(iff, line); if(!header_found) {
sstr.clear(); sstr.clear();
sstr.str(line); sstr.str(line);
} else {
getCleanLine(iff, line);
sstr.clear();
sstr.str(line);
}
sstr >> s_tmp; sstr >> s_tmp;
std::transform(s_tmp.begin(), s_tmp.end(), s_tmp.begin(), ::toupper); std::transform(s_tmp.begin(), s_tmp.end(), s_tmp.begin(), ::toupper);
......
...@@ -156,6 +156,8 @@ public: ...@@ -156,6 +156,8 @@ public:
typedef std::vector<Face> Faces; typedef std::vector<Face> Faces;
typedef std::vector<Cell> Cells; typedef std::vector<Cell> Cells;
typedef VecT PointT;
//===================================================================== //=====================================================================
// Constructors/Destructor // Constructors/Destructor
//===================================================================== //=====================================================================
......
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