Liebe Gitlab-Nutzer, lieber Gitlab-Nutzer,
es ist nun möglich sich mittels des ZIH-Logins/LDAP an unserem Dienst anzumelden. Die Konten der externen Nutzer:innen sind über den Reiter "Standard" erreichbar.
Die Administratoren


Dear Gitlab user,
it is now possible to log in to our service using the ZIH login/LDAP. The accounts of external users can be accessed via the "Standard" tab.
The administrators

Commit edc55c09 authored by Thomas Witkowski's avatar Thomas Witkowski
Browse files

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,14 +186,33 @@ 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,
DOFVector<double>* vec0,
DOFVector<double>* vec1,
DOFVector<double>* vec2,
bool writeParallel,
int nProcs)
DOFVector<double>* vec0,
DOFVector<double>* vec1,
DOFVector<double>* vec2,
bool writeParallel,
int nProcs)
{
uint32_t nValueVectors;
memcpy(reinterpret_cast<char*>(&nValueVectors), &data[8], 4);
......@@ -215,9 +231,9 @@ namespace AMDiS {
void ArhReader::readFromMemoryBlock(vector<char> &data, Mesh *mesh,
vector<DOFVector<double>*> vecs,
bool writeParallel,
int nProcs)
vector<DOFVector<double>*> vecs,
bool writeParallel,
int nProcs)
{
FUNCNAME("ArhReader::readFromMemoryBlock()");
......@@ -230,8 +246,8 @@ namespace AMDiS {
void ArhReader::readBlock(vector<char> &data,
Mesh *mesh,
vector<DOFVector<double>*> vecs)
Mesh *mesh,
vector<DOFVector<double>*> vecs)
{
FUNCNAME("ArhReader::readBlock()");
......
......@@ -53,44 +53,26 @@ namespace AMDiS {
int nProcs = -1);
static void readFromMemoryBlock(vector<char> &data, Mesh *mesh,
DOFVector<double>* vec0 = NULL,
DOFVector<double>* vec1 = NULL,
DOFVector<double>* vec2 = NULL,
DOFVector<double>* vec0 = NULL,
DOFVector<double>* vec1 = NULL,
DOFVector<double>* vec2 = NULL,
#ifdef HAVE_PARALLEL_DOMAIN_AMDIS
bool writeParallel = true,
bool writeParallel = true,
#else
bool writeParallel = false,
bool writeParallel = false,
#endif
int nProcs = -1);
int nProcs = -1);
static void readFromMemoryBlock(vector<char> &data, Mesh *mesh,
vector<DOFVector<double>*> vecs,
vector<DOFVector<double>*> vecs,
#ifdef HAVE_PARALLEL_DOMAIN_AMDIS
bool writeParallel = true,
bool writeParallel = true,
#else
bool writeParallel = false,
bool writeParallel = false,
#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;
}
int nProcs = -1);
static int getNumValueVectors(string filename);
private:
......@@ -102,8 +84,8 @@ namespace AMDiS {
vector<double>& values, DOFVector<double>* vec);
static void readBlock(vector<char> &data,
Mesh *mesh,
vector<DOFVector<double>*> vecs);
Mesh *mesh,
vector<DOFVector<double>*> vecs);
};
}
......
......@@ -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