libsim Versione 7.2.6
vol7d_network_class.F90
1! Copyright (C) 2010 ARPA-SIM <urpsim@smr.arpa.emr.it>
2! authors:
3! Davide Cesari <dcesari@arpa.emr.it>
4! Paolo Patruno <ppatruno@arpa.emr.it>
5
6! This program is free software; you can redistribute it and/or
7! modify it under the terms of the GNU General Public License as
8! published by the Free Software Foundation; either version 2 of
9! the License, or (at your option) any later version.
10
11! This program is distributed in the hope that it will be useful,
12! but WITHOUT ANY WARRANTY; without even the implied warranty of
13! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14! GNU General Public License for more details.
15
16! You should have received a copy of the GNU General Public License
17! along with this program. If not, see <http://www.gnu.org/licenses/>.
18#include "config.h"
19
20!> Classe per la gestione delle reti di stazioni per osservazioni meteo e affini.
21!! Questo modulo definisce una classe per identificare la rete
22!! a cui appartiene una stazione. Per rete si intende un insieme di stazioni
23!! omogenee per tipo di sensori, tipo di variabili osservate,
24!! frequenza delle osservazioni, formato dei dati.
25!! \ingroup vol7d
27USE kinds
30IMPLICIT NONE
31
32integer, parameter :: network_name_len=20
33
34!> Definisce la rete a cui appartiene una stazione.
35!! I membri di \a vol7d_network sono pubblici e quindi liberamente
36!! accessibili e scrivibili, ma è comunque consigliato assegnarli tramite
37!! il costruttore ::init.
39 character(len=network_name_len) :: name !< Mnemonic alias for type of report
40END TYPE vol7d_network
41
42!> Valore mancante per vol7d_network.
43TYPE(vol7d_network),PARAMETER :: vol7d_network_miss=vol7d_network(cmiss)
44
45!> Costruttore per la classe vol7d_network.
46!! Deve essere richiamato
47!! per tutti gli oggetti di questo tipo definiti in un programma.
48INTERFACE init
49 MODULE PROCEDURE vol7d_network_init
50END INTERFACE
51
52!> Distruttore per la classe vol7d_network.
53!! Distrugge l'oggetto in maniera pulita, assegnandogli un valore mancante.
54INTERFACE delete
55 MODULE PROCEDURE vol7d_network_delete
56END INTERFACE
57
58!> Logical equality operator for objects of \a vol7d_network class.
59!! It is defined as \a ELEMENTAL thus it works also with conformal arrays
60!! of any shape.
61INTERFACE OPERATOR (==)
62 MODULE PROCEDURE vol7d_network_eq
63END INTERFACE
64
65!> Logical inequality operator for objects of \a vol7d_network class.
66!! It is defined as \a ELEMENTAL thus it works also with conformal arrays
67!! of any shape.
68INTERFACE OPERATOR (/=)
69 MODULE PROCEDURE vol7d_network_ne
70END INTERFACE
71
72!> Logical greater-than operator for objects of \a vol7d_network class.
73!! It is defined as \a ELEMENTAL thus it works also with conformal arrays
74!! of any shape.
75INTERFACE OPERATOR (>)
76 MODULE PROCEDURE vol7d_network_gt
77END INTERFACE
78
79!> Logical less-than operator for objects of \a vol7d_network class.
80!! It is defined as \a ELEMENTAL thus it works also with conformal arrays
81!! of any shape.
82INTERFACE OPERATOR (<)
83 MODULE PROCEDURE vol7d_network_lt
84END INTERFACE
85
86!> Logical greater-equal operator for objects of \a vol7d_network class.
87!! It is defined as \a ELEMENTAL thus it works also with conformal arrays
88!! of any shape.
89INTERFACE OPERATOR (>=)
90 MODULE PROCEDURE vol7d_network_ge
91END INTERFACE
92
93!> Logical less-equal operator for objects of \a vol7d_network class.
94!! It is defined as \a ELEMENTAL thus it works also with conformal arrays
95!! of any shape.
96INTERFACE OPERATOR (<=)
97 MODULE PROCEDURE vol7d_network_le
98END INTERFACE
99
100#define VOL7D_POLY_TYPE TYPE(vol7d_network)
101#define VOL7D_POLY_TYPES _network
102#define ENABLE_SORT
103#include "array_utilities_pre.F90"
104
105!>Print object
106INTERFACE display
107 MODULE PROCEDURE display_network
108END INTERFACE
109
110!>Check object presence
111INTERFACE c_e
112 MODULE PROCEDURE c_e_network
113END INTERFACE
114
115!>return network object in a pretty string
116INTERFACE to_char
117 MODULE PROCEDURE to_char_network
118END INTERFACE
119
120CONTAINS
121
122!> Inizializza un oggetto \a vol7d_network con i parametri opzionali forniti.
123!! Questa è la versione \c FUNCTION, in stile F2003, del costruttore, da preferire
124!! rispetto alla versione \c SUBROUTINE \c init.
125!! Se non viene passato nessun parametro opzionale l'oggetto è
126!! inizializzato a valore mancante.
127FUNCTION vol7d_network_new(name) RESULT(this)
128CHARACTER(len=*),INTENT(in),OPTIONAL :: name !< Mnemonic alias for type of report
129
130TYPE(vol7d_network) :: this !< oggetto da inizializzare
131
132CALL init(this, name)
133
134END FUNCTION vol7d_network_new
135
136
137!> Inizializza un oggetto \a vol7d_network con i parametri opzionali forniti.
138!! Se non viene passato nessun parametro opzionale l'oggetto è
139!! inizializzato a valore mancante.
140SUBROUTINE vol7d_network_init(this, name)
141TYPE(vol7d_network),INTENT(INOUT) :: this !< oggetto da inizializzare
142CHARACTER(len=*),INTENT(in),OPTIONAL :: name !< Mnemonic alias for type of report
143
144IF (PRESENT(name)) THEN
145 this%name = lowercase(name)
146ELSE
147 this%name = cmiss
148END IF
149
150END SUBROUTINE vol7d_network_init
151
152
153!> Distrugge l'oggetto in maniera pulita, assegnandogli un valore mancante.
154SUBROUTINE vol7d_network_delete(this)
155TYPE(vol7d_network),INTENT(INOUT) :: this !< oggetto da distruggre
156
157this%name = cmiss
158
159END SUBROUTINE vol7d_network_delete
160
161
162subroutine display_network(this)
163
164TYPE(vol7d_network),INTENT(in) :: this
165
166print*,to_char_network(this)
167
168end subroutine display_network
169
170
171elemental function c_e_network(this) result(res)
172
173TYPE(vol7d_network),INTENT(in) :: this
174logical :: res
175
176res = .not. this == vol7d_network_miss
177
178end function c_e_network
179
180
181elemental character(len=20) function to_char_network(this)
182
183TYPE(vol7d_network),INTENT(in) :: this
184
185to_char_network="Network: "//trim(this%name)
186
187return
188
189end function to_char_network
190
191
192ELEMENTAL FUNCTION vol7d_network_eq(this, that) RESULT(res)
193TYPE(vol7d_network),INTENT(IN) :: this, that
194LOGICAL :: res
195
196res = (this%name == that%name)
197
198END FUNCTION vol7d_network_eq
199
200
201ELEMENTAL FUNCTION vol7d_network_ne(this, that) RESULT(res)
202TYPE(vol7d_network),INTENT(IN) :: this, that
203LOGICAL :: res
204
205res = .NOT.(this == that)
206
207END FUNCTION vol7d_network_ne
208
209
210ELEMENTAL FUNCTION vol7d_network_gt(this, that) RESULT(res)
211TYPE(vol7d_network),INTENT(IN) :: this, that
212LOGICAL :: res
213
214res = this%name > that%name
215
216END FUNCTION vol7d_network_gt
217
218ELEMENTAL FUNCTION vol7d_network_lt(this, that) RESULT(res)
219TYPE(vol7d_network),INTENT(IN) :: this, that
220LOGICAL :: res
221
222res = this%name < that%name
223
224END FUNCTION vol7d_network_lt
225
227ELEMENTAL FUNCTION vol7d_network_ge(this, that) RESULT(res)
228TYPE(vol7d_network),INTENT(IN) :: this, that
229LOGICAL :: res
230
231res = this%name >= that%name
232
233END FUNCTION vol7d_network_ge
234
235ELEMENTAL FUNCTION vol7d_network_le(this, that) RESULT(res)
236TYPE(vol7d_network),INTENT(IN) :: this, that
237LOGICAL :: res
238
239res = this%name <= that%name
240
241END FUNCTION vol7d_network_le
243
244#include "array_utilities_inc.F90"
245
246
247END MODULE vol7d_network_class
Index method.
Distruttore per la classe vol7d_network.
Index method with sorted array.
Costruttore per la classe vol7d_network.
return network object in a pretty string
Utilities for CHARACTER variables.
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.
Classe per la gestione delle reti di stazioni per osservazioni meteo e affini.
Definisce la rete a cui appartiene una stazione.

Generated with Doxygen.