if len(aList[i]) > 0:
            af = float(aList[i])
            bf = float(bList[i])
            if ((af - bf) * (af - bf)) > 0.000001:
                return False
    return True


#-------------------- Start testing --------------------------

print("Start PythonAnnotationFilter testing")

# now try with the can.ex2 exodus file for multiblock testing
from paraview.vtk.util.misc import vtkGetDataRoot
import os.path
dataToLoad = os.path.join(vtkGetDataRoot(), 'Testing/Data/can.ex2')

# Load data file
reader = OpenDataFile(dataToLoad)
reader.UpdatePipeline()

# Time management
controller = servermanager.ParaViewPipelineController()
timekeeper = controller.FindTimeKeeper(servermanager.ActiveConnection.Session)
timesteps = timekeeper.TimestepValues
time = timesteps[5]

# Merge blocks
### Just skip the merge = MergeBlocks()

# Annotation filter
from paraview.simple import *
from paraview.vtk.util.misc import vtkGetDataRoot

from os.path import realpath, join, dirname

scriptdir = dirname(realpath(__file__))
state1 = join(scriptdir, "iron-protein.pvsm")

datadir = join(vtkGetDataRoot(), "Testing/Data")

# load state with search under specified dir
LoadState(state1,
          LoadStateDataFileOptions='Search files under specified directory',
          DataDirectory=datadir)

# load state with specific filename
state2 = join(scriptdir, "blow-state.pvsm")
LoadState(state2,
          LoadStateDataFileOptions='Choose File Names',
          blowvtkFileNames=[join(datadir, 'blow.vtk')])
Пример #3
0
from paraview.simple import *
from paraview.vtk.util.misc import vtkGetDataRoot, vtkGetTempDir
from os.path import realpath, join, dirname
import sys, os.path

scriptdir = dirname(realpath(__file__))
statefile = join(scriptdir, "StateWithTextures.pvsm")
data_dir = vtkGetDataRoot() + "/Testing/Data/"

LoadState(statefile, data_directory=data_dir, restrict_to_data_directory=True)

view = GetRenderView()
Render()

try:
    baselineIndex = sys.argv.index('-B') + 1
    baselinePath = sys.argv[baselineIndex]
except:
    print("Could not get baseline directory. Test failed.")

baseline_file = os.path.join(baselinePath, "LoadStateWithTextures.png")
from paraview.vtk.test import Testing
Testing.VTK_TEMP_DIR = vtkGetTempDir()
Testing.compareImage(view.GetRenderWindow(), baseline_file, threshold=10)
Testing.interact()
   for i in xrange(size):
      if len(aList[i]) > 0:
         af = float(aList[i])
         bf = float(bList[i])
         if ((af-bf)*(af-bf)) > 0.000001:
           return False
   return True

#-------------------- Start testing --------------------------

print ("Start PythonAnnotationFilter testing")

# now try with the can.ex2 exodus file for multiblock testing
from paraview.vtk.util.misc import vtkGetDataRoot
import os.path
dataToLoad = os.path.join(vtkGetDataRoot(), 'Testing/Data/can.ex2')


# Load data file
reader = OpenDataFile(dataToLoad)
reader.GlobalVariables = ['KE', 'XMOM', 'YMOM', 'ZMOM', 'NSTEPS', 'TMSTEP']
reader.UpdatePipeline()

# Time management
controller = servermanager.ParaViewPipelineController()
timekeeper = controller.FindTimeKeeper(servermanager.ActiveConnection.Session)
timesteps = timekeeper.TimestepValues
time = timesteps[5]

# Merge blocks
### Just skip the merge = MergeBlocks()