aboutsummaryrefslogtreecommitdiff
path: root/Carpet/CarpetLib/src/gf.hh
blob: be0a1bb94963b31831389988c2ccfb9d487a20d8 (plain)
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#ifndef GF_HH
#define GF_HH

#include <cassert>
#include <cmath>
#include <iostream>
#include <string>

#include "bbox.hh"
#include "bboxset.hh"
#include "data.hh"
#include "defs.hh"
#include "dh.hh"
#include "ggf.hh"
#include "th.hh"
#include "vect.hh"

using namespace std;



// A real grid function
template<typename T>
class gf: public ggf {
  
  // Types
  typedef data<T>*      tdata;	        // data ...
  typedef vector<tdata> mdata;	        // ... for each multigrid level
  typedef vector<mdata> cdata;	        // ... for each component
  typedef vector<cdata> rdata;	        // ... for each refinement level
  typedef vector<rdata> fdata;          // ... for each time level

public:
  
  // Constructors
  gf (const int varindex, const operator_type transport_operator,
      th& t, dh& d,
      const int prolongation_order_time,
      const int vectorlength, const int vectorindex,
      gf* const vectorleader);
  
  // Destructors
  virtual ~gf ();
  
  
  
  // Helpers
  
  virtual gdata* typed_data (int tl, int rl, int lc, int ml) const
  {
    data<T>* const vl =
      this->vectorleader
      ? (data<T>*)(*this->vectorleader)(tl,rl,lc,ml)
      : NULL;
    return new data<T>(this->varindex,
                       h.refcent, this->transport_operator,
                       this->vectorlength, this->vectorindex,
                       vl);
  }
  
  
  
  // Access to the data
  
  virtual const data<T>* operator() (int tl, int rl, int lc, int ml) const;
  
  virtual data<T>* operator() (int tl, int rl, int lc, int ml);
  
  
  
  // Output
  virtual size_t memory () const;
  virtual ostream& output (ostream& os) const;
private:
  gf ();                        // canonical default construtor
  gf (const gf &);              // canonical copy construtor
  gf & operator= (const gf &);  // canonical copy

};



#endif // GF_HH