Example #1
0
def run():
    print("Running lines...")
    npoints = 4
    x = np.zeros(npoints)
    y = np.zeros(npoints)
    z = np.zeros(npoints)
    pressure = np.random.rand(npoints)
    temp = np.random.rand(npoints)
    vel = np.zeros(2)
    vel[0] = 1.0
    vel[1] = 5.0

    x[0], y[0], z[0] = 0.0, 0.0, 0.0
    x[1], y[1], z[1] = 1.0, 1.0, 1.0
    x[2], y[2], z[2] = 0.0, 0.0, 0.0
    x[3], y[3], z[3] = -1.0, 1.0, 1.0

    comments = ["comment 1", "comment 2"]
    linesToVTK(FILE_PATH,
               x,
               y,
               z,
               cellData={"vel": vel},
               pointData={
                   "temp": temp,
                   "pressure": pressure
               },
               comments=comments)
Example #2
0
from evtk.hl import linesToVTK
import numpy as np

# Example 1
npoints = 4
x = np.zeros(npoints)
y = np.zeros(npoints)
z = np.zeros(npoints)
pressure = np.random.rand(npoints)
temp = np.random.rand(npoints)
vel = np.zeros(2)
vel[0] = 1.0
vel[1] = 5.0

x[0], y[0], z[0] = 0.0, 0.0, 0.0
x[1], y[1], z[1] = 1.0, 1.0, 1.0
x[2], y[2], z[2] = 0.0, 0.0, 0.0
x[3], y[3], z[3] = -1.0, 1.0, 1.0

comments = [b"comment 1", b"comment 2"]
linesToVTK("./lines",
           x,
           y,
           z,
           cellData={"vel": vel},
           pointData={
               "temp": temp,
               "pressure": pressure
           },
           comments=comments)
Example #3
0
    f.close()
    return v, l  # return (exit verticies, lines)


###########################################################################
# main program
###########################################################################

verts, lines = getVertsLines()
npoints = 2 * lines.shape[0]

x = np.zeros(npoints)
y = np.zeros(npoints)
z = np.zeros(npoints)

for i, l in enumerate(lines):
    for j in range(2):
        x[2 * i + j] = verts[l[j] - 1, 0]
        y[2 * i + j] = verts[l[j] - 1, 1]
        z[2 * i + j] = verts[l[j] - 1, 2]

#pressure = np.random.rand(npoints)
#temp = np.random.rand(npoints)
#vel = np.zeros(2)
#vel[0] = 1.0
#vel[1] = 5.0
#

print x.shape
linesToVTK("lumen_lines", x, y, z, cellData=None, pointData=None)