Пример #1
0
#### Test PField
print "Opening vtk file"

body3d = pfunction.Body3D("3D.vtk")

X = np.arange(0.0, 1.0, 0.001)
Y = np.arange(0.0, 1.0, 0.001)
X, Y = np.meshgrid(X, Y)
Z = 0.0*X
s = X.shape

f = pfunction.PFunc_dsd("c", body3d=body3d)

for i in range(0,s[0]):
    for j in range(0,s[1]):
        Z[i,j] = f.calc(pfunction.c_dbl_array([X[i,j],Y[i,j],0.2]))

fig = plt.figure(fignum, figsize=(8,7))
allfig.append(fig)
fignum += 1
fig.suptitle('3D Field Z=0.2', fontsize=12)
p = contour(X, Y, Z, [0.15, 0.5, 0.85])


for i in range(0,s[0]):
    for j in range(0,s[1]):
        Z[i,j] = f.calc(pfunction.c_dbl_array([X[i,j],Y[i,j],0.7]))

fig = plt.figure(fignum, figsize=(8,7))
allfig.append(fig)
fignum += 1
Пример #2
0
fignum = 0
allfig = []

# test PSimple_dd
print "test PSimple_dd"
f = pfunction.PSimple_dd("Chebyshev_2")
print "  created"
print "  evaluate", max, "times"
for i in range(0, max):
    f.calc(0.2)
print "  result:", f.get()
f.delete()
print "  deleted\n"

a = np.array([2.0, 3.0])
b = pfunction.c_dbl_array(a)

# test Python
print "test Python code"
v = 0
print "  var:", a
print "  evaluate", max, "times"
for i in range(0, max):
    v = b[0] * (b[1] * b[1]) + (b[0] * b[0] * b[0]) + (
        b[1] * b[1] * b[1]) + (b[0] * b[0]) * b[1]
print "  result:", v
print "  done\n"

# test PSimple_dsd
print "test PSimple_dsd"
f = pfunction.PSimple_dsd("MyFunc_f")
Пример #3
0
#### Test PField
print "Opening vtk file"

body3d = pfunction.Body3D("3D.vtk")

X = np.arange(0.0, 1.0, 0.001)
Y = np.arange(0.0, 1.0, 0.001)
X, Y = np.meshgrid(X, Y)
Z = 0.0 * X
s = X.shape

f = pfunction.PFunc_dsd("c", body3d=body3d)

for i in range(0, s[0]):
    for j in range(0, s[1]):
        Z[i, j] = f.calc(pfunction.c_dbl_array([X[i, j], Y[i, j], 0.2]))

fig = plt.figure(fignum, figsize=(8, 7))
allfig.append(fig)
fignum += 1
fig.suptitle('3D Field Z=0.2', fontsize=12)
p = contour(X, Y, Z, [0.15, 0.5, 0.85])

for i in range(0, s[0]):
    for j in range(0, s[1]):
        Z[i, j] = f.calc(pfunction.c_dbl_array([X[i, j], Y[i, j], 0.7]))

fig = plt.figure(fignum, figsize=(8, 7))
allfig.append(fig)
fignum += 1
fig.suptitle('3D Field Z=0.7', fontsize=12)
Пример #4
0
f = pfunction.PFunc_dsd("c", body2d=body2d)

####

fig = plt.figure(fignum, figsize=(8, 8))
allfig.append(fig)
fignum += 1
fig.suptitle('Concentration Field', fontsize=12)
ax = fig.gca(projection='3d')

print "Evaluating field..."

for i in range(0, s[0]):
    for j in range(0, s[1]):
        Z[i, j] = f.calc(pfunction.c_dbl_array([X[i, j], Y[i, j]]))

print "Plotting..."

ax.plot_surface(X,
                Y,
                Z,
                rstride=1,
                cstride=1,
                cmap=cm.coolwarm,
                linewidth=0,
                antialiased=False)

#

fig = plt.figure(fignum, figsize=(8, 7))
Пример #5
0


####

fig = plt.figure(fignum, figsize=(8,8))
allfig.append(fig)
fignum += 1
fig.suptitle('Concentration Field', fontsize=12)
ax = fig.gca(projection='3d')

print "Evaluating field..."

for i in range(0,s[0]):
    for j in range(0,s[1]):
        Z[i,j] = f.calc(pfunction.c_dbl_array([X[i,j],Y[i,j]]))

print "Plotting..."

ax.plot_surface(X, Y, Z, rstride=1, cstride=1, cmap=cm.coolwarm, linewidth=0, antialiased=False)

#

fig = plt.figure(fignum, figsize=(8,7))
allfig.append(fig)
fignum += 1
fig.suptitle('Field', fontsize=12)
x = np.arange(0.0,1.0, 0.00001)
y = np.arange(0.0,1.0, 0.1)
for i in range(0,y.size):
    field = np.zeros( (x.size))
Пример #6
0
allfig = []

# test PSimple_dd
print "test PSimple_dd"
f = pfunction.PSimple_dd("Chebyshev_2")
print "  created"
print "  evaluate", max, "times"
for i in range(0,max):
    f.calc(0.2)
print "  result:", f.get()
f.delete()
print "  deleted\n"


a = np.array([2.0, 3.0]);
b = pfunction.c_dbl_array(a)


# test Python
print "test Python code"
v = 0
print "  var:", a
print "  evaluate", max, "times"
for i in range(0,max):
    v = b[0]*(b[1]*b[1])+(b[0]*b[0]*b[0])+(b[1]*b[1]*b[1])+(b[0]*b[0])*b[1]
print "  result:", v
print "  done\n"


# test PSimple_dsd
print "test PSimple_dsd"