Skip to content

Morse-Smale Quadrangulation

Pipeline description

This example first loads a mecanical model as a 2D triangle mesh from disk. This mechanical model embeds a collection of scalar fields that corresponds to the output of the EigenField module. This module generated a family of functions that are coupled to the form of the dataset (basically, they are eigenfunctions of the laplacian matrix of the triangulation, sorted by decreasing eigenvalue magnitude).

In a pre-processing step, the 83rd EigenFunction is extracted and normalized with ScalarFieldNormalizer then simplified using PersistenceDiagram and TopologicalSimplification.

We then compute the MorseSmaleComplex of the simplified scalar field. The critical points are evenly spread onto the 2D surface and the 1-separatrices will form the base of the quadrangulation (left view on the above screenshot).

The filter MorseSmaleQuadrangulation creates a coarse quadrangulation of the input mesh using the Morse-Smale complex critical points and 1-separatrices.

This coarse quadrangulation is eventually refined with the QuadrangulationSubdivision filter (right view on the above screenshot).

ParaView

To reproduce the above screenshot, go to your ttk-data directory and enter the following command:

paraview states/morseSmaleQuadrangulation.pvsm

Python code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/usr/bin/env python

from paraview.simple import *

# create a new 'XML Unstructured Grid Reader'
rockerArmvtu = XMLUnstructuredGridReader(FileName=["rockerArm.vtu"])

# create a new 'Extract Component'
extractComponent1 = ExtractComponent(Input=rockerArmvtu)
extractComponent1.InputArray = ["POINTS", "OutputEigenFunctions"]
extractComponent1.Component = 83

# create a new 'TTK ScalarFieldNormalizer'
tTKScalarFieldNormalizer1 = TTKScalarFieldNormalizer(Input=extractComponent1)
tTKScalarFieldNormalizer1.ScalarField = ["POINTS", "Result"]

# create a new 'TTK PersistenceDiagram'
tTKPersistenceDiagram1 = TTKPersistenceDiagram(Input=tTKScalarFieldNormalizer1)
tTKPersistenceDiagram1.ScalarField = ["POINTS", "Result"]
tTKPersistenceDiagram1.EmbedinDomain = 1
tTKPersistenceDiagram1.IgnoreBoundary = False

# create a new 'Threshold'
threshold1 = Threshold(Input=tTKPersistenceDiagram1)
threshold1.Scalars = ["CELLS", "Persistence"]
threshold1.ThresholdMethod = "Between"
threshold1.LowerThreshold = 0.001
threshold1.UpperThreshold = 999999999

# create a new 'TTK TopologicalSimplification'
tTKTopologicalSimplification1 = TTKTopologicalSimplification(
    Domain=tTKScalarFieldNormalizer1, Constraints=threshold1
)
tTKTopologicalSimplification1.ScalarField = ["POINTS", "Result"]

# create a new 'TTK MorseSmaleComplex'
tTKMorseSmaleComplex1 = TTKMorseSmaleComplex(Input=tTKTopologicalSimplification1)
tTKMorseSmaleComplex1.ScalarField = ["POINTS", "Result"]

# create a new 'TTK MorseSmaleQuadrangulation'
tTKMorseSmaleQuadrangulation1 = TTKMorseSmaleQuadrangulation(
    Triangulatedsurface=OutputPort(tTKMorseSmaleComplex1, 3),
    MorseSmalecriticalpoints=tTKMorseSmaleComplex1,
    MorseSmale1separatrices=OutputPort(tTKMorseSmaleComplex1, 1),
)
tTKMorseSmaleQuadrangulation1.DualQuadrangulation = 1

# create a new 'TTK QuadrangulationSubdivision'
tTKQuadrangulationSubdivision1 = TTKQuadrangulationSubdivision(
    Triangulatedsurface=OutputPort(tTKMorseSmaleComplex1, 3),
    Coarsequadrangulation=tTKMorseSmaleQuadrangulation1,
)
tTKQuadrangulationSubdivision1.Levelofsubdivisions = 3
tTKQuadrangulationSubdivision1.Numberofrelaxationiterations = 100

# save the output
SaveData("Quadrangulation.vtp", tTKQuadrangulationSubdivision1)

To run the above Python script, go to your ttk-data directory and enter the following command:

pvpython python/morseSmaleQuadrangulation.py

Inputs

  • rockerArm.vtu: a two-dimensional triangulated mechanical model.

Outputs

  • Quadrangulation.vtp: the output quadrangulated surface.

C++/Python API

EigenField

MorseSmaleComplex

MorseSmaleQuadrangulation

PersistenceDiagram

QuadrangulationSubdivision

ScalarFieldNormalizer

TopologicalSimplification