/*============================================================================
*
*                    Code_Saturne version 1.3
*                    ------------------------
*
*
*     This file is part of the Code_Saturne Kernel, element of the
*     Code_Saturne CFD tool.
*
*     Copyright (C) 1998-2007 EDF S.A., France
*
*     contact: saturne-support@edf.fr
*
*     The Code_Saturne Kernel is free software; you can redistribute it
*     and/or modify it under the terms of the GNU General Public License
*     as published by the Free Software Foundation; either version 2 of
*     the License, or (at your option) any later version.
*
*     The Code_Saturne Kernel 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 General Public License for more details.
*
*     You should have received a copy of the GNU General Public License
*     along with the Code_Saturne Kernel; if not, write to the
*     Free Software Foundation, Inc.,
*     51 Franklin St, Fifth Floor,
*     Boston, MA  02110-1301  USA
*
*============================================================================*/

#ifndef __CS_GUI_H__
#define __CS_GUI_H__

/*============================================================================
 * Reader of the parameters file: main parameters, boundary conditions
 *============================================================================*/


/*----------------------------------------------------------------------------
 * Local headers
 *----------------------------------------------------------------------------*/


#include "cs_base.h"


/*----------------------------------------------------------------------------*/


#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */


/*============================================================================
 * Type definitions
 *============================================================================*/

typedef enum {
  IH2,
  INP,
  IXCH,
  IXCK,
  IF1M,
  IF2M,
  IHM,
  IF3M,
  IF4P2M
} cs_coal_combustion_scalar_t;

typedef enum {
  ITEMP1,
  IROM1,
  YM_CHX1M,
  YM_CHX2M,
  YM_CO,
  YM_O2,
  YM_CO2,
  YM_H2O,
  YM_N2,
  IMEL,
  ITEMP2,
  IX2,
  IROM2,
  IDIAM2,
  IGMDCH,
  IGMDV1,
  IGMDV2,
  IGMHET,
  ILUMI
} cs_coal_combustion_properties_t;


typedef enum {
  COMBTEMPERATURE,
  COMBPRESSURE
} cs_combustion_variables_t;


typedef enum {
  VARIABLE,
  SCALAR,
  PROPERTY
} cs_variable_t;

typedef enum {
  INITIAL,
  MIN,
  MAX,
  BLENDING_FACTOR,
  ORDER_SCHEME,
  SLOPE_TEST,
  FLUX_RECONSTRUCTION,
  TIME_STEP_FACTOR,
  MAX_ITER_NUMBER,
  SOLVEUR_PRECISION,
  GRADIENT_TRANSPOSE,
  PRESSURE_RELAXATION,
  WALL_PRESSURE_EXTRAPOLATION,
  VELOCITY_PRESSURE_COUPLING,
  GRADIENT_RECONSTRUCTION,
  PROBE_RECORDING,
  POST_RECORDING,
  LIST_PRINTING
} cs_values_t;

typedef enum {
  THERMOPHYSICAL_MODELS,
  PHYSICAL_PROPERTIES,
  USER_SCALAR,
  LAGRANGIEN,
  BOUNDARY_CONDITIONS,
  CALCUL_MANAGEMENT,
  ANALYSIS_CONTROL,
  NUMERICAL_PARAMETERS,
  MATISSE
} cs_first_path_element_t;


typedef enum {
  START_RESTART
} cs_calcul_management_element_t;

typedef enum {
  ENTHALPY,
  TEMPERATURE_KELVIN,
  TEMPERATURE_CELSIUS
} cs_scalar_name_t;


typedef enum {
  DENSITY,
  MOLECULAR_VISCOSITY,
  TURB_VISCOSITY,
  SMAGORINSKY,
  SPECIFIC_HEAT,
  WEIGHT_MATRIX_X,
  WEIGHT_MATRIX_Y,
  WEIGHT_MATRIX_Z,
  LOCAL_TIME_STEP,
  DIFFUSION_COEFFICIENT,
  THERMAL_CONDUCTIVITY
} cs_properties_t;


typedef enum {
  REFERENCE,
  DIRICHLET,
  FLOW1,
  HYDRAULIC_DIAMETER,
  TURBULENT_INTENSITY,
  NEUMANN,
  COEF_ECHANGE,
  COALFLOW,
  FLUIDTEMPERATURE,
  RATIO
} cs_boundary_value_t;


typedef enum {
  VELOCITY_U, VELOCITY_V,
  VELOCITY_W, PRESSURE,
  TURB_K,     TURB_EPS,
  R11,        R22,
  R33,        R12,
  R13,        R23,
  TURB_PHI,   TURB_FB,
  TURB_OMEGA
} cs_variables_t;


/*=============================================================================
 * Public function prototypes
 *============================================================================*/


/*----------------------------------------------------------------------------
 * Gestion du document xml
 *----------------------------------------------------------------------------*/


void cs_gui_get_version_ihm (void);

void cs_gui_clean_memory (void);

/*-----------------------------------------------------------------------------
 * Return the name of a thermophysical model.
 *
 * parameter:
 *   model_thermo          -->  thermophysical model
 *----------------------------------------------------------------------------*/

 
char *cs_gui_get_thermophysical_model(const char *const model_thermo);


/*-----------------------------------------------------------------------------
 * Return if a particular physics model is activated.
 *
 * parameters:
 *   model                <--  thermophysical model
 *   value                <--  model name associated
 *----------------------------------------------------------------------------*/

 
int cs_gui_get_activ_thermophysical_model (char **model, char **value);


/*-----------------------------------------------------------------------------
 *
 *----------------------------------------------------------------------------*/

void cs_gui_faces_list_building(const char  *const nature,
                                const char  *const label,
                                       int  *      faces,
                                       int **      faces_list,
                                const  int  *const nfabor,
                                const  int  *const nfml,
                                const  int  *const ifmfbr,
                                const  int  *const iprfml);

int cs_gui_boundary_zone_reference_number(const char *const nature,
                                          const char *const label);

int cs_gui_boundary_zones_number(void);

char *cs_gui_boundary_zone_nature(const int ith_zone);

char *cs_gui_boundary_zone_label(const int ith_zone);




/*============================================================================
 * Public function prototypes for Fortran API
 *============================================================================*/


/*----------------------------------------------------------------------------
 * Defintion des pointeurs des scalaires model pour le charbon
 *----------------------------------------------------------------------------*/

void CS_PROCF (cscpsc, CSCPSC)
(
  int *const ncharb,
  int *const nclass,
  int *const ihm,
  int *const ih2,
  int *const inp,
  int *const ixch,
  int *const ixck,
  int *const if1m,
  int *const if2m,
  int *const if3m,
  int *const if4p2m
 );


/*----------------------------------------------------------------------------
 * Defintion des pointeurs des proprietes pour le charbon
 *----------------------------------------------------------------------------*/

void CS_PROCF (cscppp, CSCPPP)
(
  int *const nclass,
  int *const nsalpp,
  int *const nsalto,
  int *const itemp1,
  int *const irom1,
  int *const ym1,
  int *const imel,
  int *const itemp2,
  int *const ix2,
  int *const irom2,
  int *const idiam2,
  int *const igmdch,
  int *const igmdv1,
  int *const igmdv2,
  int *const igmhet,
  int *const ilumi
);


/*-----------------------------------------------------------------------------
 * Parseur du fichier de données XML
 *----------------------------------------------------------------------------*/

void CS_PROCF (csppmo, CSPPMO)
(
 int *const ippmod,                   /* ippmod choix de la physique particuliere */
 int *const icod3p,                   /* pointeurs */
 int *const icodeq,
 int *const icoebu,
 int *const icobml,
 int *const icolwc,
 int *const icp3pl,
 int *const icp3pv,
 int *const icpl3c,
 int *const icompf,
 int *const ieljou,
 int *const ielarc,
 int *const ielion,
 int *const indjon,                    /* indicateur tab enth-temp */
 int *const nscapp                     /* nombre de scalaires */
 );


/*----------------------------------------------------------------------------
 * Turbulence model.
 *
 * Fortran Interface:
 *
 * SUBROUTINE CSTURB (ITURB, IDEUCH, IGRAKE, IGRAKI)
 * *****************
 *
 * INTEGER          ITURB   <--   turbulence model
 * INTEGER          IDEUCH  <--   wall law treatment
 * INTEGER          IGRAKE  <--   k-eps gravity effects
 * INTEGER          IGRAKI  <--   Rij-eps gravity effects
 *----------------------------------------------------------------------------*/


void CS_PROCF (csturb, CSTURB) (int *const iturb,
                                int *const ideuch,
                                int *const igrake,
                                int *const igrari);

/*----------------------------------------------------------------------------
 * Specific heat variable or constant indicator.
 *
 * Fortran Interface:
 *
 * SUBROUTINE CSCPVA (ICP)
 * *****************
 *
 * INTEGER          ICP     <--   Specific heat variable or constant indicator
 *----------------------------------------------------------------------------*/

void CS_PROCF (cscpva, CSCPVA) (int *const icp);

void CS_PROCF (csnsca, CSNSCA)
(
 int *const nscaus
);

void CS_PROCF (csisca, CSISCA)
(
 int *const iscavr
);

void CS_PROCF (csivis, CSIVIS)
(
 int *const iscavr,
 int *const ivisls,
 int *const iscalt,
 int *const iscsth
);

/*----------------------------------------------------------------------------
 * Time passing parameter.
 *
 * Fortran Interface:
 *
 * SUBROUTINE CSIDTV (IDTVAR)
 * *****************
 *
 * INTEGER          IDTVAR  <--   fixed or variable time step
 *----------------------------------------------------------------------------*/

void CS_PROCF(csidtv, CSIDTV) (int *const idtvar);

/*----------------------------------------------------------------------------
 * Hydrostatic pressure parameter.
 *
 * Fortran Interface:
 *
 * SUBROUTINE CSIPHY (IPHYDR)
 * *****************
 *
 * INTEGER          IPHYDR  <--   hydrostatic pressure
 *----------------------------------------------------------------------------*/

void CS_PROCF (csiphy, CSIPHY) (int *const iphydr);


void CS_PROCF (csvnum, CSVNUM)
(
 const int *const nvarmx,
 const int *const nvar,
 const int *const iu,
 const int *const iv,
 const int *const iw,
 const int *const ipr,
 const int *const iturb,
 const int *const ik,
 const int *const iep,
 const int *const ir11,
 const int *const ir22,
 const int *const ir33,
 const int *const ir12,
 const int *const ir13,
 const int *const ir23,
 const int *const iomg,
 const int *const iphi,
 const int *const ifb,
 const int *const isca
);

/*----------------------------------------------------------------------------
 * Restart files format.
 *
 * Fortran Interface:
 *
 * SUBROUTINE CSIFOA (IFOAVA, IFOAVX)
 * *****************
 *
 * INTEGER          IFOAVA  <--   main restart file format
 * INTEGER          IFOAVX  <--   auxiliary restart file format
 *----------------------------------------------------------------------------*/


void CS_PROCF (csifoa, CSIFOA) (int *const ifoava,
                                int *const ifoavx);

/*----------------------------------------------------------------------------
 * Restart parameters.
 *
 * Fortran Interface:
 *
 * SUBROUTINE CSISUI (ISUITE, ILEAUX, ICCVFG)
 * *****************
 *
 * INTEGER          ISUITE  <--   restart
 * INTEGER          ILEAUX  <--   restart with auxiliary
 * INTEGER          ICCFVG  <--   restart with frozen field
 *----------------------------------------------------------------------------*/


void CS_PROCF (csisui, CSISUI) (int *const isuite,
                                int *const ileaux,
                                int *const iccvfg);

/*----------------------------------------------------------------------------
 * Time passing parameters.
 *
 * Fortran Interface:
 *
 * SUBROUTINE CSTIME (INPDT0, IPTLTO, NTMABS, DTREF,
 * *****************  DTMIN, DTMAX, COUMAX, FOUMAX, VARRDT)
 *
 * INTEGER          INPDT0  <--   zero tim step
 * INTEGER          IPTLTO  <--   thermal time step control
 * INTEGER          NTMABS  <--   iterations numbers
 * DOUBLE PRECISION DTREF   <--   time step
 * DOUBLE PRECISION DTMIN   <--   minimal time step
 * DOUBLE PRECISION DTMAX   <--   maximal time step
 * DOUBLE PRECISION COUMAX  <--   maximal courant number
 * DOUBLE PRECISION FOUMAX  <--   maximal fournier number
 * DOUBLE PRECISION VARRDT  <--   max time step variation between 2 iterations
 *----------------------------------------------------------------------------*/

void CS_PROCF (cstime, CSTIME) (int    *const inpdt0,
                                int    *const iptlro,
			        int    *const ntmabs,
			        double *const dtref,
                                double *const dtmin,
                                double *const dtmax,
                                double *const coumax,
                                double *const foumax,
                                double *const varrdt);

void CS_PROCF (cssca1, CSSCA1)
(
 int *const iscalt,
 int *const iscsth
);


void CS_PROCF (csnum1, CSNUM1)
(

 const    int *const isca,
       double *const blencv,
          int *const ischcv,
          int *const isstpc,
          int *const ircflu,
       double *const cdtvar,
          int *const nitmax,
       double *const epsilo
);

/*----------------------------------------------------------------------------
 * Global numerical parameters.
 *
 * Fortran Interface:
 *
 * SUBROUTINE CSNUM2 (IVISSE, RELAXP, IPUCOU, EXTRAG, IMRGRA)
 * *****************
 *
 * INTEGER          IVISSE  <--   gradient transpose
 * INTEGER          RELAXP  <--   pressure relaxation
 * INTEGER          IPUCOU  <--   velocity pressure coupling
 * INTEGER          EXTRAG  <--   wall pressure extrapolation
 * INTEGER          IMRGRA  <--   gradient reconstruction
 *----------------------------------------------------------------------------*/

void CS_PROCF (csnum2, CSNUM2) (   int *const ivisse,
                                double *const relaxp,
                                   int *const ipucou,
                                double *const extrag,
                                   int *const imrgra);

void CS_PROCF (csphys, CSPHYS)
(
 const    int *const nmodpp,
          int *const irovar,
          int *const ivivar,
       double *const gx,
       double *const gy,
       double *const gz,
       double *const ro0,
       double *const viscl0,
       double *const cp0,
       double *const t0,
       double *const p0
);

void CS_PROCF (cssca2, CSSCA2)
(
 const    int *const iscavr,
       double *const scamin,
       double *const scamax
);

void CS_PROCF (cssca3, CSSCA3)
(
 const    int *const iscavr,
       double *const visls0
);

/*----------------------------------------------------------------------------
 * Turbulence initialization parameters.
 *
 * Fortran Interface:
 *
 * SUBROUTINE CSTINI (UREF, ALMAX)
 * *****************
 *
 * INTEGER          UREF   <--   reference velocity
 * INTEGER          ALMAX  <--   reference length
 *----------------------------------------------------------------------------*/


void CS_PROCF (cstini, CSTINI) (double *const uref,
                                double *const almax);

void CS_PROCF (csenso, CSENSO)
(
 const    int *const nvppmx,
          int *const ncapt,
          int *const nthist,
          int *const ntlist,
	  int *const ichrvl,
	  int *const ichrbo,
	  int *const ichrsy,
	 char *const fmtchr,
	  int *const size_fmt,
	 char *const optchr,
	  int *const size_opt,
          int *const ntchr,
          int *const iecaux,
 const    int *const icp,
 const    int *const irom,
 const    int *const iviscl,
 const    int *const ivisct,
 const    int *const icour,
 const    int *const ifour,
 const    int *const ismago,
 const    int *const iprtot,
          int *const ichrvr,
          int *const ilisvr,
          int *const ihisvr,
 const    int *const isca,
 const    int *const ipprtp,
 const    int *const ipppro,
 const    int *const ipproc,
 const    int *const ipptx,
 const    int *const ippty,
 const    int *const ipptz,
 const    int *const ippdt,
       double *const xyzcap);

void CS_PROCF(fcnmva, FCNMVA)
(
 const char      *const fstr,    /* --> Fortran string */
 int             *const len,     /* --> String Length  */
 int             *const var_id   /* --> Variable Id (1 to n) */
 CS_ARGF_SUPP_CHAINE
);

void CS_PROCF(cfnmva, CFNMVA)
(
 char          *const fstr,    /* --> Fortran string */
 int           *const len,     /* --> String Length  */
 int           *const var_id   /* --> Variable Id (1 to n) */
 CS_ARGF_SUPP_CHAINE
);


void CS_PROCF(uiiniv, UIINIV)
(
 const int    *const nscapp,
 const int    *const ncelet,
 const int    *const ncel,
 const int    *const nfml,
 const int    *const nprfml,
 const int    *const isca,
 const int    *const ifmcel,
 const int    *const iprfml,
 double *const rtp
);


void CS_PROCF (uiclim, UICLIM)(const    int *const nscapp,
                               const    int *const nfabor,
                               const    int *const nfml,
                               const    int *const iindef,
                               const    int *const ientre,
                               const    int *const iparoi,
                               const    int *const isymet,
                               const    int *const isolib,
                               const    int *const iturb,
                               const    int *const ifmfbr,
                               const    int *const iprfml,
                                        int *const itypfb,
                                        int *const icodcl,
                                     double *const rcodcl,
                               const double *const surfbo);


void CS_PROCF (uicliv, UICLIV)(const    int *const nfabor,
                               const    int *const nfml,
                               const    int *const iindef,
                               const    int *const ientre,
                               const    int *const iparoi,
                               const    int *const isymet,
                               const    int *const isolib,
                               const    int *const ifmfbr,
                               const    int *const iprfml,
                                        int *const itypfb);


void CS_PROCF (uicpcl, UICPCL)(const    int *const nozppm,
                               const    int *const ncharm,
                               const    int *const ncharb,
                               const    int *const nclpch,
                               const    int *const nfabor,
                               const    int *const nfml,
                               const    int *const iindef,
                               const    int *const ientre,
                               const    int *const iparoi,
                               const    int *const isymet,
                               const    int *const isolib,
                               const    int *const ifmfbr,
                               const    int *const iprfml,
                                        int *const itypfb,
                                        int *const icodcl,
                                     double *const rcodcl,
                                        int *const ientat,
                                        int *const iqimp,
                                     double *const qimpat,
                                     double *const timpat,
                                        int *const ientcp,
                                     double *const qimpcp,
                                     double *const timpcp,
                                     double *const distch,
                                        int *const icalke,
                                     double *const dh,
                                     double *const xintur,
                                        int *const izfppp,
                               const double *const surfbo);


void CS_PROCF (uicpcv, UICPCV)(const    int *const nfabor,
                               const    int *const nfml,
                               const    int *const iindef,
                               const    int *const ientre,
                               const    int *const iparoi,
                               const    int *const isymet,
                               const    int *const isolib,
                               const    int *const ifmfbr,
                               const    int *const iprfml,
                                        int *const itypfb,
                                        int *const izfppp);


#ifdef __cplusplus
}
#endif /* __cplusplus */

#endif /* __CS_GUI_H__ */
