libsim Versione 7.2.6
|
◆ index_ana()
Cerca l'indice del primo o ultimo elemento di vect uguale a search. Definizione alla linea 1076 del file vol7d_ana_class.F90. 1078! Copyright (C) 2010 ARPA-SIM <urpsim@smr.arpa.emr.it>
1079! authors:
1080! Davide Cesari <dcesari@arpa.emr.it>
1081! Paolo Patruno <ppatruno@arpa.emr.it>
1082
1083! This program is free software; you can redistribute it and/or
1084! modify it under the terms of the GNU General Public License as
1085! published by the Free Software Foundation; either version 2 of
1086! the License, or (at your option) any later version.
1087
1088! This program is distributed in the hope that it will be useful,
1089! but WITHOUT ANY WARRANTY; without even the implied warranty of
1090! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1091! GNU General Public License for more details.
1092
1093! You should have received a copy of the GNU General Public License
1094! along with this program. If not, see <http://www.gnu.org/licenses/>.
1095#include "config.h"
1096
1097!> Classe per la gestione dell'anagrafica di stazioni meteo e affini.
1098!! Questo modulo definisce una classe in grado di rappresentare
1099!! le caratteristiche di una stazione meteo fissa o mobile.
1100!! \ingroup vol7d
1105IMPLICIT NONE
1106
1107!> Lunghezza della stringa che indica l'identificativo del volo.
1108INTEGER,PARAMETER :: vol7d_ana_lenident=20
1109
1110!> Definisce l'anagrafica di una stazione.
1111!! I membri di \a vol7d_ana sono pubblici e quindi liberamente
1112!! accessibili e scrivibili, ma è comunque consigliato assegnarli tramite
1113!! il costruttore ::init.
1115 TYPE(geo_coord) :: coord !< coordinata per una stazione fissa
1116 CHARACTER(len=vol7d_ana_lenident) :: ident !< identificativo per una stazione mobile (es. aereo)
1118
1119!> Valore mancante per vo7d_ana.
1121
1122!> Costruttore per la classe vol7d_ana.
1123!! Deve essere richiamato
1124!! per tutti gli oggetti di questo tipo definiti in un programma.
1126 MODULE PROCEDURE vol7d_ana_init
1127END INTERFACE
1128
1129!> Distruttore per la classe vol7d_ana.
1130!! Distrugge l'oggetto in maniera pulita, assegnandogli un valore mancante.
1132 MODULE PROCEDURE vol7d_ana_delete
1133END INTERFACE
1134
1135!> Logical equality operator for objects of \a vol7d_ana class.
1136!! It is defined as \a ELEMENTAL thus it works also with conformal arrays
1137!! of any shape.
1138INTERFACE OPERATOR (==)
1139 MODULE PROCEDURE vol7d_ana_eq
1140END INTERFACE
1141
1142!> Logical inequality operator for objects of \a vol7d_ana class.
1143!! It is defined as \a ELEMENTAL thus it works also with conformal arrays
1144!! of any shape.
1145INTERFACE OPERATOR (/=)
1146 MODULE PROCEDURE vol7d_ana_ne
1147END INTERFACE
1148
1149
1150!> Logical greater-than operator for objects of \a vol7d_ana class.
1151!! It is defined as \a ELEMENTAL thus it works also with conformal arrays
1152!! of any shape.
1153!! Comparison is performed first on \a ident, then on coord
1154INTERFACE OPERATOR (>)
1155 MODULE PROCEDURE vol7d_ana_gt
1156END INTERFACE
1157
1158!> Logical less-than operator for objects of \a vol7d_ana class.
1159!! It is defined as \a ELEMENTAL thus it works also with conformal arrays
1160!! of any shape.
1161!! Comparison is performed first on \a ident, then on coord
1162INTERFACE OPERATOR (<)
1163 MODULE PROCEDURE vol7d_ana_lt
1164END INTERFACE
1165
1166!> Logical greater-equal operator for objects of \a vol7d_ana class.
1167!! It is defined as \a ELEMENTAL thus it works also with conformal arrays
1168!! of any shape.
1169!! Comparison is performed first on \a ident, then on coord
1170INTERFACE OPERATOR (>=)
1171 MODULE PROCEDURE vol7d_ana_ge
1172END INTERFACE
1173
1174!> Logical less-equal operator for objects of \a vol7d_ana class.
1175!! It is defined as \a ELEMENTAL thus it works also with conformal arrays
1176!! of any shape.
1177!! Comparison is performed first on \a ident, then on coord
1178INTERFACE OPERATOR (<=)
1179 MODULE PROCEDURE vol7d_ana_le
1180END INTERFACE
1181
1182
1183!> check for missing value
1185 MODULE PROCEDURE vol7d_ana_c_e
1186END INTERFACE
1187
1188!> Legge un oggetto vol7d_ana o un vettore di oggetti vol7d_ana da
1189!! un file \c FORMATTED o \c UNFORMATTED.
1191 MODULE PROCEDURE vol7d_ana_read_unit, vol7d_ana_vect_read_unit
1192END INTERFACE
1193
1194!> Scrive un oggetto vol7d_ana o un vettore di oggetti vol7d_ana su
1195!! un file \c FORMATTED o \c UNFORMATTED.
1197 MODULE PROCEDURE vol7d_ana_write_unit, vol7d_ana_vect_write_unit
1198END INTERFACE
1199
1200#define VOL7D_POLY_TYPE TYPE(vol7d_ana)
1201#define VOL7D_POLY_TYPES _ana
1202#define ENABLE_SORT
1203#include "array_utilities_pre.F90"
1204
1205!> Represent ana object in a pretty string
1207 MODULE PROCEDURE to_char_ana
1208END INTERFACE
1209
1210!> Print object
1212 MODULE PROCEDURE display_ana
1213END INTERFACE
1214
1215CONTAINS
1216
1217!> Inizializza un oggetto \a vol7d_ana con i parametri opzionali forniti.
1218!! Se non viene passato nessun parametro opzionale l'oggetto è
1219!! inizializzato a valore mancante.
1220SUBROUTINE vol7d_ana_init(this, lon, lat, ident, ilon, ilat)
1221TYPE(vol7d_ana),INTENT(INOUT) :: this !< oggetto da inizializzare
1222REAL(kind=fp_geo),INTENT(in),OPTIONAL :: lon !< longitudine
1223REAL(kind=fp_geo),INTENT(in),OPTIONAL :: lat !< latitudine
1224CHARACTER(len=*),INTENT(in),OPTIONAL :: ident !< identificativo del volo
1225INTEGER(kind=int_l),INTENT(in),OPTIONAL :: ilon !< integer longitude (nint(lon*1.d5)
1226INTEGER(kind=int_l),INTENT(in),OPTIONAL :: ilat !< integer latitude (nint(lat*1.d5)
1227
1229IF (PRESENT(ident)) THEN
1230 this%ident = ident
1231ELSE
1232 this%ident = cmiss
1233ENDIF
1234
1235END SUBROUTINE vol7d_ana_init
1236
1237
1238!> Distrugge l'oggetto in maniera pulita, assegnandogli un valore mancante.
1239SUBROUTINE vol7d_ana_delete(this)
1240TYPE(vol7d_ana),INTENT(INOUT) :: this !< oggetto da distruggre
1241
1243this%ident = cmiss
1244
1245END SUBROUTINE vol7d_ana_delete
1246
1247
1248
1249character(len=80) function to_char_ana(this)
1250
1251TYPE(vol7d_ana),INTENT(in) :: this
1252
1253to_char_ana="ANA: "//&
1256 t2c(this%ident,miss="Missing ident")
1257
1258return
1259
1260end function to_char_ana
1261
1262
1263subroutine display_ana(this)
1264
1265TYPE(vol7d_ana),INTENT(in) :: this
1266
1267print*, trim(to_char(this))
1268
1269end subroutine display_ana
1270
1271
1272ELEMENTAL FUNCTION vol7d_ana_eq(this, that) RESULT(res)
1273TYPE(vol7d_ana),INTENT(IN) :: this, that
1274LOGICAL :: res
1275
1276res = this%coord == that%coord .AND. this%ident == that%ident
1277
1278END FUNCTION vol7d_ana_eq
1279
1280
1281ELEMENTAL FUNCTION vol7d_ana_ne(this, that) RESULT(res)
1282TYPE(vol7d_ana),INTENT(IN) :: this, that
1283LOGICAL :: res
1284
1285res = .NOT.(this == that)
1286
1287END FUNCTION vol7d_ana_ne
1288
1289
1290ELEMENTAL FUNCTION vol7d_ana_gt(this, that) RESULT(res)
1291TYPE(vol7d_ana),INTENT(IN) :: this, that
1292LOGICAL :: res
1293
1294res = this%ident > that%ident
1295
1296if ( this%ident == that%ident) then
1297 res =this%coord > that%coord
1298end if
1299
1300END FUNCTION vol7d_ana_gt
1301
1302
1303ELEMENTAL FUNCTION vol7d_ana_ge(this, that) RESULT(res)
1304TYPE(vol7d_ana),INTENT(IN) :: this, that
1305LOGICAL :: res
1306
1307res = .not. this < that
1308
1309END FUNCTION vol7d_ana_ge
1310
1311
1312ELEMENTAL FUNCTION vol7d_ana_lt(this, that) RESULT(res)
1313TYPE(vol7d_ana),INTENT(IN) :: this, that
1314LOGICAL :: res
1315
1316res = this%ident < that%ident
1317
1318if ( this%ident == that%ident) then
1319 res = this%coord < that%coord
1320end if
1321
1322END FUNCTION vol7d_ana_lt
1323
1324
1325ELEMENTAL FUNCTION vol7d_ana_le(this, that) RESULT(res)
1326TYPE(vol7d_ana),INTENT(IN) :: this, that
1327LOGICAL :: res
1328
1329res = .not. (this > that)
1330
1331END FUNCTION vol7d_ana_le
1332
1333
1334
1335ELEMENTAL FUNCTION vol7d_ana_c_e(this) RESULT(c_e)
1336TYPE(vol7d_ana),INTENT(IN) :: this
1337LOGICAL :: c_e
1338c_e = this /= vol7d_ana_miss
1339END FUNCTION vol7d_ana_c_e
1340
1341
1342!> This method reads from a Fortran file unit the contents of the
1343!! object \a this. The record to be read must have been written with
1344!! the ::write_unit method. The method works both on formatted and
1345!! unformatted files.
1346SUBROUTINE vol7d_ana_read_unit(this, unit)
1347TYPE(vol7d_ana),INTENT(out) :: this !< object to be read
1348INTEGER, INTENT(in) :: unit !< unit from which to read, it must be an opened Fortran file unit
1349
1350CALL vol7d_ana_vect_read_unit((/this/), unit)
1351
1352END SUBROUTINE vol7d_ana_read_unit
1353
1354
1355!> This method reads from a Fortran file unit the contents of the
1356!! object \a this. The record to be read must have been written with
1357!! the ::write_unit method. The method works both on formatted and
1358!! unformatted files.
1359SUBROUTINE vol7d_ana_vect_read_unit(this, unit)
1360TYPE(vol7d_ana) :: this(:) !< object to be read
1361INTEGER, INTENT(in) :: unit !< unit from which to read, it must be an opened Fortran file unit
1362
1363CHARACTER(len=40) :: form
1364
1366INQUIRE(unit, form=form)
1367IF (form == 'FORMATTED') THEN
1368 READ(unit,'(A)')this(:)%ident
1369ELSE
1370 READ(unit)this(:)%ident
1371ENDIF
1372
1373END SUBROUTINE vol7d_ana_vect_read_unit
1374
1375
1376!> This method writes on a Fortran file unit the contents of the
1377!! object \a this. The record can successively be read by the
1378!! ::read_unit method. The method works both on formatted and
1379!! unformatted files.
1380SUBROUTINE vol7d_ana_write_unit(this, unit)
1381TYPE(vol7d_ana),INTENT(in) :: this !< object to be written
1382INTEGER, INTENT(in) :: unit !< unit where to write, it must be an opened Fortran file unit
1383
1384CALL vol7d_ana_vect_write_unit((/this/), unit)
1385
1386END SUBROUTINE vol7d_ana_write_unit
1387
1388
1389!> This method writes on a Fortran file unit the contents of the
1390!! object \a this. The record can successively be read by the
1391!! ::read_unit method. The method works both on formatted and
1392!! unformatted files.
1393SUBROUTINE vol7d_ana_vect_write_unit(this, unit)
1394TYPE(vol7d_ana),INTENT(in) :: this(:) !< object to be written
1395INTEGER, INTENT(in) :: unit !< unit where to write, it must be an opened Fortran file unit
1396
1397CHARACTER(len=40) :: form
1398
1400INQUIRE(unit, form=form)
1401IF (form == 'FORMATTED') THEN
1402 WRITE(unit,'(A)')this(:)%ident
1403ELSE
1404 WRITE(unit)this(:)%ident
1405ENDIF
1406
1407END SUBROUTINE vol7d_ana_vect_write_unit
1408
1409
1410#include "array_utilities_inc.F90"
1411
1412
Legge un oggetto vol7d_ana o un vettore di oggetti vol7d_ana da un file FORMATTED o UNFORMATTED. Definition vol7d_ana_class.F90:301 Scrive un oggetto vol7d_ana o un vettore di oggetti vol7d_ana su un file FORMATTED o UNFORMATTED. Definition vol7d_ana_class.F90:307 Classes for handling georeferenced sparse points in geographical corodinates. Definition geo_coord_class.F90:216 Definition of constants to be used for declaring variables of a desired type. Definition kinds.F90:245 Definitions of constants and functions for working with missing values. Definition missing_values.f90:50 Classe per la gestione dell'anagrafica di stazioni meteo e affini. Definition vol7d_ana_class.F90:212 |