ProjectList.cpp 1.05 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include "Project.h"
#include "io/ArhWriter.h"
#include "io/ArhReader.h"
#include <vector>

using namespace AMDiS;

void write(SolutionInformation& info, std::string filename) {
  if(info.sysVec != NULL) {
    std::vector< DOFVector< double >* > data(info.sysVec->getNumVectors());
    Mesh* mesh = info.sysVec->getDOFVector(0)->getFeSpace()->getMesh();
    for(int i=0; i < info.sysVec->getNumVectors(); ++i) {
      data[i] = info.sysVec->getDOFVector(i);
    }
    ArhWriter::write(filename, mesh, data);
  }else if(info.dofVec != NULL) {
    Mesh* mesh = info.dofVec->getFeSpace()->getMesh();
    ArhWriter::write(filename, mesh, info.dofVec);
  }else
    assert(false);
}

bool compare(SolutionInformation& info, std::string filename) {
  if(info.sysVec != NULL) {
    assert(false);
  }else if(info.dofVec != NULL) {
    DOFVector< double > fileVec(info.dofVec->getFeSpace(), "fileVec");
    Mesh fileMesh("",2);
    fileMesh = *(info.dofVec->getFeSpace()->getMesh());
    ArhReader::read(filename, &fileMesh, &fileVec);
  }else
    assert(false);
  return false;
}