Commit edc55c09 authored by Thomas Witkowski's avatar Thomas Witkowski

Fixed some small ARH issues, add a small tool to generate arh meta files.

parent f94e0e7c
......@@ -31,16 +31,13 @@ namespace AMDiS {
bool writeParallel,
int nProcs)
{
size_t nValueVectors = getNumValueVectors(filename);
vector<DOFVector<double>*> vecs(0);
if (nValueVectors > 0)
if (vec0)
vecs.push_back(vec0);
if (nValueVectors > 1)
if (vec1)
vecs.push_back(vec1);
if (nValueVectors > 2)
if (vec2)
vecs.push_back(vec2);
for (size_t i = 3; i < nValueVectors; i++)
vecs.push_back(NULL);
ArhReader::read(filename, mesh, vecs, writeParallel, nProcs);
}
......@@ -141,7 +138,7 @@ namespace AMDiS {
if (macroInMesh.count(elIndex) == 1)
elementStructure.fitMeshToStructure(mesh, refManager, false, elIndex);
if(nValueVectors > 0){
if (nValueVectors > 0) {
uint32_t nValuesPerVector = 0;
file.read(reinterpret_cast<char*>(&nValuesPerVector), 4);
......@@ -189,6 +186,25 @@ namespace AMDiS {
}
int ArhReader::getNumValueVectors(string filename)
{
ifstream file;
file.open(filename.c_str(), ios::in | ios::binary);
string typeId = "";
uint32_t nMacroElements = 0;
uint32_t nValueVectors = 0;
file.read(const_cast<char*>(typeId.data()), 4);
file.read(reinterpret_cast<char*>(&nMacroElements), 4);
file.read(reinterpret_cast<char*>(&nValueVectors), 4);
file.close();
return nValueVectors;
}
//the following three functions are identical to read/readfile except that they read from
//a block of memory instead of from a file
void ArhReader::readFromMemoryBlock(vector<char> &data, Mesh *mesh,
......
......@@ -72,25 +72,7 @@ namespace AMDiS {
#endif
int nProcs = -1);
static int getNumValueVectors(string filename)
{
ifstream file;
file.open(filename.c_str(), ios::in | ios::binary);
string typeId = "";
uint32_t nMacroElements = 0;
uint32_t nValueVectors = 0;
//uint32_t nAllValues = 0;
file.read(const_cast<char*>(typeId.data()), 4);
file.read(reinterpret_cast<char*>(&nMacroElements), 4);
file.read(reinterpret_cast<char*>(&nValueVectors), 4);
//file.read(reinterpret_cast<char*>(&nAllValues), 4);
file.close();
return nValueVectors;
}
static int getNumValueVectors(string filename);
private:
......
......@@ -127,8 +127,11 @@ namespace AMDiS {
void ArhWriter::writeMacroElement(ofstream &file,
MeshStructure &code,
vector<vector<double> >& values,
int32_t elIndex)
uint32_t elIndex)
{
FUNCNAME("ArhWriter::writeMacroElement()");
MSG("WRITE INDEX: %d\n", elIndex);
file.write(reinterpret_cast<char*>(&elIndex), 4);
uint32_t nStructureCodes = code.getCode().size();
......@@ -140,7 +143,7 @@ namespace AMDiS {
file.write(reinterpret_cast<char*>(&(const_cast<vector<uint64_t>&>(code.getCode())[0])),
8 * nStructureCodes);
if(values.size() > 0){
if (values.size() > 0) {
uint32_t nValuesPerVector = values[0].size();
file.write(reinterpret_cast<char*>(&nValuesPerVector), 4);
......
......@@ -75,7 +75,7 @@ namespace AMDiS {
static void writeMacroElement(std::ofstream &file,
MeshStructure &code,
std::vector<std::vector<double> >& values,
int32_t elIndex);
uint32_t elIndex);
};
}
......
......@@ -191,7 +191,7 @@ namespace AMDiS {
}
if (writeArhFormat)
ArhWriter::write(fn + ".arh", feSpace->getMesh(), solutionVecs);
ArhWriter::write(paraFilename + ".arh", feSpace->getMesh(), solutionVecs);
#ifdef HAVE_PNG
if (writePngFormat) {
......
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