Commit d08cd68c authored by Philippe Pébay's avatar Philippe Pébay
Browse files

Added Youngs material interface instance along with mapper/actor

Change-Id: I6105d75a8e5a45756e7bedcb602b4054d209896c
parent ca6d081f
......@@ -10,27 +10,48 @@ VTK_DATA_ROOT = vtkGetDataRoot()
reader = vtkAVSucdReader()
reader.SetFileName( VTK_DATA_ROOT + "/Data/UCD/UCD_00005.inp" )
# Update reader and get cell data
# Update reader and get mesh and cell data
reader.Update()
cellData = reader.GetOutput().GetCellData()
mesh = reader.GetOutput()
cellData = mesh.GetCellData()
cellData.SetActiveScalars("frac_pres[1]")
# Create mapper for wireframe rendering of volume fraction #1
mapper = vtkDataSetMapper()
mapper.SetInputConnection( reader.GetOutputPort() )
mapper.SetScalarRange( cellData.GetScalars().GetRange() )
mapper.SetScalarModeToUseCellData()
mapper.SetColorModeToMapScalars()
mapper.ScalarVisibilityOn()
# Create mapper for wireframe rendering of material fraction #1
fractionMapper = vtkDataSetMapper()
fractionMapper.SetInputConnection( reader.GetOutputPort() )
fractionMapper.SetScalarRange( cellData.GetScalars().GetRange() )
fractionMapper.SetScalarModeToUseCellData()
fractionMapper.SetColorModeToMapScalars()
fractionMapper.ScalarVisibilityOn()
# Create actor
actor = vtkActor()
actor.SetMapper( mapper )
actor.GetProperty().SetRepresentationToWireframe()
# Create wireframe actor
wireActor = vtkActor()
wireActor.SetMapper( fractionMapper )
wireActor.GetProperty().SetRepresentationToWireframe()
# Create renderer
# Male multiblock from input mesh
meshMB = vtkMultiBlockDataSet()
meshMB.SetNumberOfBlocks( 1 )
meshMB.GetMetaData( 0 ).Set( vtkCompositeDataSet.NAME(), "Mesh" )
meshMB.SetBlock( 0, mesh )
# Reconstruct material interface
interface = vtkYoungsMaterialInterface()
interface.SetInput( meshMB )
# Create mappeyr for surface rendering of reconstructed interface
interfaceMapper = vtkDataSetMapper()
interfaceMapper.SetInputConnection( interface.GetOutputPort() )
# Create surface actor
surfActor = vtkActor()
surfActor.SetMapper( fractionMapper )
surfActor.GetProperty().SetRepresentationToSurface()
# Create renderer and add actors to it
renderer = vtkRenderer()
renderer.AddViewProp( actor )
renderer.AddViewProp( wireActor )
renderer.AddViewProp( surfActor )
renderer.SetBackground( .3, .4 ,.5 )
# Create render window
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment