From b213b5c09f238b0428e6ea5cdceb34e97b303784 Mon Sep 17 00:00:00 2001 From: diener Date: Tue, 3 Jun 2003 11:39:35 +0000 Subject: Added support for the new interpolator parameters. git-svn-id: http://svn.einsteintoolkit.org/cactus/EinsteinAnalysis/EHFinder/trunk@112 2a26948c-0e4f-0410-aee8-f1d3e353619c --- src/EHFinder_FindSurface.F90 | 29 +++++++++++++++++++++-------- src/EHFinder_Integrate2.F90 | 14 ++++++++++++-- 2 files changed, 33 insertions(+), 10 deletions(-) diff --git a/src/EHFinder_FindSurface.F90 b/src/EHFinder_FindSurface.F90 index bbd9521..221d969 100644 --- a/src/EHFinder_FindSurface.F90 +++ b/src/EHFinder_FindSurface.F90 @@ -21,6 +21,10 @@ subroutine EHFinder_FindSurface(CCTK_ARGUMENTS) CCTK_INT :: interp_handle2 character(len=30) :: info_message + character(len=200) :: surface_interp + CCTK_INT :: surface_interp_len + character(len=7) :: surface_order + CCTK_INT, dimension(4) :: bbox CCTK_INT, dimension(2) :: gsh, lsh, lbnd, ubnd, nghost, maxl @@ -398,18 +402,27 @@ subroutine EHFinder_FindSurface(CCTK_ARGUMENTS) rsurf = zero n_since_last_reduction = -1 - ! Get and interpolation handle for Hermite polynomial interpolation. This - ! is used to avoid problems with non-continuous derivatives in the Newton - ! iteration later on. -! call CCTK_InterpHandle ( interp_handle, "Lagrange polynomial interpolation" ) - call CCTK_InterpHandle ( interp_handle, "Hermite polynomial interpolation" ) + ! Get and interpolation handle for required polynomial interpolation. + ! If Lagrange polynomial interpolation does not work try Hermite + ! polynomial interpolation, which avoids problems with non-continuous + ! derivatives in the Newton iteration later on. + + ! First convert the string parameter to a Fortran string. + call CCTK_FortranString ( surface_interp_len, surface_interpolator, & + surface_interp ) + + ! Then get the hande ... + call CCTK_InterpHandle ( interp_handle, surface_interp(1:surface_interp_len) ) + if ( interp_handle .lt. 0 ) then call CCTK_WARN( 0, "Cannot get handle for interpolation. Forgot to activate an implementation providing interpolation operators??" ) end if - ! For now order=2 is hard wired. -! call Util_TableCreateFromString ( table_handle, "order=3" ) - call Util_TableCreateFromString ( table_handle, "order=2" ) + ! Write the required interpolation order parameter into a fortran string. + write(surface_order,'(a6,i1)') 'order=',surface_interpolation_order + + ! Then create a table from the string. + call Util_TableCreateFromString ( table_handle, surface_order ) if ( table_handle .lt. 0 ) then call CCTK_WARN( 0, "Cannot create parameter table for interpolator" ) end if diff --git a/src/EHFinder_Integrate2.F90 b/src/EHFinder_Integrate2.F90 index 48bd609..6433533 100644 --- a/src/EHFinder_Integrate2.F90 +++ b/src/EHFinder_Integrate2.F90 @@ -18,6 +18,10 @@ subroutine EHFinder_FindSurfaceElement(CCTK_ARGUMENTS) CCTK_INT :: i, j, k, im, jm CCTK_INT :: interp_handle, table_handle, coord_system_handle + character(len=200) :: area_interp + CCTK_INT :: area_interp_len + character(len=7) :: area_order + CCTK_INT, dimension(4) :: bbox CCTK_INT, dimension(2) :: gsh, lsh, lbnd, ubnd, nghost @@ -76,12 +80,18 @@ subroutine EHFinder_FindSurfaceElement(CCTK_ARGUMENTS) dthetainv = one / dtheta dphiinv = one / dphi - call CCTK_InterpHandle ( interp_handle, "Lagrange polynomial interpolation" ) + call CCTK_FortranString ( area_interp_len, area_interpolator, & + area_interp ) + + call CCTK_InterpHandle ( interp_handle, area_interp(1:area_interp_len) ) + if ( interp_handle .lt. 0 ) then call CCTK_WARN( 0, "Cannot get handle for interpolation. Forgot to activate an implementation providing interpolation operators??" ) end if - call Util_TableCreateFromString ( table_handle, "order=3" ) + write(area_order,'(a6,i1)') 'order=',area_interpolation_order + + call Util_TableCreateFromString ( table_handle, area_order ) if ( table_handle .lt. 0 ) then call CCTK_WARN( 0, "Cannot create parameter table for interpolator" ) end if -- cgit v1.2.3