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