Fonction de calcul
fr


codinservec

Contenu du fichier


/* Modnumlib Scicos interfacing function
 * Copyright (C) 2009-2011 Alan Layec
 *
 * This library 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.
 *
 * 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
 * General Public License for more details.
 *
 * You should have received a copy of the GNU 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.
 */
 
/* codinservec Vectorial code insertor block
 * Type 4 simulation function ver 1.0 - scilab-3.0
 * 16 dec 2004 - IRCOM Lab - Author : Alan
 */

 /* REVISION HISTORY :
 * $Log$
 */

#include <scicos/scicos_block.h>
#include "modnum_lib.h"

/* entrées régulières : u1[0..nu1-1] : vecteur d'entrée de code où symbole 1
 *                      u2[0..nu2-1] : vecteur d'entrée de code où symbole 2
 *
 * sorties régulières : y[0..ny-1] : vecteur de sorties de taille ny=nu1*nu2
 *
 * paramètres entiers : ipar[0] : numéro du port d'entrée contenant le code
*/

/*prototype*/
void codinservec(scicos_block *block,int flag)
{
  /*Déclaration des variables*/
  double *uc,*us;
  double *y;
  int nuc,nus;
  int n_c,n_s; /* numéro des ports code(n_c) et symbole(n_s)*/

  /*determination des numéros de ports*/
  n_c=block->ipar[0];
  if (n_c==0) n_s=1; 
  else n_s=0;

  /*Récupération des adresses des ports réguliers*/
  uc=(double *)block->inptr[n_c];
  us=(double *)block->inptr[n_s];
  y=(double *)block->outptr[0];

  /*Récupération de la taille des ports d'entrées*/
  nuc=block->insz[n_c];
  nus=block->insz[n_s];

  /*Appel routine codeinser_c*/
  codinser_c(&nuc,&nus,&uc[0],&us[0],&y[0]);
}