/*************************************************************************
* COPYRIGHT (C) 1999 - 2003  EDF R&D
* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE 
* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION; 
* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
*
* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
*
* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
*
*************************************************************************/

#ifndef MED_PROTO_H
#define MED_PROTO_H

/* Interface de l'API MED */

/* Fichier */
extern med_idt
MEDouvrir(char *nom, med_mode_acces mode_acces);
extern med_err 
MEDfermer(med_idt fid); 
extern med_int
MEDlFichDes(med_idt fid);
extern med_err 
MEDfichEntete(med_idt fid, med_fich_info quoi, char str[]); 
extern med_err 
MEDfichDesEcr(med_idt fid, char *des); 
extern med_err
MEDunvCr(med_idt fid, char *maa);
extern med_err
MEDunvLire(med_idt fid, char *maa,char *nomu);
extern med_err
MEDformatConforme(const char * nomfich);
extern med_err
MEDversionConforme(const char *nom);
extern void
MEDversionDonner(med_int *majeur, med_int *mineur, med_int *release);
extern med_err 
MEDversionLire(med_idt fid, med_int *majeur, med_int *mineur, med_int *release);
extern med_idt
MEDmonter(med_idt fid, const char *acces, med_type_donnee type);
extern med_err
MEDdemonter(med_idt fid,med_idt mid,med_type_donnee type);


/* Maillage */
extern med_err 
MEDmaaCr(med_idt fid, char *maillage, med_int dim,med_maillage type,char *desc);
extern med_err
MEDdimEspaceCr(med_idt fid, char *maillage, med_int dim);
extern med_int
MEDdimLire(med_idt fid, char *maillage); 
extern med_int 
MEDdimEspaceLire(med_idt fid, char *maillage);
extern med_err 
MEDmaaInfo(med_idt fid, int indice, char *maillage, med_int *dim, 
	   med_maillage *type,char *desc); 
extern med_int 
MEDnMaa(med_idt fid);
extern med_err 
MEDnbnosoEcr(med_idt fid, char *nom_maillage,med_int n);
extern med_int
MEDnbnosoLire(med_idt fid,char *nom_maillage);
extern med_err 
MEDnbnoisEcr(med_idt fid, char *nom_maillage,med_int n);
extern med_int
MEDnbnoisLire(med_idt fid,char *nom_maillage);
extern med_err
MEDnbnomaEcr(med_idt fid, char *nom_maillage,med_int n);
extern med_int
MEDnbnomaLire(med_idt fid,char *nom_maillage);
extern med_err
MEDnatureGrilleEcr(med_idt fid,char *maillage,med_type_grille type);
extern med_err
MEDnatureGrilleLire(med_idt fid,char *maillage,med_type_grille *type);

/* EntMaillage */
extern med_err 
MEDconnEcr(med_idt fid,char *maa, med_int mdim, med_int *connectivite,med_mode_switch mode_switch,
	   med_int nbre, med_entite_maillage type_ent,
	   med_geometrie_element type_geo,med_connectivite type_conn);

extern med_err 
MEDconnLire(med_idt fid,char *maa,med_int mdim,med_int *connectivite,med_mode_switch mode_switch,
	    med_int * pfltab, med_size psize,
	    med_entite_maillage type_ent, med_geometrie_element type_geo,med_connectivite type_conn);
extern med_err 
MEDnomEcr(med_idt fid,char *maa, char *nom, med_int n,
	  med_entite_maillage type_ent,med_geometrie_element type_geo); 
extern med_err 
MEDnomLire(med_idt fid,char *maa, char *nom, med_int n, 
	   med_entite_maillage type_ent,med_geometrie_element type_geo); 
extern med_err 
MEDnumLire(med_idt fid,char *maa, med_int *num, med_int n, 
	   med_entite_maillage type_ent,med_geometrie_element type_geo); 
extern med_err 
MEDnumEcr(med_idt fid,char *maa, med_int *num, med_int n,
	  med_entite_maillage type_ent,med_geometrie_element type_geo);
extern med_err 
MEDcoordEcr(med_idt fid, char *maa, med_int mdim, med_float *coo, 
	    med_mode_switch mode_coo,med_int n,
	    med_repere type_rep, char *nom, char *unit);
extern med_err
MEDindicesCoordEcr(med_idt fid,char *maillage,med_int mdim,med_float *indices,
		   med_int n,med_int axe,char *comp,char *unit);
extern med_err
MEDstructureCoordEcr(med_idt fid,char *maillage,med_int mdim,med_int *structure);
extern med_err 
MEDcoordLire(med_idt fid, char *maa, med_int mdim, med_float *coo,
	     med_mode_switch mode_coo,med_int numco,
	     med_int * pfltab, med_size psize, med_repere *type_rep, char *nom, char *unit);
extern med_err
MEDindicesCoordLire(med_idt fid,char *maillage,med_int mdim,med_float *indices,
		    med_int n,med_int axe,char *comp,char *unit);
extern med_err
MEDstructureCoordLire(med_idt fid,char *maillage,med_int mdim,med_int *structure);
extern med_int
MEDnEntMaa(med_idt fid, char *maa, med_table quoi, med_entite_maillage type_ent, 
	   med_geometrie_element type_geo, med_connectivite type_conn); 
extern med_err
MEDpolygoneConnEcr(med_idt fid, char *maa, med_int *index, med_int ni, med_int *con,
		   med_entite_maillage type_ent, med_connectivite type_conn);
extern med_err
MEDpolygoneInfo(med_idt fid, char *maa, med_entite_maillage type_ent,med_connectivite type_conn,
		med_int *consize);
extern med_err
MEDpolygoneConnLire(med_idt fid, char *maa, med_int *index, med_int ni, med_int *con,
		    med_entite_maillage type_ent, med_connectivite type_conn);
extern med_err
MEDpolyedreConnEcr(med_idt fid,char *maa,med_int *indexp,med_int np,med_int *indexf,med_int nf,
		   med_int *con,med_connectivite type_conn);
extern med_err
MEDpolyedreInfo(med_idt fid, char *maa,med_connectivite type_conn,med_int *nf,
		med_int *consize);
extern med_err
MEDpolyedreConnLire(med_idt fid,char *maa,med_int *indexp,med_int np,med_int *indexf,med_int nf,
		    med_int *con,med_connectivite type_conn);

/* Resultat */
extern med_err MEDchampCr(med_idt fid, char *champ, med_type_champ type, char *comp,
		   char *unit,med_int ncomp);

extern
med_err MEDchampEcr(med_idt fid, char *maa, char *cha,
		    unsigned char *val, med_mode_switch interlace, med_int nbelem, char * locname, 
		    med_int numco, char * profil, med_mode_profil pflmod, 
		    med_entite_maillage type_ent, med_geometrie_element type_geo, 
		    med_int numdt,char * dt_unit, med_float dt, med_int numo);
extern med_err 
MEDchampLire(med_idt fid,char *maa, char *cha, unsigned char *val,med_mode_switch interlace,med_int numco,
	     char * locname, char *profil, med_mode_profil pflmod, 
	     med_entite_maillage type_ent, med_geometrie_element type_geo,
	     med_int numdt, med_int numo);
 
extern med_err
MEDchampInfo(med_idt fid,int indice,char *champ,
		     med_type_champ *type,char *comp,char *unit, 
		     med_int ncomp);

extern med_err 
MEDchampRefInfo(med_idt fid,char *champ,
		med_entite_maillage type_ent, med_geometrie_element type_geo,
		int indice, med_int numdt, med_int numo,
		char * maa, med_booleen * local, med_int * ngauss);
extern med_int 
MEDnChamp(med_idt fid, int indice); 

extern med_int 
MEDnChampRef(med_idt fid, char * cha, med_entite_maillage type_ent, med_geometrie_element type_geo, med_int numdt, med_int numo);

extern
med_int 
MEDnVal(med_idt fid, char *cha, med_entite_maillage type_ent, 
	med_geometrie_element type_geo,med_int numdt, med_int numo, char * maa,med_mode_profil pflmod);

/* Famille  */
extern med_err 
MEDfamEcr(med_idt fid,char *maa, med_int *fam, med_int n,
	  med_entite_maillage type_ent, med_geometrie_element type_geo); 
extern med_err 
MEDfamLire(med_idt fid,char *maa, med_int *fam, med_int n, 
	   med_entite_maillage type_ent,med_geometrie_element type_geo);
extern med_err 
MEDfamCr(med_idt fid,char* maa,char *famille,med_int numero, 
	 med_int *attr_ident, med_int *attr_val,char *attr_desc,med_int n_attr,
	 char *groupe , med_int n_groupe);
extern med_int 
MEDnFam(med_idt fid,char *maa);
extern med_int
MEDnAttribut(med_idt fid,char *maa, int indice);
extern med_int
MEDnGroupe(med_idt fid,char *maa, int indice);
extern med_err 
MEDfamInfo(med_idt fid,char *maa,int indice, char *famille, 
	   med_int *numero,
	   med_int *attr_ident, med_int *attr_val, char *attr_desc,
	   med_int *n_attr,char *groupe ,med_int *n_groupe);  
 
/* Equivalence    */
extern med_err 
MEDequivCr(med_idt fid,char *maa, char *eq, char *desc); 
extern med_err 
MEDequivLire(med_idt fid, char *maa, char *eq, med_int *corr, med_int n,
            med_entite_maillage typ_ent,med_geometrie_element typ_geo); 
extern med_err 
MEDequivEcr(med_idt fid, char *maa, char *eq, med_int *corr, med_int n, 
	    med_entite_maillage typ_ent, med_geometrie_element typ_geo); 
extern med_err 
MEDequivInfo(med_idt fid, char *maa, int ind, char *eq, char *des);
extern med_int 
MEDnEquiv(med_idt fid, char *maa);
extern med_int 
MEDnCorres(med_idt fid,char *maa,char *eq,med_entite_maillage typ_ent,
	   med_geometrie_element typ_geo); 

/* Routines de niveau intermediaire */
extern med_int
MEDnEntites(med_idt fid,char *maa,med_entite_maillage typ_ent, 
            med_connectivite typ_con);

extern med_err
MEDnoeudsLire(med_idt fid,char *maa,med_int mdim, med_float *coord,
	      med_mode_switch mode_coo,
	      med_repere *repere,char *nomcoo, char *unicoo,char *nom,
	      med_booleen *inom,med_int *num,med_booleen *inum,med_int *fam,
	      med_int nnoeuds);

extern med_err
MEDnoeudsEcr(med_idt fid,char *maa,med_int mdim,med_float *coord,
	     med_mode_switch mode_coo,
	     med_repere repere,char *nomcoo, char *unicoo,char *nom,
	     med_booleen inom,med_int *num,med_booleen inum,med_int *fam,
	     med_int nnoeuds);
extern med_err
MEDelementsEcr(med_idt fid,char *maa,med_int mdim,med_int *connectivite,med_mode_switch mode_switch,
	       char *nom,med_booleen inom,med_int *num,med_booleen inum,
	       med_int *fam,med_int nele,med_entite_maillage typ_ent, 
	       med_geometrie_element typ_geo,med_connectivite typ_conn);
extern med_err
MEDelementsLire(med_idt fid,char *maa,med_int mdim,med_int *connectivite,med_mode_switch mode_switch,
	       char *nom,med_booleen *inom,med_int *num,med_booleen *inum,
	       med_int *fam,med_int nele,med_entite_maillage typ_ent, 
	       med_geometrie_element typ_geo,med_connectivite typ_conn);
extern med_err
MEDgro2famCr(med_idt fid,char *maillage,char *groupes,med_int *index,med_int ngroup,med_int *entites,
	     med_int nent,med_entite_maillage type_ent,
	     med_geometrie_element *type_geo,med_int *indexgeo,med_int ngeo); 

/* Routines concernant les profils */
extern med_err 
MEDprofilInfo(med_idt fid, int indice, char *profilname, med_int *n); 

extern med_int 
MEDnProfil(med_idt fid);

extern med_err 
MEDprofilEcr(med_idt fid,med_int *pflval,med_int n,char *profilname);

extern med_int 
MEDnValProfil(med_idt fid, char *nom);

extern med_err 
MEDprofilLire(med_idt fid, med_int *pflval, char *profilname);

/* Routines concernant les points de GAUSS */

extern med_int 
MEDnGauss(med_idt fid);

extern med_err
MEDgaussEcr(med_idt fid, med_geometrie_element type_geo, med_float *refcoo, med_mode_switch mode_coo,
	    med_int ngauss, med_float *gscoo, med_float * wg, char * locname );
extern med_err 
MEDprofilInfo(med_idt fid, int indice, char *profilname, med_int *n);

extern med_err 
MEDgaussLire(med_idt fid, med_float *refcoo, med_float *gscoo, med_float * wg, med_mode_switch mode_coo, char *profilname);

/* Routines concernant les pas de temps/ numéros d'ordre */

extern med_int
MEDnPasdetemps(med_idt fid,char *cha,med_entite_maillage type_ent, 
	       med_geometrie_element type_geo);

extern med_err
MEDpasdetempsInfo(med_idt fid,char *champ,
		  med_entite_maillage type_ent, med_geometrie_element type_geo,
		  int indice, med_int * ngauss, med_int * numdt, med_int * numo,
                  char * dt_unit, med_float * dt,  char * maa, med_booleen * local, med_int *nmaa);

/* Routines concernant les liens */
extern med_int 
MEDnValLien(med_idt fid, char *maa);

extern med_err
MEDlienEcr(med_idt fid, char *lienval,char *maa);

extern med_err
MEDlienLire(med_idt fid, char * lienval, char * maa);

extern med_int 
MEDnLien(med_idt fid );

extern med_err 
MEDlienInfo( med_idt fid, int indice, char * maa, med_int * n);

/* Variables scalaires */
extern med_err
MEDscalaireCr(med_idt fid,char *scalaire, med_type_champ type, char *desc);

extern med_err
MEDscalaireEntierEcr(med_idt fid, char *scalaire, med_int val,
		     med_int numdt, char *dt_unit, med_float dt, med_int numo);

extern med_err
MEDscalaireFlottantEcr(med_idt fid, char *scalaire, med_float val, 
		       med_int numdt, char *dt_unit, med_float dt, med_int numo);

extern med_int 
MEDnScalaire(med_idt fid);

extern med_err 
MEDscalaireInfo(med_idt fid,int indice,char *scalaire,
		med_type_champ *type,char *desc);

extern med_int 
MEDnScalairePasdetemps(med_idt fid,char *scalaire);

extern med_err 
MEDscalairePasdetempsInfo(med_idt fid,char *scalaire,int indice, 
			  med_int * numdt, char * dt_unit, med_float * dt,med_int * numo);

extern med_err 
MEDscalaireEntierLire(med_idt fid,char *scalaire, med_int  *val,med_int numdt, med_int numo);

extern med_err 
MEDscalaireFlottantLire(med_idt fid,char *scalaire, med_float  *val,med_int numdt, med_int numo);

#endif /* MED_PROTO_H */




