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

ArhReader modified to read specific values

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