From: fayolle Date: Thu, 18 Oct 2012 13:46:35 +0000 (+0000) Subject: - Ajout d'une API C/F/Python permettant d'écrire des floats/doubles dans des ports... X-Git-Tag: V6_6_0a1~4 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=ffda7bc07d3825dc64302975edfbff607ae9e30f;p=modules%2Fkernel.git - Ajout d'une API C/F/Python permettant d'écrire des floats/doubles dans des ports double/float (conversions automatiques). --- diff --git a/src/DSC/DSC_Python/calcium.i b/src/DSC/DSC_Python/calcium.i index 29a74ffab..5e7e7de73 100644 --- a/src/DSC/DSC_Python/calcium.i +++ b/src/DSC/DSC_Python/calcium.i @@ -888,6 +888,7 @@ int cp_cd(Superv_Component_i *component,char *instanceName); int cp_een(Superv_Component_i *component,int dep,float t,int n,char *nom,int nval,int *eval); int cp_edb(Superv_Component_i *component,int dep,double t,int n,char *nom,int nval,double *eval); int cp_ere(Superv_Component_i *component,int dep,float t,int n,char *nom,int nval,float *eval); +int cp_erd(Superv_Component_i *component,int dep,float t,int n,char *nom,int nval,float *eval); int cp_ecp(Superv_Component_i *component,int dep,float t,int n,char *nom,int nval,float *ecpval); int cp_elo(Superv_Component_i *component,int dep,float t,int n,char *nom,int nval,int *eval); int cp_ech(Superv_Component_i *component,int dep,float t,int n,char *nom,int nval,char** eval,int strSize); @@ -898,6 +899,7 @@ int cp_eln(Superv_Component_i *component,int dep,float t,int n,char *nom,int nv int cp_len(Superv_Component_i *component,int dep,float *ti,float *tf,int *niter,char *nom,int nmax,int *nval,int *lval); int cp_ldb(Superv_Component_i *component,int dep,double *ti,double *tf,int *niter,char *nom,int nmax,int *nval,double *lval); int cp_lre(Superv_Component_i *component,int dep,float *ti,float *tf,int *niter,char *nom,int nmax,int *nval,float *lval); +int cp_lrd(Superv_Component_i *component,int dep,float *ti,float *tf,int *niter,char *nom,int nmax,int *nval,float *lval); int cp_lcp(Superv_Component_i *component,int dep,float *ti,float *tf,int *niter,char *nom,int nmax,int *nval,float *lcpval); int cp_llo(Superv_Component_i *component,int dep,float *ti,float *tf,int *niter,char *nom,int nmax,int *nval,int *lval); int cp_lch(Superv_Component_i *component,int dep,float *ti,float *tf,int *niter,char *nom,int nmax,int *nval,char** lval,int strSize); diff --git a/src/DSC/DSC_User/Datastream/Calcium/CalciumC.c b/src/DSC/DSC_User/Datastream/Calcium/CalciumC.c index 24a766e73..105c2a93b 100644 --- a/src/DSC/DSC_User/Datastream/Calcium/CalciumC.c +++ b/src/DSC/DSC_User/Datastream/Calcium/CalciumC.c @@ -120,12 +120,16 @@ void ecp_lch_free (char* * data) { \ /*REVERIFIER MAINTENANT 0 COPY avec int2integer*/ CALCIUM_EXT_LECT_INTERFACE_C_(len,float,int,int2integer,); CALCIUM_EXT_LECT_INTERFACE_C_(lre,float,float,float,); +/*Permet d'envoyer/recevoir des réels sur un port Double */ +CALCIUM_EXT_LECT_INTERFACE_C_(lrd,float ,float ,float2double,); CALCIUM_EXT_LECT_INTERFACE_C_(ldb,double,double,double,); + CALCIUM_EXT_LECT_INTERFACE_C_(llo,float,int,bool,); CALCIUM_EXT_LECT_INTERFACE_C_(lcp,float,float,cplx,); /* CALCIUM_EXT_LECT_INTERFACE_C_(lch,float,char,STAR[]); */ + /**************************************/ /* INTERFACES DE LECTURE AVEC RECOPIE */ /**************************************/ @@ -204,7 +208,10 @@ CALCIUM_LECT_INTERFACE_C_(llg,float ,int,long ,long2integer,,); CALCIUM_LECT_INTERFACE_C_(lln,float ,int,long ,long,,); CALCIUM_LECT_INTERFACE_C_(lre,float ,int,float ,float,,); +/*Permet d'envoyer/recevoir des réels sur un port Double */ +CALCIUM_LECT_INTERFACE_C_(lrd,float ,int,float ,float2double,,); CALCIUM_LECT_INTERFACE_C_(ldb,double,int,double ,double,,); + CALCIUM_LECT_INTERFACE_C_(llo,float ,int,int ,bool,,); CALCIUM_LECT_INTERFACE_C_(lcp,float ,int,float ,cplx,,); #define STAR * @@ -222,6 +229,7 @@ CALCIUM_LECT_INTERFACE_C_(lin_fort_,float ,cal_int,int ,int2integer,,); CALCIUM_LECT_INTERFACE_C_(llg_fort_,float ,cal_int,long ,long2integer,,); CALCIUM_LECT_INTERFACE_C_(lre_fort_,float ,cal_int,float ,float,,); +CALCIUM_LECT_INTERFACE_C_(lrd_fort_,float ,cal_int,float ,float2double,,); CALCIUM_LECT_INTERFACE_C_(ldb_fort_,double,cal_int,double ,double,,); CALCIUM_LECT_INTERFACE_C_(llo_fort_,float ,cal_int,int ,bool,,); /*int pour bool ou cal_int */ CALCIUM_LECT_INTERFACE_C_(lcp_fort_,float ,cal_int,float ,cplx,,); @@ -305,7 +313,10 @@ CALCIUM_ECR_INTERFACE_C_(een,float ,int,int ,int2integer,,); sinon problème de conversion de 64bits vers 32bits */ CALCIUM_ECR_INTERFACE_C_(elg,float ,int,long ,long2integer,,); CALCIUM_ECR_INTERFACE_C_(ere,float ,int,float ,float,,); +/*Permet d'envoyer/recevoir des réels sur un port Double */ +CALCIUM_ECR_INTERFACE_C_(erd,float ,int,float ,float2double,,); CALCIUM_ECR_INTERFACE_C_(edb,double,int,double,double,,); + CALCIUM_ECR_INTERFACE_C_(elo,float ,int,int ,bool,,); CALCIUM_ECR_INTERFACE_C_(ecp,float ,int,float ,cplx,,); CALCIUM_ECR_INTERFACE_C_(ech,float ,int,char ,str,STAR,LCH_LAST_PARAM ); @@ -321,6 +332,7 @@ CALCIUM_ECR_INTERFACE_C_(een_fort_,float ,cal_int,cal_int,integer,,); CALCIUM_ECR_INTERFACE_C_(elg_fort_,float ,cal_int,long ,long2integer,,); CALCIUM_ECR_INTERFACE_C_(ein_fort_,float ,cal_int,int ,int2integer,,); CALCIUM_ECR_INTERFACE_C_(ere_fort_,float ,cal_int,float ,float,,); +CALCIUM_ECR_INTERFACE_C_(erd_fort_,float ,cal_int,float ,float2double,,); CALCIUM_ECR_INTERFACE_C_(edb_fort_,double,cal_int,double,double,,); CALCIUM_ECR_INTERFACE_C_(elo_fort_,float ,cal_int,int ,bool,,); CALCIUM_ECR_INTERFACE_C_(ecp_fort_,float ,cal_int,float ,cplx,,); diff --git a/src/DSC/DSC_User/Datastream/Calcium/CalciumCInterface.cxx b/src/DSC/DSC_User/Datastream/Calcium/CalciumCInterface.cxx index a9974edcf..107e5f479 100644 --- a/src/DSC/DSC_User/Datastream/Calcium/CalciumCInterface.cxx +++ b/src/DSC/DSC_User/Datastream/Calcium/CalciumCInterface.cxx @@ -66,6 +66,9 @@ CALCIUM_C2CPP_INTERFACE_CXX_(long2integer, integer, long,); CALCIUM_C2CPP_INTERFACE_CXX_(float,float,float, ); CALCIUM_C2CPP_INTERFACE_CXX_(double,double,double,); + +CALCIUM_C2CPP_INTERFACE_CXX_(float2double,double,float, ); + /* Fonnctionne mais essai suivant pour simplification de Calcium.c CALCIUM_C2CPP_INTERFACE_(bool,bool,);*/ CALCIUM_C2CPP_INTERFACE_CXX_(bool,bool,int,); CALCIUM_C2CPP_INTERFACE_CXX_(cplx,cplx,float,); diff --git a/src/DSC/DSC_User/Datastream/Calcium/CalciumCInterface.hxx b/src/DSC/DSC_User/Datastream/Calcium/CalciumCInterface.hxx index e6eca1ae3..84e117aba 100644 --- a/src/DSC/DSC_User/Datastream/Calcium/CalciumCInterface.hxx +++ b/src/DSC/DSC_User/Datastream/Calcium/CalciumCInterface.hxx @@ -80,6 +80,9 @@ CALCIUM_C2CPP_INTERFACE_HXX_(long2integer,integer, long,); CALCIUM_C2CPP_INTERFACE_HXX_(float,float,float, ); CALCIUM_C2CPP_INTERFACE_HXX_(double,double,double,); + +CALCIUM_C2CPP_INTERFACE_HXX_(float2double,double,float, ); + /* Fonctionne mais essai suivant pour simplification de Calcium.c CALCIUM_C2CPP_INTERFACE_(bool,bool,);*/ CALCIUM_C2CPP_INTERFACE_HXX_(bool,bool,int,); CALCIUM_C2CPP_INTERFACE_HXX_(cplx,cplx,float,); diff --git a/src/DSC/DSC_User/Datastream/Calcium/calcium.h b/src/DSC/DSC_User/Datastream/Calcium/calcium.h index f103fe937..4a43be266 100644 --- a/src/DSC/DSC_User/Datastream/Calcium/calcium.h +++ b/src/DSC/DSC_User/Datastream/Calcium/calcium.h @@ -169,6 +169,29 @@ extern int cp_lre( #endif ); +extern int cp_lrd( +/* ------ */ +#if CPNeedPrototype + void * component /* Pointeur de type Superv_Component_i* sur le */ + /* composant SALOME Supervisable */, + int /* E Type de dependance ou de lecture */ + /* CP_TEMPS, CP_ITERATION, CP_SEQUENTIEL */, + float * /* E/S Borne inf de l'intervalle de lecture */ + /* Retourne le pas lu dans le cas de */ + /* lecture sequentielle */, + float * /* E Borne Sup de l'intervalle de lecture */, + int * /* E/S Pas d'iteration a lire */ + /* Retourne le pas lu dans le cas de */ + /* lecture sequentielle */, + char * /* E Nom de la variable a lire */, + int /* E Nombre max de valeurs a lire */, + int * /* S Nombre de valeurs rellement lues */, + float * /* S Tableau de flottants pour stocker les */ + /* valeurs lues */ +#endif +); + + extern int cp_ldb( /* ------ */ #if CPNeedPrototype @@ -470,6 +493,22 @@ extern int cp_ere( #endif ); +extern int cp_erd( +/* ------ */ +#if CPNeedPrototype + void * component /* Pointeur de type Superv_Component_i* sur le */ + /* composant SALOME Supervisable */, + int /* E Type de dependance */ + /* CP_TEMPS, CP_ITERATION */, + float /* E Pas de temps a ecrire */, + int /* E Pas d'iteration a ecrire */, + char * /* E Nom de la variable a ecrire */, + int /* E Nombre de valeurs a ecrire */, + float * /* E Tableau de flottants a ecrire */ +#endif +); + + extern int cp_edb( /* ------ */ #if CPNeedPrototype diff --git a/src/DSC/DSC_User/Datastream/Calcium/calciumf.c b/src/DSC/DSC_User/Datastream/Calcium/calciumf.c index 5b63bb3e2..de55a4e86 100644 --- a/src/DSC/DSC_User/Datastream/Calcium/calciumf.c +++ b/src/DSC/DSC_User/Datastream/Calcium/calciumf.c @@ -155,6 +155,8 @@ void F_FUNC(cpldb,CPLDB)(long *compo,cal_int *dep,double *ti,double *tf,cal_int cal_int *max,cal_int *n, double *tab,cal_int *err STR_PLEN(nom)); void F_FUNC(cplre,CPLRE)(long *compo,cal_int *dep,float *ti,float *tf,cal_int *iter,STR_PSTR(nom), cal_int *max,cal_int *n, float *tab,cal_int *err STR_PLEN(nom)); +void F_FUNC(cplrd,CPLRD)(long *compo,cal_int *dep,float *ti,float *tf,cal_int *iter,STR_PSTR(nom), + cal_int *max,cal_int *n, double *tab,cal_int *err STR_PLEN(nom)); void F_FUNC(cplcp,CPLCP)(long *compo,cal_int *dep,float *ti,float *tf,cal_int *iter,STR_PSTR(nom), cal_int *max,cal_int *n, float *tab,cal_int *err STR_PLEN(nom)); void F_FUNC(cplch,CPLCH)(long *compo,cal_int *dep,float *ti,float *tf,cal_int *iter,STR_PSTR(nom), @@ -241,6 +243,14 @@ void F_FUNC(cplre,CPLRE)(long *compo,cal_int *dep,float *ti,float *tf,cal_int *i free_str1(cnom); } +void F_FUNC(cplrd,CPLRD)(long *compo,cal_int *dep,float *ti,float *tf,cal_int *iter,STR_PSTR(nom), + cal_int *max,cal_int *n, double *tab,cal_int *err STR_PLEN(nom)) +{ + char* cnom=fstr1(STR_PTR(nom),STR_LEN(nom)); + *err=cp_lrd_fort_((void *)*compo,*dep,ti,tf,iter,cnom,*max,n,tab); + free_str1(cnom); +} + void F_FUNC(cplcp,CPLCP)(long *compo,cal_int *dep,float *ti,float *tf,cal_int *iter,STR_PSTR(nom), cal_int *max,cal_int *n, float *tab,cal_int *err STR_PLEN(nom)) { @@ -289,6 +299,7 @@ void F_FUNC(cpech,CPECH)(long *compo,cal_int *dep,float *ti,cal_int *iter,STR_PS STR_PLEN(nom) STR_PLEN(tab)); void F_FUNC(cpedb,CPEDB)(long *compo,cal_int *dep,double *ti,cal_int *iter,STR_PSTR(nom),cal_int *n, double *tab,cal_int *err STR_PLEN(nom)); void F_FUNC(cpere,CPERE)(long *compo,cal_int *dep,float *ti,cal_int *iter,STR_PSTR(nom),cal_int *n, float *tab,cal_int *err STR_PLEN(nom)); +void F_FUNC(cperd,CPERD)(long *compo,cal_int *dep,float *ti,cal_int *iter,STR_PSTR(nom),cal_int *n, double *tab,cal_int *err STR_PLEN(nom)); void F_FUNC(cpecp,CPECP)(long *compo,cal_int *dep,float *ti,cal_int *iter,STR_PSTR(nom),cal_int *n, float *tab,cal_int *err STR_PLEN(nom)); void F_FUNC(cpein,CPEIN)(long *compo,cal_int *dep,float *ti,cal_int *iter,STR_PSTR(nom),cal_int *n, int *tab,cal_int *err STR_PLEN(nom)); void F_FUNC(cpelg,CPELG)(long *compo,cal_int *dep,float *ti,cal_int *iter,STR_PSTR(nom),cal_int *n, long *tab,cal_int *err STR_PLEN(nom)); @@ -347,6 +358,15 @@ void F_FUNC(cpere,CPERE)(long *compo,cal_int *dep,float *ti,cal_int *iter,STR_PS free_str1(cnom); } +void F_FUNC(cperd,CPERD)(long *compo,cal_int *dep,float *ti,cal_int *iter,STR_PSTR(nom),cal_int *n, double *tab,cal_int *err STR_PLEN(nom)) +{ + float tti=0.; + if(*dep == CP_TEMPS)tti=*ti; + char* cnom=fstr1(STR_PTR(nom),STR_LEN(nom)); + *err=cp_erd_fort_((void *)*compo,*dep,tti,*iter,cnom,*n,tab); + free_str1(cnom); +} + void F_FUNC(cpecp,CPECP)(long *compo,cal_int *dep,float *ti,cal_int *iter,STR_PSTR(nom),cal_int *n, float *tab,cal_int *err STR_PLEN(nom)) { float tti=0.; diff --git a/src/DSC/DSC_User/Datastream/Calcium/calciumf.h b/src/DSC/DSC_User/Datastream/Calcium/calciumf.h index da9574643..07f110137 100644 --- a/src/DSC/DSC_User/Datastream/Calcium/calciumf.h +++ b/src/DSC/DSC_User/Datastream/Calcium/calciumf.h @@ -47,6 +47,7 @@ CALCIUM_ECR_INTERFACE_C_H(elg_fort_,float ,cal_int,long ,long2integer,,); CALCIUM_ECR_INTERFACE_C_H(eln_fort_,float ,cal_int,long ,long,,); CALCIUM_ECR_INTERFACE_C_H(ein_fort_,float ,cal_int,int ,int2integer,,); CALCIUM_ECR_INTERFACE_C_H(ere_fort_,float ,cal_int,float ,float,,); +CALCIUM_ECR_INTERFACE_C_H(erd_fort_,float ,cal_int,float ,float2double,,); CALCIUM_ECR_INTERFACE_C_H(edb_fort_,double,cal_int,double,double,,); CALCIUM_ECR_INTERFACE_C_H(elo_fort_,float ,cal_int,int ,bool,,); /*int pour bool ou cal_int */ CALCIUM_ECR_INTERFACE_C_H(ecp_fort_,float ,cal_int,float ,cplx,,); @@ -69,6 +70,7 @@ CALCIUM_LECT_INTERFACE_C_H(llg_fort_,float ,cal_int,long ,long2integer,,); CALCIUM_LECT_INTERFACE_C_H(lln_fort_,float ,cal_int,long ,long,,); CALCIUM_LECT_INTERFACE_C_H(lin_fort_,float ,cal_int,int ,int2integer,,); CALCIUM_LECT_INTERFACE_C_H(lre_fort_,float ,cal_int,float ,float,,); +CALCIUM_LECT_INTERFACE_C_H(lrd_fort_,float ,cal_int,float ,float2double,,); CALCIUM_LECT_INTERFACE_C_H(ldb_fort_,double,cal_int,double ,double,,); CALCIUM_LECT_INTERFACE_C_H(llo_fort_,float ,cal_int,int ,bool,,); /*int pour bool ou cal_int */ CALCIUM_LECT_INTERFACE_C_H(lcp_fort_,float ,cal_int,float ,cplx,,);