psmile_store_data_grid.F90

Go to the documentation of this file.
00001 !-----------------------------------------------------------------------
00002 ! Copyright 2010, DKRZ, Hamburg, Germany.
00003 ! All rights reserved. Use is subject to OASIS4 license terms.
00004 !-----------------------------------------------------------------------
00005 !
00006 ! !DESCRIPTION:
00007 !
00008 ! The routine psmile_store_data_grid stores the data provided
00009 ! by the user through the interface prism_def_grid.
00010 !
00011 !
00012 ! !REVISION HISTORY:
00013 !
00014 !   Date      Programmer   Description
00015 ! ----------  ----------   -----------
00016 ! 27.10.10    M. Hanke     created
00017 !
00018 !----------------------------------------------------------------------
00019 !
00020 !  $Id: psmile_store_data_grid.F90 2769 2010-11-23 14:49:21Z hanke $
00021 !  $Author: hanke $
00022 !
00023 !----------------------------------------------------------------------
00024 
00025 subroutine psmile_store_data_grid (grid_id, grid_name, comp_id, &
00026                                    grid_valid_shape, grid_type, ierror)
00027 
00028    use psmile_user_data, only  : grid_data, init_user_coordinate_data
00029    use psmile_grid, only       : get_size_of_shape
00030    use psmile_common, only     : ch_id
00031    use psmile_reallocate, only : psmile_realloc
00032 
00033    implicit none
00034 
00035    integer, intent(out)         :: grid_id
00036    character(len=*), intent(in) :: grid_name
00037    integer, intent(in)          :: comp_id
00038    integer, intent(in)          :: grid_valid_shape (2, *)
00039    integer, intent(in)          :: grid_type
00040    integer, intent(out)         :: ierror
00041 
00042    integer                      :: size_of_shape (2)
00043    integer                      :: psmile_grid_id
00044 
00045 #ifdef VERBOSE
00046    print 9990, trim(ch_id)
00047    call psmile_flushstd
00048 #endif /* VERBOSE */
00049 
00050    ierror = 0
00051 
00052    if (.not. associated (grid_data)) then
00053       grid_id = 1
00054    else
00055       grid_id = size(grid_data) + 1
00056    endif
00057 
00058    grid_data => psmile_realloc (grid_data, grid_id)
00059 
00060    grid_data(grid_id)%grid_name = trim(grid_name)
00061    grid_data(grid_id)%comp_id = comp_id
00062    size_of_shape = get_size_of_shape(grid_type)
00063    allocate(grid_data(grid_id)%grid_valid_shape(size_of_shape(1),size_of_shape(2)))
00064    grid_data(grid_id)%grid_valid_shape = grid_valid_shape(1:2, 1:size_of_shape(2))
00065    grid_data(grid_id)%grid_type = grid_type
00066    call init_user_coordinate_data(grid_data(grid_id)%corners)
00067 
00068    nullify (grid_data(grid_id)%partition_array)
00069    nullify (grid_data(grid_id)%extent_array)
00070    nullify (grid_data(grid_id)%nbr_points_per_lat)
00071 
00072 #ifdef VERBOSE
00073    print 9980, trim(ch_id), ierror
00074    call psmile_flushstd
00075 #endif /* VERBOSE */
00076 
00077 9990 format (1x, a, ': psmile_store_data_grid: ')
00078 9980 format (1x, a, ': psmile_store_data_grid: eof ierror =', i5)
00079 end subroutine psmile_store_data_grid

Generated on 18 Mar 2011 for Oasis4 by  doxygen 1.6.1