| 1 | 
#define __C | 
| 2 | 
 | 
| 3 | 
#include "config.h" | 
| 4 | 
#include "fSimulation.h" | 
| 5 | 
#include "fortranWrappers.hpp" | 
| 6 | 
 | 
| 7 | 
// declare the actual instances of the function pointers | 
| 8 | 
 | 
| 9 | 
makeAtype_TD makeAtype; | 
| 10 | 
initFortranFF_TD initFortranFF; | 
| 11 | 
set_sticky_params_TD set_sticky_params; | 
| 12 | 
set_gb_pair_params_TD set_gb_pair_params; | 
| 13 | 
newEAMtype_TD newEAMtype; | 
| 14 | 
 | 
| 15 | 
// declare the functions on the fortran side | 
| 16 | 
 | 
| 17 | 
extern "C" { | 
| 18 | 
   | 
| 19 | 
  typedef void (*ffWrapFunction_TD)( makeAtype_TD p1, | 
| 20 | 
                                     initFortranFF_TD p2, | 
| 21 | 
                                     doForceLoop_TD p3, | 
| 22 | 
                                     set_sticky_params_TD p4, | 
| 23 | 
                                     set_gb_pair_params_TD p5, | 
| 24 | 
                                     newEAMtype_TD p6 ); | 
| 25 | 
 | 
| 26 | 
  void F90_FUNC(wrapforcefield, WRAPFORCEFIELD)( ffWrapFunction_TD myWF ); | 
| 27 | 
   | 
| 28 | 
  typedef void (*smWrapFunction_TD)( setFortranSim_TD p1, | 
| 29 | 
                                     setFortranBox_TD p2, | 
| 30 | 
                                     notifyFortranCutOff_TD p3 ); | 
| 31 | 
 | 
| 32 | 
  void F90_FUNC(wrapsimmod, WRAPSIMMOD) ( smWrapFunction_TD myWF ); | 
| 33 | 
   | 
| 34 | 
#ifdef IS_MPI | 
| 35 | 
   | 
| 36 | 
  typedef void (*spmWrapFunction_TD)( setFortranMPI_TD p1 ); | 
| 37 | 
 | 
| 38 | 
  void F90_FUNC(wrapsimparallelmod, WRAPSIMPARALLELMOD)(spmWrapFunction_TD myWF); | 
| 39 | 
 | 
| 40 | 
#endif // is_mpi | 
| 41 | 
} | 
| 42 | 
 | 
| 43 | 
// declare the functions that are defined in this file | 
| 44 | 
extern "C"{ | 
| 45 | 
  void wrapFF(makeAtype_TD p1, | 
| 46 | 
              initFortranFF_TD p2, | 
| 47 | 
              doForceLoop_TD p3, | 
| 48 | 
              set_sticky_params_TD p4, | 
| 49 | 
              set_gb_pair_params_TD p5, | 
| 50 | 
              newEAMtype_TD p6 ); | 
| 51 | 
 | 
| 52 | 
  void wrapSimInfo(setFortranSim_TD p1, | 
| 53 | 
                   setFortranBox_TD p2, | 
| 54 | 
                   notifyFortranCutOff_TD p3 ); | 
| 55 | 
   | 
| 56 | 
#ifdef IS_MPI | 
| 57 | 
  void wrapSimParallel( setFortranMPI_TD p1 ); | 
| 58 | 
#endif | 
| 59 | 
} | 
| 60 | 
 | 
| 61 | 
// take care of the ForceField functions | 
| 62 | 
 | 
| 63 | 
ForceFields* currentFF; | 
| 64 | 
void wrapMeFF( ForceFields* thisFF ){ | 
| 65 | 
   | 
| 66 | 
  currentFF = thisFF; | 
| 67 | 
  F90_FUNC(wrapforcefield, WRAPFORCEFIELD)( wrapFF ); | 
| 68 | 
} | 
| 69 | 
 | 
| 70 | 
extern "C" void wrapFF( makeAtype_TD p1, | 
| 71 | 
                        initFortranFF_TD p2, | 
| 72 | 
                        doForceLoop_TD p3, | 
| 73 | 
                        set_sticky_params_TD p4, | 
| 74 | 
                        set_gb_pair_params_TD p5, | 
| 75 | 
                        newEAMtype_TD p6 ){ | 
| 76 | 
   | 
| 77 | 
  makeAtype = p1; | 
| 78 | 
  initFortranFF = p2; | 
| 79 | 
  currentFF->setFortranForceLoop( p3 ); | 
| 80 | 
  set_sticky_params = p4; | 
| 81 | 
  set_gb_pair_params = p5; | 
| 82 | 
  newEAMtype = p6; | 
| 83 | 
} | 
| 84 | 
 | 
| 85 | 
 | 
| 86 | 
// wrap the SimInfo functions | 
| 87 | 
 | 
| 88 | 
SimInfo* currentPlug; | 
| 89 | 
void wrapMeSimInfo( SimInfo* thePlug ){ | 
| 90 | 
   | 
| 91 | 
  currentPlug = thePlug; | 
| 92 | 
  F90_FUNC(wrapsimmod, WRAPSIMMOD) ( wrapSimInfo ); | 
| 93 | 
} | 
| 94 | 
 | 
| 95 | 
 | 
| 96 | 
 | 
| 97 | 
extern "C" void wrapSimInfo( setFortranSim_TD p1, | 
| 98 | 
                             setFortranBox_TD p2, | 
| 99 | 
                             notifyFortranCutOff_TD p3 ){ | 
| 100 | 
   | 
| 101 | 
  currentPlug->setInternal( p1, p2, p3 ); | 
| 102 | 
} | 
| 103 | 
 | 
| 104 | 
 | 
| 105 | 
 | 
| 106 | 
#ifdef IS_MPI | 
| 107 | 
 | 
| 108 | 
// wrap the mpiSim functions | 
| 109 | 
 | 
| 110 | 
mpiSimulation* currentMPIsim; | 
| 111 | 
void wrapMeSimParallel( mpiSimulation* thisMPIsim ){ | 
| 112 | 
   | 
| 113 | 
  currentMPIsim = thisMPIsim; | 
| 114 | 
  F90_FUNC(wrapsimparallelmod, WRAPSIMPARALLELMOD) ( wrapSimParallel ); | 
| 115 | 
} | 
| 116 | 
 | 
| 117 | 
extern "C" void wrapSimParallel( setFortranMPI_TD p1 ){ | 
| 118 | 
   | 
| 119 | 
  currentMPIsim->setInternal( p1 ); | 
| 120 | 
} | 
| 121 | 
 | 
| 122 | 
 | 
| 123 | 
#endif // is_mpi | 
| 124 | 
 |