Index: vendors/AGRIF/CMEMS_2020/AGRIF_FILES/modinterp.F90
===================================================================
--- vendors/AGRIF/CMEMS_2020/AGRIF_FILES/modinterp.F90	(revision 10087)
+++ vendors/AGRIF/CMEMS_2020/AGRIF_FILES/modinterp.F90	(revision 10725)
@@ -26,14 +26,11 @@
 module Agrif_Interpolation
 !
-  use Agrif_Init
-  use Agrif_Arrays
-  use Agrif_InterpBasic
-  use Agrif_User_Functions
-
+    use Agrif_InterpBasic
+    use Agrif_Arrays
+    use Agrif_Mask
+    use Agrif_CurgridFunctions
 #if defined AGRIF_MPI
     use Agrif_Mpp
 #endif
-  
-    use Agrif_Mask
 !
     implicit none
@@ -69,6 +66,6 @@
     integer, dimension(6) :: ub_child
     integer, dimension(6) :: lb_parent
-    real(kind=8)   , dimension(6) :: s_child,   s_parent
-    real(kind=8)   , dimension(6) :: ds_child, ds_parent
+    real   , dimension(6) :: s_child,   s_parent
+    real   , dimension(6) :: ds_child, ds_parent
     integer, dimension(child % root_var % nbdim,2,2) :: childarray
 !
@@ -118,6 +115,6 @@
     INTEGER, DIMENSION(nbdim), INTENT(in)   :: pttab_Parent !< Index of the first point inside the domain
                                                             !<    for the parent grid variable
-    REAL(kind=8),    DIMENSION(nbdim), INTENT(in)   :: s_Child,s_Parent   !< Positions of the parent and child grids
-    REAL(kind=8),    DIMENSION(nbdim), INTENT(in)   :: ds_Child,ds_Parent !< Space steps of the parent and child grids
+    REAL,    DIMENSION(nbdim), INTENT(in)   :: s_Child,s_Parent   !< Positions of the parent and child grids
+    REAL,    DIMENSION(nbdim), INTENT(in)   :: ds_Child,ds_Parent !< Space steps of the parent and child grids
     TYPE(Agrif_Variable),      pointer      :: restore            !< Indicates points where interpolation
     LOGICAL,                   INTENT(in)   :: torestore          !< Indicates if the array restore is used
@@ -131,5 +128,5 @@
     INTEGER                       :: i,j,k,l,m,n
     INTEGER, DIMENSION(nbdim)     :: pttruetab,cetruetab
-    INTEGER, DIMENSION(nbdim)     :: indmin,     indmax, indmin_required_p, indmax_required_p
+    INTEGER, DIMENSION(nbdim)     :: indmin,     indmax
     INTEGER, DIMENSION(nbdim)     :: indminglob, indmaxglob
 #if defined AGRIF_MPI
@@ -138,5 +135,5 @@
 #endif
     LOGICAL, DIMENSION(nbdim)     :: noraftab
-    REAL(kind=8)   , DIMENSION(nbdim)     :: s_Child_temp,s_Parent_temp,s_Parent_temp_p
+    REAL   , DIMENSION(nbdim)     :: s_Child_temp,s_Parent_temp
     INTEGER, DIMENSION(nbdim)     :: lowerbound, upperbound, coords
     INTEGER, DIMENSION(nbdim,2,2), INTENT(OUT) :: childarray
@@ -174,6 +171,5 @@
             child % list_interp,                                    &
             pttab, petab, pttab_Child, pttab_Parent, nbdim,         &
-            indmin, indmax, indmin_required_p, indmax_required_p,   &
-            indminglob, indmaxglob,                                 &
+            indmin, indmax, indminglob, indmaxglob,                 &
             pttruetab, cetruetab, memberin                          &
 #if defined AGRIF_MPI
@@ -182,26 +178,12 @@
 #endif
         )
-
 !
     if (.not.find_list_interp) then
 !
-! output : lowerbound and upperbound are the (local) lower and upper bounds of the child arrays
-
         call Agrif_get_var_bounds_array(child, lowerbound, upperbound, nbdim)
-
-! input : pttab, petab : global indexes where the interpolation is required
-! output : pttruetab, cetruetab : global indexes restricted to the bounds of the current processor 
-! output : memberin is false if the current processor is not involved in the interpolation
-
         call Agrif_Childbounds(nbdim, lowerbound, upperbound,               &
                                pttab, petab, Agrif_Procrank, coords,        &
                                pttruetab, cetruetab, memberin)
-			
-
-
-! output : indminglob, indmaxglob : global indexes required on the parent grid for the interpolation
-! output : s_Parent_temp, s_Child_temp : local s_Parent, s_Child relatively to indmin ou pttab
         call Agrif_Parentbounds(type_interp,nbdim,indminglob,indmaxglob,    &
-                                indmin_required_p, indmax_required_p,           &
                                 s_Parent_temp,s_Child_temp,                 &
                                 s_Child,ds_Child,                           &
@@ -212,9 +194,5 @@
 #if defined AGRIF_MPI
         if (memberin) then
-
-! output : indmin, indmax : global indexes required on the parent grid for the interpolation on the current processor (i.e. on pttruetab, cetruetab)
-! output : s_Parent_temp, s_Child_temp : local s_Parent, s_Child relatively to indmin ou pttruetab
             call Agrif_Parentbounds(type_interp,nbdim,indmin,indmax,        &
-                                    indmin_required_p, indmax_required_p,       &
                                     s_Parent_temp,s_Child_temp,             &
                                     s_Child,ds_Child,                       &
@@ -226,14 +204,7 @@
 
         local_proc = Agrif_Procrank
-
-! output : lowerbound and upperbound are the (local) lower and upper bounds of the parent arrays
         call Agrif_get_var_bounds_array(parent,lowerbound,upperbound,nbdim)
         call Agrif_ChildGrid_to_ParentGrid()
-
-! input : indminglob,indmaxglob : global indexes where data are required for the interpolation
-! output : indminglob2,indmaxglob2 : global indexes restricted to the bounds of the current processor 
-! output : member is false if the current processor does not need to send data
-! output : indminglob3,indmaxglob3 : global bounds on the current processor for the parent array
-
+!
         call Agrif_Childbounds(nbdim,lowerbound,upperbound,                 &
                                indminglob,indmaxglob, local_proc, coords,   &
@@ -242,10 +213,4 @@
 !
         if (member) then
-
-! output : parentarray
-! output : parentarray (:,:,2) : indminglob2, indmaxglob2 in term of local indexes on current processor
-! output : parentarray (:,:,1) : indminglob2, indmaxglob2 restricted to the current processor (different from indminglob2 ???)
-! output : member is .false. is the current processor has not data to send
-
             call Agrif_GlobalToLocalBounds(parentarray,                     &
                                            lowerbound,  upperbound,         &
@@ -256,36 +221,11 @@
         call Agrif_ParentGrid_to_ChildGrid()
 #else
-
-! In the sequentiel case, the following lines ensure that the bounds needed on the parent grid in the interpolation 
-! do not exceed lower and upper bounds of the parent array
-
-! output : lowerbound and upperbound are the (local) lower and upper bounds of the parent arrays
-        call Agrif_get_var_bounds_array(parent,lowerbound,upperbound,nbdim)
-        call Agrif_ChildGrid_to_ParentGrid()
-
-! input : indminglob,indmaxglob : global indexes where data are required for the interpolation
-! output : indminglob2,indmaxglob2 : global indexes restricted to the bounds of the current processor 
-! output : member is false if the current processor does not need to send data
-
-        call Agrif_Childbounds(nbdim,lowerbound,upperbound,                 &
-                               indminglob,indmaxglob, Agrif_Procrank, coords,   &
-                               indmin,indmax,member)
-
-        call Agrif_ParentGrid_to_ChildGrid()
-
-        indminglob = indmin
-        indmaxglob = indmax
-
         parentarray(:,1,1) = indminglob
         parentarray(:,2,1) = indmaxglob
         parentarray(:,1,2) = indminglob
         parentarray(:,2,2) = indmaxglob
- 
-!       indmin = indminglob
-!        indmax = indmaxglob
-
+        indmin = indminglob
+        indmax = indmaxglob
         member = .TRUE.
-        s_Parent_temp = s_Parent + (indminglob - pttab_Parent) * ds_Parent
-
 #endif
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@@ -307,31 +247,10 @@
         s_Child_temp  = s_Child + (pttruetab - pttab_Child) * ds_Child
 #else
-
-! In the sequentiel case, the following lines ensure that the bounds needed on the parent grid in the interpolation 
-! do not exceed lower and upper bounds of the parent array
-
-! output : lowerbound and upperbound are the (local) lower and upper bounds of the parent arrays
-        call Agrif_get_var_bounds_array(parent,lowerbound,upperbound,nbdim)
-        call Agrif_ChildGrid_to_ParentGrid()
-
-! input : indminglob,indmaxglob : global indexes where data are required for the interpolation
-! output : indminglob2,indmaxglob2 : global indexes restricted to the bounds of the current processor 
-! output : member is false if the current processor does not need to send data
-
-        call Agrif_Childbounds(nbdim,lowerbound,upperbound,                 &
-                               indminglob,indmaxglob, Agrif_Procrank, coords,   &
-                               indmin,indmax,member)
-
-        call Agrif_ParentGrid_to_ChildGrid()
-
-        indminglob = indmin
-        indmaxglob = indmax
-
         parentarray(:,1,1) = indminglob
         parentarray(:,2,1) = indmaxglob
         parentarray(:,1,2) = indminglob
         parentarray(:,2,2) = indmaxglob
- !       indmin = indminglob
- !       indmax = indmaxglob
+        indmin = indminglob
+        indmax = indmaxglob
         member = .TRUE.
         s_Parent_temp = s_Parent + (indminglob - pttab_Parent) * ds_Parent
@@ -343,5 +262,4 @@
         if (.not.associated(tempP)) allocate(tempP)
 !
-
         call Agrif_array_allocate(tempP,parentarray(:,1,1),parentarray(:,2,1),nbdim)
         call Agrif_var_set_array_tozero(tempP,nbdim)
@@ -384,5 +302,4 @@
                       parentarray(6,1,2),parentarray(6,2,2),.TRUE.,nb,ndir)
         end select
-
 !
         call Agrif_ParentGrid_to_ChildGrid()
@@ -443,5 +360,4 @@
                 child%list_interp,pttab,petab,                  &
                 pttab_Child,pttab_Parent,indmin,indmax,         &
-                indmin_required_p, indmax_required_p,           &
                 indminglob,indmaxglob,                          &
                 pttruetab,cetruetab,                            &
@@ -456,12 +372,9 @@
     endif
 !
-
     if (memberin) then
 !
         if (.not.associated(tempC)) allocate(tempC)
 !
-
         call Agrif_array_allocate(tempC,pttruetab,cetruetab,nbdim)
-
 !
 !       Special values on the parent grid
@@ -471,13 +384,11 @@
 !
             if (.not.associated(parentvalues))  allocate(parentvalues)
-!t
-
+!
             call Agrif_array_allocate(parentvalues,indmin,indmax,nbdim)
             call Agrif_var_full_copy_array(parentvalues,tempPextend,nbdim)
 !
-            call Agrif_CheckMasknD(tempPextend,parentvalues,                &
-                    indmin(1:nbdim),indmax(1:nbdim),                        &
-                    indmin(1:nbdim),indmax(1:nbdim),                        &
-                    indmin_required_p(1:nbdim),indmax_required_p(1:nbdim),  &
+            call Agrif_CheckMasknD(tempPextend,parentvalues,    &
+                    indmin(1:nbdim),indmax(1:nbdim),            &
+                    indmin(1:nbdim),indmax(1:nbdim),            &
                     noraftab(1:nbdim),nbdim)
 !
@@ -507,28 +418,18 @@
                                                 ds_Child(1:2),    ds_Parent(1:2) )
             case(3)
-                s_Parent_temp_p = s_Parent + (indmin_required_p - pttab_Parent) * ds_Parent
-                call Agrif_Interp_3D_recursive( type_interp(1:3),                                 &
-                                                tempPextend % array3(                             &
-                                                indmin_required_p(1):indmax_required_p(1),        &
-                                                indmin_required_p(2):indmax_required_p(2),        &
-                                                indmin_required_p(3):indmax_required_p(3)),       &
-                                                tempC       % array3,                             &
-                                                indmin_required_p(1:3), indmax_required_p(1:3),   &
-                                                pttruetab(1:3),    cetruetab(1:3),                &
-                                                s_Child_temp(1:3), s_Parent_temp_p(1:3),          &
+                call Agrif_Interp_3D_recursive( type_interp(1:3),                       &
+                                                tempPextend % array3,                   &
+                                                tempC       % array3,                   &
+                                                indmin(1:3), indmax(1:3),               &
+                                                pttruetab(1:3),    cetruetab(1:3),      &
+                                                s_Child_temp(1:3), s_Parent_temp(1:3),  &
                                                 ds_Child(1:3),    ds_Parent(1:3) )
-
             case(4)
-                s_Parent_temp_p = s_Parent + (indmin_required_p - pttab_Parent) * ds_Parent
-                call Agrif_Interp_4D_recursive( type_interp(1:4),                                 &
-                                                tempPextend % array4(                             &
-                                                indmin_required_p(1):indmax_required_p(1),        &
-                                                indmin_required_p(2):indmax_required_p(2),        &
-                                                indmin_required_p(3):indmax_required_p(3),        &
-                                                indmin_required_p(4):indmax_required_p(4)),       &
-                                                tempC       % array4,                             &
-                                                indmin_required_p(1:4), indmax_required_p(1:4),   &
-                                                pttruetab(1:4),    cetruetab(1:4),                &
-                                                s_Child_temp(1:4), s_Parent_temp_p(1:4),          &
+                call Agrif_Interp_4D_recursive( type_interp(1:4),                       &
+                                                tempPextend % array4,                   &
+                                                tempC       % array4,                   &
+                                                indmin(1:4), indmax(1:4),               &
+                                                pttruetab(1:4),    cetruetab(1:4),      &
+                                                s_Child_temp(1:4), s_Parent_temp(1:4),  &
                                                 ds_Child(1:4),    ds_Parent(1:4) )
             case(5)
@@ -721,5 +622,4 @@
         else    ! .not.to_restore
 !
-
             if (memberin) then
     !
@@ -842,5 +742,4 @@
         endif
 
-
         call Agrif_array_deallocate(tempPextend,nbdim)
         call Agrif_array_deallocate(tempC,nbdim)
@@ -864,5 +763,4 @@
 !---------------------------------------------------------------------------------------------------
 subroutine Agrif_Parentbounds ( type_interp, nbdim, indmin, indmax, &
-                                indmin_required,indmax_required,    &
                                 s_Parent_temp, s_Child_temp,        &
                                 s_Child, ds_Child,                  &
@@ -874,8 +772,7 @@
     INTEGER,                   intent(in)  :: nbdim
     INTEGER, DIMENSION(nbdim), intent(out) :: indmin, indmax
-    INTEGER, DIMENSION(nbdim), intent(out) :: indmin_required, indmax_required
-    REAL(kind=8),    DIMENSION(nbdim), intent(out) :: s_Parent_temp, s_child_temp
-    REAL(kind=8),    DIMENSION(nbdim), intent(in)  :: s_Child, ds_child
-    REAL(kind=8),    DIMENSION(nbdim), intent(in)  :: s_Parent,ds_Parent
+    REAL,    DIMENSION(nbdim), intent(out) :: s_Parent_temp, s_child_temp
+    REAL,    DIMENSION(nbdim), intent(in)  :: s_Child, ds_child
+    REAL,    DIMENSION(nbdim), intent(in)  :: s_Parent,ds_Parent
     INTEGER, DIMENSION(nbdim), intent(in)  :: pttruetab, cetruetab
     INTEGER, DIMENSION(nbdim), intent(in)  :: pttab_Child, pttab_Parent
@@ -883,8 +780,6 @@
     INTEGER, DIMENSION(nbdim), intent(in)  :: coords
 !
-    REAL(kind=8) :: xpmin, xpmax
-    INTEGER :: coeffraf
     INTEGER :: i
-    REAL(kind=8),DIMENSION(nbdim) :: dim_newmin, dim_newmax
+    REAL,DIMENSION(nbdim) :: dim_newmin, dim_newmax
 !
     dim_newmin = s_Child + (pttruetab - pttab_Child) * ds_Child
@@ -895,18 +790,8 @@
         indmin(i) = pttab_Parent(i) + agrif_int((dim_newmin(i)-s_Parent(i))/ds_Parent(i))
         indmax(i) = pttab_Parent(i) + agrif_ceiling((dim_newmax(i)-s_Parent(i))/ds_Parent(i))
-
-        coeffraf = nint(ds_Parent(i)/ds_Child(i))
-        
-        indmin_required(i) = indmin(i)
-        indmax_required(i) = indmax(i)
 !
 !       Necessary for the Quadratic interpolation
 !
-
         if ( (pttruetab(i) == cetruetab(i)) .and. (posvar(i) == 1) ) then
-            if (Agrif_UseSpecialValue) then
-               indmin(i) = indmin(i)-MaxSearch
-               indmax(i) = indmax(i)+MaxSearch
-            endif
         elseif ( coords(i) == 0 ) then  ! (interptab == 'N')
         elseif ( (type_interp(i) == Agrif_ppm)     .or.     &
@@ -914,86 +799,11 @@
                  (type_interp(i) == Agrif_ppm_lim) .or.     &
                  (type_interp(i) == Agrif_weno) ) then
-                 
-            if ((mod(coeffraf,2) == 0).AND.(posvar(i)==2)) then
-            
-              xpmax = s_Parent(i)+(indmax(i)-pttab_Parent(i))*ds_Parent(i)
-              if (xpmax > dim_newmax(i)+ds_Child(i)) then
-                indmax(i) = indmax(i) + 1
-              else
-                indmax(i) = indmax(i) + 2
-              endif
-              
-              xpmin = s_Parent(i)+(indmin(i)-pttab_Parent(i))*ds_Parent(i)
-              if (xpmin < dim_newmin(i)-ds_Child(i)) then
-                indmin(i) = indmin(i) - 1
-              else
-                indmin(i) = indmin(i) - 2
-              endif
-              
-            else
-              indmin(i) = indmin(i) - 2
-              indmax(i) = indmax(i) + 2
-            endif
-
-            indmin_required(i) = indmin(i)
-            indmax_required(i) = indmax(i)
-        
-            if (Agrif_UseSpecialValue) then
-               indmin(i) = indmin(i)-MaxSearch
-               indmax(i) = indmax(i)+MaxSearch
-            endif
-        elseif (type_interp(i) == Agrif_linearconservlim) then
-        
-            if ((mod(coeffraf,2) == 0).AND.(posvar(i)==2)) then
-            
-              xpmax = s_Parent(i)+(indmax(i)-pttab_Parent(i))*ds_Parent(i)
-              if (xpmax > dim_newmax(i)+ds_Child(i)) then
-                indmax(i) = indmax(i)
-              else
-                indmax(i) = indmax(i) + 1
-              endif
-              
-              xpmin = s_Parent(i)+(indmin(i)-pttab_Parent(i))*ds_Parent(i)
-              if (xpmin < dim_newmin(i)-ds_Child(i)) then
-                indmin(i) = indmin(i)
-              else
-                indmin(i) = indmin(i) - 1
-              endif
-              
-            else
-              indmin(i) = indmin(i) - 1
-              indmax(i) = indmax(i) + 1
-            endif
-
-            indmin_required(i) = indmin(i)
-            indmax_required(i) = indmax(i)
-        
-            if (Agrif_UseSpecialValue) then
-               indmin(i) = indmin(i)-MaxSearch
-               indmax(i) = indmax(i)+MaxSearch
-            endif
-            
+            indmin(i) = indmin(i) - 2
+            indmax(i) = indmax(i) + 2
         elseif ( (type_interp(i) /= Agrif_constant) .and.   &
                  (type_interp(i) /= Agrif_linear) ) then
             indmin(i) = indmin(i) - 1
             indmax(i) = indmax(i) + 1
-            
-            indmin_required(i) = indmin(i)
-            indmax_required(i) = indmax(i)
-
-            if (Agrif_UseSpecialValue) then
-               indmin(i) = indmin(i)-MaxSearch
-               indmax(i) = indmax(i)+MaxSearch
-            endif
-        elseif ( (type_interp(i) == Agrif_constant) .or.   &
-                 (type_interp(i) == Agrif_linear) ) then
-            indmin_required(i) = indmin(i)
-            indmax_required(i) = indmax(i)
-            if (Agrif_UseSpecialValue) then
-               indmin(i) = indmin(i)-MaxSearch
-               indmax(i) = indmax(i)+MaxSearch
-            endif
         endif
-
 !
     enddo
@@ -1020,6 +830,6 @@
     integer,            intent(in)  :: indmin, indmax
     integer,            intent(in)  :: pttab_child, petab_child
-    real(kind=8),               intent(in)  :: s_child, s_parent
-    real(kind=8),               intent(in)  :: ds_child, ds_parent
+    real,               intent(in)  :: s_child, s_parent
+    real,               intent(in)  :: ds_child, ds_parent
     real, dimension(            &
         indmin:indmax           &
@@ -1055,6 +865,6 @@
     integer, dimension(2),              intent(in)  :: indmin, indmax
     integer, dimension(2),              intent(in)  :: pttab_child, petab_child
-    real(kind=8),    dimension(2),              intent(in)  :: s_child, s_parent
-    real(kind=8),    dimension(2),              intent(in)  :: ds_child, ds_parent
+    real,    dimension(2),              intent(in)  :: s_child, s_parent
+    real,    dimension(2),              intent(in)  :: ds_child, ds_parent
     real,    dimension(                 &
         indmin(1):indmax(1),            &
@@ -1073,5 +883,5 @@
         indmin(2):indmax(2),            &
         pttab_child(1):petab_child(1))  :: tabtemp_trsp
-    integer                             :: i, j, coeffraf, locind_child_left, ideb
+    integer                             :: i, j, coeffraf
 !---------------------------------------------------------------------------------------------------
 !
@@ -1098,16 +908,5 @@
                     s_parent(1),s_child(1),ds_parent(1),ds_child(1),1)
 !---CDIR NEXPAND
-        call PPM1dAfterCompute(tabin,tabtemp,size(tabin),size(tabtemp),1,indchildppm(:,1),tabppm(:,:,1))
-    else if (coeffraf == 1) then
-        locind_child_left = indmin(1) + agrif_int((s_child(1)-s_parent(1))/ds_parent(1))
-        
-            do j = indmin(2), indmax(2)
-            ideb = locind_child_left
-            do i = pttab_child(1), petab_child(1)
-                tabtemp(i,j) = tabin(ideb,j)
-                ideb = ideb + 1
-            enddo
-            enddo
-
+        call PPM1dAfterCompute(tabin,tabtemp,size(tabin),size(tabtemp),1)
     else
         do j = indmin(2),indmax(2)
@@ -1150,6 +949,5 @@
 !---CDIR NEXPAND
         call PPM1dAfterCompute(tabtemp_trsp, tabout_trsp,    &
-                               size(tabtemp_trsp), size(tabout_trsp), 2, &
-                              indchildppm(:,2),tabppm(:,:,2))
+                               size(tabtemp_trsp), size(tabout_trsp), 2)
     else
         do i = pttab_child(1), petab_child(1)
@@ -1186,6 +984,6 @@
     integer, dimension(3),              intent(in)  :: indmin, indmax
     integer, dimension(3),              intent(in)  :: pttab_child, petab_child
-    real(kind=8),    dimension(3),              intent(in)  :: s_child, s_parent
-    real(kind=8),    dimension(3),              intent(in)  :: ds_child, ds_parent
+    real,    dimension(3),              intent(in)  :: s_child, s_parent
+    real,    dimension(3),              intent(in)  :: ds_child, ds_parent
     real,    dimension(                 &
         indmin(1):indmax(1),            &
@@ -1201,11 +999,6 @@
         pttab_child(2):petab_child(2),  &
         indmin(3):indmax(3))            :: tabtemp
-    integer                             :: i, j, k, coeffraf,kp,kp1,kp2,kp3,kp4,kref
+    integer                             :: i, j, k, coeffraf
     integer                             :: locind_child_left, kdeb
-    real(kind=8)    :: ypos,globind_parent_left
-    real(kind=8)    :: deltax, invdsparent
-    real    :: t2,t3,t4,t5,t6,t7,t8
-    integer :: locind_parent_left
-
 !
     coeffraf = nint ( ds_parent(1) / ds_child(1) )
@@ -1266,65 +1059,5 @@
             enddo
         enddo
-    else if (type_interp(3) == Agrif_LAGRANGE) then
-      invdsparent = 1./ds_parent(3)
-      ypos = s_child(3)
-      do k=pttab_child(3), petab_child(3)
-        locind_parent_left = indmin(3)+agrif_int((ypos - s_parent(3))/ds_parent(3))
-        globind_parent_left = s_parent(3) + (locind_parent_left - indmin(3))*ds_parent(3)
-        deltax = invdsparent*(ypos-globind_parent_left)
-        deltax = nint(coeffraf*deltax)/real(coeffraf)
-        ypos = ypos + ds_child(3)
-
-        if (abs(deltax) <= 0.0001) then
-          do j = pttab_child(2), petab_child(2)
-          do i = pttab_child(1), petab_child(1)
-             tabout(i,j,k) = tabtemp(i,j,locind_parent_left)
-          enddo
-          enddo
-        else
-         t2 = deltax - 2.
-        t3 = deltax - 1.
-        t4 = deltax + 1.
-
-        t5 = -(1./6.)*deltax*t2*t3
-        t6 = 0.5*t2*t3*t4
-        t7 = -0.5*deltax*t2*t4
-        t8 = (1./6.)*deltax*t3*t4      
-          do j = pttab_child(2), petab_child(2)
-          do i = pttab_child(1), petab_child(1)
-             tabout(i,j,k) = t5*tabtemp(i,j,locind_parent_left-1) + t6*tabtemp(i,j,locind_parent_left)    &
-              +t7*tabtemp(i,j,locind_parent_left+1) + t8*tabtemp(i,j,locind_parent_left+2)
-          enddo
-          enddo
-
-        endif
-
-      enddo
-    else if (type_interp(3) == Agrif_PPM) then
-     call PPM1dPrecompute2d(1, &
-                               indmax(3)-indmin(3)+1,           &
-                               petab_child(3)-pttab_child(3)+1, &
-                               s_parent(3),s_child(3),ds_parent(3),ds_child(3),1)
-
-     do k=pttab_child(3),petab_child(3)
-        kref = k-pttab_child(3)+1
-        kp=indmin(3)+indparentppm(kref,1)-1
-        kp1 = kp + 1
-        kp2 = kp1 + 1
-        kp3 = kp2 + 1
-        kp4 = kp3 + 1
-        do j = pttab_child(2), petab_child(2)
-        do i = pttab_child(1), petab_child(1)
-         tabout(i,j,k) = tabppm(1,indchildppm(kref,1),1)*tabtemp(i,j,kp)   + &
-                         tabppm(2,indchildppm(kref,1),1)*tabtemp(i,j,kp1)  + &
-                         tabppm(3,indchildppm(kref,1),1)*tabtemp(i,j,kp2)  + &
-                         tabppm(4,indchildppm(kref,1),1)*tabtemp(i,j,kp3)  + &
-                         tabppm(5,indchildppm(kref,1),1)*tabtemp(i,j,kp4)
-        enddo
-        enddo
-     enddo
-
     else
-
         do j = pttab_child(2), petab_child(2)
         do i = pttab_child(1), petab_child(1)
@@ -1338,5 +1071,4 @@
         enddo
         enddo
-
     endif
 !---------------------------------------------------------------------------------------------------
@@ -1359,6 +1091,6 @@
     integer, dimension(4),              intent(in)  :: indmin, indmax
     integer, dimension(4),              intent(in)  :: pttab_child, petab_child
-    real(kind=8),    dimension(4),              intent(in)  :: s_child, s_parent
-    real(kind=8),    dimension(4),              intent(in)  :: ds_child, ds_parent
+    real,    dimension(4),              intent(in)  :: s_child, s_parent
+    real,    dimension(4),              intent(in)  :: ds_child, ds_parent
     real,    dimension(                 &
         indmin(1):indmax(1),            &
@@ -1378,9 +1110,4 @@
         indmin(4):indmax(4))            :: tabtemp
     integer                             :: i, j, k, l
-
-    real(kind=8)    :: ypos,globind_parent_left
-    real(kind=8)    :: deltax, invdsparent
-    real    :: t2,t3,t4,t5,t6,t7,t8
-    integer :: locind_parent_left, coeffraf
 !
     do l = indmin(4), indmax(4)
@@ -1398,44 +1125,4 @@
     enddo
 !
-     if (type_interp(4) == Agrif_LAGRANGE) then
-      coeffraf = nint(ds_parent(4)/ds_child(4))
-      invdsparent = 1./ds_parent(4)
-      ypos = s_child(4)
-      do l=pttab_child(4), petab_child(4)
-        locind_parent_left = indmin(4)+agrif_int((ypos - s_parent(4))/ds_parent(4))
-        globind_parent_left = s_parent(4) + (locind_parent_left - indmin(4))*ds_parent(4)
-        deltax = invdsparent*(ypos-globind_parent_left)
-        deltax = nint(coeffraf*deltax)/real(coeffraf)
-        ypos = ypos + ds_child(4)
-
-        if (abs(deltax) <= 0.0001) then
-          do k = pttab_child(3), petab_child(3)
-          do j = pttab_child(2), petab_child(2)
-          do i = pttab_child(1), petab_child(1)
-             tabout(i,j,k,l) = tabtemp(i,j,k,locind_parent_left)
-          enddo
-          enddo
-          enddo
-        else
-         t2 = deltax - 2.
-        t3 = deltax - 1.
-        t4 = deltax + 1.
-
-        t5 = -(1./6.)*deltax*t2*t3
-        t6 = 0.5*t2*t3*t4
-        t7 = -0.5*deltax*t2*t4
-        t8 = (1./6.)*deltax*t3*t4      
-          do k = pttab_child(3), petab_child(3)
-          do j = pttab_child(2), petab_child(2)
-          do i = pttab_child(1), petab_child(1)
-             tabout(i,j,k,l) = t5*tabtemp(i,j,k,locind_parent_left-1) + t6*tabtemp(i,j,k,locind_parent_left)    &
-              +t7*tabtemp(i,j,k,locind_parent_left+1) + t8*tabtemp(i,j,k,locind_parent_left+2)
-          enddo
-          enddo
-          enddo
-        endif
-
-      enddo
-    else
     do k = pttab_child(3), petab_child(3)
     do j = pttab_child(2), petab_child(2)
@@ -1451,5 +1138,4 @@
     enddo
     enddo
-    endif
 !---------------------------------------------------------------------------------------------------
 end subroutine Agrif_Interp_4D_recursive
@@ -1471,6 +1157,6 @@
     integer, dimension(5),              intent(in)  :: indmin, indmax
     integer, dimension(5),              intent(in)  :: pttab_child, petab_child
-    real(kind=8),    dimension(5),              intent(in)  :: s_child, s_parent
-    real(kind=8),    dimension(5),              intent(in)  :: ds_child, ds_parent
+    real,    dimension(5),              intent(in)  :: s_child, s_parent
+    real,    dimension(5),              intent(in)  :: ds_child, ds_parent
     real,    dimension(                 &
         indmin(1):indmax(1),            &
@@ -1544,6 +1230,6 @@
     integer, dimension(6),                  intent(in)  :: indmin, indmax
     integer, dimension(6),                  intent(in)  :: pttab_child, petab_child
-    real(kind=8),    dimension(6),                  intent(in)  :: s_child, s_parent
-    real(kind=8),    dimension(6),                  intent(in)  :: ds_child, ds_parent
+    real,    dimension(6),                  intent(in)  :: s_child, s_parent
+    real,    dimension(6),                  intent(in)  :: ds_child, ds_parent
     real,    dimension(                 &
         indmin(1):indmax(1),            &
@@ -1623,6 +1309,6 @@
     REAL, DIMENSION(indmin:indmax),           INTENT(IN)    :: parenttab
     REAL, DIMENSION(pttab_child:petab_child), INTENT(OUT)   :: childtab
-    REAL(kind=8)                                            :: s_parent, s_child
-    REAL(kind=8)                                            :: ds_parent,ds_child
+    REAL                                                    :: s_parent, s_child
+    REAL                                                    :: ds_parent,ds_child
 !
     if ( (indmin == indmax) .and. (pttab_child == petab_child) ) then
@@ -1693,6 +1379,5 @@
 !---------------------------------------------------------------------------------------------------
 function Agrif_Find_list_interp ( list_interp, pttab, petab, pttab_Child, pttab_Parent,     &
-                                    nbdim, indmin, indmax, indmin_required_p, indmax_required_p, &
-                                    indminglob,  indmaxglob,         &
+                                    nbdim, indmin, indmax, indminglob,  indmaxglob,         &
                                     pttruetab, cetruetab, memberin                          &
 #if defined AGRIF_MPI
@@ -1705,5 +1390,5 @@
     integer,                       intent(in)  :: nbdim
     integer, dimension(nbdim),     intent(in)  :: pttab, petab, pttab_Child, pttab_Parent
-    integer, dimension(nbdim),     intent(out) :: indmin, indmax, indmin_required_p, indmax_required_p
+    integer, dimension(nbdim),     intent(out) :: indmin, indmax
     integer, dimension(nbdim),     intent(out) :: indminglob, indmaxglob
     integer, dimension(nbdim),     intent(out) :: pttruetab, cetruetab
@@ -1744,6 +1429,4 @@
         indmin = pil % indmin(1:nbdim)
         indmax = pil % indmax(1:nbdim)
-        indmin_required_p = pil % indmin_required_p(1:nbdim)
-        indmax_required_p = pil % indmax_required_p(1:nbdim)
 
         pttruetab = pil % pttruetab(1:nbdim)
@@ -1777,6 +1460,5 @@
 !---------------------------------------------------------------------------------------------------
 subroutine Agrif_AddTo_list_interp ( list_interp, pttab, petab, pttab_Child, pttab_Parent,  &
-                                     indmin, indmax, indmin_required_p, indmax_required_p,  &
-                                     indminglob, indmaxglob,                &
+                                     indmin, indmax, indminglob, indmaxglob,                &
                                      pttruetab, cetruetab,                                  &
                                      memberin, nbdim                                        &
@@ -1792,5 +1474,5 @@
     integer                                 :: nbdim
     integer, dimension(nbdim)               :: pttab, petab, pttab_Child, pttab_Parent
-    integer, dimension(nbdim)               :: indmin,indmax, indmin_required_p, indmax_required_p
+    integer, dimension(nbdim)               :: indmin,indmax
     integer, dimension(nbdim)               :: indminglob, indmaxglob
     integer, dimension(nbdim)               :: pttruetab, cetruetab
@@ -1821,7 +1503,4 @@
     pil % indmin(1:nbdim) = indmin(1:nbdim)
     pil % indmax(1:nbdim) = indmax(1:nbdim)
-
-    pil % indmin_required_p(1:nbdim) = indmin_required_p(1:nbdim)
-    pil % indmax_required_p(1:nbdim) = indmax_required_p(1:nbdim)
 
     pil % memberin = memberin
