From a85b282d7be7a32528242e440ce40c23437f940b Mon Sep 17 00:00:00 2001 From: odemirel <odemirel@7c7fe9aa-52eb-4d9e-b0a8-ba7d787348e9> Date: Mon, 8 Mar 2010 16:14:10 +0000 Subject: [PATCH] fixes regarding the new topology git-svn-id: https://ppm.inf.ethz.ch/svn/ppmnumerics/branches/ngtopo/libppmnumerics@546 7c7fe9aa-52eb-4d9e-b0a8-ba7d787348e9 --- src/ppm_comp_pp_ring.f | 3 +- src/ppm_gmm_cpt.f | 61 ++++++++++++++++++++++---------------- src/ppm_gmm_extend.f | 35 ++++++++++++++-------- src/ppm_gmm_extend_fwd.f | 25 +++++++++++----- src/ppm_gmm_finalize.f | 4 +++ src/ppm_gmm_init.f | 44 ++++++++++++++------------- src/ppm_gmm_reinitialize.f | 10 +++++-- 7 files changed, 111 insertions(+), 71 deletions(-) diff --git a/src/ppm_comp_pp_ring.f b/src/ppm_comp_pp_ring.f index be54ec2..af2e23c 100644 --- a/src/ppm_comp_pp_ring.f +++ b/src/ppm_comp_pp_ring.f @@ -68,8 +68,7 @@ USE ppm_module_substop USE ppm_module_error USE ppm_module_alloc - USE ppm_module_map - USE ppm_module_map_part_ring_shift + USE ppm_module_map, ONLY : ppm_module_map_part_ring_shift USE ppm_module_comp_pp_doring IMPLICIT NONE #if __KIND == __SINGLE_PRECISION | __KIND == __SINGLE_PRECISION_COMPLEX diff --git a/src/ppm_gmm_cpt.f b/src/ppm_gmm_cpt.f index 18c7f8f..3c776cf 100644 --- a/src/ppm_gmm_cpt.f +++ b/src/ppm_gmm_cpt.f @@ -37,6 +37,11 @@ USE ppm_module_data_mesh USE ppm_module_data_gmm USE ppm_module_gmm_kickoff + USE ppm_module_substart + USE ppm_module_substop + USE ppm_module_error + USE ppm_module_alloc + USE ppm_module_typedef IMPLICIT NONE #if __KIND == __SINGLE_PRECISION | __KIND == __SINGLE_PRECISION_COMPLEX INTEGER, PARAMETER :: MK = ppm_kind_single @@ -92,10 +97,14 @@ REAL(MK) :: t0,x,y,z,xx,yy,zz,dx,dy,dz REAL(MK) :: s,sprev,thresh LOGICAL :: lok + TYPE(ppm_t_topo), POINTER :: topo + TYPE(ppm_t_equi_mesh), POINTER :: mesh !------------------------------------------------------------------------- ! Initialise !------------------------------------------------------------------------- CALL substart('ppm_gmm_cpt',t0,info) + topo => ppm_topo(gmm_topoid)%t + mesh => topo%mesh(gmm_meshid) #if __KIND == __SINGLE_PRECISION clotmp => gmm_clos #elif __KIND == __DOUBLE_PRECISION @@ -118,7 +127,7 @@ GOTO 9999 ENDIF #if __DIM == __3D - IF (SIZE(fdata,4) .LT. ppm_nsublist(gmm_topoid)) THEN + IF (SIZE(fdata,4) .LT. topo%nsublist) THEN info = ppm_error_error CALL ppm_error(ppm_err_argument,'ppm_gmm_cpt', & & 'field data for some subs is missing',__LINE__,info) @@ -143,7 +152,7 @@ GOTO 9999 ENDIF #elif __DIM == __2D - IF (SIZE(fdata,3) .LT. ppm_nsublist(gmm_topoid)) THEN + IF (SIZE(fdata,3) .LT. topo%nsublist) THEN info = ppm_error_error CALL ppm_error(ppm_err_argument,'ppm_gmm_cpt', & & 'field data for some subs is missing',__LINE__,info) @@ -167,23 +176,23 @@ ! Find mesh spacing !------------------------------------------------------------------------- IF (ppm_kind .EQ. ppm_kind_single) THEN - dx = (ppm_max_physs(1,gmm_topoid)-ppm_min_physs(1,gmm_topoid))/ & - & REAL(ppm_cart_mesh(gmm_meshid,gmm_topoid)%Nm(1)-1,ppm_kind_single) - dy = (ppm_max_physs(2,gmm_topoid)-ppm_min_physs(2,gmm_topoid))/ & - & REAL(ppm_cart_mesh(gmm_meshid,gmm_topoid)%Nm(2)-1,ppm_kind_single) + dx = (topo%max_physs(1)-topo%min_physs(1))/ & + & REAL(mesh%Nm(1)-1,ppm_kind_single) + dy = (topo%max_physs(2)-topo%min_physs(2))/ & + & REAL(mesh%Nm(2)-1,ppm_kind_single) IF (ppm_dim .GT. 2) THEN - dz = (ppm_max_physs(3,gmm_topoid)-ppm_min_physs(3,gmm_topoid))/ & - & REAL(ppm_cart_mesh(gmm_meshid,gmm_topoid)%Nm(3)-1, & + dz = (topo%max_physs(3)-topo%min_physs(3))/ & + & REAL(mesh%Nm(3)-1, & & ppm_kind_single) ENDIF ELSE - dx = (ppm_max_physd(1,gmm_topoid)-ppm_min_physd(1,gmm_topoid))/ & - & REAL(ppm_cart_mesh(gmm_meshid,gmm_topoid)%Nm(1)-1,ppm_kind_double) - dy = (ppm_max_physd(2,gmm_topoid)-ppm_min_physd(2,gmm_topoid))/ & - & REAL(ppm_cart_mesh(gmm_meshid,gmm_topoid)%Nm(2)-1,ppm_kind_double) + dx = (topo%max_physs(1)-topo%min_physs(1))/ & + & REAL(mesh%Nm(1)-1,ppm_kind_double) + dy = (topo%max_physs(2)-topo%min_physs(2))/ & + & REAL(mesh%Nm(2)-1,ppm_kind_double) IF (ppm_dim .GT. 2) THEN - dz = (ppm_max_physd(3,gmm_topoid)-ppm_min_physd(3,gmm_topoid))/ & - & REAL(ppm_cart_mesh(gmm_meshid,gmm_topoid)%Nm(3)-1, & + dz = (topo%max_physs(3)-topo%min_physs(3))/ & + & REAL(mesh%Nm(3)-1, & & ppm_kind_double) ENDIF ENDIF @@ -285,20 +294,20 @@ sprev = HUGE(sprev) ENDIF isub = ipts(4,npts) - jsub = ppm_isublist(isub,gmm_topoid) + jsub = topo%isublist(isub) IF (PRESENT(chi)) THEN x = chi(1,ipts(1,npts),ipts(2,npts),ipts(3,npts),isub) y = chi(2,ipts(1,npts),ipts(2,npts),ipts(3,npts),isub) z = chi(3,ipts(1,npts),ipts(2,npts),ipts(3,npts),isub) ELSE IF (ppm_kind .EQ. ppm_kind_single) THEN - x = ppm_min_subs(1,jsub,gmm_topoid) + (ipts(1,npts)-1)*dx - y = ppm_min_subs(2,jsub,gmm_topoid) + (ipts(2,npts)-1)*dy - z = ppm_min_subs(3,jsub,gmm_topoid) + (ipts(3,npts)-1)*dz + x = topo%min_subs(1,jsub) + (ipts(1,npts)-1)*dx + y = topo%min_subs(2,jsub)+ (ipts(2,npts)-1)*dy + z = topo%min_subs(3,jsub)+ (ipts(3,npts)-1)*dz ELSE - x = ppm_min_subd(1,jsub,gmm_topoid) + (ipts(1,npts)-1)*dx - y = ppm_min_subd(2,jsub,gmm_topoid) + (ipts(2,npts)-1)*dy - z = ppm_min_subd(3,jsub,gmm_topoid) + (ipts(3,npts)-1)*dz + x = topo%min_subd(1,jsub) + (ipts(1,npts)-1)*dx + y = topo%min_subd(2,jsub) + (ipts(2,npts)-1)*dy + z = topo%min_subd(3,jsub) + (ipts(3,npts)-1)*dz ENDIF ENDIF xx = clotmp(1,idx(i)) @@ -323,17 +332,17 @@ sprev = HUGE(sprev) ENDIF isub = ipts(3,npts) - jsub = ppm_isublist(isub,gmm_topoid) + jsub = topo%isublist(isub) IF (PRESENT(chi)) THEN x = chi(1,ipts(1,npts),ipts(2,npts),isub) y = chi(2,ipts(1,npts),ipts(2,npts),isub) ELSE IF (ppm_kind .EQ. ppm_kind_single) THEN - x = ppm_min_subs(1,jsub,gmm_topoid) + (ipts(1,npts)-1)*dx - y = ppm_min_subs(2,jsub,gmm_topoid) + (ipts(2,npts)-1)*dy + x = topo%min_subs(1,jsub) + (ipts(1,npts)-1)*dx + y = topo%min_subs(2,jsub)+ (ipts(2,npts)-1)*dy ELSE - x = ppm_min_subd(1,jsub,gmm_topoid) + (ipts(1,npts)-1)*dx - y = ppm_min_subd(2,jsub,gmm_topoid) + (ipts(2,npts)-1)*dy + x = topo%min_subd(1,jsub) + (ipts(1,npts)-1)*dx + y = topo%min_subd(2,jsub) + (ipts(2,npts)-1)*dy ENDIF ENDIF xx = clotmp(1,idx(i)) diff --git a/src/ppm_gmm_extend.f b/src/ppm_gmm_extend.f index 900a896..be93c7e 100644 --- a/src/ppm_gmm_extend.f +++ b/src/ppm_gmm_extend.f @@ -84,7 +84,7 @@ #endif !!! This routine extends a function defined on the interface to the whole !!! band on which the level function is defined. The extension is done - !!! such that the graident of the function is perpendicular to the + !!! such that the gradient of the function is perpendicular to the !!! gradient of the level function. ppm_gmm_init must be called BEFORE !!! this routine is invoked. !------------------------------------------------------------------------- @@ -101,6 +101,11 @@ USE ppm_module_gmm_cpt USE ppm_module_gmm_march USE ppm_module_gmm_finalize + USE ppm_module_substart + USE ppm_module_substop + USE ppm_module_error + USE ppm_module_alloc + USE ppm_module_typedef IMPLICIT NONE #if __KIND == __SINGLE_PRECISION | __KIND == __SINGLE_PRECISION_COMPLEX INTEGER, PARAMETER :: MK = ppm_kind_single @@ -242,6 +247,8 @@ REAL(MK) :: t0,x,y,z,big LOGICAL :: lok REAL(MK), DIMENSION(:,:), POINTER :: closest + TYPE(ppm_t_topo), POINTER :: topo + TYPE(ppm_t_equi_mesh), POINTER :: mesh #if __TYPE == __VFIELD #if __DIM == __2D REAL(MK), DIMENSION(:,:,: ), POINTER :: ext_wrk @@ -254,6 +261,8 @@ !------------------------------------------------------------------------- CALL substart('ppm_gmm_extend',t0,info) big = HUGE(big) + topo => ppm_topo(gmm_topoid)%t + mesh => topo%mesh(gmm_meshid) !------------------------------------------------------------------------- ! Set pointers !------------------------------------------------------------------------- @@ -335,7 +344,7 @@ ! ldu(1) = maxxhi + ghostsize(1) ! ldu(2) = maxyhi + ghostsize(2) ! ldu(3) = maxzhi + ghostsize(3) -! ldu(4) = ppm_nsublist(gmm_topoid) +! ldu(4) = topo%nsublist ! CALL ppm_alloc(udata,ldl,ldu,iopt,info) ! IF (info .NE. ppm_param_success) THEN ! info = ppm_error_fatal @@ -416,7 +425,7 @@ ! ldu(1) = maxxhi + ghostsize(1) ! ldu(2) = maxyhi + ghostsize(2) ! ldu(3) = maxzhi + ghostsize(3) -! ldu(4) = ppm_nsublist(gmm_topoid) +! ldu(4) = topo%nsublist ! CALL ppm_alloc(udata,ldu,iopt,info) ! IF (info .NE. ppm_param_success) THEN ! info = ppm_error_fatal @@ -428,11 +437,11 @@ ! Nuke points farther from the interface than ivalue !------------------------------------------------------------------------- #if __DIM == __3D - DO isub=1,ppm_nsublist(gmm_topoid) - jsub = ppm_isublist(isub,gmm_topoid) - DO k=1,ppm_cart_mesh(gmm_meshid,gmm_topoid)%nnodes(3,jsub) - DO j=1,ppm_cart_mesh(gmm_meshid,gmm_topoid)%nnodes(2,jsub) - DO i=1,ppm_cart_mesh(gmm_meshid,gmm_topoid)%nnodes(1,jsub) + DO isub=1,topo%nsublist + jsub = topo%isublist(isub) + DO k=1,mesh%nnodes(3,jsub) + DO j=1,mesh%nnodes(2,jsub) + DO i=1,mesh%nnodes(1,jsub) IF (ABS(fdata(i,j,k,isub)) .GT. ivalue) THEN #if __TYPE == __VFIELD DO ida=1,lda @@ -447,10 +456,10 @@ ENDDO ENDDO #elif __DIM == __2D - DO isub=1,ppm_nsublist(gmm_topoid) - jsub = ppm_isublist(isub,gmm_topoid) - DO j=1,ppm_cart_mesh(gmm_meshid,gmm_topoid)%nnodes(2,jsub) - DO i=1,ppm_cart_mesh(gmm_meshid,gmm_topoid)%nnodes(1,jsub) + DO isub=1,topo%nsublist + jsub = topo%isublist(isub) + DO j=1,mesh%nnodes(2,jsub) + DO i=1,mesh%nnodes(1,jsub) IF (ABS(fdata(i,j,isub)) .GT. ivalue) THEN #if __TYPE == __VFIELD DO ida=1,lda @@ -492,7 +501,7 @@ #if __DIM == __3D ldu(3) = UBOUND(udata,4) #endif - ldu(4) = ppm_nsublist(gmm_topoid) + ldu(4) = topo%nsublist CALL ppm_alloc(ext_wrk,ldl,ldu,iopt,info) IF (info .NE. ppm_param_success) THEN info = ppm_error_fatal diff --git a/src/ppm_gmm_extend_fwd.f b/src/ppm_gmm_extend_fwd.f index 6c1dba5..fc0c3fa 100644 --- a/src/ppm_gmm_extend_fwd.f +++ b/src/ppm_gmm_extend_fwd.f @@ -22,7 +22,7 @@ & rhscst,dxinv,dyinv,dzinv,ghostsize,info,speed,chi) #endif #endif - !!! This routine performs the forward extension step of the GMM. See + !!! This routine performs the forward marching step of the GMM. See !!! ppm_gmm_march for details. !!! !!! === References === @@ -34,6 +34,11 @@ USE ppm_module_data USE ppm_module_data_mesh USE ppm_module_data_gmm + USE ppm_module_substart + USE ppm_module_substop + USE ppm_module_error + USE ppm_module_alloc + USE ppm_module_typedef IMPLICIT NONE #if __KIND == __SINGLE_PRECISION INTEGER, PARAMETER :: MK = ppm_kind_single @@ -119,6 +124,8 @@ REAL(MK), DIMENSION(-3:3,ppm_dim):: phi,psi REAL(MK), DIMENSION(ppm_dim) :: alpha,beta REAL(MK), DIMENSION(2) :: roots + TYPE(ppm_t_topo), POINTER :: topo + TYPE(ppm_t_equi_mesh), POINTER :: mesh !------------------------------------------------------------------------- ! Externals !------------------------------------------------------------------------- @@ -127,6 +134,8 @@ ! Initialise !------------------------------------------------------------------------- CALL substart('ppm_gmm_extend_fwd',t0,info) + topo => ppm_topo(gmm_topoid)%t + mesh => topo%mesh(gmm_meshid) phi = 0.0_MK psi = 0.0_MK big = HUGE(big) @@ -176,10 +185,10 @@ jj = gmm_ipos(2,p) kk = gmm_ipos(3,p) jsub = gmm_ipos(4,p) - isub = ppm_isublist(jsub,gmm_topoid) - xhi = ppm_cart_mesh(gmm_meshid,gmm_topoid)%nnodes(1,isub) - yhi = ppm_cart_mesh(gmm_meshid,gmm_topoid)%nnodes(2,isub) - zhi = ppm_cart_mesh(gmm_meshid,gmm_topoid)%nnodes(3,isub) + isub = topo%isublist(jsub) + xhi = mesh%nnodes(1,isub) + yhi = mesh%nnodes(2,isub) + zhi = mesh%nnodes(3,isub) fdta0= fdta(ii,jj,kk,jsub) absfdta0 = fdta0 IF (absfdta0 .LT. 0.0_MK) absfdta0 = -absfdta0 @@ -429,9 +438,9 @@ ii = gmm_ipos(1,p) jj = gmm_ipos(2,p) jsub = gmm_ipos(3,p) - isub = ppm_isublist(jsub,gmm_topoid) - xhi = ppm_cart_mesh(gmm_meshid,gmm_topoid)%nnodes(1,isub) - yhi = ppm_cart_mesh(gmm_meshid,gmm_topoid)%nnodes(2,isub) + isub = topo%isublist(jsub) + xhi = mesh%nnodes(1,isub) + yhi = mesh%nnodes(2,isub) fdta0= fdta(ii,jj,jsub) !--------------------------------------------------------------------- ! GMM update condition (see Kim:2001a) diff --git a/src/ppm_gmm_finalize.f b/src/ppm_gmm_finalize.f index b5c0ff9..ad277d2 100644 --- a/src/ppm_gmm_finalize.f +++ b/src/ppm_gmm_finalize.f @@ -18,6 +18,10 @@ !------------------------------------------------------------------------- USE ppm_module_data USE ppm_module_data_gmm + USE ppm_module_substart + USE ppm_module_substop + USE ppm_module_error + USE ppm_module_alloc IMPLICIT NONE !------------------------------------------------------------------------- ! Arguments diff --git a/src/ppm_gmm_init.f b/src/ppm_gmm_init.f index d0e169a..c5d2539 100644 --- a/src/ppm_gmm_init.f +++ b/src/ppm_gmm_init.f @@ -5,7 +5,7 @@ ! ETH Zurich ! CH-8092 Zurich, Switzerland !------------------------------------------------------------------------- - SUBROUTINE ppm_gmm_init(meshid,Nest,prec,info) + SUBROUTINE ppm_gmm_init(field_topoid,meshid,Nest,prec,info) !!! This routine initializes the ppm_gmm module and allocates all data !!! structures. !------------------------------------------------------------------------- @@ -18,6 +18,8 @@ USE ppm_module_data USE ppm_module_data_gmm USE ppm_module_data_mesh + USE ppm_module_error + USE ppm_module_typedef IMPLICIT NONE !------------------------------------------------------------------------- ! Arguments @@ -33,15 +35,19 @@ !!! *ppm_kind_double INTEGER, INTENT(IN ) :: meshid !!! Mesh ID (user numbering) for which a GMM should be initialized. + INTEGER, INTENT(IN ) :: field_topoid + !!! Topo ID of the field INTEGER, INTENT( OUT) :: info !!! Return status. 0 upon success !------------------------------------------------------------------------- ! Local variables !------------------------------------------------------------------------- - INTEGER, DIMENSION(3) :: ldu - INTEGER :: iopt,i,isub - LOGICAL :: lok - REAL(ppm_kind_double) :: t0 + INTEGER, DIMENSION(3) :: ldu + INTEGER :: iopt,i,isub + LOGICAL :: lok + REAL(ppm_kind_double) :: t0 + TYPE(ppm_t_topo), POINTER :: topo + TYPE(ppm_t_equi_mesh), POINTER :: mesh !------------------------------------------------------------------------- ! Externals !------------------------------------------------------------------------- @@ -50,6 +56,8 @@ ! Initialise !------------------------------------------------------------------------- CALL substart('ppm_gmm_init',t0,info) + topo => ppm_topo(field_topoid)%t + mesh => topo%mesh(gmm_meshid) !------------------------------------------------------------------------- ! Check arguments !------------------------------------------------------------------------- @@ -60,8 +68,7 @@ & 'Please call ppm_init first!',__LINE__,info) GOTO 9999 ENDIF - CALL ppm_check_meshid(ppm_param_id_user,meshid,ppm_field_topoid, & - & lok,info) + CALL ppm_check_meshid(field_topoid,meshid,lok,info) IF (.NOT. lok) THEN info = ppm_error_error CALL ppm_error(ppm_err_argument,'ppm_gmm_init', & @@ -116,28 +123,25 @@ GOTO 9999 ENDIF !------------------------------------------------------------------------- - ! Set topoid for all GMM operations - !------------------------------------------------------------------------- - gmm_topoid = ppm_field_topoid - !------------------------------------------------------------------------- ! Translate meshid to internal numbering and store it !------------------------------------------------------------------------- - gmm_meshid = ppm_meshid(gmm_topoid)%internal(meshid) + + gmm_meshid = mesh%ID !------------------------------------------------------------------------- ! Determine max extent of mesh in any sub !------------------------------------------------------------------------- maxxhi = 0 maxyhi = 0 maxzhi = 0 - DO i=1,ppm_nsublist(gmm_topoid) - isub = ppm_isublist(i,gmm_topoid) - IF (ppm_cart_mesh(gmm_meshid,gmm_topoid)%nnodes(1,isub).GT.maxxhi) & - & maxxhi = ppm_cart_mesh(gmm_meshid,gmm_topoid)%nnodes(1,isub) - IF (ppm_cart_mesh(gmm_meshid,gmm_topoid)%nnodes(2,isub).GT.maxyhi) & - & maxyhi = ppm_cart_mesh(gmm_meshid,gmm_topoid)%nnodes(2,isub) + DO i=1,topo%nsublist + isub = topo%isublist(i) + IF (mesh%nnodes(1,isub).GT.maxxhi) & + & maxxhi = mesh%nnodes(1,isub) + IF (mesh%nnodes(2,isub).GT.maxyhi) & + & maxyhi = mesh%nnodes(2,isub) IF (ppm_dim .GT. 2) THEN - IF (ppm_cart_mesh(gmm_meshid,gmm_topoid)%nnodes(3,isub).GT.maxzhi)& - & maxzhi = ppm_cart_mesh(gmm_meshid,gmm_topoid)%nnodes(3,isub) + IF (mesh%nnodes(3,isub).GT.maxzhi)& + & maxzhi = mesh%nnodes(3,isub) ENDIF ENDDO !------------------------------------------------------------------------- diff --git a/src/ppm_gmm_reinitialize.f b/src/ppm_gmm_reinitialize.f index 0da3ba9..0aa7983 100644 --- a/src/ppm_gmm_reinitialize.f +++ b/src/ppm_gmm_reinitialize.f @@ -44,6 +44,10 @@ USE ppm_module_gmm_kickoff USE ppm_module_gmm_march USE ppm_module_gmm_finalize + USE ppm_module_substart + USE ppm_module_substop + USE ppm_module_error + USE ppm_module_typedef IMPLICIT NONE #if __KIND == __SINGLE_PRECISION | __KIND == __SINGLE_PRECISION_COMPLEX INTEGER, PARAMETER :: MK = ppm_kind_single @@ -107,10 +111,12 @@ INTEGER :: xhi,i,isub,Nminit,MaxIt REAL(MK) :: t0,th LOGICAL :: lok + TYPE(ppm_t_topo), POINTER :: topo !------------------------------------------------------------------------- ! Initialise !------------------------------------------------------------------------- CALL substart('ppm_gmm_reinitialize',t0,info) + topo => ppm_topo(gmm_topoid)%t !------------------------------------------------------------------------- ! Check arguments !------------------------------------------------------------------------- @@ -134,7 +140,7 @@ GOTO 9999 ENDIF #if __DIM == __3D - IF (SIZE(fdata,4) .LT. ppm_nsublist(gmm_topoid)) THEN + IF (SIZE(fdata,4) .LT. topo%nsublist) THEN info = ppm_error_error CALL ppm_error(ppm_err_argument,'ppm_gmm_reinitialize', & & 'field data for some subs is missing',__LINE__,info) @@ -159,7 +165,7 @@ GOTO 9999 ENDIF #elif __DIM == __2D - IF (SIZE(fdata,3) .LT. ppm_nsublist(gmm_topoid)) THEN + IF (SIZE(fdata,3) .LT. topo%nsublist) THEN info = ppm_error_error CALL ppm_error(ppm_err_argument,'ppm_gmm_reinitialize', & & 'field data for some subs is missing',__LINE__,info) -- GitLab