- #1
ted_kingdom
- 5
- 0
Hi!
I require help in writing a code where I want to put FUNCTION definitions in one module and INTERFACEs to the functions (as I use assumed-shape arrays in the functions) in another. But I get multiple errors when trying to compile. Could anyone assist me in solving this problem? Please see program below. Thanks in advance.
I require help in writing a code where I want to put FUNCTION definitions in one module and INTERFACEs to the functions (as I use assumed-shape arrays in the functions) in another. But I get multiple errors when trying to compile. Could anyone assist me in solving this problem? Please see program below. Thanks in advance.
Code:
MODULE qwer
CONTAINS
PURE FUNCTION BMatVect(ShapeFuncDeriv,JacobiInv)
IMPLICIT NONE
Real, Intent(IN) :: JacobiInv(:,:),ShapeFuncDeriv(:,:)
Real::BMatVect(size(ShapeFuncDeriv,1),size(ShapeFuncDeriv,2))
BMatVect = Matmul(JacobiInv, ShapeFuncDeriv)
END FUNCTION BMatVect
END MODULE qwer
MODULE ty
USE qwer
INTERFACE BMatVect_function
PURE FUNCTION BMatVect(ShapeFuncDeriv,JacobiInv)
IMPLICIT NONE
Real, Intent(IN) :: JacobiInv(:,:),ShapeFuncDeriv(:,:)
Real::BMatVect(size(ShapeFuncDeriv,1),size(ShapeFuncDeriv,2))
END FUNCTION BMatVect
END INTERFACE BMatVect_function
END MODULE ty
PROGRAM MyTest
USE ty
IMPLICIT NONE
REAL :: A(2,2) = reshape((/1,1,1,1/),(/2,2/)), &
B(2,4) = reshape((/-0.5,-0.5,0.5,0.0,0.0,0.0,0.0,0.5/),(/2,4/)), &
C(2,4)
C = BMatVect (B, A)
PRINT*, C(1,:)
PRINT*, C(2,:)
END PROGRAM MyTest
Last edited: