aboutsummaryrefslogtreecommitdiff
path: root/src/AMRPlus/flexmatrix.h
blob: 6b052e7904cf94727080a4360bd4ec8ece17357b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#ifndef FLEX_MATRIX_H
#define FLEX_MATRIX_H
#include <stdlib.h>

template <class X>
class flexmatrix{
    X* data;
    int M, N;
    
    public:
    flexmatrix(int m, int n){
	M=m;N=n; if (M*N==0) cout<<"Serious Problem! "<<endl;
	data=new X [M*N];
    }
    ~flexmatrix(){delete[] data;}
    X& operator()(int m, int n){return data[m*N+n];}
};


#endif