6.1.1 User Defined Functions

An original transformation can be defined by the user when the following entries are provided.

xx, yy = NumRu::DCL.stfusr(ux,uy) The forward transformation
ux, uy = NumRu::DCL.stiusr(xx,yy) The inverse transformation
stsusr Initialization of functions


The entries for forward and inverse transformation are called from the subroutine stftrn, which is a subroutine of stftrf. The values of ux, uy handed over to stfusr, are values that have been processed by stfrad ¤È stfrot. Enlargement and parallel transformation is performed by stftrn, so only the other basic transformation functions need to be set for these functions. Although settings exist for both forward and inverse transformation functions, only the entry statement for the inverse function is necessary if inverse transformation is not performed.

The stsusr is called from the sgstrf, which conforms the transformation function. For this entry, the functions of STPACK performed by sgstrf must normally be initialized. The functions for initialization are ststrf, ststrn, stsrad, and stsrot (in map projection).

The following program defines a log-log coordinate for common logarithm.




*--------------------------------------------------------------

*     USER SUPPLIED FUNCTION

*--------------------------------------------------------------

      SUBROUTINE xx, yy = NumRu::DCL.stfusr(ux,uy)



      XX = LOG(UX)

      YY = LOG(UY)



      RETURN

*--------------------------------------------------------------

      ENTRY ux, uy = NumRu::DCL.stiusr(xx,yy)



      UX = EXP(XX)

      UY = EXP(YY)



      RETURN

      END

*--------------------------------------------------------------

      SUBROUTINE stsusr



      vxmin, vxmax, vymin, vymax = NumRu::DCL.sgqvpt()

      uxmin, uxmax, uymin, uymax = NumRu::DCL.sgqwnd()



      CX = (VXMAX-VXMIN)/LOG(UXMAX/UXMIN)

      CY = (VYMAX-VYMIN)/LOG(UYMAX/UYMIN)



      VX0 = VXMIN - CX*LOG(UXMIN)

      VY0 = VYMIN - CY*LOG(UYMIN)



      NumRu::DCL.ststrf(lmapa)

      NumRu::DCL.stsrad(lxdeg,lydeg)

      NumRu::DCL.ststrn(itr,cxa,cya,vxoff,vyoff)



      END


The following program uses the MPFMWL/MPIMWL in MATH1/MAPLIB to define a pseudo-Mollweide map projection function.


*---------------------------------------------------------------

*     USER SUPPLIED FUNCTION

*---------------------------------------------------------------

      SUBROUTINE xx, yy = NumRu::DCL.stfusr(ux,uy)



      CALL MPFMWL(UX, UY, XX, YY) 

      RETURN 

*---------------------------------------------------------------

      ENTRY ux, uy = NumRu::DCL.stiusr(xx,yy) 



      CALL MPIMWL(XX, YY, UX, UY) 



      RETURN 

      END 

*---------------------------------------------------------------

      SUBROUTINE stsusr 

      LOGICAL LDEG 



      vxmin, vxmax, vymin, vymax = NumRu::DCL.sgqvpt() 

      simfac, vxoff, vyoff = NumRu::DCL.sgqsim() 

      plx, ply, plrot = NumRu::DCL.sgqmpl() 

      lpara = NumRu::DCL.sglget(cp) 



      IF(LDEG) THEN 

        CP = return_value = NumRu::DCL.rfpi()/180 

      ELSE 

        CP = 1 

      ENDIF 



      rpara = NumRu::DCL.sgrget(cp) 

      rpara = NumRu::DCL.sgrget(cp) 

      rpara = NumRu::DCL.sgrget(cp) 

      rpara = NumRu::DCL.sgrget(cp) 

      CALL SZSCLX(CP*TXMIN, CP*TXMAX) 

      CALL SZSCLY(CP*TYMIN, CP*TYMAX) 



      VX0 = (VXMAX+VXMIN)/2 + XOFF 

      VY0 = (VYMAX+VYMIN)/2 + YOFF 



      NumRu::DCL.ststrf(lmapa) 

      NumRu::DCL.stsrad(lxdeg,lydeg) 

      CALL stsrot(return_value = NumRu::DCL.rfpi() 

      NumRu::DCL.ststrn(itr,cxa,cya,vxoff,vyoff) 



      END