-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathInterpolation.py
42 lines (34 loc) · 1.09 KB
/
Interpolation.py
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
import numpy as np
import gl as gl
class Interpolation:
def __init__(self,numOfNodes,numOfQuads):
self.__nNodes = numOfNodes
self.__nQuads = numOfQuads
self.__xnodes = gl.lglnodes(self.__nNodes-1)
self.__xquads = gl.lglnodes(self.__nQuads-1)
self.__W = np.diag(self.__xquads[1])
self.__G, self.__D = gl.lagint(self.__xnodes[0],self.__xquads[0])
self.__V = gl.vandermonde(self.__nNodes-1, self.__xnodes[0])
self.__Vinv = np.linalg.inv(self.__V)
# Returns location of nodes and quads
def xnodes(self):
return self.__xnodes[0]
def xquads(self):
return self.__xquads[0]
# Return number of nodes and quads
def nnodes(self):
return self.__nNodes
def nquads(self):
return self.__nQuads
# Returns the interpolation matrices
def B(self):
return self.__G
def D(self):
return self.__D
def W(self):
return self.__W
# Returns vandermonde matrix
def V(self):
return self.__V
def Vinv(self):
return self.__Vinv