Example #1
0
            opacities.append([O])
    if a == "-res":
        W = int(args[idx + 1])
        H = int(args[idx + 2])
    if a == "-numFrames":
        numFrames = int(args[idx + 1])

#figure out what vtk file to open and what it is like
filename = args[len(args) - 1]
volumename = filename.split("/")[-1]
extps = volumename.rfind(".")
filetype = volumename[extps:]
volumename = volumename[0:extps]

window_size = vec2i(W, H)
aspect = Any(float(W) / H)

frame = sg.Frame()
frame.immediatelyWait = True
frame.createChild("windowSize", "vec2i", Any(window_size))

renderer = sg.Renderer("scivis")
frame.createChildAs("renderer", "renderer_scivis")

world = frame.child("world")

lightsMan = frame.child("lights")
baseMaterialRegistry = frame.child("baseMaterialRegistry")

importer = sg.getImporter(world, FileName(filename))
importer.setLightsManager(lightsMan)
Example #2
0
args = sg.init(sys.argv)

mpiRank = 0
mpiWorldSize = 1
comm = MPI.COMM_WORLD
mpiRank = comm.Get_rank()
mpiWorldSize = comm.Get_size()

#optional command line arguments
W = 1024
H = 768
numFrames = 100

window_size = vec2i(W, H)
aspect = Any(float(W) / H)

frame = sg.Frame()
frame.immediatelyWait = True
frame.createChild("windowSize", "vec2i", Any(window_size))

renderer = sg.Renderer("mpiRaycast")
frame.createChildAs("renderer", "renderer_mpiRaycast")

world = frame.child("world")

lightsMan = frame.child("lights")
baseMaterialRegistry = frame.child("baseMaterialRegistry")

world.createChildAs("generator", "generator_wavelet")
world.render()
Example #3
0
#Copyright 2021 Intel Corporation
#SPDX-License-Identifier: Apache-2.0

import sys, numpy
import pysg as sg
from pysg import Any, vec3f, Data, vec2i

sg.init(sys.argv)

# specific rkcommon::math types needed for SG
pos = Any(vec3f(0.0, 0.0, 10.0))
dir = Any(vec3f(0.0, 0.0, -1.0))
up = Any(vec3f(0.0, 1.0, 0.0))

W = 1024
H = 768

window_size = Any(vec2i(W, H))
aspect = Any(float(W) / H)

vertex = numpy.array(
    [[-1.0, -1.0, 3.0], [-1.0, 1.0, 3.0], [1.0, -1.0, 3.0], [0.1, 0.1, 0.3]],
    dtype=numpy.float32)

color = numpy.array([[0.9, 0.5, 0.5, 1.0], [0.8, 0.8, 0.8, 1.0],
                     [0.8, 0.8, 0.8, 1.0], [0.5, 0.9, 0.5, 1.0]],
                    dtype=numpy.float32)

index = numpy.array([[0, 1, 2], [1, 2, 3]], dtype=numpy.uint32)

mat = numpy.array([0], dtype=numpy.uint32)
Example #4
0
if filename != "wavelet" and filename != "slices":
    sg.loadPlugin("vtk")
    volumename = filename.split("/")[-1]
    path = filename[:len(filename) - len(volumename)]
    extps = volumename.rfind(".")
    filetype = volumename[extps:]
    volumename = volumename[0:extps]

myFilename = ""
if filetype != ".pvd":
    myFilename = path + volumename + str(mpiRank) + filetype
else:
    myFilename = path + volumename + filetype

window_size = vec2i(W, H)
aspect = Any(float(W) / H)

frame = sg.Frame()
frame.immediatelyWait = True
frame.createChild("windowSize", "vec2i", Any(window_size))

renderer = sg.Renderer("mpiRaycast")
frame.createChildAs("renderer", "renderer_mpiRaycast")

world = frame.child("world")

lightsMan = frame.child("lights")
baseMaterialRegistry = frame.child("baseMaterialRegistry")

if filename == "slices":
    ws = world.createChildAs("generator", "generator_wavelet_slices")
Example #5
0
import sys, numpy
from mpi4py import MPI
import pysg as sg
from pysg import Any, vec3f, Data, vec2i

sg.init(sys.argv)

mpiRank = 0
mpiWorldSize = 1
comm = MPI.COMM_WORLD
mpiRank = comm.Get_rank()
mpiWorldSize = comm.Get_size()

# specific rkcommon::math types needed for SG
pos = Any(vec3f((mpiWorldSize + 1.0) / 2.0, 0.5, -mpiWorldSize * 0.5))
dir = Any(vec3f(0.0, 0.0, 1.0))
up = Any(vec3f(0.0, 1.0, 0.0))

W = 1024
H = 768

window_size = Any(vec2i(W, H))
aspect = Any(float(W) / H)

vertex = numpy.array(
    [[mpiRank, 0.0, 3.5], [mpiRank, 1.0, 3.0], [1.0 * (mpiRank + 1), 0.0, 3.0],
     [1.0 * (mpiRank + 1), 1.0, 2.5]],
    dtype=numpy.float32)

color = numpy.array([[0.0, 0.0, 1.0, 1.0], [0.0, 0.0, 1.0, 1.0],