Skip to content
Snippets Groups Projects
Commit d815bf76 authored by Lionel GUEZ's avatar Lionel GUEZ
Browse files

Simplify `read_eddy` with upgraded `Shapelib_03`

Use `dbf_read_attribute_03` instead of dbfreadattribute in procedure
`read_eddy`. This also allows us to avoid the intermediary real
`c_double` variable. Modify intent of hshp arguments, taking also
advantage of upgrade of `shp_read_object_03` in `Shapelib_03`.
parent 452c18cb
No related branches found
No related tags found
No related merge requests found
......@@ -2,6 +2,5 @@ digraph call_graph
{
main -> {get_snapshot overlap};
main -> dispatch_snapshot;
overlap -> {interpolate_eddy weight};
interpolate_eddy -> write_eddy;
overlap -> {interpolate_eddy weight, write_eddy};
}
\ No newline at end of file
......@@ -862,7 +862,7 @@ m. Cf. figures (\ref{fig:test_get_eddy}) et (\ref{fig:test_get_snapshot}).
\begin{figure}[htbp]
\centering
\includegraphics[width=\textwidth]{test_get_snapshot}
\caption{Test Get\_snapshot\_region\_1. Région 1, sans minimum
\caption{Test Extraction\_eddies\_region\_1. Région 1, sans minimum
d'amplitude. Contours extérieurs et contours de vitesse
maximale. En rouge les anticyclones, en bleu les cyclones. Croix :
contour extérieur sans contour de maximum de vitesse
......@@ -1007,10 +1007,17 @@ On n'enregistre pas de contours pour les tourbillons interpolés. Les
tourbillons interpolés sont écrits avec les autres, en utilisant une
forme NULL pour le polygone correspondant à un contour interpolé. Un
processus donné, dans plusieurs appels à overlap, peut interpoler des
extremums à une même date. Donc, dans le shapefile \verb+extremum_$m+,
les dates sont dans le désordre. En outre, deux processus peuvent
interpoler des extremums à une même date. Il sera certainement utile
de concaténer et trier les shapefiles en post-traitement.
extremums à une même date. Donc, dans le shapefile \verb+extremum+
écrit par un processus donné, les dates sont dans le désordre. En
outre, deux processus peuvent interpoler des extremums à une même
date. Il sera certainement utile de concaténer et trier les shapefiles
en post-traitement.
Un processus donné alterne lecture de shapefiles (créés par
extraction\_eddies) et écriture de shapefiles (contenant les
tourbillons interpolés). Un processus donné doit donc manipuler deux
jeux de pointeurs de shapefiles. On peut éventuellement upposer que
les numéros de champs sont les mêmes pour les deux jeux de shapefiles.
La méta-donnée logique \og interpolé \fg{} dans
\verb+extremum_$m.dbf+ est nécessaire parce qu'il est possible de ne
......@@ -1047,13 +1054,14 @@ Les entrées-sorties sont dans : l'algorithme principal directement
(lecture de longitude et latitude), \verb+get_snapshot+ (lecture des
shapefiles), \verb+overlap+ (écriture dans
\verb+edgelist_$m.txt+, arcs entre \verb+k_begin+(m) et
\verb+k_end_main_loop+(m)), \verb+write_eddy+ (écriture
dans \verb+extremum_$m+, \verb+outermost_contour_$m+,
\verb+max_speed_contour_$m+), \verb+dispatch_snapshot+ directement
(écriture dans \verb+isolated_nodes_$m+,
\verb+number_eddies_$m+). Les processus écrivent dans des fichiers
indicés par le numéro de processus donc deux processus ne peuvent
écrire dans le même fichier. Cf. figure (\ref{fig:input_output}).
\verb+k_end_main_loop+(m)), \verb+write_eddy+ (écriture dans
\verb+extremum+, \verb+outermost_contour+, \verb+max_speed_contour+),
\verb+dispatch_snapshot+ directement (écriture dans
\verb+isolated_nodes_$m+,
\verb+number_eddies_$m+). Les processus écrivent dans des fichiers ou
répertoires indicés par le numéro de processus donc deux processus ne
peuvent écrire dans le même fichier. Cf. figure
(\ref{fig:input_output}).
\begin{figure}[htbp]
\centering
\includegraphics[width=\textwidth]{input_output}
......@@ -1477,10 +1485,9 @@ j, k, delta $\in \{2, \dots, \mathtt{max\_delta}\}$ : scalaires
entiers, données. flow : donnée-résultat. Cherche les arcs entre
flow(j - delta) et flow(j), correspondant aux dates k - delta et
k. Écrit ces arcs dans \verb+graph.txt+, écrit les tourbillons
interpolés dans les shapefiles via interpolate\_eddy et
\verb+write_eddy+. Met à jour flow(j - delta)\%list\_vis\%delta\_out,
flow(j)\%list\_vis\%delta\_in, flow\%number\_eddies. Cf. algorithme
(\ref{alg:overlapping}).
interpolés dans les shapefiles via \verb+write_eddy+. Met à jour
flow(j - delta)\%list\_vis\%delta\_out, flow(j)\%list\_vis\%delta\_in,
flow\%number\_eddies. Cf. algorithme (\ref{alg:overlapping}).
\begin{algorithm}[htbp]
\begin{algorithmic}
\FOR{i1 = 1 \TO flow(j - delta)\%number\_vis\_extr}
......
......@@ -18,13 +18,13 @@ contains
ftinteger
use shapelib_03, only: shp_create_03, dbf_add_field_03
TYPE(shpfileobject), intent(out):: hshp_extremum ! shapefile extremum_$m
TYPE(shpfileobject), intent(out):: hshp_extremum ! shapefile extremum
TYPE(shpfileobject), intent(out):: hshp_outermost
! shapefile outermost_contour_$m
! shapefile outermost_contour
TYPE(shpfileobject), intent(out):: hshp_max_speed
! shapefile x_speed_contour_$m
! shapefile max_speed_contour
!---------------------------------------------------------------------
......
......@@ -13,9 +13,9 @@ contains
use contour_531, only: null_polyline
use gpc_f, only: shpobj2pol, polygon
use nr_util, only: deg_to_rad, pi
use shapelib, only: shpfileobject, shpobject, dbfreadattribute, &
shpdestroyobject
use shapelib_03, only: shp_read_object_03, dbf_get_field_index_03
use shapelib, only: shpfileobject, shpobject, shpdestroyobject
use shapelib_03, only: shp_read_object_03, dbf_get_field_index_03, &
dbf_read_attribute_03
use derived_types, only: eddy
use read_field_indices_m, only: ifield_extr_ssh, ifield_extr_date, &
......@@ -31,13 +31,13 @@ contains
integer, intent(out):: k ! date index
integer, intent(out):: i ! eddy index
TYPE(shpfileobject), intent(inout):: hshp_extremum ! shapefile extremum_$m
TYPE(shpfileobject), intent(in):: hshp_extremum ! shapefile extremum
TYPE(shpfileobject), intent(inout):: hshp_outermost
! shapefile outermost_contour_$m
TYPE(shpfileobject), intent(in):: hshp_outermost
! shapefile outermost_contour
TYPE(shpfileobject), intent(inout):: hshp_max_speed
! shapefile x_speed_contour_$m
TYPE(shpfileobject), intent(in):: hshp_max_speed
! shapefile max_speed_contour
integer, intent(in):: ishape ! 0-based
......@@ -46,50 +46,43 @@ contains
integer int_attr ! integer attribute
TYPE(shpobject) psobject
type(polygon) p
real(c_double) attr
! We need this intermediary variable because the kind of the
! argument to dbfreadattribute cannot be the default kind
real attr
!---------------------------------------------------------------------
call dbfreadattribute(hshp_extremum, ishape, ifield_extr_ssh, attr = attr)
e%ssh_extr = attr
call dbfreadattribute(hshp_extremum, ishape, ifield_extr_date, attr = k)
call dbfreadattribute(hshp_extremum, ishape, ifield_extr_eddy_index, &
attr = i)
call dbf_read_attribute_03(hshp_extremum, ishape, ifield_extr_ssh, &
e%ssh_extr)
call dbf_read_attribute_03(hshp_extremum, ishape, ifield_extr_date, k)
call dbf_read_attribute_03(hshp_extremum, ishape, ifield_extr_eddy_index, i)
call dbfreadattribute(hshp_extremum, ishape, ifield_extr_interp, &
attr = int_attr)
call dbf_read_attribute_03(hshp_extremum, ishape, ifield_extr_interp, &
int_attr)
e%interpolated = int_attr == 1
call dbfreadattribute(hshp_extremum, ishape, ifield_extr_cycl, &
attr = int_attr)
call dbf_read_attribute_03(hshp_extremum, ishape, ifield_extr_cycl, &
int_attr)
e%cyclone = int_attr == 1
call dbfreadattribute(hshp_extremum, ishape, ifield_extr_valid, &
attr = int_attr)
call dbf_read_attribute_03(hshp_extremum, ishape, ifield_extr_valid, &
int_attr)
e%valid = int_attr == 1
call dbfreadattribute(hshp_extremum, ishape, ifield_extr_speed, attr = attr)
e%max_speed = attr
call dbf_read_attribute_03(hshp_extremum, ishape, ifield_extr_speed, &
e%max_speed)
call shp_read_object_03(hshp_extremum, ishape, psobject)
e%coord_extr = [psobject%padfx(1), psobject%padfy(1)] * deg_to_rad
call shpdestroyobject(psobject)
call dbfreadattribute(hshp_outermost, ishape, ifield_out_r_eq_area, &
attr = attr)
e%out_cont%area = merge(pi * real(attr)**2 * 1e6, - 1e6, &
attr >= 0._c_double)
call dbf_read_attribute_03(hshp_outermost, ishape, ifield_out_r_eq_area, &
attr)
e%out_cont%area = merge(pi * attr**2 * 1e6, - 1e6, attr >= 0.)
! * 1e6: km2 to m2
call dbfreadattribute(hshp_outermost, ishape, ifield_out_ssh, attr = attr)
e%out_cont%ssh = attr
call dbfreadattribute(hshp_outermost, ishape, ifield_out_radius4, &
attr = e%radius4)
call dbf_read_attribute_03(hshp_outermost, ishape, ifield_out_ssh, &
e%out_cont%ssh)
call dbf_read_attribute_03(hshp_outermost, ishape, ifield_out_radius4, &
e%radius4)
call shp_read_object_03(hshp_outermost, ishape, psobject)
p = shpobj2pol(psobject)
......@@ -102,15 +95,13 @@ contains
e%out_cont%polyline%points = e%out_cont%polyline%points * deg_to_rad
end if
call dbfreadattribute(hshp_max_speed, ishape, &
ifield_max_speed_r_eq_area, attr = attr)
e%speed_cont%area = merge(pi * real(attr)**2 * 1e6, - 1e6, &
attr >= 0._c_double)
call dbf_read_attribute_03(hshp_max_speed, ishape, &
ifield_max_speed_r_eq_area, attr)
e%speed_cont%area = merge(pi * attr**2 * 1e6, - 1e6, attr >= 0.)
! * 1e6: km2 to m2
call dbfreadattribute(hshp_max_speed, ishape, ifield_max_speed_ssh, &
attr = attr)
e%speed_cont%ssh = attr
call dbf_read_attribute_03(hshp_max_speed, ishape, ifield_max_speed_ssh, &
e%speed_cont%ssh)
call shp_read_object_03(hshp_max_speed, ishape, psobject)
p = shpobj2pol(psobject)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment