This repository has been archived by the owner on Jul 25, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
VectorGridFunction.h
109 lines (80 loc) · 3.14 KB
/
VectorGridFunction.h
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#ifndef VECTORGRIDFUNCTION_H
#define VECTORGRIDFUNCTION_H
#include "GridFunction.h"
#include <fstream>
#include <complex>
#include <vector>
using namespace std;
//See .cpp file for explanations of functions
template <class T>
class VectorGridFunction
{
public:
vector<GridFunction<T>> data;
int VGFvectorDim; //outer vector dimension
int GFarrayDim; //array dimension
int GFvectorDim; //inner vector dimension
public:
VectorGridFunction(int VGFvecSize, int GFvecSize, int GFarraySize,
T initvalue);
//Constructor that sets values to default value.
VectorGridFunction(int VGFvecSize, int GFvecSize, int GFarraySize);
//Empty constructor.
inline T get(int VGFvcoord, int GFvcoord, int GFacoord);
//Get value at full coordinate specification.
inline vector<T> get(int VGFvcoord,int GFvcoord);
// Get vector at outer two vector coordinates.
inline GridFunction<T> get(int VGFvcoord);
//Get grid function at outermost vectorcoordinate.
void set(int VGFvcoord, int GFvcoord, int GFacoord,T value);
//Set value at full coordinate specification
void set(int VGFcoord,GridFunction<T> value);
// Set Grid Function at outermost vector specification.
void set(int VGFcoord,int GFcoord,std::vector<T> arr);
// Set vector at outer two vector coordinates.
void setVector(int GFcoord, int GFacoord, vector<T> vec);
//Using a for loop, set the values along the VGFcoord vector dimension at the inner two
//coordinates.
int VGFdim();//the dimension of the external vector
int GFvecDim();//the dimension of the vector within the GridFunction
int GFarrDim();//the dimension of the array within the GridFunction
void append(GridFunction<T> gf); //appends a GridFunction to the end of the VGF.
void save(string filenames); //vector of filenames to print to
vector<T> getVector(int GFvcoord, int GFacoord);
//Using a for loop, returns a vector of the values along the VGFcoord dimension at the
// inner two coordinates specified.
vector<T> getVectorRegion(int GFvcoord, int GFacoord,int vmin, int vmax);
// Does the same, but returns an vector.
// Array2D<T> getVectorNodeArray2D(int GFcoord,int startvec, int stopvec);
// Returns an Array2D of outer vector (VGFcoord dimension) values and inner coordinate
//(GFacoord dimension) values. VGFcoord runs from startvec to stopvec.
};
//Adds two VGFs.
template <typename T>
VectorGridFunction<T> operator+(VectorGridFunction<T>, VectorGridFunction<T>);
//Multiplies a real scalar by a real VGF.
template <typename T>
VectorGridFunction<T> operator*(T, VectorGridFunction<T>);
//Multiplies a real scalar by a complex VGF to return a complex VGF.
template <typename T>
VectorGridFunction<complex<T>> operator*(T, VectorGridFunction<complex<T>>);
//Get dimension of outer vector.
template <class T>
inline int VectorGridFunction<T>::VGFdim()
{
return VGFvectorDim;
}
//Get dimension of inner vector.
template <class T>
inline int VectorGridFunction<T>::GFvecDim()
{
return GFvectorDim;
}
//Get dimension of array.
template <class T>
inline int VectorGridFunction<T>::GFarrDim()
{
return GFarrayDim;
}
#include "VectorGridFunction.tpp"
#endif