[Fortran] 纯文本查看 复制代码
Module Pointer_Mod
Implicit None
Type Api
Integer::Id
Real(Kind=8),Pointer::Bus(:)
End Type Api
Contains
Subroutine Hello(Moon,Tiger,Fish)
Integer,Intent(In)::Moon
Type(Api),Intent(In)::Tiger
Real(Kind=8),Intent(Out)::Fish
Integer::I
Fish=0.d0
If(Moon==1)Then
Do I=1,10,1
Fish=Fish+Tiger%Bus(I)
End Do
Else if(Moon==2)Then
Do I=1,10,1
Fish=Fish-Tiger%Bus(I)
End Do
End If !!
End Subroutine
End Module
program Test_Pointer
Use Pointer_Mod
implicit none
Integer::Moon,I
Type(Api)::Tiger
Real(Kind=8)::Fish
Moon=1
Tiger%Id=10
Allocate(Tiger%Bus(10))
Do I=1,10,1
Tiger%Bus(I)=I+1.d0
End Do
Call Hello(Moon,Tiger,Fish)
Write(*,*)Fish
Pause
end program Test_Pointer
[Fortran] 纯文本查看 复制代码
interface SURFACE_VALUES
function DV_SURFACE_VALUES(DERIVATIVE, VARIABLESX, VARIABLESY, KNOTSX, KNOTSY, COEFFS)
import
implicit none
integer :: DERIVATIVE(2)
real(kind(1d0)) :: VARIABLESX(:), VARIABLESY(:)
type (d_spline_knots) :: knotsx, knotsy
real(kind(1d0)) :: COEFFS(:,:)
real(kind(1d0)) :: DV_SURFACE_VALUES(size(VARIABLESX),size(VARIABLESY))
end function DV_SURFACE_VALUES
end interface SURFACE_VALUES
[Fortran] 纯文本查看 复制代码
Module surface_fitting_int
USE norm_int
implicit none
interface surface_fitting
function D_SURFACE_FITTING(DATA,KNOTSX,KNOTSY,CONSTRAINTS,COVARIANCE,IOPT,epack)
import
implicit none
type (d_spline_knots) :: knotsx, knotsy
real(kind(1d0)) :: DATA(:,:)
type (D_SURFACE_CONSTRAINTS) , optional :: CONSTRAINTS(:)
real(kind(1d0)) , optional :: COVARIANCE(:,:)
type (d_options) , optional :: iopt(:)
type (d_error) , optional :: epack
real(kind(1d0)) :: D_SURFACE_FITTING(size(KNOTSX%D_KNOTS)-KNOTSX%SPLINE_DEGREE-1,size(KNOTSY%D_KNOTS)-KNOTSY%SPLINE_DEGREE-1)
end function D_SURFACE_FITTING
end interface surface_fitting
interface SURFACE_VALUES
function DV_SURFACE_VALUES(DERIVATIVE, VARIABLESX, VARIABLESY, KNOTSX, KNOTSY, COEFFS)
import
implicit none
integer :: DERIVATIVE(2)
real(kind(1d0)) :: VARIABLESX(:), VARIABLESY(:)
type (d_spline_knots) :: knotsx, knotsy
real(kind(1d0)) :: COEFFS(:,:)
real(kind(1d0)) :: DV_SURFACE_VALUES(size(VARIABLESX),size(VARIABLESY))
end function DV_SURFACE_VALUES
end interface SURFACE_VALUES
interface SURFACE_CONSTRAINTS
function DSURFACE_CONSTRAINTS(derivative,point,value,type,periodic)
import
type (d_surface_constraints) :: DSURFACE_CONSTRAINTS
integer , optional :: derivative(:)
real(kind(1d0)) :: point(:)
real(kind(1d0)) , optional :: periodic(:)
real(kind(1d0)) , optional :: value
character(len=*):: type
end function DSURFACE_CONSTRAINTS
end interface SURFACE_CONSTRAINTS
End Module surface_fitting_int