00001 #include "M3.h"
00002 #include "M3_fortran.h"
00003 #include "M3_mpi.h"
00004
00005 int32_t M3_f77_RunConfig_ReadMPI(
00006 M3_RunConfigStruct **runConfig,
00007 char *runConfigFileName,
00008 int32_t *runType,
00009 MPI_Fint *theComm,
00010 f90strlen strlen )
00011 {
00012 MPI_Comm ccomm;
00013 char cFileName[256];
00014 char *strend;
00015 int i = 0;
00016 int n;
00017
00018 if( runConfigFileName[0] == ' ')
00019 {
00020 for( i = 0; i < strlen && runConfigFileName[i] == ' '; i++ );
00021 runConfigFileName += i;
00022 }
00023
00024 strend = strchr( runConfigFileName, ' ');
00025 if( strend == NULL )
00026 n = strlen - i;
00027 else
00028 n = strend - runConfigFileName;
00029
00030 M3_ErrorCheck(-1, "Run config file name is longer than 255 characters", n < 256, M3_EFLAG_DEFAULT );
00031 memcpy( cFileName, runConfigFileName, n);
00032 cFileName[n] = '\0';
00033
00034
00035 ccomm = MPI_Comm_f2c(*theComm);
00036
00037 M3_RunConfigStruct_ReadMPI( runConfig, cFileName, *runType, ccomm );
00038
00039 return(1);
00040 }
00041
00042
00043 int32_t M3_f77_RunConfig_ReadBinMPI(
00044 M3_RunConfigStruct **runConfig,
00045 char *runConfigFileName,
00046 int32_t *runType,
00047 MPI_Fint *theComm,
00048 f90strlen strlen )
00049 {
00050 MPI_Comm ccomm;
00051 char cFileName[256];
00052 char *strend;
00053 int i = 0;
00054 int n;
00055
00056 if( runConfigFileName[0] == ' ')
00057 {
00058 for( i = 0; i < strlen && runConfigFileName[i] == ' '; i++ );
00059 runConfigFileName += i;
00060 }
00061
00062 strend = strchr( runConfigFileName, ' ');
00063 if( strend == NULL )
00064 n = strlen - i;
00065 else
00066 n = strend - runConfigFileName;
00067
00068 M3_ErrorCheck(-1, "Run config file name is longer than 255 characters", n < 256, M3_EFLAG_DEFAULT );
00069 memcpy( cFileName, runConfigFileName, n);
00070 cFileName[n] = '\0';
00071
00072
00073 ccomm = MPI_Comm_f2c(*theComm);
00074
00075 M3_RunConfigStruct_ReadBinMPI( runConfig, cFileName, *runType, ccomm );
00076
00077 return(1);
00078 }
00079
00080
00081 int32_t M3_f77_RunConfig_Bcast( M3_RunConfigStruct **runConfig, int32_t *root, MPI_Fint *theComm )
00082 {
00083 MPI_Comm ccomm;
00084
00085
00086 ccomm = MPI_Comm_f2c(*theComm);
00087
00088 M3_RunConfigStruct_Bcast( runConfig, *root, ccomm );
00089
00090 return(1);
00091 }