Back to index

salome-kernel  6.5.0
Defines | Functions
calciumf.c File Reference
#include <string.h>
#include <stdlib.h>
#include "fortoc.h"
#include "calcium.h"
#include "calciumf.h"
#include "CalciumFortranInt.h"
#include <stdio.h>

Go to the source code of this file.

Defines

#define FLOAT_OK   0
#define POS_INFINITY   1
#define NEG_INFINITY   2
#define QUIET_NAN   3
#define SIGNALING_NAN   4

Functions

static void fstrtocstr (char *cstr, char *fstr, cal_int fstr_len)
static void cstrtofstr (char *cstr, char *fstr, cal_int fstr_len)
static char * fstr1 (char *nom, cal_int nnom)
static void free_str1 (char *nom)
int CheckFloat (float *value)
void F_FUNC (void F_FUNC(cpcd, CPCD)
void F_FUNC (cpfin, CPFIN)
void F_FUNC (void F_FUNC(cpfini, CPFINI)
void F_FUNC (cpfint, CPFINT)
void F_FUNC (cpeffi, CPEFFI)
void F_FUNC (cpefft, CPEFFT)
void F_FUNC (void F_FUNC(cplin, CPLIN)
void F_FUNC (cpllg, CPLLG)
void F_FUNC (cplln, CPLLN)
void F_FUNC (cplen, CPLEN)
void F_FUNC (cpllo, CPLLO)
void F_FUNC (cpldb, CPLDB)
void F_FUNC (cplre, CPLRE)
void F_FUNC (cplcp, CPLCP)
void F_FUNC (cplch, CPLCH)
void F_FUNC (void F_FUNC(cpech, CPECH)
void F_FUNC (cpedb, CPEDB)
void F_FUNC (cpere, CPERE)
void F_FUNC (cpecp, CPECP)
void F_FUNC (cpein, CPEIN)
void F_FUNC (cpelg, CPELG)
void F_FUNC (cpeln, CPELN)
void F_FUNC (cpeen, CPEEN)
void F_FUNC (cpelo, CPELO)

Define Documentation

#define FLOAT_OK   0

Definition at line 66 of file calciumf.c.

#define NEG_INFINITY   2

Definition at line 68 of file calciumf.c.

#define POS_INFINITY   1

Definition at line 67 of file calciumf.c.

#define QUIET_NAN   3

Definition at line 69 of file calciumf.c.

#define SIGNALING_NAN   4

Definition at line 70 of file calciumf.c.


Function Documentation

int CheckFloat ( float *  value)

Definition at line 72 of file calciumf.c.

{
   unsigned long L1 = *(unsigned long*)value;
   unsigned long L2 = L1 & 0x7fffffff;
   if (L2 < 0x7f800000) return (FLOAT_OK); // Short circuit for most values
   if (L1 == 0x7f800000) return (POS_INFINITY);
   else if (L1 == 0xff800000) return (NEG_INFINITY);
   else if (L2 >= 0x7fc00000) return (QUIET_NAN);
   else if ((L2 >= 0x7f800001) && (L2 <= 0x7fbfffff)) return (SIGNALING_NAN);
   else return (FLOAT_OK);
}
static void cstrtofstr ( char *  cstr,
char *  fstr,
cal_int  fstr_len 
) [static]

Definition at line 43 of file calciumf.c.

{
  cal_int i, len;
  len = strlen(cstr);
  if (len > fstr_len) len = fstr_len;
  for (i = 0; i < len; i++)
    fstr[i] = cstr[i];
  while (i < fstr_len)
    fstr[i++] = ' ';
}

Here is the caller graph for this function:

void F_FUNC ( void F_FUNC cpcd,
CPCD   
)

Definition at line 88 of file calciumf.c.

{
  /* nom is OUT argument */
  cp_cd((void *)*compo,STR_PTR(nom));
  /* replace in place ??? */
  cstrtofstr(STR_PTR(nom),STR_PTR(nom),STR_LEN(nom));
}

Here is the call graph for this function:

void F_FUNC ( cpfin  ,
CPFIN   
)

Definition at line 99 of file calciumf.c.

{
  *err=cp_fin((void *)*compo,(int)*dep);
}

Here is the call graph for this function:

void F_FUNC ( void F_FUNC cpfini,
CPFINI   
)

Definition at line 107 of file calciumf.c.

{
  char* cnom=fstr1(STR_PTR(nom),STR_LEN(nom));
  *err=cp_fini((void *)*compo,cnom,*i);
  free_str1(cnom);
}

Here is the call graph for this function:

void F_FUNC ( cpfint  ,
CPFINT   
)

Definition at line 119 of file calciumf.c.

{
  char* cnom=fstr1(STR_PTR(nom),STR_LEN(nom));
  *err=cp_fint((void *)*compo,cnom,*t);
  free_str1(cnom);
}

Here is the call graph for this function:

void F_FUNC ( cpeffi  ,
CPEFFI   
)

Definition at line 126 of file calciumf.c.

{
  char* cnom=fstr1(STR_PTR(nom),STR_LEN(nom));
  *err=cp_effi((void *)*compo,cnom,*i);
  free_str1(cnom);
}

Here is the call graph for this function:

void F_FUNC ( cpefft  ,
CPEFFT   
)

Definition at line 133 of file calciumf.c.

{
  char* cnom=fstr1(STR_PTR(nom),STR_LEN(nom));
  *err=cp_efft((void *)*compo,cnom,*t);
  free_str1(cnom);
}

Here is the call graph for this function:

void F_FUNC ( void F_FUNC cplin,
CPLIN   
)

Definition at line 144 of file calciumf.c.

{
  char* cnom=fstr1(STR_PTR(nom),STR_LEN(nom));

#if   !SIZEOF_INT
#error "The macro SIZEOF_INT must be defined."
#elif SIZEOF_INT == 4
  *err=cp_lin_fort_((void *)*compo,*dep,ti,tf,iter,cnom,*max,n,tab);
#else
  fprintf(stderr,"End of CPLIN: %s : Can't use fortran INTEGER*4 because int C is not 32bits long on this machine.\n",
          cnom);
#endif
  free_str1(cnom);
}

Here is the call graph for this function:

void F_FUNC ( cpllg  ,
CPLLG   
)

Definition at line 180 of file calciumf.c.

{
  char* cnom=fstr1(STR_PTR(nom),STR_LEN(nom));
#if   !SIZEOF_LONG
#error "The macro SIZEOF_LONG must be defined."
#elif SIZEOF_LONG == 8
  *err=cp_llg_fort_((void *)*compo,*dep,ti,tf,iter,cnom,*max,n,tab);
#else
  fprintf(stderr,"End of CPLLG: %s : Can't use fortran INTEGER*8 because long C is not 64bits long on this machine.\n",
          cnom);
#endif
  free_str1(cnom);
}

Here is the call graph for this function:

void F_FUNC ( cplln  ,
CPLLN   
)

Definition at line 195 of file calciumf.c.

{
 char* cnom=fstr1(STR_PTR(nom),STR_LEN(nom));
#if   !SIZEOF_LONG
#error "The macro SIZEOF_LONG must be defined."
#elif SIZEOF_LONG == 8
  *err=cp_lln_fort_((void *)*compo,*dep,ti,tf,iter,cnom,*max,n,tab);
#else
  fprintf(stderr,"End of CPLLN: %s : Can't use fortran INTEGER*8 because long C is not 64bits long on this machine.\n",
          cnom);
#endif
  free_str1(cnom);
}

Here is the call graph for this function:

void F_FUNC ( cplen  ,
CPLEN   
)

Definition at line 211 of file calciumf.c.

{
  char* cnom=fstr1(STR_PTR(nom),STR_LEN(nom));
  *err=cp_len_fort_((void *)*compo,*dep,ti,tf,iter,cnom,*max,n,tab);
  free_str1(cnom);
}

Here is the call graph for this function:

void F_FUNC ( cpllo  ,
CPLLO   
)

Definition at line 220 of file calciumf.c.

{
  char* cnom=fstr1(STR_PTR(nom),STR_LEN(nom));
  *err=cp_llo_fort_((void *)*compo,*dep,ti,tf,iter,cnom,*max,n,tab);
  free_str1(cnom);
}

Here is the call graph for this function:

void F_FUNC ( cpldb  ,
CPLDB   
)

Definition at line 228 of file calciumf.c.

{
  char* cnom=fstr1(STR_PTR(nom),STR_LEN(nom));
  *err=cp_ldb_fort_((void *)*compo,*dep,ti,tf,iter,cnom,*max,n,tab);
  free_str1(cnom);
}

Here is the call graph for this function:

void F_FUNC ( cplre  ,
CPLRE   
)

Definition at line 236 of file calciumf.c.

{
  char* cnom=fstr1(STR_PTR(nom),STR_LEN(nom));
  *err=cp_lre_fort_((void *)*compo,*dep,ti,tf,iter,cnom,*max,n,tab);
  free_str1(cnom);
}

Here is the call graph for this function:

void F_FUNC ( cplcp  ,
CPLCP   
)

Definition at line 244 of file calciumf.c.

{
  char* cnom=fstr1(STR_PTR(nom),STR_LEN(nom));
  *err=cp_lcp_fort_((void *)*compo,*dep,ti,tf,iter,cnom,*max,n,tab);
  free_str1(cnom);
}

Here is the call graph for this function:

void F_FUNC ( cplch  ,
CPLCH   
)

Definition at line 252 of file calciumf.c.

{
  char **tabChaine = NULL;
  cal_int    index = 0;
  char*      cnom = fstr1(STR_PTR(nom),STR_LEN(nom));

  tabChaine = (char **) malloc(sizeof(char *) * (*max));
  for (index = 0; index < *max; index++)
    tabChaine[index] = (char *) malloc(sizeof(char) * (STR_LEN(tab)+1));

  *err=cp_lch_fort_((void *)*compo,*dep,ti,tf,iter,cnom,*max,n,tabChaine,STR_LEN(tab));

  if (*err == CPOK )
    {
      for (index = 0; index < *n; index++)
        {
          strncpy(&tab[index * STR_LEN(tab)], tabChaine[index], strlen(tabChaine[index]));
          if(STR_LEN(tab) > strlen(tabChaine[index]))
            memset(&tab[index * STR_LEN(tab)+strlen(tabChaine[index])],' ',STR_LEN(tab)-strlen(tabChaine[index]));
        }
    }

  if (tabChaine != (char **) NULL)
    {
      for (index = 0; index < *max; index++)
        free(tabChaine[index]);
      free(tabChaine);
    }
  free_str1(cnom);
}

Here is the call graph for this function:

void F_FUNC ( void F_FUNC cpech,
CPECH   
)

Definition at line 288 of file calciumf.c.

{
  char ** tabChaine=NULL;
  cal_int     index=0,index2=0;
  char*   cnom=fstr1(STR_PTR(nom),STR_LEN(nom));
  float tti=0.;
  if(*dep == CP_TEMPS)tti=*ti;

  tabChaine = (char **) malloc(sizeof(char *) * *n);
  for (index = 0; index < *n; index++)
    {
      tabChaine[index] = (char *) malloc(sizeof(char) * (STR_LEN(tab) + 1));
      strncpy(tabChaine[index],&tab[STR_LEN(tab) * index],STR_LEN(tab));
      tabChaine[index][STR_LEN(tab)]='\0';
      for (index2 = STR_LEN(tab) - 1; index2 >= 0; index2--)
        {
          if ( tabChaine[index][index2] == ' ' || tabChaine[index][index2] == '\0' )
            tabChaine[index][index2]='\0';
        }
    }

  *err=cp_ech_fort_((void *)*compo,*dep,tti,*iter,cnom,*n,tabChaine,STR_LEN(tab) );

  if (tabChaine != (char **) NULL)
    {
      for (index = 0; index < *n; index++)
        free(tabChaine[index]);
      free(tabChaine);
    }
  free_str1(cnom);
}

Here is the call graph for this function:

void F_FUNC ( cpedb  ,
CPEDB   
)

Definition at line 332 of file calciumf.c.

{
  double tti=0.;
  if(*dep == CP_TEMPS)tti=*ti;
  char* cnom=fstr1(STR_PTR(nom),STR_LEN(nom));
  *err=cp_edb_fort_((void *)*compo,*dep,tti,*iter,cnom,*n,tab);
  free_str1(cnom);
}

Here is the call graph for this function:

void F_FUNC ( cpere  ,
CPERE   
)

Definition at line 341 of file calciumf.c.

{
  float tti=0.;
  if(*dep == CP_TEMPS)tti=*ti;
  char* cnom=fstr1(STR_PTR(nom),STR_LEN(nom));
  *err=cp_ere_fort_((void *)*compo,*dep,tti,*iter,cnom,*n,tab);
  free_str1(cnom);
}

Here is the call graph for this function:

void F_FUNC ( cpecp  ,
CPECP   
)

Definition at line 350 of file calciumf.c.

{
  float tti=0.;
  if(*dep == CP_TEMPS)tti=*ti;
  char* cnom=fstr1(STR_PTR(nom),STR_LEN(nom));
  *err=cp_ecp_fort_((void *)*compo,*dep,tti,*iter,cnom,*n,tab);
  free_str1(cnom);
}

Here is the call graph for this function:

void F_FUNC ( cpein  ,
CPEIN   
)

Definition at line 360 of file calciumf.c.

{
  float tti=0.;
  if(*dep == CP_TEMPS)tti=*ti;
  char* cnom=fstr1(STR_PTR(nom),STR_LEN(nom));
#if   !SIZEOF_INT
#error "The macro SIZEOF_INT must be defined."
#elif SIZEOF_INT == 4
  *err=cp_ein_fort_((void *)*compo,*dep,tti,*iter,cnom,*n,tab);
#else
  fprintf(stderr,"CPEIN: %s %f %d : Can't use fortran INTEGER*4 because int C is not 32bits long on this machine.\n",
          cnom, *ti,*iter);
#endif
  free_str1(cnom);
}

Here is the call graph for this function:

void F_FUNC ( cpelg  ,
CPELG   
)

Definition at line 376 of file calciumf.c.

{
  float tti=0.;
  if(*dep == CP_TEMPS)tti=*ti;
  char* cnom=fstr1(STR_PTR(nom),STR_LEN(nom));
#if   !SIZEOF_LONG
#error "The macro SIZEOF_LONG must be defined."
#elif SIZEOF_LONG == 8
  *err=cp_elg_fort_((void *)*compo,*dep,tti,*iter,cnom,*n,tab);
#else
  fprintf(stderr,"CPELG: %s %f %d : Can't use fortran INTEGER*8 because long C is not 64bits long on this machine.\n",
          cnom, *ti,*iter);
#endif
  free_str1(cnom);
}

Here is the call graph for this function:

void F_FUNC ( cpeln  ,
CPELN   
)

Definition at line 392 of file calciumf.c.

{
  float tti=0.;
  if(*dep == CP_TEMPS)tti=*ti;
  char* cnom=fstr1(STR_PTR(nom),STR_LEN(nom));
#if   !SIZEOF_LONG
#error "The macro SIZEOF_LONG must be defined."
#elif SIZEOF_LONG == 8
  *err=cp_eln_fort_((void *)*compo,*dep,tti,*iter,cnom,*n,tab);
#else
  fprintf(stderr,"CPELN: %s %f %d : Can't use fortran INTEGER*8 because long C is not 64bits long on this machine.\n",
          cnom, *ti,*iter);
#endif
  free_str1(cnom);
}

Here is the call graph for this function:

void F_FUNC ( cpeen  ,
CPEEN   
)

Definition at line 409 of file calciumf.c.

{
  float tti=0.;
  if(*dep == CP_TEMPS)tti=*ti;
  char* cnom=fstr1(STR_PTR(nom),STR_LEN(nom));
  *err=cp_een_fort_((void *)*compo,*dep,tti,*iter,cnom,*n,tab);
  free_str1(cnom);
}

Here is the call graph for this function:

void F_FUNC ( cpelo  ,
CPELO   
)

Definition at line 418 of file calciumf.c.

{
  float tti=0.;
  if(*dep == CP_TEMPS)tti=*ti;
  char* cnom=fstr1(STR_PTR(nom),STR_LEN(nom));
  *err=cp_elo_fort_((void *)*compo,*dep,tti,*iter,cnom,*n,tab);
  free_str1(cnom);
}

Here is the call graph for this function:

static void free_str1 ( char *  nom) [static]

Definition at line 61 of file calciumf.c.

{
  free(nom);
}

Here is the caller graph for this function:

static char* fstr1 ( char *  nom,
cal_int  nnom 
) [static]

Definition at line 54 of file calciumf.c.

{
  char * cnom=(char*)malloc((nnom+1)*sizeof(char));
  fstrtocstr(cnom,nom,nnom);
  return cnom;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void fstrtocstr ( char *  cstr,
char *  fstr,
cal_int  fstr_len 
) [static]

Definition at line 33 of file calciumf.c.

{
  cal_int i,iend;
  for (iend = fstr_len-1; iend >= 0; iend--)
    if (fstr[iend] != ' ') break;
  for (i = 0; i <= iend; i++)
    cstr[i] = fstr[i];
  cstr[i] = '\0';
}

Here is the caller graph for this function: