Top Banner
Efficient Storage and Processing of Adaptive Triangular Grids using Sierpinski Curves Csaba Attila Vigh Department of Informatics, TU München JASS 2006, course 2: Numerical Simulation: From Models to Visualizations
76

Efficient Storage and Processing of Adaptive Triangular Grids using Sierpinski Curves Csaba Attila Vigh Department of Informatics, TU München JASS 2006,

Dec 17, 2015

Download

Documents

Rosamund Hines
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Efficient Storage and Processing of Adaptive Triangular Grids using Sierpinski Curves Csaba Attila Vigh Department of Informatics, TU München JASS 2006,

Efficient Storage and Processing of Adaptive Triangular Grids using

Sierpinski Curves

Csaba Attila VighDepartment of Informatics, TU München

JASS 2006, course 2:Numerical Simulation: From Models to Visualizations

Page 2: Efficient Storage and Processing of Adaptive Triangular Grids using Sierpinski Curves Csaba Attila Vigh Department of Informatics, TU München JASS 2006,

Outline

• Adaptive Grids – Introduction and basic ideas

• Space-Filling curves– Geometric generation– Hilbert’s, Peano’s, Sierpinski’s curve

• Adaptive Triangular Grids– Generation and Efficient Processing

• Extension to 3D

Page 3: Efficient Storage and Processing of Adaptive Triangular Grids using Sierpinski Curves Csaba Attila Vigh Department of Informatics, TU München JASS 2006,

Adaptive Grids – Basics

• Why do we need Adaptive grids?

• Modeling and Simulation– PDE – mathematical model– Discretization – Solution with Finite Elements or similar

methods– Demand for Adaptive Refinement – very often

Page 4: Efficient Storage and Processing of Adaptive Triangular Grids using Sierpinski Curves Csaba Attila Vigh Department of Informatics, TU München JASS 2006,

Adaptive Grids – Basics

• Adaptive Refinement– Trade-off between Memory Requirements and

Computing Time– Need to obtain Neighbor Relationships

between Grid Cells– Storing Relationships Explicitly leads to:

• Arbitrary Unstructured Grids• Considerable Memory Overhead

Page 5: Efficient Storage and Processing of Adaptive Triangular Grids using Sierpinski Curves Csaba Attila Vigh Department of Informatics, TU München JASS 2006,

Adaptive Grids – Basics

• Adaptive Refinement - want to save memory?– Use a Strongly Structured Grid– Use Recursive Splitting of Cells (Triangles)– Neighbor Relations must be computed– Computing Time should be small

Page 6: Efficient Storage and Processing of Adaptive Triangular Grids using Sierpinski Curves Csaba Attila Vigh Department of Informatics, TU München JASS 2006,

Adaptive Grids – Basics

• Processing of Recursively Refined (Triangular) Grid– Linearize Access to the Cells using Space-

Filling Curves• For Triangles – Sierpinski Curve

– Use a Stack System for Cache-Efficiency– Parallelization Strategies using Space-Filling

Curves are readily available

Page 7: Efficient Storage and Processing of Adaptive Triangular Grids using Sierpinski Curves Csaba Attila Vigh Department of Informatics, TU München JASS 2006,

Space-Filling Curves

• 1878, Cantor– Any two Finite-Dimensional Manifolds have

same Cardinality– [0, 1] can be Mapped Bijectively onto the

Square [0,1]x[0,1], or onto the Cube

• 1879, Netto – such a Mapping is necessarily Discontinuous

Page 8: Efficient Storage and Processing of Adaptive Triangular Grids using Sierpinski Curves Csaba Attila Vigh Department of Informatics, TU München JASS 2006,

Space-Filling Curves

• Is then possible to obtain a Surjective Continuous Mapping?

or

• Is there a Curve that passes through every Point of a Two-Dimensional Region?

• 1890, Peano constructed the first one

Page 9: Efficient Storage and Processing of Adaptive Triangular Grids using Sierpinski Curves Csaba Attila Vigh Department of Informatics, TU München JASS 2006,

Hilbert’s Space-Filling Curve

• Hilbert’s Geometric Generating Process– If Interval I ( ) can be mapped continuously

onto the square Q ( )• Partition I into Four Congruent Subintervals• Partition Q into Four Congruent Subsquares

– Then each Subinterval can be Mapped Continuously onto one of the Subsquares

– Next continue the Partitioning Process on the Subintervals and Subsquares

1,0 21,0

Page 10: Efficient Storage and Processing of Adaptive Triangular Grids using Sierpinski Curves Csaba Attila Vigh Department of Informatics, TU München JASS 2006,

Hilbert’s Space-Filling Curve

• Hilbert’s Geometric Generating Process– After n Partitioning Steps I and Q are split into

Congruent Replicas– Subsquares can be arranged such that

• Adjacent Subintervals correspond to Adjacent Subsquares with an Edge in common

• Inclusion Relationships are preserved

n22

Page 11: Efficient Storage and Processing of Adaptive Triangular Grids using Sierpinski Curves Csaba Attila Vigh Department of Informatics, TU München JASS 2006,

Hilbert’s Space-Filling Curve

Hilbert’s Mapping and three Iterations

Page 12: Efficient Storage and Processing of Adaptive Triangular Grids using Sierpinski Curves Csaba Attila Vigh Department of Informatics, TU München JASS 2006,

Hilbert’s Space-Filling Curve

Six Iterations

Page 13: Efficient Storage and Processing of Adaptive Triangular Grids using Sierpinski Curves Csaba Attila Vigh Department of Informatics, TU München JASS 2006,

Peano’s Space-Filling Curve

• Partitioning in 9 Subintervals and Subsquares

• Subintervals mapped to Subsquaresn23 n23

3 4 92 5 81 6 7

Peano’s Mapping

Page 14: Efficient Storage and Processing of Adaptive Triangular Grids using Sierpinski Curves Csaba Attila Vigh Department of Informatics, TU München JASS 2006,

Peano’s Space-Filling Curve

Three Iterations of the Peano Curve

Page 15: Efficient Storage and Processing of Adaptive Triangular Grids using Sierpinski Curves Csaba Attila Vigh Department of Informatics, TU München JASS 2006,

Sierpinski’s Space-Filling Curve

Four Iterations of the Sierpinski Curve

• Slicing the Square into half by its Diagonal

• Half of the Curve lies on one Triangle

• Other half lies on the other Triangle

Page 16: Efficient Storage and Processing of Adaptive Triangular Grids using Sierpinski Curves Csaba Attila Vigh Department of Informatics, TU München JASS 2006,

Sierpinski’s Space-Filling Curve

• Curve may be viewed as a Map from Unit Interval I onto a Right Isosceles Triangle T

• T with Vertices at (0,0), (2,0), (1,1)

• Hilbert’s Generating Principle– Partition I into two Congruent Subintervals– Partition T into two Congruent Subtriangles– Order of Subtriangles shown in the next

picture

Page 17: Efficient Storage and Processing of Adaptive Triangular Grids using Sierpinski Curves Csaba Attila Vigh Department of Informatics, TU München JASS 2006,

Sierpinski’s Space-Filling Curve

Page 18: Efficient Storage and Processing of Adaptive Triangular Grids using Sierpinski Curves Csaba Attila Vigh Department of Informatics, TU München JASS 2006,

Sierpinski’s Space-Filling Curve

• Curve starts from (0,0), ends at (2,0)• Exit Point from each Subtriangle coincides with

Entry Point of the next one• Requirement on Orientation in Subtriangles

shown in picture below

Page 19: Efficient Storage and Processing of Adaptive Triangular Grids using Sierpinski Curves Csaba Attila Vigh Department of Informatics, TU München JASS 2006,

Recursively Structured Triangular Grids and Sierpinski Curves

– Computational Domain• Right Isosceles Triangle – Starting Cell

– Grid constructed recursively• Split each Triangle Cell into 2 Congruent Subcells• Splitting Repeated until Desired Resolution is

Reached• Grid may be Adaptive – Local Splitting

Page 20: Efficient Storage and Processing of Adaptive Triangular Grids using Sierpinski Curves Csaba Attila Vigh Department of Informatics, TU München JASS 2006,

Recursively Structured Triangular Grids and Sierpinski Curves

Recursive Construction of the Grid on a Triangular Domain

Page 21: Efficient Storage and Processing of Adaptive Triangular Grids using Sierpinski Curves Csaba Attila Vigh Department of Informatics, TU München JASS 2006,

Recursively Structured Triangular Grids and Sierpinski Curves

• Cells are in Linear Order on the Sierpinski Curve

• Corresponds to Depth-First Traversal of the Substructuring Tree

• Additional Memory 1 bit per Cell indicating whether– Cell is a Leave, or– Cell is Adaptively Refined

Page 22: Efficient Storage and Processing of Adaptive Triangular Grids using Sierpinski Curves Csaba Attila Vigh Department of Informatics, TU München JASS 2006,

Recursively Structured Triangular Grids and Sierpinski Curves

• Extensions for Flexibility– Several Initial Triangles may be used– Arbitrary Triangles may be used if

• Structure of Recursive Subdivision preserved• One Leg is defined as Tagged Edge and will take

the role of the Hypotenuse

– Tagged Edge can be replaced by a Linear Interpolation of the Boundary (see next picture)

Page 23: Efficient Storage and Processing of Adaptive Triangular Grids using Sierpinski Curves Csaba Attila Vigh Department of Informatics, TU München JASS 2006,

Recursively Structured Triangular Grids and Sierpinski Curves

Subdividing Triangles at Boundaries

Page 24: Efficient Storage and Processing of Adaptive Triangular Grids using Sierpinski Curves Csaba Attila Vigh Department of Informatics, TU München JASS 2006,

Discretization of the PDE

• A Discretization with Linear FE– Generates

• Element Stiffness Matrices• Right Hand Sides

– Accumulates them into Global System of Equations for the Unknowns on the Nodes

• We consider it to be too Memory Consuming

Page 25: Efficient Storage and Processing of Adaptive Triangular Grids using Sierpinski Curves Csaba Attila Vigh Department of Informatics, TU München JASS 2006,

Discretization of the PDE

• Assumption– Stiffness Matrix Computation possible on the

fly, or– Hardcode it into the Software

• Typical for Iterative Solvers– Contain Matrix-Vector Product between

Stiffness Matrix and Unknowns

• Memory used only for storing Grid Structure

Page 26: Efficient Storage and Processing of Adaptive Triangular Grids using Sierpinski Curves Csaba Attila Vigh Department of Informatics, TU München JASS 2006,

Discretization of the PDE

• Classical Node-Oriented Processing– Loop over Unknowns (Nodes on Grid)– Requires Access to all neighbor Nodes– Difficult in a Recursively Structured Grid– Neighbor could be on a Different Subtree

• Our Approach: Cell-Oriented Processing

Page 27: Efficient Storage and Processing of Adaptive Triangular Grids using Sierpinski Curves Csaba Attila Vigh Department of Informatics, TU München JASS 2006,

Cache Efficient Processing of the Computational Grid

• Cell-Oriented Processing– Need Access to Unknowns for each Cell– Process Elements along the Sierpinski Curve

• Sierpinski Curve Divides Unknowns into two halves– Left of the Curve: Red Nodes– Right of the Curve: Green Nodes– See picture next

Page 28: Efficient Storage and Processing of Adaptive Triangular Grids using Sierpinski Curves Csaba Attila Vigh Department of Informatics, TU München JASS 2006,

Cache Efficient Processing of the Computational Grid

Red (Circles), Green (Boxes)

Page 29: Efficient Storage and Processing of Adaptive Triangular Grids using Sierpinski Curves Csaba Attila Vigh Department of Informatics, TU München JASS 2006,

Cache Efficient Processing of the Computational Grid

• Access to Unknowns is like Access to a Stack

• Consider Unknowns 5 to 10– During Processing Cells to the Left – Access

in Ascending Order– During Processing Cells to the Right – Access

in Descending Order

• Nodes 8, 9, 10 Placed in turn on Top of the Stack

Page 30: Efficient Storage and Processing of Adaptive Triangular Grids using Sierpinski Curves Csaba Attila Vigh Department of Informatics, TU München JASS 2006,

Cache Efficient Processing of the Computational Grid

• System of Four Stacks – to Organize Access to Unknowns– Read Stack holds Initial Value of Unknowns– Two Helper Stacks – Red and Green – hold

Intermediate Values of Unknowns of respective Color

– Write Stack stores Updated Values of Unknowns

Page 31: Efficient Storage and Processing of Adaptive Triangular Grids using Sierpinski Curves Csaba Attila Vigh Department of Informatics, TU München JASS 2006,

Cache Efficient Processing of the Computational Grid

• When Moving from one Cell to the other– 2 Unknowns Adjacent to Common Edge can

always be reused– 2 Unknowns opposite to Common Edge must

be processed:• One from Exited Cell • One in the New Cell

Page 32: Efficient Storage and Processing of Adaptive Triangular Grids using Sierpinski Curves Csaba Attila Vigh Department of Informatics, TU München JASS 2006,

Cache Efficient Processing of the Computational Grid

• Unknown from Exited Cell– Put onto Write Stack – if processing complete– Put onto Helper Stack of respective Color – if

needed by other Cells

• Unknown in the New Cell– Take from Read Stack – if never used it

before– Take from Helper Stack of respective Color –

if already used it before

Page 33: Efficient Storage and Processing of Adaptive Triangular Grids using Sierpinski Curves Csaba Attila Vigh Department of Informatics, TU München JASS 2006,

Cache Efficient Processing of the Computational Grid

• Unknown from Exited Cell– Count number of Accesses – Determine

whether Processing is Complete or not– Determine the Color – Left or Right side of the

Sierpinski Curve ?– Curve Enters and Exits at the 2 Nodes

adjacent to the Hypotenuse– Only 3 possible Scenarios

Page 34: Efficient Storage and Processing of Adaptive Triangular Grids using Sierpinski Curves Csaba Attila Vigh Department of Informatics, TU München JASS 2006,

Cache Efficient Processing of the Computational Grid

• Determining Color of the Nodes1. Curve Enters through Hypotenuse – Exits across

Opposite Leg

2. Curve Enters through Adjacent Leg – Exits through Hypotenuse

3. Curve Enters and Exits across the Opposite Legs

Red (circles), Green (boxes)

Page 35: Efficient Storage and Processing of Adaptive Triangular Grids using Sierpinski Curves Csaba Attila Vigh Department of Informatics, TU München JASS 2006,

Cache Efficient Processing of the Computational Grid

• Unknown in the New Cell– Determine Color as above– Determine whether New or Old

• Consider the 3 Triangle Cells adjacent to “This Cell”

• One is Old – where the Curve entered• One is New – where the Curve exits• Third Cell may be Old or New – check Adjacent

Edges– Both New Third Cell is New Unknown is New– Unknown is Old otherwise

Page 36: Efficient Storage and Processing of Adaptive Triangular Grids using Sierpinski Curves Csaba Attila Vigh Department of Informatics, TU München JASS 2006,

Cache Efficient Processing of the Computational Grid

•Recursive Propagation of Edge Parameters

•Knowing Scenario for the Cell also know Scenarios for Subcells

Page 37: Efficient Storage and Processing of Adaptive Triangular Grids using Sierpinski Curves Csaba Attila Vigh Department of Informatics, TU München JASS 2006,

Cache Efficient Processing of the Computational Grid

• Processing of the Grid is managed by a set of 6 Recursive Procedures

• On the Leaves the Discretization-Level Operations are performed

• Example from Maple worksheet is next

Page 38: Efficient Storage and Processing of Adaptive Triangular Grids using Sierpinski Curves Csaba Attila Vigh Department of Informatics, TU München JASS 2006,

Step 1

Page 39: Efficient Storage and Processing of Adaptive Triangular Grids using Sierpinski Curves Csaba Attila Vigh Department of Informatics, TU München JASS 2006,

Step 2

Page 40: Efficient Storage and Processing of Adaptive Triangular Grids using Sierpinski Curves Csaba Attila Vigh Department of Informatics, TU München JASS 2006,

Step 3

Page 41: Efficient Storage and Processing of Adaptive Triangular Grids using Sierpinski Curves Csaba Attila Vigh Department of Informatics, TU München JASS 2006,

Step 4

Page 42: Efficient Storage and Processing of Adaptive Triangular Grids using Sierpinski Curves Csaba Attila Vigh Department of Informatics, TU München JASS 2006,

Step 5

Page 43: Efficient Storage and Processing of Adaptive Triangular Grids using Sierpinski Curves Csaba Attila Vigh Department of Informatics, TU München JASS 2006,

Step 6

Page 44: Efficient Storage and Processing of Adaptive Triangular Grids using Sierpinski Curves Csaba Attila Vigh Department of Informatics, TU München JASS 2006,

Step 7

Page 45: Efficient Storage and Processing of Adaptive Triangular Grids using Sierpinski Curves Csaba Attila Vigh Department of Informatics, TU München JASS 2006,

Step 8

Page 46: Efficient Storage and Processing of Adaptive Triangular Grids using Sierpinski Curves Csaba Attila Vigh Department of Informatics, TU München JASS 2006,

Step 9

Page 47: Efficient Storage and Processing of Adaptive Triangular Grids using Sierpinski Curves Csaba Attila Vigh Department of Informatics, TU München JASS 2006,

Step 10

Page 48: Efficient Storage and Processing of Adaptive Triangular Grids using Sierpinski Curves Csaba Attila Vigh Department of Informatics, TU München JASS 2006,

Step 11

Page 49: Efficient Storage and Processing of Adaptive Triangular Grids using Sierpinski Curves Csaba Attila Vigh Department of Informatics, TU München JASS 2006,

Step 12

Page 50: Efficient Storage and Processing of Adaptive Triangular Grids using Sierpinski Curves Csaba Attila Vigh Department of Informatics, TU München JASS 2006,

Step 13

Page 51: Efficient Storage and Processing of Adaptive Triangular Grids using Sierpinski Curves Csaba Attila Vigh Department of Informatics, TU München JASS 2006,

Step 14

Page 52: Efficient Storage and Processing of Adaptive Triangular Grids using Sierpinski Curves Csaba Attila Vigh Department of Informatics, TU München JASS 2006,

Step 15

Page 53: Efficient Storage and Processing of Adaptive Triangular Grids using Sierpinski Curves Csaba Attila Vigh Department of Informatics, TU München JASS 2006,

Step 16

Page 54: Efficient Storage and Processing of Adaptive Triangular Grids using Sierpinski Curves Csaba Attila Vigh Department of Informatics, TU München JASS 2006,

Step 17

Page 55: Efficient Storage and Processing of Adaptive Triangular Grids using Sierpinski Curves Csaba Attila Vigh Department of Informatics, TU München JASS 2006,

Step 18

Page 56: Efficient Storage and Processing of Adaptive Triangular Grids using Sierpinski Curves Csaba Attila Vigh Department of Informatics, TU München JASS 2006,

Step 19

Page 57: Efficient Storage and Processing of Adaptive Triangular Grids using Sierpinski Curves Csaba Attila Vigh Department of Informatics, TU München JASS 2006,

Step 20

Page 58: Efficient Storage and Processing of Adaptive Triangular Grids using Sierpinski Curves Csaba Attila Vigh Department of Informatics, TU München JASS 2006,

Step 21

Page 59: Efficient Storage and Processing of Adaptive Triangular Grids using Sierpinski Curves Csaba Attila Vigh Department of Informatics, TU München JASS 2006,

Step 22

Page 60: Efficient Storage and Processing of Adaptive Triangular Grids using Sierpinski Curves Csaba Attila Vigh Department of Informatics, TU München JASS 2006,

Step 23

Page 61: Efficient Storage and Processing of Adaptive Triangular Grids using Sierpinski Curves Csaba Attila Vigh Department of Informatics, TU München JASS 2006,

Step 24

Page 62: Efficient Storage and Processing of Adaptive Triangular Grids using Sierpinski Curves Csaba Attila Vigh Department of Informatics, TU München JASS 2006,

Step 25

Page 63: Efficient Storage and Processing of Adaptive Triangular Grids using Sierpinski Curves Csaba Attila Vigh Department of Informatics, TU München JASS 2006,

Step 26

Page 64: Efficient Storage and Processing of Adaptive Triangular Grids using Sierpinski Curves Csaba Attila Vigh Department of Informatics, TU München JASS 2006,

Step 27

Page 65: Efficient Storage and Processing of Adaptive Triangular Grids using Sierpinski Curves Csaba Attila Vigh Department of Informatics, TU München JASS 2006,

Step 28

Page 66: Efficient Storage and Processing of Adaptive Triangular Grids using Sierpinski Curves Csaba Attila Vigh Department of Informatics, TU München JASS 2006,

Step 29

Page 67: Efficient Storage and Processing of Adaptive Triangular Grids using Sierpinski Curves Csaba Attila Vigh Department of Informatics, TU München JASS 2006,

Step 30

Page 68: Efficient Storage and Processing of Adaptive Triangular Grids using Sierpinski Curves Csaba Attila Vigh Department of Informatics, TU München JASS 2006,

Step 31

Page 69: Efficient Storage and Processing of Adaptive Triangular Grids using Sierpinski Curves Csaba Attila Vigh Department of Informatics, TU München JASS 2006,

Step 32

Page 70: Efficient Storage and Processing of Adaptive Triangular Grids using Sierpinski Curves Csaba Attila Vigh Department of Informatics, TU München JASS 2006,

Parallelization – 5 Equal parts

Page 71: Efficient Storage and Processing of Adaptive Triangular Grids using Sierpinski Curves Csaba Attila Vigh Department of Informatics, TU München JASS 2006,

Conformity of Locally Refined Grids

• No hanging Nodes• Maintaining Conformity in any Locally

Refined Grid– Consider Triangles, Tetrahedrons or N-

Simplices Refined with Recursive Bisections– Need only Finite Number of Additional

Bisections for Completion– Locality of Refinement is preserved– Grid will not become Globally Uniformly

Refined

Page 72: Efficient Storage and Processing of Adaptive Triangular Grids using Sierpinski Curves Csaba Attila Vigh Department of Informatics, TU München JASS 2006,

3D Sierpinski Curves

• 2D Sierpinski Curve fills a Triangle

• 3D Curve expected to fill a Tetrahedron

• How to subdivide a Tetrahedron?

• Tetrahedron with a Tagged Edge:– 4-Tuple with– Edge is

• Directed• Tagged• Takes the role of the Hypotenuse

4321 ,,, xxxx 34321 ,,, xxxx

21 , xx

Page 73: Efficient Storage and Processing of Adaptive Triangular Grids using Sierpinski Curves Csaba Attila Vigh Department of Informatics, TU München JASS 2006,

3D Sierpinski Curves

• Bisection of Tetrahedron along Tagged Edge

,

• Sierpinski Curve Approximated by Polygonal Line of the Tagged Edges

542354314321 ,,,,,,,,,, xxxxxxxxxxxx 215 , xxx

233121 ,,,, xxxxxx

Page 74: Efficient Storage and Processing of Adaptive Triangular Grids using Sierpinski Curves Csaba Attila Vigh Department of Informatics, TU München JASS 2006,

3D Sierpinski Curves

Bisection of a Tagged Tetrahedron. Red Arrows approximate the Sierpinski Curve.

Page 75: Efficient Storage and Processing of Adaptive Triangular Grids using Sierpinski Curves Csaba Attila Vigh Department of Informatics, TU München JASS 2006,

Conclusion

• Algorithm Efficiently generates and processes Adaptive Triangular Grids

• Memory Requirement is minimal

• Hope to achieve Computational Speed competitive with Algorithms based on Regular Grids

• Extension to 3D is currently subject to research

Page 76: Efficient Storage and Processing of Adaptive Triangular Grids using Sierpinski Curves Csaba Attila Vigh Department of Informatics, TU München JASS 2006,

Questions?

???

Thank You!