! ! $Id: modupdatebasic.F 2715 2011-03-30 15:58:35Z rblod $ ! C AGRIF (Adaptive Grid Refinement In Fortran) C C Copyright (C) 2003 Laurent Debreu (Laurent.Debreu@imag.fr) C Christophe Vouland (Christophe.Vouland@imag.fr) C C This program is free software; you can redistribute it and/or modify C it under the terms of the GNU General Public License as published by C the Free Software Foundation; either version 2 of the License, or C (at your option) any later version. C C This program is distributed in the hope that it will be useful, C but WITHOUT ANY WARRANTY; without even the implied warranty of C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the C GNU General Public License for more details. C C You should have received a copy of the GNU General Public License C along with this program; if not, write to the Free Software C Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. C C C CCC Module Agrif_Updatebasic C C Module Agrif_Updatebasic C CCC Description: CCC Module containing different procedures of update (copy,average, CCC full_weighting) used in the Agrif_Update module. C C Modules used: C USE Agrif_types IMPLICIT NONE integer,dimension(:,:),allocatable :: indchildcopy integer,dimension(:,:),allocatable :: indchildaverage C CONTAINS C Define procedures contained in this module C C C C ************************************************************************** CCC Subroutine Copy1d C ************************************************************************** C Subroutine agrif_copy1d(x,y,np,nc, & s_parent,s_child,ds_parent,ds_child) C CCC Description: CCC Subroutine to do a copy on a parent grid (vector x) from its child grid CCC (vector y). C CC Method: C C Declarations: C C C Arguments INTEGER :: np,nc REAL, DIMENSION(np) :: x REAL, DIMENSION(nc) :: y REAL :: s_parent,s_child REAL :: ds_parent,ds_child C C Local variables INTEGER :: i,locind_child_left,coeffraf C C coeffraf = nint(ds_parent/ds_child) C if (coeffraf == 1) then C locind_child_left = 1 + nint((s_parent - s_child)/ds_child) C !CDIR ALTCODE x(1:np) = y(locind_child_left:locind_child_left+np-1) C return C endif C locind_child_left = 1 + nint((s_parent - s_child)/ds_child) !CDIR ALTCODE do i = 1,np C x(i) = y(locind_child_left) C locind_child_left = locind_child_left + coeffraf C enddo C Return C C End Subroutine agrif_copy1d C ************************************************************************** CCC Subroutine Copy1dprecompute C ************************************************************************** C Subroutine copy1dprecompute2d(nc2,np,nc, & s_parent,s_child,ds_parent,ds_child,dir) C CCC Description: CCC Subroutine to precompute index for a copy on a parent grid (vector x) from CCC its child grid (vector y). C CC Method: C C Declarations: C C C Arguments INTEGER :: nc2,np,nc INTEGER :: dir REAL :: s_parent,s_child REAL :: ds_parent,ds_child C C Local variables INTEGER,DIMENSION(:,:),ALLOCATABLE :: indchildcopy_tmp INTEGER :: i,locind_child_left,coeffraf C C coeffraf = nint(ds_parent/ds_child) C locind_child_left = 1 + nint((s_parent - s_child)/ds_child) if (.not.allocated(indchildcopy)) then allocate(indchildcopy(np*nc2,3)) else if (size(indchildcopy,1)