User Tools

Site Tools


Sidebar

2013:groups:sm:blha:api

This is an old revision of the document!


Suggestion for implementation details of the BLHA2 accord

C/C++ interface (pointer version) (olp.h)

olp.h
#ifndef __OLP_H__
#define __OLP_H__
 
#ifdef __cplusplus
extern "C" {
#endif
 
void OLP_Start(char* fname, int* ierr);
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_Info(char olp_name[15], char olp_version[15], char cite_message[255]);
 
#ifdef __cplusplus
}
#endif // __cplusplus
#endif // __OLP_H__

C++ interface (reference version)

olp.h
#ifndef __OLP_H__
#define __OLP_H__
 
extern "C" {
void OLP_Start(char* fname, int &ierr);
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_Info(char olp_name[15], char olp_version[15], char cite_message[255]);
}
 
#endif // __OLP_H__

Fortran 2003 (or later) module for binding with C/C++:

olp.f90
module olp
   implicit none
   public :: OLP_Start, OLP_EvalSubProcess2, OLP_SetParameter
 
contains
 
subroutine OLP_Start(contract_file_name,ierr) &
 & bind(C,name="OLP_Start")
   use, intrinsic :: iso_c_binding
   implicit none
   character(kind=c_char,len=1), intent(in) :: contract_file_name
   integer(kind=c_int), intent(out) :: ierr
 
  interface
     function strlen(s) bind(C,name='strlen')
       use, intrinsic :: iso_c_binding
       implicit none
       character(kind=c_char,len=1), intent(in) :: s
       integer(kind=c_int) :: strlen
     end function strlen
  end interface
 
 
   ! ...
   ! open( ... , file=contract_file_name(1:strlen(l)), ...) 
   ! ...
 
end subroutine
 
 
subroutine OLP_SetParameter(variable_name, real_part, complex_part, success) &
 & bind(C,name="OLP_SetParameter") 
   use, intrinsic :: iso_c_binding
   implicit none
   character(kind=c_char,len=1), intent(in) :: variable_name
   real(kind=c_double), value, intent(in) :: real_part, complex_part
   integer(kind=c_int), intent(out) :: success
 
   !....
end subroutine
 
subroutine OLP_EvalSubProcess2(label, momenta, mu, res, rstatus) &
   & bind(C,name="OLP_EvalSubProcess2")
   use, intrinsic :: iso_c_binding
   implicit none
   integer(kind=c_int), value, intent(in) :: label
   real(kind=c_double), value, intent(in) :: mu
   real(kind=c_double), dimension(50), intent(in) :: momenta
   real(kind=c_double), dimension(4), intent(out) :: res
   integer(kind=c_int), intent(out) :: rstatus
 
    !....
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
2013/groups/sm/blha/api.1372671249.txt.gz · Last modified: 2013/07/01 11:34 by johann_felix.graf_von_sodenfraunhofen