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