| 1 |
|
#include <cstdlib> |
| 2 |
+ |
#include <cstring> |
| 3 |
|
|
| 4 |
+ |
|
| 5 |
|
#include "SimInfo.hpp" |
| 6 |
+ |
#define __C |
| 7 |
+ |
#include "fSimulation.h" |
| 8 |
+ |
#include "simError.h" |
| 9 |
|
|
| 10 |
< |
extern "C"{ |
| 6 |
< |
void wrapsimmod_( void (*wrapFunction)(void (*fSub)( int*, double*, |
| 7 |
< |
double*, double*))); |
| 8 |
< |
} |
| 10 |
> |
#include <fortranWrappers.hpp> |
| 11 |
|
|
| 10 |
– |
void wrapSimInfo(void (*fSub)( int*, double*, double*, double*)); |
| 11 |
– |
|
| 12 |
|
SimInfo* currentInfo; |
| 13 |
|
|
| 14 |
|
SimInfo::SimInfo(){ |
| 20 |
|
setTemp = 0; |
| 21 |
|
thermalTime = 0.0; |
| 22 |
|
|
| 23 |
< |
currentInfo = this; |
| 24 |
< |
wrapMe(); |
| 23 |
> |
wrapMeSimInfo( this ); |
| 24 |
|
} |
| 25 |
|
|
| 26 |
+ |
void SimInfo::refreshSim(){ |
| 27 |
|
|
| 28 |
< |
void SimInfo::wrapMe(){ |
| 28 |
> |
simtype fInfo; |
| 29 |
> |
int isError; |
| 30 |
|
|
| 31 |
< |
wrapsimmod_( wrapSimInfo ); |
| 32 |
< |
} |
| 31 |
> |
fInfo.box[0] = box_x; |
| 32 |
> |
fInfo.box[1] = box_y; |
| 33 |
> |
fInfo.box[2] = box_z; |
| 34 |
|
|
| 35 |
+ |
fInfo.rlist = rList; |
| 36 |
+ |
fInfo.rcut = rCut; |
| 37 |
+ |
fInfo.SIM_uses_PBC = usePBC; |
| 38 |
|
|
| 39 |
< |
void SimInfo::refreshSim(){ |
| 40 |
< |
|
| 36 |
< |
double box[3]; |
| 37 |
< |
|
| 38 |
< |
box[0] = box_x; |
| 39 |
< |
box[1] = box_y; |
| 40 |
< |
box[2] = box_z; |
| 39 |
> |
isError = 0; |
| 40 |
> |
setFsimulation( &fInfo, &isError ); |
| 41 |
|
|
| 42 |
< |
setFsimulation( &n_atoms, box, &rList, &rCut ); |
| 43 |
< |
} |
| 42 |
> |
if( isError ){ |
| 43 |
|
|
| 44 |
+ |
sprintf( painCave.errMsg, |
| 45 |
+ |
"There was an error setting the simulation information in fortran.\n" ); |
| 46 |
+ |
painCave.isFatal = 1; |
| 47 |
+ |
simError(); |
| 48 |
+ |
} |
| 49 |
|
|
| 50 |
< |
void wrapSimInfo(void (*fSub)( int*, double*, double*, double*)){ |
| 51 |
< |
|
| 52 |
< |
currentInfo->setInternal(fSub); |
| 50 |
> |
#ifdef IS_MPI |
| 51 |
> |
sprintf( checkPointMsg, |
| 52 |
> |
"succesfully sent the simulation information to fortran.\n"); |
| 53 |
> |
MPIcheckPoint(); |
| 54 |
> |
#endif // is_mpi |
| 55 |
|
} |
| 56 |
+ |
|