MED fichier
parfilecf.c
Aller à la documentation de ce fichier.
1 /* This file is part of MED.
2  *
3  * COPYRIGHT (C) 1999 - 2016 EDF R&D, CEA/DEN
4  * MED is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * MED is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public License
15  * along with MED. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #define MED_HAVE_MPI
19 
20 #include <med.h>
21 #include "med_config.h"
22 #include "med_outils.h"
23 #include <string.h>
24 #include <stdlib.h>
25 
26 #include <mpi.h>
27 
28 extern void *MedVersionedApi3F;
29 extern void f77Api3IsSet(void * obj);
30 
31 /*
32  From Fortran call of following C functions :
33 - MEDparfileOpen
34 */
35 
36 
37 
38 #define nmpffope F77_FUNC(mpffope,MPFFOPE)
39 
40 #ifdef PPRO_NT
41 med_int
42 MPFFOPE(const char const *name,
43  const unsigned int bidon,
44  const med_int const *access,
45  const med_int const *len,
46  const med_int const *com,
47  const med_int const *info)
48 #else
49 med_int
50 nmpffope (const char const *name,
51  const med_int const *access,
52  const med_int const *len,
53  const med_int const *com,
54  const med_int const *info)
55 #endif
56 {
57  char * _fn;
58  med_int _ret;
59  med_access_mode _access;
60  MPI_Comm _comm;
61  MPI_Info _info;
62 
63  /* Cette méthode a pour unique but de forcer la construction
64  de l'objet MedVersionedApiF et donc la mise à jour de MedVersionedApi
65  avec les APis fortran. Certains compilateurs suppriment le symbole MedVersionedApiF
66  croyant qu'il nest pas utilisé et la mise à jour de MedVersionedApi n'est
67  alors pas effectuée.*/
69 
70  _comm = MPI_Comm_f2c((MPI_Fint) *com);
71  _info = MPI_Info_f2c((MPI_Fint) *info);
72 
73  _fn = _MED2cstring((char *) name, (int) *len);
74  if (!_fn)
75  return(-1);
76  _access = (med_access_mode) *access;
77 /* ISCRUTE(*com); */
78 /* ISCRUTE(_comm); */
79 /* ISCRUTE(*info); */
80 /* ISCRUTE(_info); */
81 /* SSCRUTE(_fn); */
82 /* ISCRUTE_int(_access); */
83 
84  _ret = (med_int) MEDparFileOpen(_fn, _access, _comm, _info);
85 /* ISCRUTE(_ret); */
86 
87  _MEDcstringFree(_fn);
88 
89  return(_ret);
90 }
91 
92 
MEDC_EXPORT med_err _MEDcstringFree(char *chaine)
med_access_mode
Definition: med.h:113
#define nmpffope
Definition: parfilecf.c:38
void * MedVersionedApi3F
int med_int
Definition: med.h:316
med_idt MEDparFileOpen(const char *const filename, const med_access_mode accessmode, const MPI_Comm comm, const MPI_Info info)
Ouverture d'un fichier MED pour une utilisation parallèle.
void f77Api3IsSet(void *obj)
MEDC_EXPORT char * _MED2cstring(char *chaine, int longueur)
Definition: MED2cstring.c:35