! ! $Id: modupdate.F 779 2007-12-22 17:04:17Z rblod $ ! ! AGRIF (Adaptive Grid Refinement In Fortran) ! ! Copyright (C) 2003 Laurent Debreu (Laurent.Debreu@imag.fr) ! Christophe Vouland (Christophe.Vouland@imag.fr) ! ! This program is free software; you can redistribute it and/or modify ! it under the terms of the GNU General Public License as published by ! the Free Software Foundation; either version 2 of the License, or ! (at your option) any later version. ! ! This program is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU General Public License for more details. ! ! You should have received a copy of the GNU General Public License ! along with this program; if not, write to the Free Software ! Foundation, Inc., 59 Temple Place- Suite 330, Boston, MA 02111-1307, USA. ! !--------------------------------------------------------------------------------------------------- !> Module Agrif_User_Update !! !! This module contains the main procedures used to update a variable. !--------------------------------------------------------------------------------------------------- ! module Agrif_User_Update ! use Agrif_Update use Agrif_Save ! implicit none ! contains ! ! !=================================================================================================== ! subroutine Agrif_Set_UpdateType !> This subroutine is used to specify the type of update we want to do. The index of the variable we want !! to interpolate is a profile defined with the subroutine Agrif_Declare_Variable. !--------------------------------------------------------------------------------------------------- subroutine Agrif_Set_UpdateType ( tabvarsindic, update, update1, update2, & update3, update4, update5 ) !--------------------------------------------------------------------------------------------------- INTEGER, intent(in) :: tabvarsindic !< index of the variable in tabvars INTEGER, OPTIONAL, intent(in) :: update, update1, update2, update3, update4, update5 !< type of update ! INTEGER :: indic ! indice of the variable in tabvars type(Agrif_Variable), pointer :: root_var ! root_var => Agrif_Search_Variable(Agrif_Mygrid,tabvarsindic) ! root_var % type_update = Agrif_Update_Copy if (present(update)) root_var % type_update = update if (present(update1)) root_var % type_update(1) = update1 if (present(update2)) root_var % type_update(2) = update2 if (present(update3)) root_var % type_update(3) = update3 if (present(update4)) root_var % type_update(4) = update4 if (present(update5)) root_var % type_update(5) = update5 !--------------------------------------------------------------------------------------------------- end subroutine Agrif_Set_UpdateType !=================================================================================================== ! ! !=================================================================================================== ! subroutine Agrif_Update_Variable !> This subroutine is used to update variables. When the location is not specify, the update is made !! within the domain of the reference grid (not at boundary). The index of the variable we want to !! interpolate is a profile defined with the subroutine Agrif_Declare_Variable. !>locupdate1 : specifies the location for the first dimension. !--------------------------------------------------------------------------------------------------- subroutine Agrif_Update_Variable ( tabvarsindic, procname, & locupdate, locupdate1, locupdate2, locupdate3, locupdate4 ) !--------------------------------------------------------------------------------------------------- integer, intent(in) :: tabvarsindic !< Indice of the variable in tabvars procedure() :: procname !< Data recovery procedure written by users integer, dimension(2), intent(in), optional :: locupdate !< location to update integer, dimension(2), intent(in), optional :: locupdate1 integer, dimension(2), intent(in), optional :: locupdate2 integer, dimension(2), intent(in), optional :: locupdate3 integer, dimension(2), intent(in), optional :: locupdate4 !--------------------------------------------------------------------------------------------------- integer :: indic integer :: nbdim integer, dimension(6) :: updateinf ! First positions where interpolations are calculated integer, dimension(6) :: updatesup ! Last positions where interpolations are calculated type(Agrif_Variable), pointer :: root_var type(Agrif_Variable), pointer :: parent_var type(Agrif_Variable), pointer :: child_var ! if ( Agrif_Root() .AND. (.not.agrif_coarse) ) return if (agrif_curgrid%grand_mother_grid) return ! child_var => Agrif_Search_Variable(Agrif_Curgrid, tabvarsindic) parent_var => child_var % parent_var if (.not.associated(parent_var)) then ! can occur during the first update of Agrif_Coarsegrid (if any) parent_var => Agrif_Search_Variable(Agrif_Curgrid % parent, tabvarsindic) child_var % parent_var => parent_var endif root_var => child_var % root_var ! nbdim = root_var % nbdim ! updateinf = -99 updatesup = -99 ! if ( present(locupdate) ) then updateinf(1:nbdim) = locupdate(1) updatesup(1:nbdim) = locupdate(2) endif ! if ( present(locupdate1) ) then updateinf(1) = locupdate1(1) updatesup(1) = locupdate1(2) endif ! if ( present(locupdate2) ) then updateinf(2) = locupdate2(1) updatesup(2) = locupdate2(2) endif if ( present(locupdate3) ) then updateinf(3) = locupdate3(1) updatesup(3) = locupdate3(2) endif if ( present(locupdate4) ) then updateinf(4) = locupdate4(1) updatesup(4) = locupdate4(2) endif ! call Agrif_UpdateVariable( parent_var, child_var, updateinf, updatesup, procname ) !--------------------------------------------------------------------------------------------------- end subroutine Agrif_Update_Variable !=================================================================================================== ! end module Agrif_User_Update