libsim Versione 7.2.6
|
◆ vol7d_ana_read_unit()
This method reads from a Fortran file unit the contents of the object this. The record to be read must have been written with the write_unit method. The method works both on formatted and unformatted files.
Definizione alla linea 512 del file vol7d_ana_class.F90. 513! Copyright (C) 2010 ARPA-SIM <urpsim@smr.arpa.emr.it>
514! authors:
515! Davide Cesari <dcesari@arpa.emr.it>
516! Paolo Patruno <ppatruno@arpa.emr.it>
517
518! This program is free software; you can redistribute it and/or
519! modify it under the terms of the GNU General Public License as
520! published by the Free Software Foundation; either version 2 of
521! the License, or (at your option) any later version.
522
523! This program is distributed in the hope that it will be useful,
524! but WITHOUT ANY WARRANTY; without even the implied warranty of
525! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
526! GNU General Public License for more details.
527
528! You should have received a copy of the GNU General Public License
529! along with this program. If not, see <http://www.gnu.org/licenses/>.
530#include "config.h"
531
532!> Classe per la gestione dell'anagrafica di stazioni meteo e affini.
533!! Questo modulo definisce una classe in grado di rappresentare
534!! le caratteristiche di una stazione meteo fissa o mobile.
535!! \ingroup vol7d
540IMPLICIT NONE
541
542!> Lunghezza della stringa che indica l'identificativo del volo.
543INTEGER,PARAMETER :: vol7d_ana_lenident=20
544
545!> Definisce l'anagrafica di una stazione.
546!! I membri di \a vol7d_ana sono pubblici e quindi liberamente
547!! accessibili e scrivibili, ma è comunque consigliato assegnarli tramite
548!! il costruttore ::init.
550 TYPE(geo_coord) :: coord !< coordinata per una stazione fissa
551 CHARACTER(len=vol7d_ana_lenident) :: ident !< identificativo per una stazione mobile (es. aereo)
553
554!> Valore mancante per vo7d_ana.
556
557!> Costruttore per la classe vol7d_ana.
558!! Deve essere richiamato
559!! per tutti gli oggetti di questo tipo definiti in un programma.
561 MODULE PROCEDURE vol7d_ana_init
562END INTERFACE
563
564!> Distruttore per la classe vol7d_ana.
565!! Distrugge l'oggetto in maniera pulita, assegnandogli un valore mancante.
567 MODULE PROCEDURE vol7d_ana_delete
568END INTERFACE
569
570!> Logical equality operator for objects of \a vol7d_ana class.
571!! It is defined as \a ELEMENTAL thus it works also with conformal arrays
572!! of any shape.
573INTERFACE OPERATOR (==)
574 MODULE PROCEDURE vol7d_ana_eq
575END INTERFACE
576
577!> Logical inequality operator for objects of \a vol7d_ana class.
578!! It is defined as \a ELEMENTAL thus it works also with conformal arrays
579!! of any shape.
580INTERFACE OPERATOR (/=)
581 MODULE PROCEDURE vol7d_ana_ne
582END INTERFACE
583
584
585!> Logical greater-than operator for objects of \a vol7d_ana class.
586!! It is defined as \a ELEMENTAL thus it works also with conformal arrays
587!! of any shape.
588!! Comparison is performed first on \a ident, then on coord
589INTERFACE OPERATOR (>)
590 MODULE PROCEDURE vol7d_ana_gt
591END INTERFACE
592
593!> Logical less-than operator for objects of \a vol7d_ana class.
594!! It is defined as \a ELEMENTAL thus it works also with conformal arrays
595!! of any shape.
596!! Comparison is performed first on \a ident, then on coord
597INTERFACE OPERATOR (<)
598 MODULE PROCEDURE vol7d_ana_lt
599END INTERFACE
600
601!> Logical greater-equal operator for objects of \a vol7d_ana class.
602!! It is defined as \a ELEMENTAL thus it works also with conformal arrays
603!! of any shape.
604!! Comparison is performed first on \a ident, then on coord
605INTERFACE OPERATOR (>=)
606 MODULE PROCEDURE vol7d_ana_ge
607END INTERFACE
608
609!> Logical less-equal operator for objects of \a vol7d_ana class.
610!! It is defined as \a ELEMENTAL thus it works also with conformal arrays
611!! of any shape.
612!! Comparison is performed first on \a ident, then on coord
613INTERFACE OPERATOR (<=)
614 MODULE PROCEDURE vol7d_ana_le
615END INTERFACE
616
617
618!> check for missing value
620 MODULE PROCEDURE vol7d_ana_c_e
621END INTERFACE
622
623!> Legge un oggetto vol7d_ana o un vettore di oggetti vol7d_ana da
624!! un file \c FORMATTED o \c UNFORMATTED.
626 MODULE PROCEDURE vol7d_ana_read_unit, vol7d_ana_vect_read_unit
627END INTERFACE
628
629!> Scrive un oggetto vol7d_ana o un vettore di oggetti vol7d_ana su
630!! un file \c FORMATTED o \c UNFORMATTED.
632 MODULE PROCEDURE vol7d_ana_write_unit, vol7d_ana_vect_write_unit
633END INTERFACE
634
635#define VOL7D_POLY_TYPE TYPE(vol7d_ana)
636#define VOL7D_POLY_TYPES _ana
637#define ENABLE_SORT
638#include "array_utilities_pre.F90"
639
640!> Represent ana object in a pretty string
642 MODULE PROCEDURE to_char_ana
643END INTERFACE
644
645!> Print object
647 MODULE PROCEDURE display_ana
648END INTERFACE
649
650CONTAINS
651
652!> Inizializza un oggetto \a vol7d_ana con i parametri opzionali forniti.
653!! Se non viene passato nessun parametro opzionale l'oggetto è
654!! inizializzato a valore mancante.
655SUBROUTINE vol7d_ana_init(this, lon, lat, ident, ilon, ilat)
656TYPE(vol7d_ana),INTENT(INOUT) :: this !< oggetto da inizializzare
657REAL(kind=fp_geo),INTENT(in),OPTIONAL :: lon !< longitudine
658REAL(kind=fp_geo),INTENT(in),OPTIONAL :: lat !< latitudine
659CHARACTER(len=*),INTENT(in),OPTIONAL :: ident !< identificativo del volo
660INTEGER(kind=int_l),INTENT(in),OPTIONAL :: ilon !< integer longitude (nint(lon*1.d5)
661INTEGER(kind=int_l),INTENT(in),OPTIONAL :: ilat !< integer latitude (nint(lat*1.d5)
662
664IF (PRESENT(ident)) THEN
665 this%ident = ident
666ELSE
667 this%ident = cmiss
668ENDIF
669
670END SUBROUTINE vol7d_ana_init
671
672
673!> Distrugge l'oggetto in maniera pulita, assegnandogli un valore mancante.
674SUBROUTINE vol7d_ana_delete(this)
675TYPE(vol7d_ana),INTENT(INOUT) :: this !< oggetto da distruggre
676
678this%ident = cmiss
679
680END SUBROUTINE vol7d_ana_delete
681
682
683
684character(len=80) function to_char_ana(this)
685
686TYPE(vol7d_ana),INTENT(in) :: this
687
688to_char_ana="ANA: "//&
691 t2c(this%ident,miss="Missing ident")
692
693return
694
695end function to_char_ana
696
697
698subroutine display_ana(this)
699
700TYPE(vol7d_ana),INTENT(in) :: this
701
702print*, trim(to_char(this))
703
704end subroutine display_ana
705
706
707ELEMENTAL FUNCTION vol7d_ana_eq(this, that) RESULT(res)
708TYPE(vol7d_ana),INTENT(IN) :: this, that
709LOGICAL :: res
710
711res = this%coord == that%coord .AND. this%ident == that%ident
712
713END FUNCTION vol7d_ana_eq
714
715
716ELEMENTAL FUNCTION vol7d_ana_ne(this, that) RESULT(res)
717TYPE(vol7d_ana),INTENT(IN) :: this, that
718LOGICAL :: res
719
720res = .NOT.(this == that)
721
722END FUNCTION vol7d_ana_ne
723
724
725ELEMENTAL FUNCTION vol7d_ana_gt(this, that) RESULT(res)
726TYPE(vol7d_ana),INTENT(IN) :: this, that
727LOGICAL :: res
728
729res = this%ident > that%ident
730
731if ( this%ident == that%ident) then
732 res =this%coord > that%coord
733end if
734
735END FUNCTION vol7d_ana_gt
736
737
738ELEMENTAL FUNCTION vol7d_ana_ge(this, that) RESULT(res)
739TYPE(vol7d_ana),INTENT(IN) :: this, that
740LOGICAL :: res
741
742res = .not. this < that
743
744END FUNCTION vol7d_ana_ge
745
746
747ELEMENTAL FUNCTION vol7d_ana_lt(this, that) RESULT(res)
748TYPE(vol7d_ana),INTENT(IN) :: this, that
749LOGICAL :: res
750
751res = this%ident < that%ident
752
753if ( this%ident == that%ident) then
754 res = this%coord < that%coord
755end if
756
757END FUNCTION vol7d_ana_lt
758
759
760ELEMENTAL FUNCTION vol7d_ana_le(this, that) RESULT(res)
761TYPE(vol7d_ana),INTENT(IN) :: this, that
762LOGICAL :: res
763
764res = .not. (this > that)
765
766END FUNCTION vol7d_ana_le
767
768
769
770ELEMENTAL FUNCTION vol7d_ana_c_e(this) RESULT(c_e)
771TYPE(vol7d_ana),INTENT(IN) :: this
772LOGICAL :: c_e
773c_e = this /= vol7d_ana_miss
774END FUNCTION vol7d_ana_c_e
775
776
777!> This method reads from a Fortran file unit the contents of the
778!! object \a this. The record to be read must have been written with
779!! the ::write_unit method. The method works both on formatted and
780!! unformatted files.
781SUBROUTINE vol7d_ana_read_unit(this, unit)
782TYPE(vol7d_ana),INTENT(out) :: this !< object to be read
783INTEGER, INTENT(in) :: unit !< unit from which to read, it must be an opened Fortran file unit
784
785CALL vol7d_ana_vect_read_unit((/this/), unit)
786
787END SUBROUTINE vol7d_ana_read_unit
788
789
790!> This method reads from a Fortran file unit the contents of the
791!! object \a this. The record to be read must have been written with
792!! the ::write_unit method. The method works both on formatted and
793!! unformatted files.
794SUBROUTINE vol7d_ana_vect_read_unit(this, unit)
795TYPE(vol7d_ana) :: this(:) !< object to be read
796INTEGER, INTENT(in) :: unit !< unit from which to read, it must be an opened Fortran file unit
797
798CHARACTER(len=40) :: form
799
801INQUIRE(unit, form=form)
802IF (form == 'FORMATTED') THEN
803 READ(unit,'(A)')this(:)%ident
804ELSE
805 READ(unit)this(:)%ident
806ENDIF
807
808END SUBROUTINE vol7d_ana_vect_read_unit
809
810
811!> This method writes on a Fortran file unit the contents of the
812!! object \a this. The record can successively be read by the
813!! ::read_unit method. The method works both on formatted and
814!! unformatted files.
815SUBROUTINE vol7d_ana_write_unit(this, unit)
816TYPE(vol7d_ana),INTENT(in) :: this !< object to be written
817INTEGER, INTENT(in) :: unit !< unit where to write, it must be an opened Fortran file unit
818
819CALL vol7d_ana_vect_write_unit((/this/), unit)
820
821END SUBROUTINE vol7d_ana_write_unit
822
823
824!> This method writes on a Fortran file unit the contents of the
825!! object \a this. The record can successively be read by the
826!! ::read_unit method. The method works both on formatted and
827!! unformatted files.
828SUBROUTINE vol7d_ana_vect_write_unit(this, unit)
829TYPE(vol7d_ana),INTENT(in) :: this(:) !< object to be written
830INTEGER, INTENT(in) :: unit !< unit where to write, it must be an opened Fortran file unit
831
832CHARACTER(len=40) :: form
833
835INQUIRE(unit, form=form)
836IF (form == 'FORMATTED') THEN
837 WRITE(unit,'(A)')this(:)%ident
838ELSE
839 WRITE(unit)this(:)%ident
840ENDIF
841
842END SUBROUTINE vol7d_ana_vect_write_unit
843
844
845#include "array_utilities_inc.F90"
846
847
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 |