This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Last revision Both sides next revision | ||
2013:groups:sm:blha:api [2013/06/13 13:50] johann_felix.graf_von_sodenfraunhofen suggestion for c-compatible fortran interface |
2013:groups:sm:blha:api [2013/08/13 08:36] gudrun.heinrich |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Suggestion for implementation details of the BLHA2 accord ====== | ||
- | C/C++ interface (pointer version) (olp.h) | ||
- | <code c++> | + | ==== C/C++ interface (pointer version) (olp.h) ==== |
+ | |||
+ | <code c++ olp.h> | ||
#ifndef __OLP_H__ | #ifndef __OLP_H__ | ||
#define __OLP_H__ | #define __OLP_H__ | ||
Line 12: | Line 14: | ||
void OLP_Start(char* fname, int* ierr); | void OLP_Start(char* fname, int* ierr); | ||
void OLP_SetParameter(char* line, double* real_part, double *cmplx_part, int* status); | void OLP_SetParameter(char* line, double* real_part, double *cmplx_part, int* status); | ||
- | void OLP_EvalSubProcess2(int l, double* mom, double mu, double* r, int* status); | + | void OLP_EvalSubProcess2(int* l, double* mom, double* mu, double* r, double* acc); |
+ | void OLP_Info(char olp_name[15], char olp_version[15], char cite_message[255]); | ||
#ifdef __cplusplus | #ifdef __cplusplus | ||
Line 20: | Line 23: | ||
</code> | </code> | ||
- | C++ interface (reference version) | + | ==== C++ interface (reference version) ==== |
- | <code c++> | + | <code c++ olp.h> |
#ifndef __OLP_H__ | #ifndef __OLP_H__ | ||
#define __OLP_H__ | #define __OLP_H__ | ||
Line 30: | Line 33: | ||
void OLP_Start(char* fname, int &ierr); | void OLP_Start(char* fname, int &ierr); | ||
void OLP_SetParameter(char* line, double& real_part, double& cmplx_part, int& status); | void OLP_SetParameter(char* line, double& real_part, double& cmplx_part, int& status); | ||
- | void OLP_EvalSubProcess2(int l, double& mom, double& mu, double& r, int& status); | + | void OLP_EvalSubProcess2(int l, double mom[], double mu, double r[], double &acc); |
+ | void OLP_Info(char olp_name[15], char olp_version[15], char cite_message[255]); | ||
} | } | ||
Line 38: | Line 42: | ||
- | Fortran 2003 (or later) module for binding with C/C++: | + | ==== Fortran 2003 (or later) module for binding with C/C++: ==== |
- | <code fortran> | + | <code fortran olp.f90> |
module olp | module olp | ||
implicit none | implicit none | ||
Line 76: | Line 80: | ||
implicit none | implicit none | ||
character(kind=c_char,len=1), intent(in) :: variable_name | character(kind=c_char,len=1), intent(in) :: variable_name | ||
- | real(kind=c_double), value, intent(in) :: real_part, complex_part | + | real(kind=c_double), intent(in) :: real_part, complex_part |
integer(kind=c_int), intent(out) :: success | integer(kind=c_int), intent(out) :: success | ||
Line 82: | Line 86: | ||
end subroutine | end subroutine | ||
- | subroutine OLP_EvalSubProcess2(label, momenta, mu, res, rstatus) & | + | subroutine OLP_EvalSubProcess2(label, momenta, mu, res, acc) & |
& bind(C,name="OLP_EvalSubProcess2") | & bind(C,name="OLP_EvalSubProcess2") | ||
use, intrinsic :: iso_c_binding | use, intrinsic :: iso_c_binding | ||
Line 90: | Line 94: | ||
real(kind=c_double), dimension(50), intent(in) :: momenta | real(kind=c_double), dimension(50), intent(in) :: momenta | ||
real(kind=c_double), dimension(4), intent(out) :: res | real(kind=c_double), dimension(4), intent(out) :: res | ||
- | integer(kind=c_int), intent(out) :: rstatus | + | real(kind=c_double), dimension(1), intent(out) :: acc |
!.... | !.... | ||
end subroutine OLP_EvalSubProcess2 | end subroutine OLP_EvalSubProcess2 | ||
+ | |||
+ | subroutine OLP_Info(olp_name, olp_version, cite_message) & | ||
+ | & bind(C,name="OLP_Info") | ||
+ | use, intrinsic :: iso_c_binding | ||
+ | implicit none | ||
+ | character(kind=c_char,len=1), intent(out) :: olp_name | ||
+ | character(kind=c_char,len=1), intent(out) :: olp_version | ||
+ | character(kind=c_char,len=1), intent(out) :: cite_message | ||
+ | |||
+ | ! ... | ||
+ | |||
+ | end subroutine OLP_Info | ||
end module olp | end module olp | ||
</code> | </code> | ||
+ |