Commit e14c659f authored by Siqi Ling's avatar Siqi Ling
Browse files

negociate with Florian for Volke

parent d9ef20ed
...@@ -24,7 +24,7 @@ namespace AMDiS { namespace io { ...@@ -24,7 +24,7 @@ namespace AMDiS { namespace io {
namespace Arh3Reader namespace Arh3Reader
{ {
const uint8_t MAJOR = 3; const uint8_t MAJOR = 3;
const uint8_t MINOR = 0; const uint8_t MINOR = 1;
const uint8_t PARH_MAJOR = 1; const uint8_t PARH_MAJOR = 1;
const uint8_t PARH_MINOR = 0; const uint8_t PARH_MINOR = 0;
const uint8_t TARH_MAJOR = 1; const uint8_t TARH_MAJOR = 1;
......
...@@ -31,11 +31,11 @@ namespace AMDiS { namespace io { ...@@ -31,11 +31,11 @@ namespace AMDiS { namespace io {
("Cannot read Arh format: this file is not \"%s\" format.\n", id.c_str()); ("Cannot read Arh format: this file is not \"%s\" format.\n", id.c_str());
TEST_EXIT(major == major_) TEST_EXIT(major == major_)
("Cannot read Arh format: Arh2Reader major version is %i, the file major version is %i. \n", ("Cannot read Arh format: Arh3Reader major version is %i, the file major version is %i. \n",
major, major_); major, major_);
TEST_EXIT(minor >= minor_) TEST_EXIT(minor >= minor_)
("Cannot read Arh format: ArhReader minor version is %i is smaller than the file minor version %i.\n", ("Cannot read Arh format: Arh3Reader minor version is %i is smaller than the file minor version %i.\n",
minor, minor_); minor, minor_);
} }
...@@ -252,10 +252,10 @@ namespace AMDiS { namespace io { ...@@ -252,10 +252,10 @@ namespace AMDiS { namespace io {
TEST_EXIT(cps == Cpsformat::ZLIB || TEST_EXIT(cps == Cpsformat::ZLIB ||
cps == Cpsformat::BZIP2 || cps == Cpsformat::BZIP2 ||
cps == Cpsformat::NONE) cps == Cpsformat::NONE)
("Cannot read Arh2 file. Currently only support zlib and bzip2 compression.\n"); ("Cannot read Arh3 file. Currently only support zlib and bzip2 compression.\n");
#else #else
TEST_EXIT(cps == Cpsformat::NONE) TEST_EXIT(cps == Cpsformat::NONE)
("HAVE_COMPRESSION OFF. Cannot read compressed Arh2 file.\n"); ("HAVE_COMPRESSION OFF. Cannot read compressed Arh3 file.\n");
#endif #endif
TEST_EXIT(dow == (unsigned)mesh->getGeo(WORLD)) TEST_EXIT(dow == (unsigned)mesh->getGeo(WORLD))
...@@ -266,7 +266,6 @@ namespace AMDiS { namespace io { ...@@ -266,7 +266,6 @@ namespace AMDiS { namespace io {
("File %s has %d vector(s), which is less than the number of DOFVectors %i in vecs!\n", ("File %s has %d vector(s), which is less than the number of DOFVectors %i in vecs!\n",
filename.c_str(), nValueVectors, vecs.size()); filename.c_str(), nValueVectors, vecs.size());
vector<int> vecsNameLen;
vector<string> vecsName; vector<string> vecsName;
vector<int> filesNameLen; vector<int> filesNameLen;
...@@ -276,7 +275,7 @@ namespace AMDiS { namespace io { ...@@ -276,7 +275,7 @@ namespace AMDiS { namespace io {
vector<string> dataformat; vector<string> dataformat;
vector<int> macroElIndex(nMacroElements); vector<int> macroElIndex(nMacroElements);
vector<pair<int,int> > macroElSize(nMacroElements); // pos, uncompressed size vector<pair<int,int> > macroElSize(nMacroElements); // pos, uncompressed size
int fileSize = 0; int fileSize = 0, feSpacesNamesLen = 0, valueNamesLen = 0;
vector<vector<int> > feSpaceDOFs; vector<vector<int> > feSpaceDOFs;
vector<string> AFEDfileName(nFeSpaces); vector<string> AFEDfileName(nFeSpaces);
...@@ -299,6 +298,7 @@ namespace AMDiS { namespace io { ...@@ -299,6 +298,7 @@ namespace AMDiS { namespace io {
uint32_t tmpInt = 0; uint32_t tmpInt = 0;
file.read(reinterpret_cast<char*>(&tmpInt), 4); file.read(reinterpret_cast<char*>(&tmpInt), 4);
file.read(&AFEDfileName[i][0], tmpInt); file.read(&AFEDfileName[i][0], tmpInt);
feSpacesNamesLen += tmpInt;
for(int j = 0; j < 4; j++) for(int j = 0; j < 4; j++)
{ {
file.read(reinterpret_cast<char*>(&perDOFs[j]), 4); file.read(reinterpret_cast<char*>(&perDOFs[j]), 4);
...@@ -311,7 +311,7 @@ namespace AMDiS { namespace io { ...@@ -311,7 +311,7 @@ namespace AMDiS { namespace io {
string tmpString(""); string tmpString("");
uint32_t tmpInt = 0; uint32_t tmpInt = 0;
file.read(reinterpret_cast<char*>(&tmpInt), 4); file.read(reinterpret_cast<char*>(&tmpInt), 4);
vecsNameLen.push_back(tmpInt); valueNamesLen += tmpInt;
tmpString.resize(tmpInt, ' '); tmpString.resize(tmpInt, ' ');
file.read(&tmpString[0], tmpInt); // file.read(&tmpString[0], tmpInt); //
vecsName.push_back(tmpString); vecsName.push_back(tmpString);
...@@ -323,15 +323,26 @@ namespace AMDiS { namespace io { ...@@ -323,15 +323,26 @@ namespace AMDiS { namespace io {
dataformat.push_back(tmpString); dataformat.push_back(tmpString);
} }
int headerLen_= 34 +
nMacroElements * 12 + 12 +
feSpacesNamesLen +
nFeSpaces * 20 +
valueNamesLen +
nValueVectors * 12;
TEST_EXIT_DBG(headerLen_ <= headerLen)
("Header length (without macro file name) is already larger than the header specified in the file.\n");
// Read macroFile_nl //TODO // Read macroFile_nl //TODO
uint32_t macroFile_nl = 0; if (headerLen_ < headerLen) {
file.read(reinterpret_cast<char*>(&macroFile_nl), 4); uint32_t macroFile_nl = 0;
if (macroFile_nl > 0) { file.read(reinterpret_cast<char*>(&macroFile_nl), 4);
string tmpString(""); if (macroFile_nl > 0) {
tmpString.resize(macroFile_nl, ' '); string tmpString("");
file.read(&tmpString[0], macroFile_nl); tmpString.resize(macroFile_nl, ' ');
file.read(&tmpString[0], macroFile_nl);
}
} }
//================header is over==================// //================header is over==================//
// Adjust and check vecs // Adjust and check vecs
...@@ -679,10 +690,10 @@ namespace AMDiS { namespace io { ...@@ -679,10 +690,10 @@ namespace AMDiS { namespace io {
TEST_EXIT(cps == Cpsformat::ZLIB || TEST_EXIT(cps == Cpsformat::ZLIB ||
cps == Cpsformat::BZIP2 || cps == Cpsformat::BZIP2 ||
cps == Cpsformat::NONE) cps == Cpsformat::NONE)
("Cannot read Arh2 file. Currently only support zlib and bzip2 compression.\n"); ("Cannot read Arh3 file. Currently only support zlib and bzip2 compression.\n");
#else #else
TEST_EXIT(cps == Cpsformat::NONE) TEST_EXIT(cps == Cpsformat::NONE)
("HAVE_COMPRESSION OFF. Cannot read compressed Arh2 file.\n"); ("HAVE_COMPRESSION OFF. Cannot read compressed Arh3 file.\n");
#endif #endif
vector<int> macroElIndex(nMacroElements); vector<int> macroElIndex(nMacroElements);
......
...@@ -300,13 +300,16 @@ namespace AMDiS { namespace io { ...@@ -300,13 +300,16 @@ namespace AMDiS { namespace io {
map<const FiniteElemSpace*, string> AFEDfileName; map<const FiniteElemSpace*, string> AFEDfileName;
uint32_t valueNamesLen = 0, fileNamesLen = 0; uint32_t valueNamesLen = 0, feSpacesNamesLen = 0;
for (size_t i = 0; i < vecs.size(); i++) for (size_t i = 0; i < vecs.size(); i++)
valueNamesLen += vecs[i]->getName().length(); valueNamesLen += vecs[i]->getName().length();
// TODO AFEDfileName
map<const FiniteElemSpace*, vector<int> >::iterator feSpaceIt; map<const FiniteElemSpace*, vector<int> >::iterator feSpaceIt;
for (feSpaceIt = feSpaces.begin(); feSpaceIt != feSpaces.end(); feSpaceIt++) for (feSpaceIt = feSpaces.begin(); feSpaceIt != feSpaces.end(); feSpaceIt++) {
AFEDfileName.insert(make_pair(feSpaceIt->first, string())); AFEDfileName.insert(make_pair(feSpaceIt->first, string()));
feSpacesNamesLen += 0;
}
uint32_t nValueVectors = vecs.size(); uint32_t nValueVectors = vecs.size();
uint32_t nFeSpaces = feSpaces.size(); uint32_t nFeSpaces = feSpaces.size();
...@@ -343,7 +346,7 @@ namespace AMDiS { namespace io { ...@@ -343,7 +346,7 @@ namespace AMDiS { namespace io {
uint32_t dim = mesh->getDim(); uint32_t dim = mesh->getDim();
uint32_t headerLen = 34 + //fixed part of header uint32_t headerLen = 34 + //fixed part of header
nMacroElements * 12 + 12 + //macroElemnts table nMacroElements * 12 + 12 + //macroElemnts table
fileNamesLen + //feSpaces table feSpacesNamesLen + //feSpaces table
nFeSpaces * 20 + //feSpaces table nFeSpaces * 20 + //feSpaces table
valueNamesLen + //value vector table valueNamesLen + //value vector table
nValueVectors * 12 + //also value vector table nValueVectors * 12 + //also value vector table
......
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