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