Commit a71cce06 authored by Praetorius, Simon's avatar Praetorius, Simon

ArhReader modified to read specific values

parent b5a85d69
......@@ -31,14 +31,15 @@ namespace AMDiS {
bool writeParallel,
int nProcs)
{
vector<DOFVector<double>*> vecs(0);
if (vec0 != NULL)
vecs.push_back(vec0);
if (vec1 != NULL)
vecs.push_back(vec1);
if (vec2 != NULL)
vecs.push_back(vec2);
int nValueVectors = getNumValueVectors(filename);
vector<DOFVector<double>*> vecs(nValueVectors, NULL);
if (nValueVectors > 0)
vecs[0] = vec0;
if (nValueVectors > 1)
vecs[1] = vec1;
if (nValueVectors > 2)
vecs[2] = vec2;
ArhReader::read(filename, mesh, vecs, writeParallel, nProcs);
}
......@@ -143,8 +144,10 @@ namespace AMDiS {
for (unsigned int j = 0; j < nValueVectors; j++) {
vector<double> values(nValuesPerVector);
file.read(reinterpret_cast<char*>(&(values[0])), 8 * nValuesPerVector);
if (macroInMesh.count(elIndex) == 1)
setDofValues(elIndex, mesh, values, vecs[j]);
if (vecs[j] != NULL) {
if (macroInMesh.count(elIndex) == 1)
setDofValues(elIndex, mesh, values, vecs[j]);
}
}
}
......
......@@ -44,6 +44,26 @@ namespace AMDiS {
bool writeParallel = true,
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;
}
private:
static void readFile(string filename,
......
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