forked from DurhamDecLab/ARBInterp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
3D_ARBInterpExample.py
48 lines (35 loc) · 1.25 KB
/
3D_ARBInterpExample.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
43
44
45
46
47
48
from __future__ import division
import numpy as np
from ARBTools.ARBInterp import tricubic
######################################################################
if __name__ == '__main__':
fieldname = "Example3DScalarField"
print ("--- Loading field ---")
field = np.genfromtxt(fieldname+'.csv', delimiter=',')
Run = tricubic(field) # mode kword arg will be ignored if a scalar (Nx4) input is detected
coords=np.zeros((20,3))
coords[:,0]=np.linspace(-2e-3,2e-3,20)
coords[:,1]=np.linspace(-2e-3,2e-3,20)
coords[:,2]=np.linspace(-2e-3,2e-3,20)
output = Run.Query((coords[3]))
print ('\n')
print ('Single point query, scalar field:')
print (output)
print ('\n')
Comps = Run.Query(coords)
print ('\n')
print ('Multi point query, scalar field:')
print (Comps)
fieldname = "Example3DVectorField"
print ("--- Loading field ---")
field = np.genfromtxt(fieldname+'.csv', delimiter=',')
Run = tricubic(field, mode='both') # mode options are 'both', 'vector' or 'norm', defaults to 'vector'. Pass arg 'quiet' to suppress setup text
output = Run.Query((coords[3]))
print ('Single point query, vector field:')
print ('\n')
print (output)
print ('\n')
Comps = Run.Query(coords)
print ('Multi point query, vector field:')
print ('\n')
print (Comps)