SlideShare une entreprise Scribd logo
1  sur  86
Télécharger pour lire hors ligne
Grids
theory and domain requirements
Riccardo Rigon, Francesco Serafin
Naturaltopologies,ValdiRabbi,2017
!2
Representation of space (and time) is a necessary step to implement
any Physics. However, it the topics is seldom faced with the
appropriate generality, and this reflects into implementations in
softwares that do not have a general structure.
In literature there are at least three issues to be considered:
• The naming
• The mathematics
• The implementation (its abstract implementation and its deployment
in a language - Java for us)
Introduction
Rigon & Serafin
!3
Because grids are a so general argument, people worked to understand
each other when dealing with it. The most thought outcome is the work
of the Ugrid Convention. You can find it at
•https://github.com/ugrid-conventions/ugrid-conventions
but we summarize some points here (please do not go directly to them,
you will loss something, probably).
The naming
Rigon & Serafin
What follows assumes that the readers know what a topology is.
!4
Their approach aims to establish a common description for NetCDF
files that contains unstructured grid data. We do not specify what
unstructured means (you can find it here).
The bare bone idea is that grids are mathematical objects formed by
•nodes (a point, a coordinate pair or triplet: the most basic element of
the topology. The word “node” seems to be more commonly used than
the alternative “vertex”)
The naming
Rigon & Serafin
1
2
34
The number are arbitrary, of course.
!5
Nodes
Rigon & Serafin
• edges (a line or curve bounded by two nodes)
1
2
34
1
2
34
a b
cd
Here the edges are named according to letters, but numbers would have
been the same. The set of nodes does not identify the set of edges.
a b
cd
e
!6
Edges
Rigon & Serafin
• edges (a line or curve bounded by two nodes)
1
2
34
b
cd
e
The above geometry is not exactly what expected, because it does not
seems to have the same topology of the other two (we will be more
precise on this in what follows). But the figure drawn is certainly a
union of nodes and edges. We will call it a graph
!7
•faces (a plane or surface enclosed by a set of edges. In a 2D horizontal application
one may consider the word “polygon”, but in the hierarchy of elements the word
“face” is most common)
1
2
34
1
2
34
a b
cd
a b
cd
e
A
A B
Faces are denoted my boldface capital letters.
Faces
Rigon & Serafin
!8
•volumes (a volume enclosed by a set of faces. The alternative word “cell” was
considered, but “cell” is often used in the community to describe 2 dimensional
structures.)
The symbol A denotes the volume
C
1
2
34
a b
cd
e
A B
A B
C
A
D
D
Faces
Rigon & Serafin
!9
•volumes (a volume enclosed by a set of faces. The alternative word “cell” was
considered, but “cell” is often used in the community to describe 2 dimensional
structures.)
We were used to see the entities are 2 dimensional, but these are 3
dimensional and are formed by 4 faces (4 nodes, 6 edges), two of which stay
behind (in perspective, to form a tetrahedron).
C
1
2
34
a b
cd
e
A B
A B
C
A
D
D
Volumes
Rigon & Serafin
!10
Here you see a tetrahedron planar development).
Volumes
Rigon & Serafin
!11
With some more nodes, we could have cube (8 nodes, 12 edges), as well other figures
Volumes
Rigon & Serafin
!12
In fact one fundamental concept is that about topological
dimensionality of the entities, we are dealing with
•nodes are 0 dimensional
•edges are 1 dimensional
•faces are 2 dimensional
•volumes are 3 dimensional
The specification of the number of a certain group of d-cells (0-cells
are nodes etc.) does not imply the dimensionality of the union set. In
fact, for instance
b
cd
e
does not imply the existence of a face included between nodes [4,3,2].
All we are interested in can jus live on the 1-dimensional space
identified by edges
1
2
34
Dimensionality
Rigon & Serafin
!13
Rigon & Serafin
Meshes/Grids/Complexes
Said the above, we are not usually interested in single nodes, faces,
edged, volumes, but to a certain group of them, mixed in various
forms, to obtain approximation of any shape (as you noticed I avoid
to use the word geometry)
These sets are our meshes, grids, or, as we will define later, cw-complexes.
tetrahedron cube
rhombic dodecahedron
!14
Rigon & Serafin
Meshes/Grids/Complexes
Alliez. P; Ucelli, G; Gotsman, C; Attene, M., Recent Advances in Remeshing of Surfaces, 2008
Any shape, also very complicate objects
!15
A more formal treatment of the matter seems necessary now to put in
order the concepts above and proceed eventually to implement some grid
structure. The concepts are mostly taken from Heinzl and Schawaha
(2011), which at lest inherits something from Berti’s dissertation below.
Algebraic topology
Rigon & Serafin
Heinzl, R., & Schwaha, P. (2011). A generic topology library. Science of Computer Programming, 76(4),
324–346. http://doi.org/10.1016/j.scico.2009.09.007
Berti, G. (2000, May 25). Generic Software Components for Scientific Computing.
They fall in the field of algebraic topology
From Wikipedia:
Algebraic topology is a branch of mathematics that uses tools from abstract
algebra to study topological spaces. The basic goal is to find
algebraic invariants that classify topological spaces up to homeomorphism,
though usually most classify up to homotopy equivalence.
Hatcher, A. (2001), Algebraic Topology.
!16
Algebraic topology
Rigon & Serafin
•Definition of a Topological Space
Rigon & Serafin
A topological space consists of a set X and and a family of subset
of X such that:
the space contains et least the empty set
and X
is closed under finite intersection
taking finite number of intersections
of subset belonging to
an element already in
is closed under arbitrary union
obtains
taking finite of infinite number of
unions of subset belonging to
obtains an element already in
The members of are called “open sets”
!17
Algebraic topology
Rigon & Serafin
•Definition of Hausdorff Space
Rigon & Serafin
The concept of topology is very wide and general. In order to be more
specific, and useful to our tasks, we concentrate on Hausdorff spaces.
The topological space is said to be Hausdorff if and only if
such that
with
This allows the separation of sets in the topological space
https://www.quora.com/What-is-the-significance-of-Hausdorff-
Spaces-How-do-these-measurements-help-us-What-does-it-allow-us-
to-have
!18
Algebraic topology
Rigon & Serafin
•Definition of N-Cell
Rigon & Serafin
A subset of an Hausdorff space is an open set if is is
homeomorphic to the interior of an open ball in for some n, being
an interior ball defined as:
So , we implicitly assume that our space is, at least locally, a metric space
As follows from the invariance of domain theorem, n is unique
To sum up, the last three slides were necessary to say that n-cells are objects
homeomorphic to open balls in
Given an n-cell, e, we can say that dim(e) = n
!19
Algebraic topology
Rigon & SerafinRigon & Serafin
To sum up, the last three slides were necessary to say that n-cells are objects
homeomorphic to open balls in
The shape does not actually matters (from the topological point of view).
The fact that they have no holes insides, instead, matters.
!20
We dealt so far with open cells (balls). However, we usually care also about
their boundary. In the topological language, this means to care about the
closure of the balls.
Rigon & Serafin
Algebraic topology
In mathematics, the closure of a subset S of points in
a topological space consists of all points in S together with
all limit points of S. The closure of S may equivalently be
defined as the union of S and its boundary, and also as the
intersection of all closed sets containing S. Intuitively, the
closure can be thought of as all the points that are either in S or
"near" S. A point which is in the closure of S is a point of
closure of S. The notion of closure is in many ways dual to the
notion of interior.
Wikipedia teaches:
For S a subset of a Euclidean space, x is a point of closure of S if
every open ball centered at x contains a point of S (this point may
be x itself).
•Definition of Closure
!21
Rigon & Serafin
Algebraic topology
For S a subset of a Euclidean space, x is a point of closure of S if
every open ball centered at x contains a point of S (this point may
be x itself).
•Definition of Closure
Later on we will observe that the closure of a set of dimension n
can be iteratively be constructed by adding to it appropriate sets
homeomorphic to open ball in (n-1) up to n=0
!22
Algebraic topology
Rigon & SerafinRigon & Serafin
Nodes are 0-cells
They actually do not constitute something like a 0-dimensional space but
are a discrete space.
In our use, they come also with a metric characterisation which is the set of
their coordinates (whatever type the coordinates are)
1
2
34
!23
Algebraic topology
Rigon & SerafinRigon & Serafin
Edges are 1-cells
They they can be used to join 0-cells to form a graph. Each one of the edges
is homeomorphic to a 1-ball (of radius 1):
a b
c
1
!24
Faces are 2-cells. They are delimited by 1- cells (edges)
And homeomorphic to the circle of radius 1
1
Rigon & Serafin
Algebraic topology
!25
Volumes are 3-cells (and lives in a 3-D space, minimum). They are
delimited by 2-cells (faces)
http://www.open.edu/openlearn/ocw/mod/oucontent/view.php?printable=1&id=4104
1
They are homeomorphic to a sphere of radius 1
Rigon & Serafin
Algebraic topology
!26
Rigon & Serafin
Algebraic topology
•Definition - Cell decomposition of a space
For the definition of CW complexes, we adopt the definitions given by Hansen.
A cell decomposition of a space X is a family
of subspaces of X , (not necessarily of the same dimension) such that each
is a cell and
the symbol means disjoint union of the sets, i.e.
Definition 4.1 - Cell decomposition of a space
!27
Algebraic topology
Rigon & SerafinRigon & Serafin
•Definition n-skeleton
The n-skeleton of a n-cell is
Note that if is a cell-decomposition of a space X, then the cells of can
have many different dimensions.
There are no restrictions on the number of cells in a cell-decomposition.
Thus we can have uncountable many cells in such a decomposition. E.g.
any space X has a cell-decomposition where each point of X is a 0-cell. A
finite cell-decomposition is a cell decomposition consisting of finitely
many cells.
!28
Complex topology
Rigon & Serafin
•Definition of CW-complex . A pair consisting of a Hausdorff space X and a
cell-decomposition of X is called a CW-complex if the following 3 axioms are
satisfied:
I - Characteristic map:
II - Closure finiteness:
III - Weak topology:
For each n-cell e ∈ there is a map
For any cell e ∈ its closure intersects only a finite number of other cells in .
A subset A ⊆ X is closed iff A ∩ ē is closed in X for each e ∈ E.
It can be restricted to any skeleton of e and to the interior of e
!29
Therefore, a CW-Complex is the topological equivalent (and rigorously
defined) of what a mesh (or a grid is). In practice, we take an n-
dimensional object, we subdivide it a finite number of elements of the
same dimension, its boundaries and the boundaries of the n-cells that
composed it are given by (n-1) dimensional objects. In turn, also these
boundaries have boundaries, an they are n-2 dimensional objects and
so on.
Complexes topology
Rigon & Serafin
!30
Complexes topology information
Rigon & Serafin
How much information we need to characterise a
CW- complex ?
Since its decompositional properties, a CW complex is fully described when
we enumerate all of its cells, starting from the 0-dimensional ones.
Nodes —> {{1},{2},{3}, …., {n}}
Let the grid nodes be numbered from 1 to n
They are nodes in a n-dimensional space, they have no topology on them yet
!31
{{1},.,{3}, …,{11}, .…{77}, …, {n}}
Complexes topology information
Rigon & Serafin
Nodes can be associated two by two to obtain the 1-complex
nodes’ list
edges’ list
Since we already have the nodes, we do not necessarily need to store
the 0-complexes in a pair, but their address, if this is convenient
{{1,3}, .., {3,11},…, {11,77}, …,{77,n}}
!32
Complexes topology information
Rigon & Serafin
Edges can be associated to obtain the 2-complex
nodes’ list
edges’ list
{{1,3,11,77,n}, ….., ….., …..,}faces’ list
Once the set of nodes that pertains to a face are listed, the face is
univocally identified. We do not need to list the edges (but with this,
we implicitly imposed an ordering among the edges and their
orientation)
{{1},.,{3}, …,{11}, .…{77}, …, {n}}
{{1,3}, .., {3,11},…, {11,77}, …,{77,n}}
!33
Complexes topology information
Rigon & Serafin
Faces can be associated to obtain the 3-complex
nodes’ list
edges’ list
{{1,3,11,77,n}, ….., ….., …..,}faces’ list
volumes’ list {{1,3,11,77,n, ….., ….., …..}}
{{1},.,{3}, …,{11}, .…{77}, …, {n}}
{{1,3}, .., {3,11},…, {11,77}, …,{77,n}}
!34
1
2
34
5
This below is called Hasse diagram
Rigon & Serafin
{{1},{2},{3},{4},{5}}
{{1,2},{1,3},{1,4},{1,5},{2,3},{2,4},{3,4},{3,5},{4,5}}
{{1,2,3},{1,2,4},{1,3,4},{1,3,5},{1,4,5},{2,3,4},{3,4,5}}
{{1,2,3,4},{1,3,4,5}}
nodes: 0-cells
edges: 1-list
faces: 2-list
volumes: 3-list
!35
Hasse diagram
Rigon & Serafin
{{1},{2},{3},{4},{5}}
{{1,2},{1,3},{1,4},{1,5},{2,3},{2,4},{3,4},{3,5},{4,5}}
{{1,2,3},{1,2,4},{1,3,4},{1,3,5},{1,4,5},{2,3,4},{3,4,5}}
{{1,2,3,4},{1,3,4,5}}
All the connections between nodes, edges, faces and volumes are well
represented by the Hasse diagram. On top you have just the single points, on
the first line, the edges, on the second line the facets, in the last lines the
volumes.
!36
Hasse diagram
Rigon & Serafin
{{1},{2},{3},{4},{5}}
{{1,2},{1,3},{1,4},{1,5},{2,3},{2,4},{3,4},{3,5},{4,5}}
{{1,2,3},{1,2,4},{1,3,4},{1,3,5},{1,4,5},{2,3,4},{3,4,5}}
{{1,2,3,4},{1,3,4,5}}
The arrows links connect the nodes to the edges they belong, the edges to
the faces and the faces to volumes.
!37
Hasse diagram
Rigon & Serafin
{{1},{2},{3},{4},{5}}
{{1,2},{1,3},{1,4},{1,5},{2,3},{2,4},{3,4},{3,5},{4,5}}
{{1,2,3},{1,2,4},{1,3,4},{1,3,5},{1,4,5},{2,3,4},{3,4,5}}
{{1,2,3,4},{1,3,4,5}}
The number of such arrow is equal to the number listed in each row (I do not
why, but I think it can be proven by some combinatorics or by induction)
!38
Hasse diagram
Rigon & Serafin
{{1},{2},{3},{4},{5}}
{{1,2},{1,3},{1,4},{1,5},{2,3},{2,4},{3,4},{3,5},{4,5}}
{{1,2,3},{1,2,4},{1,3,4},{1,3,5},{1,4,5},{2,3,4},{3,4,5}}
{{1,2,3,4},{1,3,4,5}}
Therefore to fully represent the topology of a CW-complex you need a
number of variables equal to the number of nodes, plus twice the number of
lines, plus three times the number of facets and four times the number of
volumes.
!39
Hasse diagram
Rigon & Serafin
{{1},{2},{3},{4},{5}}
{{1,2},{1,3},{1,4},{1,5},{2,3},{2,4},{3,4},{3,5},{4,5}}
Let’s observe that any group of connections represents the non-zero entries
of a incidence (or adjacency matrix). Such a matrix is, in this case the one
below
!40
Is is a five by five matrix. Each column represent a node, as well as any row.
The entries are 1 if there is a connection (edge) between the nodes and 0
otherwise. If the edges are oriented, 1 can be turned to -1 to indicate the
direction of the edge.
The matrix is symmetric (or antisymmetric with oriented edges). So the
independent non zero numbers (connections are 8 (in this case). Therefore,
it seems kind in favor of incidence matrix the information storage.
A incidence Matrix
Rigon & Serafin
!41
One has to reflect that the edges (but see below), has to be encoded in
any case, and this brings unavoidably in other 9 entities.
Well, 9+8 =17 which is still less that 18, in this case, but we have to observe
that storing a sparse matrix has further costs, which I did not included.
However, in adding cells, then, the number of 0s increase. The incidence matrix
above is a case of a sparse matrix and their treatment has a wide literature
(e.g. Serafin, 2014)
A incidence Matrix
Rigon & Serafin
!42
The incidence Matrix
Rigon & Serafin
Driven by the Hasse diagram, we actually did not show the real incidence
matrix. This is usually a N*E matrix, where N is the number of nodes and E is
the number of edges whose entries are 1 if the node and the edge are
connected, and 0 otherwise.
This “detail” does not matter at this point
of the discussion.
!43
Back to the Hasse diagram
Rigon & Serafin
In general to fully represent the topology of a CW-complex you need a
number of variables, B, equal to
the number of nodes, N
plus the number of nodes in an edge times the edges, 2*E
the number of edges in a facet times the number of facets, Ef *F
and the number of facet in a volume times the number of volumes, Fv*V
The above generalises the concept to CW-complex built on any shape, not
only tetrahedrons. If cells change shape, the formula has to be modified
accordingly.
We come back later on the fact that some information given is redundant.
!44
Every of the above entities has metric properties associated
Metric properties
Rigon & Serafin
nodes coordinates*
edges length, shape*
faces area
volumes volumes
*coordinates can be curvilinear, as well edges. Not necessarily straight
lines, because, for instance constrained to be geodetics on a surface.
!45
Any cell has its dual (complemetary network)
Rigon & Serafin
Any element of a cell complex (primal) has its own complementary (dual) element.
So a volume, can be associated to one of its internal points. For instance its center.
So, from a primal complex a new complex, the dual complex, can be obtained.
Two cases are illustrated below.
Tonti, E. (2013). The Mathematical Structure of Classical and Relativistic Physics (pp. 1–537).
!46
Any cell has its dual (complemetary network)
Rigon & Serafin
Another examples examples is represented by the Delaunay triangulation of a
plane and its Voronoi counterpart.
Tonti, E. (2013). The Mathematical Structure of Classical and Relativistic Physics (pp. 1–537).
!47
Any cell has its dual (complemetary network)
Rigon & Serafin
Why this is relevant ?
Clearly because often physical quantities in spaces are associated to a
volume (for instance the mass of a fluid), and, practically, attributed to some
internal point of that volume.
The internal point is the dual of the volume.
At the same time other quantities are associated to the faces of the cw-
complex, for instance fluxes. Fluxes, in turn, are associated with
directions. In fact, the dual of surfaces (faces) are (pseudo)-vectors (i.e., in
our case, edges-lines with an orientation associated, see below)
!48
Any cell has its dual (complemetary network)
Rigon & Serafin
Volumes have nodes dual (and viceversa)
Tonti, E. (2013). The Mathematical Structure of Classical and Relativistic Physics (pp. 1–537).
!49
Any cell has its dual (complemetary network)
Rigon & Serafin
Faces have edges dual (and viceversa)
Tonti, E. (2013). The Mathematical Structure of Classical and Relativistic Physics (pp. 1–537).
!50
Therefore we have also to make some room for storing information
about the dual quantities. Maybe.
Any cell has its dual (complemetary network)
Rigon & Serafin
Ferretti, E. (2015). The algebraic formulation: why and how to use it. Curved and Layer. Struct., 2, 106–149. http://doi.org/10.1515/cls-2015-0007
!51
Hasse diagram
Rigon & Serafin
{{1},{2},{3},{4},{5}}
{{1,2},{1,3},{1,4},{1,5},{2,3},{2,4},{3,4},{3,5},{4,5}}
{{1,2,3},{1,2,4},{1,3,4},{1,3,5},{1,4,5},{2,3,4},{3,4,5}}
{{1,2,3,4},{1,3,4,5}}
Now, let’s go back to some redundancy presented in the Hasse graphs
In particular, our statement is that, the information contained in the 1-
cells can be skipped
!52
Some on orientation
Rigon & Serafin
This can be obtained if the faces are oriented. Some, e.g. Tonti
(2013) and Ferretti (2015) argument a lot with orientation. This is
probably derived from a better knowledge of algebraic topology
better that ours, but we mostly find their treatment of the matter a
little too involved.
!53
Some on orientation
Rigon & Serafin
Our own position:
a - 1-d cells can be oriented (in the case below right to left)
b - 2-d cells can be oriented because the orientation of their dual
c - 1-d skeletons of 2-d cells can be oriented (thanks to the right hand rule)
!54
Nobodys actually says that the circulation on the skeleton of the face must
be in agreement with the one of the pseudo-vector blue. We can draw
them independently.
Usually they say that the orientation of the skeleton is the inner
(whilst arbitrary) orientation. The one of the orthogonal vector is the
outer one. But we do not care.
Some on orientation
Rigon & Serafin
!55
Some on orientation
Rigon & Serafin
What is relevant for us is that if 1-d skeletons of cells can be oriented, then
we can skip to specify in the Hasse diagram the 1-cells, and they can be
deduced directly by the two cells, if they are represented using some
ordering.
1
21 7
Assuming we label the nodes with numbers, for instance, the “natural” ordering
of the above triangle would be clockwise, i.e. {1,7,21} and the edges are simply
between nodes 1-7, 7-21, 21-1
!56
Some on orientation
Rigon & Serafin
A little more complicate is the case of faces made up with polygons with
more than 3 sides
1
21
7
5
In such cases usually it happens that the number do not identify an
ordering scheme. However, if we establish that we start from the
lowest number and move from it in the direction the lowest of the two
adjacent numbers, then an ordering scheme is re-stablished and the 4-
tuple {1,7,5,21} identify (seen, from this side) a clockwise orientation.
At the same time, we know that our 1-cells are {1,7}, {7,5},{5,21},{21,1}
!57
Some on orientation
Rigon & Serafin
Please, notice that clockwise and counterclockwise is just a perspective
(or, if you prefer, a representation.
1
21
7
5
Looked from the other side, the facet is counterclockwise ordered
The concept actually is connected to the vector spaces properties.
!58
Information compression
Rigon & Serafin
That’s it!
{{1},{2},{3},{4},{5}}
{{1,2,3},{1,2,4},{1,3,4},{1,3,5},{1,4,5},{2,3,4},{3,4,5}}
{{1,2,3,4},{1,3,4,5}}
The numbers necessary to fully identify the topology is reduced.
!59
Further simplifications
Rigon & Serafin
Actually if we restrict just to the use of simplexes, the information can be
further restricted. In fact, the list of numbers below,
{{1,2,3,4},{1,3,4,5}}
allows to fully identify the facets of the simplexes. There is a trade-off though,
that some little larger effort should be done to find out them from any sublist,
i.e. say, for instance,
{1,2,3,4}
Not even the previous information reduction came for free, actually,
because besides the little effort to identify edges, in implementation,
maybe we do have to make room for a place to store the geometric
characteristic (length) of the edges somewhere else that in the natural place
which would be the object containing (but we will see) the edges data.
!60
Rigon & Serafin
Beyond topology, geometry
So far we can assume to have a grid, represented as described before.
Which operations do we want to do with it ?
Certainly we want to estimate its geometric properties
nodes coordinates
edges length, shape
faces area
volumes volumes
What we assume to have are the coordinates of nodes
and the topology of the grid
!61
Rigon & Serafin
Beyond topology, geometry (and a little view to deployment)
To estimate edges length, we have to:
iterate over all the edges
for any edge get the limiting nodes
estimate the length, according to the type of
coordinates
store the length in an appropriate container which
should be aware that the value belongs to a certain
feature of the grid
Berti, G. (2000, May 25). Generic Software Components for Scientific Computing.
I draw an algorithm here, and I try to endorse the attitude described in Berti
(2000), chapter 2.
!62
Rigon & Serafin
Beyond topology, geometry (and a little view to deployment)
To estimate edges length, we have to:
iterate over all the edges
It means that whatever container memorizes the edges, we needs to be able
to iterate over them easily and efficiently (and possibly in parallel).
Containers that have this characteristic in Java are vectors and/or various
types of collections. We do want to take decisions too early, and being able,
in case to change the type of container for efficiency reasons at run time.
Actually, our previous discussion showed that we could not have a real
container for edges, but just the container for faces.
Therefore the container must be specified in an abstract way. Also: we could
have different types of iterators, for the different objects in the same
container
!63
Rigon & Serafin
Beyond topology, geometry (and a little view to deployment)
To estimate edges length, we have to:
for any edge get the limiting nodes
Therefore we need to have, besides the container for edges, a container for
nodes (which was obvious since the beginning). the way we wrote the Hasse
diagrams already contains the idea that the edges (or faces) container is
actually composed with references to (or a copy of) the specific nodes
!64
Rigon & Serafin
Beyond topology, geometry (and a little view to deployment)
To estimate edges length, we have to:
estimate the length, according to the type of
coordinates
We can have Cartesian coordinates, Latitude and Longitude, Cylindrical
coordinates. This implies that any type of coordinates has its own way to
estimate lengths. Besides, we should be able to attach to our topology
coordinate types at run time (when we know our system), and add new types
of coordinates if required. Moreover, the algorithm should be independent
from the type of container used to store the basic quantities: we should try to
avoid interlock between data storage and algorithms (Berti, 2000, chapter 1)
Berti, G. (2000, May 25). Generic Software Components for Scientific Computing.
!65
Rigon & Serafin
Beyond topology, geometry (and a little view to deployment)
To estimate edges length, we have to:
store the length in an appropriate container which
should be aware that the value belongs to a certain
feature of the grid
We probably would like here to separate geometry and topology and do not
use the the topology container (adding a field) to store it. This, in turn, can be
the archetype for storing also other quantities, like physical quantities, for
instance.
!66
Rigon & Serafin
Beyond topology, geometry (and a little view to deployment)
To estimate facets area, we have to:
iterate over all the facets
for any face get the limiting edges
estimate the area, according to the type of coordinates
store the area in an appropriate container which should
be aware that the value belongs to a certain feature of
the grid
Berti, G. (2000, May 25). Generic Software Components for Scientific Computing.
Changed what is to be changed, this algorithm implies the same issues that
the estimation of edges length imply.
!67
Rigon & Serafin
Beyond topology, geometry (and a little view to deployment)
To estimate volumes’ volume, we have to:
iterate over all the volumes
for any volume get the limiting nodes
estimate the volume, according to the type of
coordinates
store the volumes in an appropriate container which
should be aware that the value belongs to a certain
feature of the grid
Berti, G. (2000, May 25). Generic Software Components for Scientific Computing.
Changed what is to be changed, this algorithm implies the same issues that
the estimation of edges length imply.
!68
*** operations
Count them
Estimate their reciprocal distance
Cluster/separate groups of them according to
topology and some external indication
Common operations
*** Stands for any of “nodes”, ‘edges”, “faces”, “volumes”
All of the above operations requires the same attention that were
given to previously illustrated algorithms
Rigon & Serafin
!69
On Physical quantities
Rigon & SerafinRigon & Serafin
So far, we did not talk about physical properties and how they are
attached to grids. In fact, some quantities are attached to volumes,
some others to faces, some others to edges.
We can have actually more than one quantity attached to a grid and we
do want to separate the topology for the geometry and the (physical)
data from the rest. We do not know how many quantities we want to
attach to the grid and we must be able to do it at run time.
!70
Hints for a Java deoplynment
Rigon & Serafin
Let’s try therefore a little thinking for a Java
deployment.
In general the abstraction required several times implies the use of
three tools:
•Generic programming (via Java generics)
•Using interfaces (i.e. programming to interfaces)
•Using some design patterns to insulate what changes.
I cannot say to dominate the three topics, but I will try to distill
what I know (in further series of slides).
!71
Hints for a Java deployment
Rigon & Serafin
Previous deployments
Apparently there are not such type of libraries in Java, except, maybe the
book by Nikishkov* (2006, 2010) below. This book has a section dedicated to
mesh generation that could be important to read in any case.
There exists, instead, various examples in C/C++ that use generic
programming. Among those, the first to mention is the work coming out from
Berti’s thesis (2000). In particular his GRAL libraries available on Github.
I will not go further .
Nikishkov, G. (2010). Programming Finite Elements in Java (pp. 1–394). Springer-Verlag 2010.
Berti, G. (2000, May 25). Generic Software Components for Scientific Computing.
Nikishkov, G. (2006). Object oriented design of a finite element code in Java. Cmes, 11, 81–90. http://doi.o
10.3970/cmes.2006.011.081
*Actually, I give a quick look to Nikishkov work, and I do not fill it very inspiring. Probably useful.
!72
Other requirements
There are other requirements that we have to fulfill before to go to
implementations. For instance, when we have to deal with conservation laws, we
have to iterate over all the neighbors of a cell of a cell to estimate some
quantities (for instance fluxes)
The Hasse diagrams we draw connects a 3-cells to their boundary 2-cells but
they do not know which are their neighbors.
We have the possibility to estimate the neighbors scanning the connections
between cells and storing somewhere the connections (which seems kind of
necessary in order to decrease the computational burden).
It turns out that the more parsimonious way to do it, without invoking some
compression of the data is to use the dual of the primal grid.
The use of the dual
Rigon & Serafin
!73
The dual of the primal grid is a grid itself
Let’s do a 2-d example, which is more easy to visualize this time.
In this draw, red points are those dual of the faces, and in the
same number. Green edges are dual to boundary edges, in the same
number than primal edges.
Rigon & Serafin
The use of the dual
!74
Let’s number them
1
2
3
4
5
6
7
The use of the dual
Rigon & Serafin
{{1},{2},{3},{4},{5},{6},{7}}
{{1,2},{1,6},{1,7},{2,3},{3,4},{4,5},{5,7}}
and build the Hasse diagram
!75
1
2
3
4
5
6
7
8
Do the usual work with the primal complex
Build the primal information
Rigon & Serafin
{{1},{2},{3},{4},{5},{6},{7},{8}}
{{1,2,8},{1,7,8},{2,3,8},{3,4,5},{3,5,8},{6,7,8},{5,6,8}}
!76
1
2
3
4
5
6
7
8
{{1},{2},{3},{4},{5},{6},{7},{8}}
{{1,2,8},{1,7,8},{2,3,8},{3,4,5},{3,5,8},{6,7,8},{5,6,8}}
{{1},{2},{3},{4},{5},{6},{7}}
{{1,2},{1,6},{1,7},{2,3},{3,4},{4,5},{5,7}}
The total information
Rigon & Serafin
1
2
3
4
5
6
7
!77
1
2
3
4
5
6
7
8
{{1},{2},{3},{4},{5},{6},{7}}
{{1,2},{1,6},{1,7},{2,3},{3,4},{4,5},{5,7}}
{{1},{2},{3},{4},{5},{6},{7},{8}}
{{1,2,8},{1,7,8},{2,3,8},{3,4,5},{3,5,8},{6,7,8},{5,6,8}}
Rigon & Serafin
1
2
3
4
5
6
7
Eliminating redundancy
Because there is a one-to-one correspondence between 2-cells
and the dual 1-cells, replicating this topological information
can be done. However, we have to remind that the information
about the geometry of dual-nodes has to be stored.
!78
To sum up
Rigon & Serafin
Previously we arrived at the estimation that the number
of variables to be stored (for the primal graph) is
!79
Rigon & Serafin
To sum up
Adding the dual set, ad assuming we are able to avoid
to store the numbers of dual nodes, we have to increase
B by the number of edges in the dual, obtaining:
In turn, the number of edges in the dual is equal to the
number of its primal (complementary) set.
In the 2D case we illustrated
!80
Rigon & Serafin
To sum up
Looking at implementations, we have to observe also which
(geo)metrical data we have to store:
nodes coordinates
edges length
faces area
volume volumes
dual nodes position
dual edges length }
One decision to take is if dual’s attribute has to be stored along with
the primal set entities. In the latter case, in 3D the dual edges are in
one to one correspondence to faces, and dual nodes to volumes.
!81
Rigon & Serafin
To sum up
In 2D, however, dual edges have edges themselves as primal.
nodes coordinates
edges length
faces area
dual nodes position
dual edges length }
Therefore (including the fact that fluxes will be trough edges and not faces,
in 2D is probably convenient to implement edges.
!82
In 1D, systems we have just nodes and edges, and the dual of the primal is
given itself by nodes and edges
nodes coordinates
edges length
dual nodes position
if we take the dual position conventionally in the middle, storing dual
nodes position is not so important, and computationally easy to
estimate
Rigon & Serafin
To sum up
!83
Graphs
Rigon & Serafin
A graph can be seen as a particular case of a 1-complex, formed by nodes
and edges
Therefore it would be completely described by labeling the nodes and
marking the connections (for instance through a Hasse diagram or an
incidence matrix)
!84
Graphs
Rigon & Serafin
Relevant to to the graph is the orientation of its edges that selects
direction of “flows” of quantities. certainly the general structure of
graphs can be much more complex than that draw here, including loops
and other features. As observed by Branin (1966), these flows identified
topological algebraic structures on the graphs
Branin, F. H. (1966). The algebraic-topological basis for network analogies and the vector
calculus (pp. 1–40). Presented at the Symposium on generalized Networks, New York.
!85
In order to make faster the computation it is necessary to cope with
parallelisation of the codes. This can happen in several ways.
One way is to observe the nature of algorithm to be implemented, and
observe, for instance, that many algorithms for estimating the
geometrical quantities, once properly represented are embarrassingly
parallel . In other cases, parallelisation can be obtained by splitting the
grid in parts which are executing in parallel. This is actually a field of
research since many years. But the work of Berti and his libraries, or the
work by can give some guidance.
The structure of the CW-complex themselves can help to get it properly.
With respect to Java, it could be observed that, after Java 8 and the
introduction of streams, data that can be streamed can be internally
parallelise. Another relevant example could be the Muskel 2 libraries
which were recently implemented in Java, or the implementation
structure of the Net3 graph.
Parallel computation
Rigon & Serafin
Heinzl, R., & Schwaha, P. (2011). A generic topology library. Science of Computer Programming, 76(4), 3
http://doi.org/10.1016/j.scico.2009.09.007
Berti, G. (2000, May 25). Generic Software Components for Scientific Computing.
!86
Find this presentation at
http://abouthydrology.blogspot.com
Ulrici,2000?
Other material at
Questions ?
R. Rigon

Contenu connexe

Similaire à Grids

Gabor Frames for Quasicrystals and K-theory
Gabor Frames for Quasicrystals and K-theoryGabor Frames for Quasicrystals and K-theory
Gabor Frames for Quasicrystals and K-theory
Michael Kreisel
 
presentation-geseke
presentation-gesekepresentation-geseke
presentation-geseke
Guk Chan Han
 
Gupte - first year paper_approved (1)
Gupte - first year paper_approved (1)Gupte - first year paper_approved (1)
Gupte - first year paper_approved (1)
Shweta Gupte
 
topological_quantum_computing
topological_quantum_computingtopological_quantum_computing
topological_quantum_computing
Zachary Forster
 
Masterscriptie T. Dings (4029100)
Masterscriptie T. Dings (4029100)Masterscriptie T. Dings (4029100)
Masterscriptie T. Dings (4029100)
Teun Dings
 
HIDDEN DIMENSIONS IN NATURE
HIDDEN DIMENSIONS IN NATUREHIDDEN DIMENSIONS IN NATURE
HIDDEN DIMENSIONS IN NATURE
Milan Joshi
 

Similaire à Grids (20)

Mesh final pzn_geo1004_2015_f3_2017
Mesh final pzn_geo1004_2015_f3_2017Mesh final pzn_geo1004_2015_f3_2017
Mesh final pzn_geo1004_2015_f3_2017
 
Gabor Frames for Quasicrystals and K-theory
Gabor Frames for Quasicrystals and K-theoryGabor Frames for Quasicrystals and K-theory
Gabor Frames for Quasicrystals and K-theory
 
Conformal matching
Conformal matchingConformal matching
Conformal matching
 
presentation-geseke
presentation-gesekepresentation-geseke
presentation-geseke
 
Conceptual Spaces for Cognitive Architectures: A Lingua Franca for Different ...
Conceptual Spaces for Cognitive Architectures: A Lingua Franca for Different ...Conceptual Spaces for Cognitive Architectures: A Lingua Franca for Different ...
Conceptual Spaces for Cognitive Architectures: A Lingua Franca for Different ...
 
Gupte - first year paper_approved (1)
Gupte - first year paper_approved (1)Gupte - first year paper_approved (1)
Gupte - first year paper_approved (1)
 
Compact Monothetic C semirings
Compact Monothetic C semiringsCompact Monothetic C semirings
Compact Monothetic C semirings
 
Lectures on Analytic Geometry
Lectures on Analytic GeometryLectures on Analytic Geometry
Lectures on Analytic Geometry
 
project
projectproject
project
 
Solid modeling
Solid modelingSolid modeling
Solid modeling
 
topological_quantum_computing
topological_quantum_computingtopological_quantum_computing
topological_quantum_computing
 
Masterscriptie T. Dings (4029100)
Masterscriptie T. Dings (4029100)Masterscriptie T. Dings (4029100)
Masterscriptie T. Dings (4029100)
 
Hidden dimensions in nature
Hidden dimensions in natureHidden dimensions in nature
Hidden dimensions in nature
 
hidden dimension in nature
hidden dimension in naturehidden dimension in nature
hidden dimension in nature
 
HIDDEN DIMENSIONS IN NATURE
HIDDEN DIMENSIONS IN NATUREHIDDEN DIMENSIONS IN NATURE
HIDDEN DIMENSIONS IN NATURE
 
FRACTAL GEOMETRY AND ITS APPLICATIONS BY MILAN A JOSHI
FRACTAL GEOMETRY AND ITS APPLICATIONS BY MILAN A JOSHIFRACTAL GEOMETRY AND ITS APPLICATIONS BY MILAN A JOSHI
FRACTAL GEOMETRY AND ITS APPLICATIONS BY MILAN A JOSHI
 
Spectral clustering with motifs and higher-order structures
Spectral clustering with motifs and higher-order structuresSpectral clustering with motifs and higher-order structures
Spectral clustering with motifs and higher-order structures
 
Analysis of SAED patterns
Analysis of SAED patternsAnalysis of SAED patterns
Analysis of SAED patterns
 
Graph theory ppt.pptx
Graph theory ppt.pptxGraph theory ppt.pptx
Graph theory ppt.pptx
 
Daa chpater 12
Daa chpater 12Daa chpater 12
Daa chpater 12
 

Plus de Riccardo Rigon

Plus de Riccardo Rigon (20)

Models for hazards mapping
Models for hazards mappingModels for hazards mapping
Models for hazards mapping
 
A short introduction to some hydrological extreme phenomena
A short introduction to some hydrological extreme phenomenaA short introduction to some hydrological extreme phenomena
A short introduction to some hydrological extreme phenomena
 
EvaporAzione
EvaporAzioneEvaporAzione
EvaporAzione
 
Francesco Serafin
Francesco Serafin Francesco Serafin
Francesco Serafin
 
Meledrio
MeledrioMeledrio
Meledrio
 
Lisbon talk for SteepStreams
Lisbon talk  for SteepStreamsLisbon talk  for SteepStreams
Lisbon talk for SteepStreams
 
Grids implementation
Grids implementationGrids implementation
Grids implementation
 
Some photos from the field
Some photos from the fieldSome photos from the field
Some photos from the field
 
Virtual water fem 07032017
Virtual water fem 07032017Virtual water fem 07032017
Virtual water fem 07032017
 
Dalton Prize Lecture 2017 by Dani Or
Dalton Prize Lecture 2017 by Dani OrDalton Prize Lecture 2017 by Dani Or
Dalton Prize Lecture 2017 by Dani Or
 
Projecting Climate Change Impacts on Water Resources in Regions of Complex To...
Projecting Climate Change Impacts on Water Resources in Regions of Complex To...Projecting Climate Change Impacts on Water Resources in Regions of Complex To...
Projecting Climate Change Impacts on Water Resources in Regions of Complex To...
 
The modern flood forecasting
The modern flood forecastingThe modern flood forecasting
The modern flood forecasting
 
La moderna previsione delle piene
La moderna previsione delle pieneLa moderna previsione delle piene
La moderna previsione delle piene
 
Hydrological Extremes and Human societies
Hydrological Extremes and Human societies Hydrological Extremes and Human societies
Hydrological Extremes and Human societies
 
The Science of Water Transport and Floods from Theory to Relevant Application...
The Science of Water Transport and Floods from Theory to Relevant Application...The Science of Water Transport and Floods from Theory to Relevant Application...
The Science of Water Transport and Floods from Theory to Relevant Application...
 
The Science of Water Transport and Floods from Theory to Relevant Applications
The Science of Water Transport and Floods from Theory to Relevant ApplicationsThe Science of Water Transport and Floods from Theory to Relevant Applications
The Science of Water Transport and Floods from Theory to Relevant Applications
 
Climaware at the end
Climaware at the endClimaware at the end
Climaware at the end
 
Hymod model for catchments
Hymod model for catchmentsHymod model for catchments
Hymod model for catchments
 
Egu2017 pico
Egu2017 picoEgu2017 pico
Egu2017 pico
 
Freezing Soil for the class of Environmental Modelling
Freezing Soil for the class of Environmental ModellingFreezing Soil for the class of Environmental Modelling
Freezing Soil for the class of Environmental Modelling
 

Dernier

An Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfAn Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdf
SanaAli374401
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 
Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.
MateoGardella
 

Dernier (20)

Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
An Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfAn Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdf
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writing
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 

Grids

  • 1. Grids theory and domain requirements Riccardo Rigon, Francesco Serafin Naturaltopologies,ValdiRabbi,2017
  • 2. !2 Representation of space (and time) is a necessary step to implement any Physics. However, it the topics is seldom faced with the appropriate generality, and this reflects into implementations in softwares that do not have a general structure. In literature there are at least three issues to be considered: • The naming • The mathematics • The implementation (its abstract implementation and its deployment in a language - Java for us) Introduction Rigon & Serafin
  • 3. !3 Because grids are a so general argument, people worked to understand each other when dealing with it. The most thought outcome is the work of the Ugrid Convention. You can find it at •https://github.com/ugrid-conventions/ugrid-conventions but we summarize some points here (please do not go directly to them, you will loss something, probably). The naming Rigon & Serafin What follows assumes that the readers know what a topology is.
  • 4. !4 Their approach aims to establish a common description for NetCDF files that contains unstructured grid data. We do not specify what unstructured means (you can find it here). The bare bone idea is that grids are mathematical objects formed by •nodes (a point, a coordinate pair or triplet: the most basic element of the topology. The word “node” seems to be more commonly used than the alternative “vertex”) The naming Rigon & Serafin 1 2 34 The number are arbitrary, of course.
  • 5. !5 Nodes Rigon & Serafin • edges (a line or curve bounded by two nodes) 1 2 34 1 2 34 a b cd Here the edges are named according to letters, but numbers would have been the same. The set of nodes does not identify the set of edges. a b cd e
  • 6. !6 Edges Rigon & Serafin • edges (a line or curve bounded by two nodes) 1 2 34 b cd e The above geometry is not exactly what expected, because it does not seems to have the same topology of the other two (we will be more precise on this in what follows). But the figure drawn is certainly a union of nodes and edges. We will call it a graph
  • 7. !7 •faces (a plane or surface enclosed by a set of edges. In a 2D horizontal application one may consider the word “polygon”, but in the hierarchy of elements the word “face” is most common) 1 2 34 1 2 34 a b cd a b cd e A A B Faces are denoted my boldface capital letters. Faces Rigon & Serafin
  • 8. !8 •volumes (a volume enclosed by a set of faces. The alternative word “cell” was considered, but “cell” is often used in the community to describe 2 dimensional structures.) The symbol A denotes the volume C 1 2 34 a b cd e A B A B C A D D Faces Rigon & Serafin
  • 9. !9 •volumes (a volume enclosed by a set of faces. The alternative word “cell” was considered, but “cell” is often used in the community to describe 2 dimensional structures.) We were used to see the entities are 2 dimensional, but these are 3 dimensional and are formed by 4 faces (4 nodes, 6 edges), two of which stay behind (in perspective, to form a tetrahedron). C 1 2 34 a b cd e A B A B C A D D Volumes Rigon & Serafin
  • 10. !10 Here you see a tetrahedron planar development). Volumes Rigon & Serafin
  • 11. !11 With some more nodes, we could have cube (8 nodes, 12 edges), as well other figures Volumes Rigon & Serafin
  • 12. !12 In fact one fundamental concept is that about topological dimensionality of the entities, we are dealing with •nodes are 0 dimensional •edges are 1 dimensional •faces are 2 dimensional •volumes are 3 dimensional The specification of the number of a certain group of d-cells (0-cells are nodes etc.) does not imply the dimensionality of the union set. In fact, for instance b cd e does not imply the existence of a face included between nodes [4,3,2]. All we are interested in can jus live on the 1-dimensional space identified by edges 1 2 34 Dimensionality Rigon & Serafin
  • 13. !13 Rigon & Serafin Meshes/Grids/Complexes Said the above, we are not usually interested in single nodes, faces, edged, volumes, but to a certain group of them, mixed in various forms, to obtain approximation of any shape (as you noticed I avoid to use the word geometry) These sets are our meshes, grids, or, as we will define later, cw-complexes. tetrahedron cube rhombic dodecahedron
  • 14. !14 Rigon & Serafin Meshes/Grids/Complexes Alliez. P; Ucelli, G; Gotsman, C; Attene, M., Recent Advances in Remeshing of Surfaces, 2008 Any shape, also very complicate objects
  • 15. !15 A more formal treatment of the matter seems necessary now to put in order the concepts above and proceed eventually to implement some grid structure. The concepts are mostly taken from Heinzl and Schawaha (2011), which at lest inherits something from Berti’s dissertation below. Algebraic topology Rigon & Serafin Heinzl, R., & Schwaha, P. (2011). A generic topology library. Science of Computer Programming, 76(4), 324–346. http://doi.org/10.1016/j.scico.2009.09.007 Berti, G. (2000, May 25). Generic Software Components for Scientific Computing. They fall in the field of algebraic topology From Wikipedia: Algebraic topology is a branch of mathematics that uses tools from abstract algebra to study topological spaces. The basic goal is to find algebraic invariants that classify topological spaces up to homeomorphism, though usually most classify up to homotopy equivalence. Hatcher, A. (2001), Algebraic Topology.
  • 16. !16 Algebraic topology Rigon & Serafin •Definition of a Topological Space Rigon & Serafin A topological space consists of a set X and and a family of subset of X such that: the space contains et least the empty set and X is closed under finite intersection taking finite number of intersections of subset belonging to an element already in is closed under arbitrary union obtains taking finite of infinite number of unions of subset belonging to obtains an element already in The members of are called “open sets”
  • 17. !17 Algebraic topology Rigon & Serafin •Definition of Hausdorff Space Rigon & Serafin The concept of topology is very wide and general. In order to be more specific, and useful to our tasks, we concentrate on Hausdorff spaces. The topological space is said to be Hausdorff if and only if such that with This allows the separation of sets in the topological space https://www.quora.com/What-is-the-significance-of-Hausdorff- Spaces-How-do-these-measurements-help-us-What-does-it-allow-us- to-have
  • 18. !18 Algebraic topology Rigon & Serafin •Definition of N-Cell Rigon & Serafin A subset of an Hausdorff space is an open set if is is homeomorphic to the interior of an open ball in for some n, being an interior ball defined as: So , we implicitly assume that our space is, at least locally, a metric space As follows from the invariance of domain theorem, n is unique To sum up, the last three slides were necessary to say that n-cells are objects homeomorphic to open balls in Given an n-cell, e, we can say that dim(e) = n
  • 19. !19 Algebraic topology Rigon & SerafinRigon & Serafin To sum up, the last three slides were necessary to say that n-cells are objects homeomorphic to open balls in The shape does not actually matters (from the topological point of view). The fact that they have no holes insides, instead, matters.
  • 20. !20 We dealt so far with open cells (balls). However, we usually care also about their boundary. In the topological language, this means to care about the closure of the balls. Rigon & Serafin Algebraic topology In mathematics, the closure of a subset S of points in a topological space consists of all points in S together with all limit points of S. The closure of S may equivalently be defined as the union of S and its boundary, and also as the intersection of all closed sets containing S. Intuitively, the closure can be thought of as all the points that are either in S or "near" S. A point which is in the closure of S is a point of closure of S. The notion of closure is in many ways dual to the notion of interior. Wikipedia teaches: For S a subset of a Euclidean space, x is a point of closure of S if every open ball centered at x contains a point of S (this point may be x itself). •Definition of Closure
  • 21. !21 Rigon & Serafin Algebraic topology For S a subset of a Euclidean space, x is a point of closure of S if every open ball centered at x contains a point of S (this point may be x itself). •Definition of Closure Later on we will observe that the closure of a set of dimension n can be iteratively be constructed by adding to it appropriate sets homeomorphic to open ball in (n-1) up to n=0
  • 22. !22 Algebraic topology Rigon & SerafinRigon & Serafin Nodes are 0-cells They actually do not constitute something like a 0-dimensional space but are a discrete space. In our use, they come also with a metric characterisation which is the set of their coordinates (whatever type the coordinates are) 1 2 34
  • 23. !23 Algebraic topology Rigon & SerafinRigon & Serafin Edges are 1-cells They they can be used to join 0-cells to form a graph. Each one of the edges is homeomorphic to a 1-ball (of radius 1): a b c 1
  • 24. !24 Faces are 2-cells. They are delimited by 1- cells (edges) And homeomorphic to the circle of radius 1 1 Rigon & Serafin Algebraic topology
  • 25. !25 Volumes are 3-cells (and lives in a 3-D space, minimum). They are delimited by 2-cells (faces) http://www.open.edu/openlearn/ocw/mod/oucontent/view.php?printable=1&id=4104 1 They are homeomorphic to a sphere of radius 1 Rigon & Serafin Algebraic topology
  • 26. !26 Rigon & Serafin Algebraic topology •Definition - Cell decomposition of a space For the definition of CW complexes, we adopt the definitions given by Hansen. A cell decomposition of a space X is a family of subspaces of X , (not necessarily of the same dimension) such that each is a cell and the symbol means disjoint union of the sets, i.e. Definition 4.1 - Cell decomposition of a space
  • 27. !27 Algebraic topology Rigon & SerafinRigon & Serafin •Definition n-skeleton The n-skeleton of a n-cell is Note that if is a cell-decomposition of a space X, then the cells of can have many different dimensions. There are no restrictions on the number of cells in a cell-decomposition. Thus we can have uncountable many cells in such a decomposition. E.g. any space X has a cell-decomposition where each point of X is a 0-cell. A finite cell-decomposition is a cell decomposition consisting of finitely many cells.
  • 28. !28 Complex topology Rigon & Serafin •Definition of CW-complex . A pair consisting of a Hausdorff space X and a cell-decomposition of X is called a CW-complex if the following 3 axioms are satisfied: I - Characteristic map: II - Closure finiteness: III - Weak topology: For each n-cell e ∈ there is a map For any cell e ∈ its closure intersects only a finite number of other cells in . A subset A ⊆ X is closed iff A ∩ ē is closed in X for each e ∈ E. It can be restricted to any skeleton of e and to the interior of e
  • 29. !29 Therefore, a CW-Complex is the topological equivalent (and rigorously defined) of what a mesh (or a grid is). In practice, we take an n- dimensional object, we subdivide it a finite number of elements of the same dimension, its boundaries and the boundaries of the n-cells that composed it are given by (n-1) dimensional objects. In turn, also these boundaries have boundaries, an they are n-2 dimensional objects and so on. Complexes topology Rigon & Serafin
  • 30. !30 Complexes topology information Rigon & Serafin How much information we need to characterise a CW- complex ? Since its decompositional properties, a CW complex is fully described when we enumerate all of its cells, starting from the 0-dimensional ones. Nodes —> {{1},{2},{3}, …., {n}} Let the grid nodes be numbered from 1 to n They are nodes in a n-dimensional space, they have no topology on them yet
  • 31. !31 {{1},.,{3}, …,{11}, .…{77}, …, {n}} Complexes topology information Rigon & Serafin Nodes can be associated two by two to obtain the 1-complex nodes’ list edges’ list Since we already have the nodes, we do not necessarily need to store the 0-complexes in a pair, but their address, if this is convenient {{1,3}, .., {3,11},…, {11,77}, …,{77,n}}
  • 32. !32 Complexes topology information Rigon & Serafin Edges can be associated to obtain the 2-complex nodes’ list edges’ list {{1,3,11,77,n}, ….., ….., …..,}faces’ list Once the set of nodes that pertains to a face are listed, the face is univocally identified. We do not need to list the edges (but with this, we implicitly imposed an ordering among the edges and their orientation) {{1},.,{3}, …,{11}, .…{77}, …, {n}} {{1,3}, .., {3,11},…, {11,77}, …,{77,n}}
  • 33. !33 Complexes topology information Rigon & Serafin Faces can be associated to obtain the 3-complex nodes’ list edges’ list {{1,3,11,77,n}, ….., ….., …..,}faces’ list volumes’ list {{1,3,11,77,n, ….., ….., …..}} {{1},.,{3}, …,{11}, .…{77}, …, {n}} {{1,3}, .., {3,11},…, {11,77}, …,{77,n}}
  • 34. !34 1 2 34 5 This below is called Hasse diagram Rigon & Serafin {{1},{2},{3},{4},{5}} {{1,2},{1,3},{1,4},{1,5},{2,3},{2,4},{3,4},{3,5},{4,5}} {{1,2,3},{1,2,4},{1,3,4},{1,3,5},{1,4,5},{2,3,4},{3,4,5}} {{1,2,3,4},{1,3,4,5}} nodes: 0-cells edges: 1-list faces: 2-list volumes: 3-list
  • 35. !35 Hasse diagram Rigon & Serafin {{1},{2},{3},{4},{5}} {{1,2},{1,3},{1,4},{1,5},{2,3},{2,4},{3,4},{3,5},{4,5}} {{1,2,3},{1,2,4},{1,3,4},{1,3,5},{1,4,5},{2,3,4},{3,4,5}} {{1,2,3,4},{1,3,4,5}} All the connections between nodes, edges, faces and volumes are well represented by the Hasse diagram. On top you have just the single points, on the first line, the edges, on the second line the facets, in the last lines the volumes.
  • 36. !36 Hasse diagram Rigon & Serafin {{1},{2},{3},{4},{5}} {{1,2},{1,3},{1,4},{1,5},{2,3},{2,4},{3,4},{3,5},{4,5}} {{1,2,3},{1,2,4},{1,3,4},{1,3,5},{1,4,5},{2,3,4},{3,4,5}} {{1,2,3,4},{1,3,4,5}} The arrows links connect the nodes to the edges they belong, the edges to the faces and the faces to volumes.
  • 37. !37 Hasse diagram Rigon & Serafin {{1},{2},{3},{4},{5}} {{1,2},{1,3},{1,4},{1,5},{2,3},{2,4},{3,4},{3,5},{4,5}} {{1,2,3},{1,2,4},{1,3,4},{1,3,5},{1,4,5},{2,3,4},{3,4,5}} {{1,2,3,4},{1,3,4,5}} The number of such arrow is equal to the number listed in each row (I do not why, but I think it can be proven by some combinatorics or by induction)
  • 38. !38 Hasse diagram Rigon & Serafin {{1},{2},{3},{4},{5}} {{1,2},{1,3},{1,4},{1,5},{2,3},{2,4},{3,4},{3,5},{4,5}} {{1,2,3},{1,2,4},{1,3,4},{1,3,5},{1,4,5},{2,3,4},{3,4,5}} {{1,2,3,4},{1,3,4,5}} Therefore to fully represent the topology of a CW-complex you need a number of variables equal to the number of nodes, plus twice the number of lines, plus three times the number of facets and four times the number of volumes.
  • 39. !39 Hasse diagram Rigon & Serafin {{1},{2},{3},{4},{5}} {{1,2},{1,3},{1,4},{1,5},{2,3},{2,4},{3,4},{3,5},{4,5}} Let’s observe that any group of connections represents the non-zero entries of a incidence (or adjacency matrix). Such a matrix is, in this case the one below
  • 40. !40 Is is a five by five matrix. Each column represent a node, as well as any row. The entries are 1 if there is a connection (edge) between the nodes and 0 otherwise. If the edges are oriented, 1 can be turned to -1 to indicate the direction of the edge. The matrix is symmetric (or antisymmetric with oriented edges). So the independent non zero numbers (connections are 8 (in this case). Therefore, it seems kind in favor of incidence matrix the information storage. A incidence Matrix Rigon & Serafin
  • 41. !41 One has to reflect that the edges (but see below), has to be encoded in any case, and this brings unavoidably in other 9 entities. Well, 9+8 =17 which is still less that 18, in this case, but we have to observe that storing a sparse matrix has further costs, which I did not included. However, in adding cells, then, the number of 0s increase. The incidence matrix above is a case of a sparse matrix and their treatment has a wide literature (e.g. Serafin, 2014) A incidence Matrix Rigon & Serafin
  • 42. !42 The incidence Matrix Rigon & Serafin Driven by the Hasse diagram, we actually did not show the real incidence matrix. This is usually a N*E matrix, where N is the number of nodes and E is the number of edges whose entries are 1 if the node and the edge are connected, and 0 otherwise. This “detail” does not matter at this point of the discussion.
  • 43. !43 Back to the Hasse diagram Rigon & Serafin In general to fully represent the topology of a CW-complex you need a number of variables, B, equal to the number of nodes, N plus the number of nodes in an edge times the edges, 2*E the number of edges in a facet times the number of facets, Ef *F and the number of facet in a volume times the number of volumes, Fv*V The above generalises the concept to CW-complex built on any shape, not only tetrahedrons. If cells change shape, the formula has to be modified accordingly. We come back later on the fact that some information given is redundant.
  • 44. !44 Every of the above entities has metric properties associated Metric properties Rigon & Serafin nodes coordinates* edges length, shape* faces area volumes volumes *coordinates can be curvilinear, as well edges. Not necessarily straight lines, because, for instance constrained to be geodetics on a surface.
  • 45. !45 Any cell has its dual (complemetary network) Rigon & Serafin Any element of a cell complex (primal) has its own complementary (dual) element. So a volume, can be associated to one of its internal points. For instance its center. So, from a primal complex a new complex, the dual complex, can be obtained. Two cases are illustrated below. Tonti, E. (2013). The Mathematical Structure of Classical and Relativistic Physics (pp. 1–537).
  • 46. !46 Any cell has its dual (complemetary network) Rigon & Serafin Another examples examples is represented by the Delaunay triangulation of a plane and its Voronoi counterpart. Tonti, E. (2013). The Mathematical Structure of Classical and Relativistic Physics (pp. 1–537).
  • 47. !47 Any cell has its dual (complemetary network) Rigon & Serafin Why this is relevant ? Clearly because often physical quantities in spaces are associated to a volume (for instance the mass of a fluid), and, practically, attributed to some internal point of that volume. The internal point is the dual of the volume. At the same time other quantities are associated to the faces of the cw- complex, for instance fluxes. Fluxes, in turn, are associated with directions. In fact, the dual of surfaces (faces) are (pseudo)-vectors (i.e., in our case, edges-lines with an orientation associated, see below)
  • 48. !48 Any cell has its dual (complemetary network) Rigon & Serafin Volumes have nodes dual (and viceversa) Tonti, E. (2013). The Mathematical Structure of Classical and Relativistic Physics (pp. 1–537).
  • 49. !49 Any cell has its dual (complemetary network) Rigon & Serafin Faces have edges dual (and viceversa) Tonti, E. (2013). The Mathematical Structure of Classical and Relativistic Physics (pp. 1–537).
  • 50. !50 Therefore we have also to make some room for storing information about the dual quantities. Maybe. Any cell has its dual (complemetary network) Rigon & Serafin Ferretti, E. (2015). The algebraic formulation: why and how to use it. Curved and Layer. Struct., 2, 106–149. http://doi.org/10.1515/cls-2015-0007
  • 51. !51 Hasse diagram Rigon & Serafin {{1},{2},{3},{4},{5}} {{1,2},{1,3},{1,4},{1,5},{2,3},{2,4},{3,4},{3,5},{4,5}} {{1,2,3},{1,2,4},{1,3,4},{1,3,5},{1,4,5},{2,3,4},{3,4,5}} {{1,2,3,4},{1,3,4,5}} Now, let’s go back to some redundancy presented in the Hasse graphs In particular, our statement is that, the information contained in the 1- cells can be skipped
  • 52. !52 Some on orientation Rigon & Serafin This can be obtained if the faces are oriented. Some, e.g. Tonti (2013) and Ferretti (2015) argument a lot with orientation. This is probably derived from a better knowledge of algebraic topology better that ours, but we mostly find their treatment of the matter a little too involved.
  • 53. !53 Some on orientation Rigon & Serafin Our own position: a - 1-d cells can be oriented (in the case below right to left) b - 2-d cells can be oriented because the orientation of their dual c - 1-d skeletons of 2-d cells can be oriented (thanks to the right hand rule)
  • 54. !54 Nobodys actually says that the circulation on the skeleton of the face must be in agreement with the one of the pseudo-vector blue. We can draw them independently. Usually they say that the orientation of the skeleton is the inner (whilst arbitrary) orientation. The one of the orthogonal vector is the outer one. But we do not care. Some on orientation Rigon & Serafin
  • 55. !55 Some on orientation Rigon & Serafin What is relevant for us is that if 1-d skeletons of cells can be oriented, then we can skip to specify in the Hasse diagram the 1-cells, and they can be deduced directly by the two cells, if they are represented using some ordering. 1 21 7 Assuming we label the nodes with numbers, for instance, the “natural” ordering of the above triangle would be clockwise, i.e. {1,7,21} and the edges are simply between nodes 1-7, 7-21, 21-1
  • 56. !56 Some on orientation Rigon & Serafin A little more complicate is the case of faces made up with polygons with more than 3 sides 1 21 7 5 In such cases usually it happens that the number do not identify an ordering scheme. However, if we establish that we start from the lowest number and move from it in the direction the lowest of the two adjacent numbers, then an ordering scheme is re-stablished and the 4- tuple {1,7,5,21} identify (seen, from this side) a clockwise orientation. At the same time, we know that our 1-cells are {1,7}, {7,5},{5,21},{21,1}
  • 57. !57 Some on orientation Rigon & Serafin Please, notice that clockwise and counterclockwise is just a perspective (or, if you prefer, a representation. 1 21 7 5 Looked from the other side, the facet is counterclockwise ordered The concept actually is connected to the vector spaces properties.
  • 58. !58 Information compression Rigon & Serafin That’s it! {{1},{2},{3},{4},{5}} {{1,2,3},{1,2,4},{1,3,4},{1,3,5},{1,4,5},{2,3,4},{3,4,5}} {{1,2,3,4},{1,3,4,5}} The numbers necessary to fully identify the topology is reduced.
  • 59. !59 Further simplifications Rigon & Serafin Actually if we restrict just to the use of simplexes, the information can be further restricted. In fact, the list of numbers below, {{1,2,3,4},{1,3,4,5}} allows to fully identify the facets of the simplexes. There is a trade-off though, that some little larger effort should be done to find out them from any sublist, i.e. say, for instance, {1,2,3,4} Not even the previous information reduction came for free, actually, because besides the little effort to identify edges, in implementation, maybe we do have to make room for a place to store the geometric characteristic (length) of the edges somewhere else that in the natural place which would be the object containing (but we will see) the edges data.
  • 60. !60 Rigon & Serafin Beyond topology, geometry So far we can assume to have a grid, represented as described before. Which operations do we want to do with it ? Certainly we want to estimate its geometric properties nodes coordinates edges length, shape faces area volumes volumes What we assume to have are the coordinates of nodes and the topology of the grid
  • 61. !61 Rigon & Serafin Beyond topology, geometry (and a little view to deployment) To estimate edges length, we have to: iterate over all the edges for any edge get the limiting nodes estimate the length, according to the type of coordinates store the length in an appropriate container which should be aware that the value belongs to a certain feature of the grid Berti, G. (2000, May 25). Generic Software Components for Scientific Computing. I draw an algorithm here, and I try to endorse the attitude described in Berti (2000), chapter 2.
  • 62. !62 Rigon & Serafin Beyond topology, geometry (and a little view to deployment) To estimate edges length, we have to: iterate over all the edges It means that whatever container memorizes the edges, we needs to be able to iterate over them easily and efficiently (and possibly in parallel). Containers that have this characteristic in Java are vectors and/or various types of collections. We do want to take decisions too early, and being able, in case to change the type of container for efficiency reasons at run time. Actually, our previous discussion showed that we could not have a real container for edges, but just the container for faces. Therefore the container must be specified in an abstract way. Also: we could have different types of iterators, for the different objects in the same container
  • 63. !63 Rigon & Serafin Beyond topology, geometry (and a little view to deployment) To estimate edges length, we have to: for any edge get the limiting nodes Therefore we need to have, besides the container for edges, a container for nodes (which was obvious since the beginning). the way we wrote the Hasse diagrams already contains the idea that the edges (or faces) container is actually composed with references to (or a copy of) the specific nodes
  • 64. !64 Rigon & Serafin Beyond topology, geometry (and a little view to deployment) To estimate edges length, we have to: estimate the length, according to the type of coordinates We can have Cartesian coordinates, Latitude and Longitude, Cylindrical coordinates. This implies that any type of coordinates has its own way to estimate lengths. Besides, we should be able to attach to our topology coordinate types at run time (when we know our system), and add new types of coordinates if required. Moreover, the algorithm should be independent from the type of container used to store the basic quantities: we should try to avoid interlock between data storage and algorithms (Berti, 2000, chapter 1) Berti, G. (2000, May 25). Generic Software Components for Scientific Computing.
  • 65. !65 Rigon & Serafin Beyond topology, geometry (and a little view to deployment) To estimate edges length, we have to: store the length in an appropriate container which should be aware that the value belongs to a certain feature of the grid We probably would like here to separate geometry and topology and do not use the the topology container (adding a field) to store it. This, in turn, can be the archetype for storing also other quantities, like physical quantities, for instance.
  • 66. !66 Rigon & Serafin Beyond topology, geometry (and a little view to deployment) To estimate facets area, we have to: iterate over all the facets for any face get the limiting edges estimate the area, according to the type of coordinates store the area in an appropriate container which should be aware that the value belongs to a certain feature of the grid Berti, G. (2000, May 25). Generic Software Components for Scientific Computing. Changed what is to be changed, this algorithm implies the same issues that the estimation of edges length imply.
  • 67. !67 Rigon & Serafin Beyond topology, geometry (and a little view to deployment) To estimate volumes’ volume, we have to: iterate over all the volumes for any volume get the limiting nodes estimate the volume, according to the type of coordinates store the volumes in an appropriate container which should be aware that the value belongs to a certain feature of the grid Berti, G. (2000, May 25). Generic Software Components for Scientific Computing. Changed what is to be changed, this algorithm implies the same issues that the estimation of edges length imply.
  • 68. !68 *** operations Count them Estimate their reciprocal distance Cluster/separate groups of them according to topology and some external indication Common operations *** Stands for any of “nodes”, ‘edges”, “faces”, “volumes” All of the above operations requires the same attention that were given to previously illustrated algorithms Rigon & Serafin
  • 69. !69 On Physical quantities Rigon & SerafinRigon & Serafin So far, we did not talk about physical properties and how they are attached to grids. In fact, some quantities are attached to volumes, some others to faces, some others to edges. We can have actually more than one quantity attached to a grid and we do want to separate the topology for the geometry and the (physical) data from the rest. We do not know how many quantities we want to attach to the grid and we must be able to do it at run time.
  • 70. !70 Hints for a Java deoplynment Rigon & Serafin Let’s try therefore a little thinking for a Java deployment. In general the abstraction required several times implies the use of three tools: •Generic programming (via Java generics) •Using interfaces (i.e. programming to interfaces) •Using some design patterns to insulate what changes. I cannot say to dominate the three topics, but I will try to distill what I know (in further series of slides).
  • 71. !71 Hints for a Java deployment Rigon & Serafin Previous deployments Apparently there are not such type of libraries in Java, except, maybe the book by Nikishkov* (2006, 2010) below. This book has a section dedicated to mesh generation that could be important to read in any case. There exists, instead, various examples in C/C++ that use generic programming. Among those, the first to mention is the work coming out from Berti’s thesis (2000). In particular his GRAL libraries available on Github. I will not go further . Nikishkov, G. (2010). Programming Finite Elements in Java (pp. 1–394). Springer-Verlag 2010. Berti, G. (2000, May 25). Generic Software Components for Scientific Computing. Nikishkov, G. (2006). Object oriented design of a finite element code in Java. Cmes, 11, 81–90. http://doi.o 10.3970/cmes.2006.011.081 *Actually, I give a quick look to Nikishkov work, and I do not fill it very inspiring. Probably useful.
  • 72. !72 Other requirements There are other requirements that we have to fulfill before to go to implementations. For instance, when we have to deal with conservation laws, we have to iterate over all the neighbors of a cell of a cell to estimate some quantities (for instance fluxes) The Hasse diagrams we draw connects a 3-cells to their boundary 2-cells but they do not know which are their neighbors. We have the possibility to estimate the neighbors scanning the connections between cells and storing somewhere the connections (which seems kind of necessary in order to decrease the computational burden). It turns out that the more parsimonious way to do it, without invoking some compression of the data is to use the dual of the primal grid. The use of the dual Rigon & Serafin
  • 73. !73 The dual of the primal grid is a grid itself Let’s do a 2-d example, which is more easy to visualize this time. In this draw, red points are those dual of the faces, and in the same number. Green edges are dual to boundary edges, in the same number than primal edges. Rigon & Serafin The use of the dual
  • 74. !74 Let’s number them 1 2 3 4 5 6 7 The use of the dual Rigon & Serafin {{1},{2},{3},{4},{5},{6},{7}} {{1,2},{1,6},{1,7},{2,3},{3,4},{4,5},{5,7}} and build the Hasse diagram
  • 75. !75 1 2 3 4 5 6 7 8 Do the usual work with the primal complex Build the primal information Rigon & Serafin {{1},{2},{3},{4},{5},{6},{7},{8}} {{1,2,8},{1,7,8},{2,3,8},{3,4,5},{3,5,8},{6,7,8},{5,6,8}}
  • 77. !77 1 2 3 4 5 6 7 8 {{1},{2},{3},{4},{5},{6},{7}} {{1,2},{1,6},{1,7},{2,3},{3,4},{4,5},{5,7}} {{1},{2},{3},{4},{5},{6},{7},{8}} {{1,2,8},{1,7,8},{2,3,8},{3,4,5},{3,5,8},{6,7,8},{5,6,8}} Rigon & Serafin 1 2 3 4 5 6 7 Eliminating redundancy Because there is a one-to-one correspondence between 2-cells and the dual 1-cells, replicating this topological information can be done. However, we have to remind that the information about the geometry of dual-nodes has to be stored.
  • 78. !78 To sum up Rigon & Serafin Previously we arrived at the estimation that the number of variables to be stored (for the primal graph) is
  • 79. !79 Rigon & Serafin To sum up Adding the dual set, ad assuming we are able to avoid to store the numbers of dual nodes, we have to increase B by the number of edges in the dual, obtaining: In turn, the number of edges in the dual is equal to the number of its primal (complementary) set. In the 2D case we illustrated
  • 80. !80 Rigon & Serafin To sum up Looking at implementations, we have to observe also which (geo)metrical data we have to store: nodes coordinates edges length faces area volume volumes dual nodes position dual edges length } One decision to take is if dual’s attribute has to be stored along with the primal set entities. In the latter case, in 3D the dual edges are in one to one correspondence to faces, and dual nodes to volumes.
  • 81. !81 Rigon & Serafin To sum up In 2D, however, dual edges have edges themselves as primal. nodes coordinates edges length faces area dual nodes position dual edges length } Therefore (including the fact that fluxes will be trough edges and not faces, in 2D is probably convenient to implement edges.
  • 82. !82 In 1D, systems we have just nodes and edges, and the dual of the primal is given itself by nodes and edges nodes coordinates edges length dual nodes position if we take the dual position conventionally in the middle, storing dual nodes position is not so important, and computationally easy to estimate Rigon & Serafin To sum up
  • 83. !83 Graphs Rigon & Serafin A graph can be seen as a particular case of a 1-complex, formed by nodes and edges Therefore it would be completely described by labeling the nodes and marking the connections (for instance through a Hasse diagram or an incidence matrix)
  • 84. !84 Graphs Rigon & Serafin Relevant to to the graph is the orientation of its edges that selects direction of “flows” of quantities. certainly the general structure of graphs can be much more complex than that draw here, including loops and other features. As observed by Branin (1966), these flows identified topological algebraic structures on the graphs Branin, F. H. (1966). The algebraic-topological basis for network analogies and the vector calculus (pp. 1–40). Presented at the Symposium on generalized Networks, New York.
  • 85. !85 In order to make faster the computation it is necessary to cope with parallelisation of the codes. This can happen in several ways. One way is to observe the nature of algorithm to be implemented, and observe, for instance, that many algorithms for estimating the geometrical quantities, once properly represented are embarrassingly parallel . In other cases, parallelisation can be obtained by splitting the grid in parts which are executing in parallel. This is actually a field of research since many years. But the work of Berti and his libraries, or the work by can give some guidance. The structure of the CW-complex themselves can help to get it properly. With respect to Java, it could be observed that, after Java 8 and the introduction of streams, data that can be streamed can be internally parallelise. Another relevant example could be the Muskel 2 libraries which were recently implemented in Java, or the implementation structure of the Net3 graph. Parallel computation Rigon & Serafin Heinzl, R., & Schwaha, P. (2011). A generic topology library. Science of Computer Programming, 76(4), 3 http://doi.org/10.1016/j.scico.2009.09.007 Berti, G. (2000, May 25). Generic Software Components for Scientific Computing.
  • 86. !86 Find this presentation at http://abouthydrology.blogspot.com Ulrici,2000? Other material at Questions ? R. Rigon