grafo.jl |
|
---|---|
Solution workflow automatic generator for `boris` using Graphs.jl. |
using Graphs
|
The arterial tree is specified as a |
g = simple_graph(13)
add_edge!(g, 1,2)
add_edge!(g, 2,3)
add_edge!(g, 2,4)
add_edge!(g, 3,5)
add_edge!(g, 3,6)
add_edge!(g, 4,11)
add_edge!(g, 4,7)
add_edge!(g, 5,8)
add_edge!(g, 5,9)
add_edge!(g, 6,10)
add_edge!(g, 6,11)
add_edge!(g, 7,12)
add_edge!(g, 11,13)
|
Function |
e = edges(g)
|
Each edge is evaluated starting from the 1st; current edge index is stored as |
for i in 1:length(e)
s = source(e[i])
t = target(e[i])
|
If the source node is the first in the arterial tree, the inlet boundary condtion is applied. |
if s == 1
@printf "edge %i - source %i -> setInletBC \n" i s
end
|
Once the source node is processed, the edge (vessel) is solved by means of Godunov’s method. |
@printf "edge %i - solve \n" i
|
If the target node is a peripheral node, the outlet boundary condition is applied. |
if out_degree(t, g) == 0
@printf "edge %i - target %i -> setOutletBC \n" i t
|
If from the target |
elseif out_degree(t, g) == 1
|
The conjunction is solved calling the joinVessels routine with parent and daughter indices. |
if length(in_edges(t, g)) == 1
o = out_edges(t, g)
@printf "edge %i -> conjunction %i - %i \n" i i edge_index(o[1],g)
|
Before solving the anastomosis a check is done on the current edge index |
else
es = in_edges(t, g)
if i == max(edge_index(es[1],g), edge_index(es[2], g))
@printf "node %i -> anastomosis(%i, %i, %i) \n" t edge_index(es[1],g) edge_index(es[2], g) edge_index(out_edges(t,g)[1])
end
end
|
A bifurcation is found when the |
elseif out_degree(t, g) == 2
@printf "node %i -> bifurcation(%i, %i, %i) \n" t i edge_index(out_edges(t,g)[1]) edge_index(out_edges(t,g)[2])
end
end
|