ArhReader.h 2.14 KB
Newer Older
1
2
3
4
// ============================================================================
// ==                                                                        ==
// == Amdis - Adaptive multidimensional simulations                          ==
// ==                                                                        ==
5
// ==  http://www.amdis-fem.org                                              ==
6
7
// ==                                                                        ==
// ============================================================================
8
9
10
11
12
13
14
15
16
17
18
19
//
// Software License for AMDiS
//
// Copyright (c) 2010 Dresden University of Technology 
// All rights reserved.
// Authors: Simon Vey, Thomas Witkowski et al.
//
// This file is part of AMDiS
//
// See also license.opensource.txt in the distribution.


20
21
22
23
24
25
26
27
28
29

/** \file ArhReader.h */

#ifndef AMDIS_ARH_READER_H
#define AMDIS_ARH_READER_H

#include "AMDiS_fwd.h"

namespace AMDiS {

30
31
  using namespace std;

32
33
34
  class ArhReader
  {
  public:
35
    static void read(string filename, Mesh *mesh,
36
37
		     DOFVector<double>* vec0 = NULL, 
		     DOFVector<double>* vec1 = NULL,
38
39
40
		     DOFVector<double>* vec2 = NULL,		     
		     bool writeParallel = true,
		     int nProcs = -1);
41

42
43
44
45
    static void read(string filename, Mesh *mesh, 
		     vector<DOFVector<double>*> vecs,
		     bool writeParallel = true,
		     int nProcs = -1);
46

47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
    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;
    }
    
67
  private:
68
69
70
71
72

    static void readFile(string filename, 
			 Mesh *mesh,
			 vector<DOFVector<double>*> vecs);

73
    static void setDofValues(int macroElIndex, Mesh *mesh, 
74
			     vector<double>& values, DOFVector<double>* vec);
75
76
77
78
  };
}

#endif