# state file generated using paraview version 6.1.1
import paraview
paraview.compatibility.major = 6
paraview.compatibility.minor = 1

#### import the simple module from the paraview
from paraview.simple import *
#### disable automatic camera reset on 'Show'
paraview.simple._DisableFirstRenderCameraReset()

# ----------------------------------------------------------------
# setup views used in the visualization
# ----------------------------------------------------------------

# Create a new 'Render View'
renderView1 = GetRenderView()
renderView1.Set(
    CenterOfRotation=[5.0, 5.0, 5.0],
    CameraPosition=[-25.43182801450687, 12.603516529045677, 23.532397716059094],
    CameraFocalPoint=[5.0, 5.0, 5.0],
    CameraViewUp=[-0.04269406678886594, 0.8977471661888106, -0.4384372728920159],
)


# create a new 'Unstructured Cell Types'
unstructuredCellTypes2 = UnstructuredCellTypes(registrationName='UnstructuredCellTypes2')
unstructuredCellTypes2.CellType = 'Tet'

# create a new 'Generate Time Steps'
generateTimeSteps2 = GenerateTimeSteps(registrationName='GenerateTimeSteps2', Input=unstructuredCellTypes2)
generateTimeSteps2.TimeStepValues = [1.0]

# create a new 'Unstructured Cell Types'
unstructuredCellTypes1 = UnstructuredCellTypes(registrationName='UnstructuredCellTypes1')
unstructuredCellTypes1.CellType = 'Pyramid'

# create a new 'Generate Time Steps'
generateTimeSteps1 = GenerateTimeSteps(registrationName='GenerateTimeSteps1', Input=unstructuredCellTypes1)
generateTimeSteps1.TimeStepValues = [1.0]

# create a new 'Unstructured Cell Types'
unstructuredCellTypes3 = UnstructuredCellTypes(registrationName='UnstructuredCellTypes3')
unstructuredCellTypes3.CellType = 'Wedge'

# create a new 'Generate Time Steps'
generateTimeSteps3 = GenerateTimeSteps(registrationName='GenerateTimeSteps3', Input=unstructuredCellTypes3)
generateTimeSteps3.TimeStepValues = [1.0]



# create a new 'Group Datasets'
groupDatasets1 = GroupDatasets(registrationName='GroupDatasets1', Input=[generateTimeSteps3, generateTimeSteps2, generateTimeSteps1])
groupDatasets1.BlockNames = ['GenerateTimeSteps3', 'GenerateTimeSteps2', 'GenerateTimeSteps1']

# ----------------------------------------------------------------
# setup the visualization in view 'renderView1'
# ----------------------------------------------------------------

# show data from groupDatasets1
groupDatasets1Display = Show(groupDatasets1, renderView1, 'UnstructuredGridRepresentation')

# get color transfer function/color map for 'Polynomial'
polynomialLUT = GetColorTransferFunction('Polynomial')
polynomialLUT.Set(
    RGBPoints=GenerateRGBPoints(
        range_min=1.0,
        range_max=31.0,
    ),
    ScalarRangeInitialized=1.0,
)

# trace defaults for the display properties.
groupDatasets1Display.Set(
    Representation='Surface',
    ColorArrayName=['POINTS', 'Polynomial'],
    LookupTable=polynomialLUT,
    Assembly='Hierarchy',
)

# init the 'Piecewise Function' selected for 'ScaleTransferFunction'
groupDatasets1Display.ScaleTransferFunction.Points = [0.0, 0.0, 0.5, 0.0, 8.66025447845459, 1.0, 0.5, 0.0]

# init the 'Piecewise Function' selected for 'OpacityTransferFunction'
groupDatasets1Display.OpacityTransferFunction.Points = [0.0, 0.0, 0.5, 0.0, 8.66025447845459, 1.0, 0.5, 0.0]

# setup the color legend parameters for each legend in this view

# get color legend/bar for polynomialLUT in view renderView1
polynomialLUTColorBar = GetScalarBar(polynomialLUT, renderView1)
polynomialLUTColorBar.Set(
    Title='Polynomial',
    ComponentTitle='',
)

# set color bar visibility
polynomialLUTColorBar.Visibility = 1

# show color legend
groupDatasets1Display.SetScalarBarVisibility(renderView1, True)

# ----------------------------------------------------------------
# setup color maps and opacity maps used in the visualization
# note: the Get..() functions create a new object, if needed
# ----------------------------------------------------------------

# get opacity transfer function/opacity map for 'Polynomial'
polynomialPWF = GetOpacityTransferFunction('Polynomial')
polynomialPWF.Set(
    Points=[1.0, 0.0, 0.5, 0.0, 31.0, 1.0, 0.5, 0.0],
    ScalarRangeInitialized=1,
)

# ----------------------------------------------------------------
# setup animation scene, tracks and keyframes
# note: the Get..() functions create a new object, if needed
# ----------------------------------------------------------------

# get the time-keeper
timeKeeper1 = GetTimeKeeper()

# initialize the timekeeper
timeKeeper1.SuppressedTimeSources = [unstructuredCellTypes2, unstructuredCellTypes3, unstructuredCellTypes1]

# get time animation track
timeAnimationCue1 = GetTimeTrack()

# initialize the animation track

# get animation scene
animationScene1 = GetAnimationScene()

# initialize the animation scene
animationScene1.Set(
    ViewModules=renderView1,
    Cues=timeAnimationCue1,
    AnimationTime=1.0,
    StartTime=1.0,
    EndTime=2.0,
    PlayMode='Snap To TimeSteps',
)

# initialize the animation scene

# ----------------------------------------------------------------
# restore active source
SetActiveSource(groupDatasets1)

SaveData('mbsplit.vtkhdf', proxy=groupDatasets1, WriteAllTimeSteps=1,
    SplitByComposite=1)
