|
libsim Versione 8.0.0
|
◆ volgrid6d_alloc()
Allocate the dimension descriptors of the volgrid6d object. This method allocates the horizontal grid descriptor and the one dimensional arrays of the dimensions
This method should be explicitly used only in rare cases, it is usually called implicitly through the import interface.
Definizione alla linea 408 del file volgrid6d_class.F90. 409 CALL raise_fatal_error()
410ENDIF
411
412END SUBROUTINE volgrid6d_alloc_vol
413
414
415!> Return a 2-d pointer to a x-y slice of a volume. This method works
416!! both with volumes having allocated and non-allocated this%voldati
417!! array, and it returns a pointer to a 2-d slice either from the
418!! allocated this%voldati array or from the grid_id object on file or
419!! in memory. In the second case the pointer should be either
420!! ALLOCATE'd to the expected size or NULLIFY'ed, and if NULLIFY'ed,
421!! it is allocated within the method, thus it will have to be
422!! deallocated by the caller when not in use anymore. Since this
423!! method may be called many times by a program, it is optimized for
424!! speed and it does not make any check about the matching size of the
425!! pointer and the array or about the allocation status of \a this, so
426!! it should be called only when everything has been checked to be in
427!! good shape.
428SUBROUTINE volgrid_get_vol_2d(this, ilevel, itime, itimerange, ivar, voldati)
429TYPE(volgrid6d),INTENT(in) :: this !< object from which the slice has to be retrieved
430INTEGER,INTENT(in) :: ilevel !< index of vertical level of the slice
431INTEGER,INTENT(in) :: itime !< index of time level of the slice
432INTEGER,INTENT(in) :: itimerange !< index of timerange of the slice
433INTEGER,INTENT(in) :: ivar !< index of physical variable of the slice
434REAL,POINTER :: voldati(:,:) !< pointer to the data, if \a this%voldati is already allocated, it will just point to the requested slice, otherwise it will be allocated if and only if it is nullified on entry
435
436IF (ASSOCIATED(this%voldati)) THEN
437 voldati => this%voldati(:,:,ilevel,itime,itimerange,ivar)
438 RETURN
439ELSE
440 IF (.NOT.ASSOCIATED(voldati)) THEN
441 ALLOCATE(voldati(this%griddim%dim%nx,this%griddim%dim%ny))
442 ENDIF
443 CALL grid_id_decode_data(this%gaid(ilevel,itime,itimerange,ivar), voldati)
444ENDIF
445
446END SUBROUTINE volgrid_get_vol_2d
447
448
449!> Return a 3-d pointer to a x-y-z slice of a volume. This method works
450!! both with volumes having allocated and non-allocated this%voldati
451!! array, and it returns a pointer to a 3-d slice either from the
452!! allocated this%voldati array or from the grid_id object on file or
453!! in memory. In the second case the pointer should be either
454!! ALLOCATE'd to the expected size or NULLIFY'ed, and if NULLIFY'ed,
455!! it is allocated within the method, thus it will have to be
456!! deallocated by the caller when not in use anymore. Since this
457!! method may be called many times by a program, it is optimized for
458!! speed and it does not make any check about the matching size of the
459!! pointer and the array or about the allocation status of \a this, so
460!! it should be called only when everything has been checked to be in
461!! good shape.
462SUBROUTINE volgrid_get_vol_3d(this, itime, itimerange, ivar, voldati, zlist)
463TYPE(volgrid6d),INTENT(in) :: this !< object from which the slice has to be retrieved
464INTEGER,INTENT(in) :: itime !< index of time level of the slice
465INTEGER,INTENT(in) :: itimerange !< index of timerange of the slice
466INTEGER,INTENT(in) :: ivar !< index of physical variable of the slice
467REAL,POINTER :: voldati(:,:,:) !< pointer to the data, if \a this%voldati is already allocated, it will just point to the requested slice, otherwise it will be allocated if and only if it is nullified on entry
468LOGICAL,OPTIONAL,INTENT(out),ALLOCATABLE :: zlist(:) !< list of vertical level present in the data
469
470INTEGER :: ilevel
471LOGICAL :: done
472
473IF (ASSOCIATED(this%voldati)) THEN
474 voldati => this%voldati(:,:,:,itime,itimerange,ivar)
475 IF (PRESENT(zlist)) zlist(:) = c_e(this%gaid(:,itime,itimerange,ivar))
476 RETURN
477ELSE
478 IF (.NOT.ASSOCIATED(voldati)) THEN
479 ALLOCATE(voldati(this%griddim%dim%nx,this%griddim%dim%ny,SIZE(this%level)))
480 ENDIF
481 IF (PRESENT(zlist)) THEN
482 ALLOCATE(zlist(SIZE(this%level)))
483 ENDIF
484!$OMP PARALLEL DEFAULT(SHARED)
485!$OMP MASTER
486 DO ilevel = 1, SIZE(this%level)
487!$OMP TASK FIRSTPRIVATE(ilevel),PRIVATE(done)
488 CALL grid_id_decode_data(this%gaid(ilevel,itime,itimerange,ivar), &
489 voldati(:,:,ilevel),done)
490 IF (PRESENT(zlist)) zlist(ilevel) = done
491!$OMP END TASK
492 ENDDO
493!$OMP END MASTER
494!$OMP END PARALLEL
495ENDIF
496
497END SUBROUTINE volgrid_get_vol_3d
498
499
500!> Reset a 2-d x-y slice of a volume after the data have been modified.
501!! This method works both with volumes having allocated and
502!! non-allocated this%voldati array, and it updates the requested
503!! slice. In case \a this%voldati is already allocated, this is a
504!! no-operation while in the other case this method encodes the field
505!! provided into the grid_id object on file or in memory. Since this
506!! method may be called many times by a program, it is optimized for
507!! speed and it does not make any check about the matching size of the
508!! field and the array or about the allocation status of \a this, so
|