- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
hi all,
I need to create a C inteface for the following subroutine:
SUBROUTINE CUBATR_X (DIMENS,NumFun,Integrand,NumRgn,Vertices,RgType,Value,AbsErr, IFAIL,Neval,EpsAbs,EpsRel,Restart,MinPts,MaxPts,Key,Job,Tune)
But there are two special parameters I am not sure about the translation:
1. Integrand is a interface to array-valued function
INTERFACE
FUNCTION Integrand(NUMFUN,X) RESULT(Value)
USE Precision_Model
INTEGER, INTENT(IN) :: NUMFUN
REAL(kind=stnd), DIMENSION(:), INTENT(IN) :: X
REAL(kind=stnd), DIMENSION(NUMFUN) :: Value
END FUNCTION Integrand
END INTERFACE
typedef float* (*integrand_t)(const int*, const float*) ????
2. REAL(kind=stnd), INTENT(IN), DIMENSION(:,:,:) :: Vertices
float ***Vertices ?????
besides, what does "kind=stnd" mean?
I found that "stnd = Selected_Real_Kind ( 12, 50 )". should I use "double" instead of "float" in this case?
thanks in advance
I need to create a C inteface for the following subroutine:
SUBROUTINE CUBATR_X (DIMENS,NumFun,Integrand,NumRgn,Vertices,RgType,Value,AbsErr, IFAIL,Neval,EpsAbs,EpsRel,Restart,MinPts,MaxPts,Key,Job,Tune)
But there are two special parameters I am not sure about the translation:
1. Integrand is a interface to array-valued function
INTERFACE
FUNCTION Integrand(NUMFUN,X) RESULT(Value)
USE Precision_Model
INTEGER, INTENT(IN) :: NUMFUN
REAL(kind=stnd), DIMENSION(:), INTENT(IN) :: X
REAL(kind=stnd), DIMENSION(NUMFUN) :: Value
END FUNCTION Integrand
END INTERFACE
typedef float* (*integrand_t)(const int*, const float*) ????
2. REAL(kind=stnd), INTENT(IN), DIMENSION(:,:,:) :: Vertices
float ***Vertices ?????
besides, what does "kind=stnd" mean?
I found that "stnd = Selected_Real_Kind ( 12, 50 )". should I use "double" instead of "float" in this case?
thanks in advance
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
When I have run into bad ones like that, I usually end up writing a wrapper function in fortran (with arguments that are easy to translate to C), and then call that wrapper instead.
Good luck!
Good luck!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
thanks for your suggestion.
but I have no idea of fortran programming at all. Could you please write a wrapper for me?
thanks
but I have no idea of fortran programming at all. Could you please write a wrapper for me?
thanks

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page